]> Pileus Git - ~andy/gtk/blob - gtk/gtkcellarea.h
Added GtkCellArea to the build
[~andy/gtk] / gtk / gtkcellarea.h
1 /* gtkcellarea.h
2  *
3  * Copyright (C) 2010 Openismus GmbH
4  *
5  * Authors:
6  *      Tristan Van Berkom <tristanvb@openismus.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23
24 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
25 #error "Only <gtk/gtk.h> can be included directly."
26 #endif
27
28 #ifndef __GTK_CELL_AREA_H__
29 #define __GTK_CELL_AREA_H__
30
31 #include <gtk/gtkcellrenderer.h>
32 #include <gtk/gtkwidget.h>
33
34 G_BEGIN_DECLS
35
36 #define GTK_TYPE_CELL_AREA                (gtk_cell_area_get_type ())
37 #define GTK_CELL_AREA(obj)                (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_AREA, GtkCellArea))
38 #define GTK_CELL_AREA_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CELL_AREA, GtkCellAreaClass))
39 #define GTK_IS_CELL_AREA(obj)     (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_AREA))
40 #define GTK_IS_CELL_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CELL_AREA))
41 #define GTK_CELL_AREA_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_AREA, GtkCellAreaClass))
42
43 typedef struct _GtkCellArea              GtkCellArea;
44 typedef struct _GtkCellAreaClass         GtkCellAreaClass;
45
46
47 /**
48  * GtkCellCallback:
49  * @renderer: the cell renderer to operate on
50  * @data: user-supplied data
51  *
52  * The type of the callback functions used for iterating over
53  * the cell renderers of a #GtkCellArea, see gtk_cell_area_forall().
54  */
55 typedef void    (*GtkCellCallback)     (GtkCellRenderer  *renderer,
56                                         gpointer          data);
57
58
59 /**
60  * GtkCellAttributeCallback:
61  * @area: the #GtkCellArea containing @renderer
62  * @renderer: the #GtkCellRenderer that has an attribute
63  * @attribute: the property attributed to @id
64  * @id: the identifier of this attributed value
65  * @data: user-supplied data
66  *
67  * The type of the callback functions used for iterating over the 
68  * attributes of the cell renderers in a #GtkCellArea, 
69  * see gtk_cell_area_attribute_forall().
70  */
71 typedef void    (*GtkCellAttributeCallback)     (GtkCellArea      *area,
72                                                  GtkCellRenderer  *renderer,
73                                                  const gchar      *attribute,
74                                                  gint              id,
75                                                  gpointer          data);
76
77
78 struct _GtkCellArea
79 {
80   GInitiallyUnowned parent_instance;
81
82 };
83
84 struct _GtkCellAreaClass
85 {
86   GInitiallyUnownedClass parent_class;
87
88   /* vtable - not signals */
89
90   /* Basic methods */
91   void               (* add)                             (GtkCellArea        *area,
92                                                           GtkCellRenderer    *renderer);
93   void               (* remove)                          (GtkCellArea        *area,
94                                                           GtkCellRenderer    *renderer);
95   void               (* forall)                          (GtkCellArea        *area,
96                                                           GtkCellCallback     callback,
97                                                           gpointer            callback_data);
98   gint               (* event)                           (GtkCellArea        *area,
99                                                           GtkWidget          *widget,
100                                                           GdkEvent           *event,
101                                                           const GdkRectangle *cell_area);
102   void               (* render)                          (GtkCellArea        *area,
103                                                           cairo_t            *cr,
104                                                           GtkWidget          *widget,
105                                                           const GdkRectangle *cell_area);
106
107   /* Attributes */
108   void               (* attribute_connect)               (GtkCellArea        *area,
109                                                           GtkCellRenderer    *renderer,
110                                                           const gchar        *attribute,
111                                                           gint                id);
112   void               (* attribute_disconnect)            (GtkCellArea        *area,
113                                                           GtkCellRenderer    *renderer,
114                                                           const gchar        *attribute,
115                                                           gint                id);
116   void               (* attribute_apply)                 (GtkCellArea        *area,
117                                                           gint                id,
118                                                           GValue                  *value);
119   void               (* attribute_forall)                (GtkCellArea             *area,
120                                                           GtkCellRenderer         *renderer,
121                                                           GtkCellAttributeCallback callback,
122                                                           gpointer                 user_data);
123
124   /* Geometry */
125   GtkSizeRequestMode (* get_request_mode)                (GtkCellArea        *area);
126   void               (* get_preferred_width)             (GtkCellArea        *area,
127                                                           GtkWidget          *widget,
128                                                           gint               *minimum_size,
129                                                           gint               *natural_size);
130   void               (* get_preferred_height_for_width)  (GtkCellArea        *area,
131                                                           GtkWidget          *widget,
132                                                           gint                width,
133                                                           gint               *minimum_height,
134                                                           gint               *natural_height);
135   void               (* get_preferred_height)            (GtkCellArea        *area,
136                                                           GtkWidget          *widget,
137                                                           gint               *minimum_size,
138                                                           gint               *natural_size);
139   void               (* get_preferred_width_for_height)  (GtkCellArea        *area,
140                                                           GtkWidget          *widget,
141                                                           gint                height,
142                                                           gint               *minimum_width,
143                                                           gint               *natural_width);
144
145
146   /* Padding for future expansion */
147   void (*_gtk_reserved1) (void);
148   void (*_gtk_reserved2) (void);
149   void (*_gtk_reserved3) (void);
150   void (*_gtk_reserved4) (void);
151   void (*_gtk_reserved5) (void);
152   void (*_gtk_reserved6) (void);
153   void (*_gtk_reserved7) (void);
154   void (*_gtk_reserved8) (void);
155 };
156
157 GType              gtk_cell_area_get_type                       (void) G_GNUC_CONST;
158
159 /* Basic methods */
160 void               gtk_cell_area_add                            (GtkCellArea        *area,
161                                                                  GtkCellRenderer    *renderer);
162 void               gtk_cell_area_remove                         (GtkCellArea        *area,
163                                                                  GtkCellRenderer    *renderer);
164 void               gtk_cell_area_forall                         (GtkCellArea        *area,
165                                                                  GtkCellCallback     callback,
166                                                                  gpointer            callback_data);
167 gint               gtk_cell_area_event                          (GtkCellArea        *area,
168                                                                  GtkWidget          *widget,
169                                                                  GdkEvent           *event,
170                                                                  const GdkRectangle *cell_area);
171 void               gtk_cell_area_render                         (GtkCellArea        *area,
172                                                                  cairo_t            *cr,
173                                                                  GtkWidget          *widget,
174                                                                  const GdkRectangle *cell_area);
175
176 /* Attributes */
177 void               gtk_cell_area_attribute_connect              (GtkCellArea        *area,
178                                                                  GtkCellRenderer    *renderer,
179                                                                  const gchar        *attribute,
180                                                                  gint                id); 
181 void               gtk_cell_area_attribute_disconnect           (GtkCellArea        *area,
182                                                                  GtkCellRenderer    *renderer,
183                                                                  const gchar        *attribute,
184                                                                  gint                id);
185 void               gtk_cell_area_attribute_apply                (GtkCellArea        *area,
186                                                                  gint                id,
187                                                                  GValue             *value);
188 void               gtk_cell_area_attribute_forall               (GtkCellArea             *area,
189                                                                  GtkCellRenderer         *renderer,
190                                                                  GtkCellAttributeCallback callback,
191                                                                  gpointer                 user_data);
192
193 /* Geometry */
194 GtkSizeRequestMode gtk_cell_area_get_request_mode               (GtkCellArea        *area);
195 void               gtk_cell_area_get_preferred_width            (GtkCellArea        *area,
196                                                                  GtkWidget          *widget,
197                                                                  gint               *minimum_size,
198                                                                  gint               *natural_size);
199 void               gtk_cell_area_get_preferred_height_for_width (GtkCellArea        *area,
200                                                                  GtkWidget          *widget,
201                                                                  gint                width,
202                                                                  gint               *minimum_height,
203                                                                  gint               *natural_height);
204 void               gtk_cell_area_get_preferred_height           (GtkCellArea        *area,
205                                                                  GtkWidget          *widget,
206                                                                  gint               *minimum_size,
207                                                                  gint               *natural_size);
208 void               gtk_cell_area_get_preferred_width_for_height (GtkCellArea        *area,
209                                                                  GtkWidget          *widget,
210                                                                  gint                height,
211                                                                  gint               *minimum_width,
212                                                                  gint               *natural_width);
213
214
215 G_END_DECLS
216
217 #endif /* __GTK_CELL_AREA_H__ */