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);
104 GtkCellAreaContext *(* create_context) (GtkCellArea *area);
105 GtkSizeRequestMode (* get_request_mode) (GtkCellArea *area);
106 void (* get_preferred_width) (GtkCellArea *area,
107 GtkCellAreaContext *context,
110 gint *natural_width);
111 void (* get_preferred_height_for_width) (GtkCellArea *area,
112 GtkCellAreaContext *context,
115 gint *minimum_height,
116 gint *natural_height);
117 void (* get_preferred_height) (GtkCellArea *area,
118 GtkCellAreaContext *context,
120 gint *minimum_height,
121 gint *natural_height);
122 void (* get_preferred_width_for_height) (GtkCellArea *area,
123 GtkCellAreaContext *context,
127 gint *natural_width);
129 /* Cell Properties */
130 void (* set_cell_property) (GtkCellArea *area,
131 GtkCellRenderer *renderer,
135 void (* get_cell_property) (GtkCellArea *area,
136 GtkCellRenderer *renderer,
142 gboolean (* can_focus) (GtkCellArea *area);
143 gboolean (* focus) (GtkCellArea *area,
144 GtkDirectionType direction);
145 gboolean (* activate) (GtkCellArea *area,
146 GtkCellAreaContext *context,
148 const GdkRectangle *cell_area,
149 GtkCellRendererState flags);
152 /* Padding for future expansion */
153 void (*_gtk_reserved1) (void);
154 void (*_gtk_reserved2) (void);
155 void (*_gtk_reserved3) (void);
156 void (*_gtk_reserved4) (void);
157 void (*_gtk_reserved5) (void);
158 void (*_gtk_reserved6) (void);
159 void (*_gtk_reserved7) (void);
160 void (*_gtk_reserved8) (void);
163 GType gtk_cell_area_get_type (void) G_GNUC_CONST;
166 void gtk_cell_area_add (GtkCellArea *area,
167 GtkCellRenderer *renderer);
168 void gtk_cell_area_remove (GtkCellArea *area,
169 GtkCellRenderer *renderer);
170 gboolean gtk_cell_area_has_renderer (GtkCellArea *area,
171 GtkCellRenderer *renderer);
172 void gtk_cell_area_forall (GtkCellArea *area,
173 GtkCellCallback callback,
174 gpointer callback_data);
175 void gtk_cell_area_get_cell_allocation (GtkCellArea *area,
176 GtkCellAreaContext *context,
178 GtkCellRenderer *renderer,
179 const GdkRectangle *cell_area,
180 GdkRectangle *allocation);
181 gint gtk_cell_area_event (GtkCellArea *area,
182 GtkCellAreaContext *context,
185 const GdkRectangle *cell_area,
186 GtkCellRendererState flags);
187 void gtk_cell_area_render (GtkCellArea *area,
188 GtkCellAreaContext *context,
191 const GdkRectangle *background_area,
192 const GdkRectangle *cell_area,
193 GtkCellRendererState flags,
194 gboolean paint_focus);
195 void gtk_cell_area_set_style_detail (GtkCellArea *area,
196 const gchar *detail);
197 G_CONST_RETURN gchar *gtk_cell_area_get_style_detail (GtkCellArea *area);
200 GtkCellAreaContext *gtk_cell_area_create_context (GtkCellArea *area);
201 GtkSizeRequestMode gtk_cell_area_get_request_mode (GtkCellArea *area);
202 void gtk_cell_area_get_preferred_width (GtkCellArea *area,
203 GtkCellAreaContext *context,
207 void gtk_cell_area_get_preferred_height_for_width (GtkCellArea *area,
208 GtkCellAreaContext *context,
211 gint *minimum_height,
212 gint *natural_height);
213 void gtk_cell_area_get_preferred_height (GtkCellArea *area,
214 GtkCellAreaContext *context,
218 void gtk_cell_area_get_preferred_width_for_height (GtkCellArea *area,
219 GtkCellAreaContext *context,
223 gint *natural_width);
224 G_CONST_RETURN gchar *gtk_cell_area_get_current_path_string (GtkCellArea *area);
228 void gtk_cell_area_apply_attributes (GtkCellArea *area,
229 GtkTreeModel *tree_model,
231 gboolean is_expander,
232 gboolean is_expanded);
233 void gtk_cell_area_attribute_connect (GtkCellArea *area,
234 GtkCellRenderer *renderer,
235 const gchar *attribute,
237 void gtk_cell_area_attribute_disconnect (GtkCellArea *area,
238 GtkCellRenderer *renderer,
239 const gchar *attribute);
241 /* Cell Properties */
242 void gtk_cell_area_class_install_cell_property (GtkCellAreaClass *aclass,
245 GParamSpec* gtk_cell_area_class_find_cell_property (GtkCellAreaClass *aclass,
246 const gchar *property_name);
247 GParamSpec** gtk_cell_area_class_list_cell_properties (GtkCellAreaClass *aclass,
248 guint *n_properties);
249 void gtk_cell_area_add_with_properties (GtkCellArea *area,
250 GtkCellRenderer *renderer,
251 const gchar *first_prop_name,
252 ...) G_GNUC_NULL_TERMINATED;
253 void gtk_cell_area_cell_set (GtkCellArea *area,
254 GtkCellRenderer *renderer,
255 const gchar *first_prop_name,
256 ...) G_GNUC_NULL_TERMINATED;
257 void gtk_cell_area_cell_get (GtkCellArea *area,
258 GtkCellRenderer *renderer,
259 const gchar *first_prop_name,
260 ...) G_GNUC_NULL_TERMINATED;
261 void gtk_cell_area_cell_set_valist (GtkCellArea *area,
262 GtkCellRenderer *renderer,
263 const gchar *first_property_name,
265 void gtk_cell_area_cell_get_valist (GtkCellArea *area,
266 GtkCellRenderer *renderer,
267 const gchar *first_property_name,
269 void gtk_cell_area_cell_set_property (GtkCellArea *area,
270 GtkCellRenderer *renderer,
271 const gchar *property_name,
272 const GValue *value);
273 void gtk_cell_area_cell_get_property (GtkCellArea *area,
274 GtkCellRenderer *renderer,
275 const gchar *property_name,
278 #define GTK_CELL_AREA_WARN_INVALID_CHILD_PROPERTY_ID(object, property_id, pspec) \
279 G_OBJECT_WARN_INVALID_PSPEC ((object), "cell property id", (property_id), (pspec))
283 gboolean gtk_cell_area_can_focus (GtkCellArea *area);
284 gboolean gtk_cell_area_focus (GtkCellArea *area,
285 GtkDirectionType direction);
286 gboolean gtk_cell_area_activate (GtkCellArea *area,
287 GtkCellAreaContext *context,
289 const GdkRectangle *cell_area,
290 GtkCellRendererState flags);
291 void gtk_cell_area_set_focus_cell (GtkCellArea *area,
292 GtkCellRenderer *renderer);
293 GtkCellRenderer *gtk_cell_area_get_focus_cell (GtkCellArea *area);
297 void gtk_cell_area_add_focus_sibling (GtkCellArea *area,
298 GtkCellRenderer *renderer,
299 GtkCellRenderer *sibling);
300 void gtk_cell_area_remove_focus_sibling (GtkCellArea *area,
301 GtkCellRenderer *renderer,
302 GtkCellRenderer *sibling);
303 gboolean gtk_cell_area_is_focus_sibling (GtkCellArea *area,
304 GtkCellRenderer *renderer,
305 GtkCellRenderer *sibling);
306 G_CONST_RETURN GList *gtk_cell_area_get_focus_siblings (GtkCellArea *area,
307 GtkCellRenderer *renderer);
308 GtkCellRenderer *gtk_cell_area_get_focus_from_sibling (GtkCellArea *area,
309 GtkCellRenderer *renderer);
311 /* Cell Activation/Editing */
312 GtkCellRenderer *gtk_cell_area_get_edited_cell (GtkCellArea *area);
313 GtkCellEditable *gtk_cell_area_get_edit_widget (GtkCellArea *area);
314 gboolean gtk_cell_area_activate_cell (GtkCellArea *area,
316 GtkCellRenderer *renderer,
318 const GdkRectangle *cell_area,
319 GtkCellRendererState flags);
320 void gtk_cell_area_stop_editing (GtkCellArea *area,
323 /* Functions for area implementations */
325 /* Distinguish the inner cell area from the whole requested area including margins */
326 void gtk_cell_area_inner_cell_area (GtkCellArea *area,
328 const GdkRectangle *cell_area,
329 GdkRectangle *inner_area);
331 /* Aligns a cell renderer into cell_area by requesting it's size ... used for focus and cell edit areas */
332 void gtk_cell_area_aligned_cell_area (GtkCellArea *area,
334 GtkCellRenderer *renderer,
335 const GdkRectangle *cell_area,
336 GdkRectangle *aligned_area);
339 /* Request the size of a cell while respecting the cell margins (requests are margin inclusive) */
340 void gtk_cell_area_request_renderer (GtkCellArea *area,
341 GtkCellRenderer *renderer,
342 GtkOrientation orientation,
350 #endif /* __GTK_CELL_AREA_H__ */