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 _GtkCellAreaContext GtkCellAreaContext;
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 void (* get_cell_allocation) (GtkCellArea *area,
83 GtkCellAreaContext *context,
85 GtkCellRenderer *renderer,
86 const GdkRectangle *cell_area,
87 GdkRectangle *allocation);
88 gint (* event) (GtkCellArea *area,
89 GtkCellAreaContext *context,
92 const GdkRectangle *cell_area,
93 GtkCellRendererState flags);
94 void (* render) (GtkCellArea *area,
95 GtkCellAreaContext *context,
98 const GdkRectangle *background_area,
99 const GdkRectangle *cell_area,
100 GtkCellRendererState flags,
101 gboolean paint_focus);
102 void (* apply_attributes) (GtkCellArea *area,
103 GtkTreeModel *tree_model,
105 gboolean is_expander,
106 gboolean is_expanded);
109 GtkCellAreaContext *(* create_context) (GtkCellArea *area);
110 GtkSizeRequestMode (* get_request_mode) (GtkCellArea *area);
111 void (* get_preferred_width) (GtkCellArea *area,
112 GtkCellAreaContext *context,
115 gint *natural_width);
116 void (* get_preferred_height_for_width) (GtkCellArea *area,
117 GtkCellAreaContext *context,
120 gint *minimum_height,
121 gint *natural_height);
122 void (* get_preferred_height) (GtkCellArea *area,
123 GtkCellAreaContext *context,
125 gint *minimum_height,
126 gint *natural_height);
127 void (* get_preferred_width_for_height) (GtkCellArea *area,
128 GtkCellAreaContext *context,
132 gint *natural_width);
134 /* Cell Properties */
135 void (* set_cell_property) (GtkCellArea *area,
136 GtkCellRenderer *renderer,
140 void (* get_cell_property) (GtkCellArea *area,
141 GtkCellRenderer *renderer,
147 gboolean (* can_focus) (GtkCellArea *area);
148 gboolean (* focus) (GtkCellArea *area,
149 GtkDirectionType direction);
150 gboolean (* activate) (GtkCellArea *area,
151 GtkCellAreaContext *context,
153 const GdkRectangle *cell_area,
154 GtkCellRendererState flags);
157 /* Padding for future expansion */
158 void (*_gtk_reserved1) (void);
159 void (*_gtk_reserved2) (void);
160 void (*_gtk_reserved3) (void);
161 void (*_gtk_reserved4) (void);
162 void (*_gtk_reserved5) (void);
163 void (*_gtk_reserved6) (void);
164 void (*_gtk_reserved7) (void);
165 void (*_gtk_reserved8) (void);
168 GType gtk_cell_area_get_type (void) G_GNUC_CONST;
171 void gtk_cell_area_add (GtkCellArea *area,
172 GtkCellRenderer *renderer);
173 void gtk_cell_area_remove (GtkCellArea *area,
174 GtkCellRenderer *renderer);
175 gboolean gtk_cell_area_has_renderer (GtkCellArea *area,
176 GtkCellRenderer *renderer);
177 void gtk_cell_area_forall (GtkCellArea *area,
178 GtkCellCallback callback,
179 gpointer callback_data);
180 void gtk_cell_area_get_cell_allocation (GtkCellArea *area,
181 GtkCellAreaContext *context,
183 GtkCellRenderer *renderer,
184 const GdkRectangle *cell_area,
185 GdkRectangle *allocation);
186 gint gtk_cell_area_event (GtkCellArea *area,
187 GtkCellAreaContext *context,
190 const GdkRectangle *cell_area,
191 GtkCellRendererState flags);
192 void gtk_cell_area_render (GtkCellArea *area,
193 GtkCellAreaContext *context,
196 const GdkRectangle *background_area,
197 const GdkRectangle *cell_area,
198 GtkCellRendererState flags,
199 gboolean paint_focus);
200 void gtk_cell_area_set_style_detail (GtkCellArea *area,
201 const gchar *detail);
202 G_CONST_RETURN gchar *gtk_cell_area_get_style_detail (GtkCellArea *area);
205 GtkCellAreaContext *gtk_cell_area_create_context (GtkCellArea *area);
206 GtkSizeRequestMode gtk_cell_area_get_request_mode (GtkCellArea *area);
207 void gtk_cell_area_get_preferred_width (GtkCellArea *area,
208 GtkCellAreaContext *context,
212 void gtk_cell_area_get_preferred_height_for_width (GtkCellArea *area,
213 GtkCellAreaContext *context,
216 gint *minimum_height,
217 gint *natural_height);
218 void gtk_cell_area_get_preferred_height (GtkCellArea *area,
219 GtkCellAreaContext *context,
223 void gtk_cell_area_get_preferred_width_for_height (GtkCellArea *area,
224 GtkCellAreaContext *context,
228 gint *natural_width);
229 G_CONST_RETURN gchar *gtk_cell_area_get_current_path_string (GtkCellArea *area);
233 void gtk_cell_area_apply_attributes (GtkCellArea *area,
234 GtkTreeModel *tree_model,
236 gboolean is_expander,
237 gboolean is_expanded);
238 void gtk_cell_area_attribute_connect (GtkCellArea *area,
239 GtkCellRenderer *renderer,
240 const gchar *attribute,
242 void gtk_cell_area_attribute_disconnect (GtkCellArea *area,
243 GtkCellRenderer *renderer,
244 const gchar *attribute);
246 /* Cell Properties */
247 void gtk_cell_area_class_install_cell_property (GtkCellAreaClass *aclass,
250 GParamSpec* gtk_cell_area_class_find_cell_property (GtkCellAreaClass *aclass,
251 const gchar *property_name);
252 GParamSpec** gtk_cell_area_class_list_cell_properties (GtkCellAreaClass *aclass,
253 guint *n_properties);
254 void gtk_cell_area_add_with_properties (GtkCellArea *area,
255 GtkCellRenderer *renderer,
256 const gchar *first_prop_name,
257 ...) G_GNUC_NULL_TERMINATED;
258 void gtk_cell_area_cell_set (GtkCellArea *area,
259 GtkCellRenderer *renderer,
260 const gchar *first_prop_name,
261 ...) G_GNUC_NULL_TERMINATED;
262 void gtk_cell_area_cell_get (GtkCellArea *area,
263 GtkCellRenderer *renderer,
264 const gchar *first_prop_name,
265 ...) G_GNUC_NULL_TERMINATED;
266 void gtk_cell_area_cell_set_valist (GtkCellArea *area,
267 GtkCellRenderer *renderer,
268 const gchar *first_property_name,
270 void gtk_cell_area_cell_get_valist (GtkCellArea *area,
271 GtkCellRenderer *renderer,
272 const gchar *first_property_name,
274 void gtk_cell_area_cell_set_property (GtkCellArea *area,
275 GtkCellRenderer *renderer,
276 const gchar *property_name,
277 const GValue *value);
278 void gtk_cell_area_cell_get_property (GtkCellArea *area,
279 GtkCellRenderer *renderer,
280 const gchar *property_name,
283 #define GTK_CELL_AREA_WARN_INVALID_CHILD_PROPERTY_ID(object, property_id, pspec) \
284 G_OBJECT_WARN_INVALID_PSPEC ((object), "cell property id", (property_id), (pspec))
288 gboolean gtk_cell_area_can_focus (GtkCellArea *area);
289 gboolean gtk_cell_area_focus (GtkCellArea *area,
290 GtkDirectionType direction);
291 gboolean gtk_cell_area_activate (GtkCellArea *area,
292 GtkCellAreaContext *context,
294 const GdkRectangle *cell_area,
295 GtkCellRendererState flags);
296 void gtk_cell_area_set_focus_cell (GtkCellArea *area,
297 GtkCellRenderer *renderer);
298 GtkCellRenderer *gtk_cell_area_get_focus_cell (GtkCellArea *area);
302 void gtk_cell_area_add_focus_sibling (GtkCellArea *area,
303 GtkCellRenderer *renderer,
304 GtkCellRenderer *sibling);
305 void gtk_cell_area_remove_focus_sibling (GtkCellArea *area,
306 GtkCellRenderer *renderer,
307 GtkCellRenderer *sibling);
308 gboolean gtk_cell_area_is_focus_sibling (GtkCellArea *area,
309 GtkCellRenderer *renderer,
310 GtkCellRenderer *sibling);
311 G_CONST_RETURN GList *gtk_cell_area_get_focus_siblings (GtkCellArea *area,
312 GtkCellRenderer *renderer);
313 GtkCellRenderer *gtk_cell_area_get_focus_from_sibling (GtkCellArea *area,
314 GtkCellRenderer *renderer);
316 /* Cell Activation/Editing */
317 GtkCellRenderer *gtk_cell_area_get_edited_cell (GtkCellArea *area);
318 GtkCellEditable *gtk_cell_area_get_edit_widget (GtkCellArea *area);
319 gboolean gtk_cell_area_activate_cell (GtkCellArea *area,
321 GtkCellRenderer *renderer,
323 const GdkRectangle *cell_area,
324 GtkCellRendererState flags);
325 void gtk_cell_area_stop_editing (GtkCellArea *area,
328 /* Functions for area implementations */
330 /* Distinguish the inner cell area from the whole requested area including margins */
331 void gtk_cell_area_inner_cell_area (GtkCellArea *area,
333 const GdkRectangle *cell_area,
334 GdkRectangle *inner_area);
336 /* Aligns a cell renderer into cell_area by requesting it's size ... used for focus and cell edit areas */
337 void gtk_cell_area_aligned_cell_area (GtkCellArea *area,
339 GtkCellRenderer *renderer,
340 const GdkRectangle *cell_area,
341 GdkRectangle *aligned_area);
344 /* Request the size of a cell while respecting the cell margins (requests are margin inclusive) */
345 void gtk_cell_area_request_renderer (GtkCellArea *area,
346 GtkCellRenderer *renderer,
347 GtkOrientation orientation,
355 #endif /* __GTK_CELL_AREA_H__ */