3 * Copyright (C) 2010 Openismus GmbH
6 * Tristan Van Berkom <tristanvb@openismus.com>
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.
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.
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.
24 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
25 #error "Only <gtk/gtk.h> can be included directly."
28 #ifndef __GTK_CELL_AREA_H__
29 #define __GTK_CELL_AREA_H__
31 #include <gtk/gtkcellrenderer.h>
32 #include <gtk/gtkwidget.h>
33 #include <gtk/gtktreemodel.h>
37 #define GTK_TYPE_CELL_AREA (gtk_cell_area_get_type ())
38 #define GTK_CELL_AREA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_AREA, GtkCellArea))
39 #define GTK_CELL_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CELL_AREA, GtkCellAreaClass))
40 #define GTK_IS_CELL_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_AREA))
41 #define GTK_IS_CELL_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CELL_AREA))
42 #define GTK_CELL_AREA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_AREA, GtkCellAreaClass))
44 typedef struct _GtkCellArea GtkCellArea;
45 typedef struct _GtkCellAreaClass GtkCellAreaClass;
46 typedef struct _GtkCellAreaPrivate GtkCellAreaPrivate;
47 typedef struct _GtkCellAreaIter GtkCellAreaIter;
51 * @renderer: the cell renderer to operate on
52 * @data: user-supplied data
54 * The type of the callback functions used for iterating over
55 * the cell renderers of a #GtkCellArea, see gtk_cell_area_forall().
57 typedef void (*GtkCellCallback) (GtkCellRenderer *renderer,
63 GInitiallyUnowned parent_instance;
65 GtkCellAreaPrivate *priv;
68 struct _GtkCellAreaClass
70 GInitiallyUnownedClass parent_class;
72 /* vtable - not signals */
75 void (* add) (GtkCellArea *area,
76 GtkCellRenderer *renderer);
77 void (* remove) (GtkCellArea *area,
78 GtkCellRenderer *renderer);
79 void (* forall) (GtkCellArea *area,
80 GtkCellCallback callback,
81 gpointer callback_data);
82 gint (* event) (GtkCellArea *area,
83 GtkCellAreaIter *iter,
86 const GdkRectangle *cell_area,
87 GtkCellRendererState flags);
88 void (* render) (GtkCellArea *area,
89 GtkCellAreaIter *iter,
92 const GdkRectangle *cell_area,
93 GtkCellRendererState flags);
96 GtkCellAreaIter *(* create_iter) (GtkCellArea *area);
97 GtkSizeRequestMode (* get_request_mode) (GtkCellArea *area);
98 void (* get_preferred_width) (GtkCellArea *area,
99 GtkCellAreaIter *iter,
103 void (* get_preferred_height_for_width) (GtkCellArea *area,
104 GtkCellAreaIter *iter,
107 gint *minimum_height,
108 gint *natural_height);
109 void (* get_preferred_height) (GtkCellArea *area,
110 GtkCellAreaIter *iter,
114 void (* get_preferred_width_for_height) (GtkCellArea *area,
115 GtkCellAreaIter *iter,
119 gint *natural_width);
121 /* Cell Properties */
122 void (* set_cell_property) (GtkCellArea *area,
123 GtkCellRenderer *renderer,
127 void (* get_cell_property) (GtkCellArea *area,
128 GtkCellRenderer *renderer,
134 void (* grab_focus) (GtkCellArea *area,
135 GtkDirectionType direction);
137 /* Padding for future expansion */
138 void (*_gtk_reserved1) (void);
139 void (*_gtk_reserved2) (void);
140 void (*_gtk_reserved3) (void);
141 void (*_gtk_reserved4) (void);
142 void (*_gtk_reserved5) (void);
143 void (*_gtk_reserved6) (void);
144 void (*_gtk_reserved7) (void);
145 void (*_gtk_reserved8) (void);
148 GType gtk_cell_area_get_type (void) G_GNUC_CONST;
151 void gtk_cell_area_add (GtkCellArea *area,
152 GtkCellRenderer *renderer);
153 void gtk_cell_area_remove (GtkCellArea *area,
154 GtkCellRenderer *renderer);
155 void gtk_cell_area_forall (GtkCellArea *area,
156 GtkCellCallback callback,
157 gpointer callback_data);
158 gint gtk_cell_area_event (GtkCellArea *area,
159 GtkCellAreaIter *iter,
162 const GdkRectangle *cell_area,
163 GtkCellRendererState flags);
164 void gtk_cell_area_render (GtkCellArea *area,
165 GtkCellAreaIter *iter,
168 const GdkRectangle *cell_area,
169 GtkCellRendererState flags);
172 GtkCellAreaIter *gtk_cell_area_create_iter (GtkCellArea *area);
173 GtkSizeRequestMode gtk_cell_area_get_request_mode (GtkCellArea *area);
174 void gtk_cell_area_get_preferred_width (GtkCellArea *area,
175 GtkCellAreaIter *iter,
179 void gtk_cell_area_get_preferred_height_for_width (GtkCellArea *area,
180 GtkCellAreaIter *iter,
183 gint *minimum_height,
184 gint *natural_height);
185 void gtk_cell_area_get_preferred_height (GtkCellArea *area,
186 GtkCellAreaIter *iter,
190 void gtk_cell_area_get_preferred_width_for_height (GtkCellArea *area,
191 GtkCellAreaIter *iter,
195 gint *natural_width);
198 void gtk_cell_area_apply_attributes (GtkCellArea *area,
199 GtkTreeModel *tree_model,
201 void gtk_cell_area_attribute_connect (GtkCellArea *area,
202 GtkCellRenderer *renderer,
203 const gchar *attribute,
205 void gtk_cell_area_attribute_disconnect (GtkCellArea *area,
206 GtkCellRenderer *renderer,
207 const gchar *attribute);
209 /* Cell Properties */
210 void gtk_cell_area_class_install_cell_property (GtkCellAreaClass *aclass,
213 GParamSpec* gtk_cell_area_class_find_cell_property (GtkCellAreaClass *aclass,
214 const gchar *property_name);
215 GParamSpec** gtk_cell_area_class_list_cell_properties (GtkCellAreaClass *aclass,
216 guint *n_properties);
217 void gtk_cell_area_add_with_properties (GtkCellArea *area,
218 GtkCellRenderer *renderer,
219 const gchar *first_prop_name,
220 ...) G_GNUC_NULL_TERMINATED;
221 void gtk_cell_area_cell_set (GtkCellArea *area,
222 GtkCellRenderer *renderer,
223 const gchar *first_prop_name,
224 ...) G_GNUC_NULL_TERMINATED;
225 void gtk_cell_area_cell_get (GtkCellArea *area,
226 GtkCellRenderer *renderer,
227 const gchar *first_prop_name,
228 ...) G_GNUC_NULL_TERMINATED;
229 void gtk_cell_area_cell_set_valist (GtkCellArea *area,
230 GtkCellRenderer *renderer,
231 const gchar *first_property_name,
233 void gtk_cell_area_cell_get_valist (GtkCellArea *area,
234 GtkCellRenderer *renderer,
235 const gchar *first_property_name,
237 void gtk_cell_area_cell_set_property (GtkCellArea *area,
238 GtkCellRenderer *renderer,
239 const gchar *property_name,
240 const GValue *value);
241 void gtk_cell_area_cell_get_property (GtkCellArea *area,
242 GtkCellRenderer *renderer,
243 const gchar *property_name,
246 #define GTK_CELL_AREA_WARN_INVALID_CHILD_PROPERTY_ID(object, property_id, pspec) \
247 G_OBJECT_WARN_INVALID_PSPEC ((object), "cell property id", (property_id), (pspec))
251 void gtk_cell_area_grab_focus (GtkCellArea *area,
252 GtkDirectionType direction);
253 void gtk_cell_area_focus_leave (GtkCellArea *area,
254 GtkDirectionType direction,
256 void gtk_cell_area_set_can_focus (GtkCellArea *area,
258 gboolean gtk_cell_area_get_can_focus (GtkCellArea *area);
259 void gtk_cell_area_set_focus_cell (GtkCellArea *area,
260 GtkCellRenderer *renderer);
261 GtkCellRenderer *gtk_cell_area_get_focus_cell (GtkCellArea *area);
264 gint gtk_cell_area_get_cell_margin_left (GtkCellArea *area);
265 void gtk_cell_area_set_cell_margin_left (GtkCellArea *area,
267 gint gtk_cell_area_get_cell_margin_right (GtkCellArea *area);
268 void gtk_cell_area_set_cell_margin_right (GtkCellArea *area,
270 gint gtk_cell_area_get_cell_margin_top (GtkCellArea *area);
271 void gtk_cell_area_set_cell_margin_top (GtkCellArea *area,
273 gint gtk_cell_area_get_cell_margin_bottom (GtkCellArea *area);
274 void gtk_cell_area_set_cell_margin_bottom (GtkCellArea *area,
277 /* Functions for area implementations */
279 /* Distinguish the inner cell area from the whole requested area including margins */
280 void gtk_cell_area_inner_cell_area (GtkCellArea *area,
281 GdkRectangle *cell_area,
282 GdkRectangle *inner_cell_area);
284 /* Request the size of a cell while respecting the cell margins (requests are margin inclusive) */
285 void gtk_cell_area_request_renderer (GtkCellArea *area,
286 GtkCellRenderer *renderer,
287 GtkOrientation orientation,
295 #endif /* __GTK_CELL_AREA_H__ */