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);
136 void (* update_focus) (GtkCellArea *area);
138 /* Padding for future expansion */
139 void (*_gtk_reserved1) (void);
140 void (*_gtk_reserved2) (void);
141 void (*_gtk_reserved3) (void);
142 void (*_gtk_reserved4) (void);
143 void (*_gtk_reserved5) (void);
144 void (*_gtk_reserved6) (void);
145 void (*_gtk_reserved7) (void);
146 void (*_gtk_reserved8) (void);
149 GType gtk_cell_area_get_type (void) G_GNUC_CONST;
152 void gtk_cell_area_add (GtkCellArea *area,
153 GtkCellRenderer *renderer);
154 void gtk_cell_area_remove (GtkCellArea *area,
155 GtkCellRenderer *renderer);
156 void gtk_cell_area_forall (GtkCellArea *area,
157 GtkCellCallback callback,
158 gpointer callback_data);
159 gint gtk_cell_area_event (GtkCellArea *area,
160 GtkCellAreaIter *iter,
163 const GdkRectangle *cell_area,
164 GtkCellRendererState flags);
165 void gtk_cell_area_render (GtkCellArea *area,
166 GtkCellAreaIter *iter,
169 const GdkRectangle *cell_area,
170 GtkCellRendererState flags);
173 GtkCellAreaIter *gtk_cell_area_create_iter (GtkCellArea *area);
174 GtkSizeRequestMode gtk_cell_area_get_request_mode (GtkCellArea *area);
175 void gtk_cell_area_get_preferred_width (GtkCellArea *area,
176 GtkCellAreaIter *iter,
180 void gtk_cell_area_get_preferred_height_for_width (GtkCellArea *area,
181 GtkCellAreaIter *iter,
184 gint *minimum_height,
185 gint *natural_height);
186 void gtk_cell_area_get_preferred_height (GtkCellArea *area,
187 GtkCellAreaIter *iter,
191 void gtk_cell_area_get_preferred_width_for_height (GtkCellArea *area,
192 GtkCellAreaIter *iter,
196 gint *natural_width);
199 void gtk_cell_area_apply_attributes (GtkCellArea *area,
200 GtkTreeModel *tree_model,
202 gboolean is_expander,
203 gboolean is_expanded);
204 void gtk_cell_area_attribute_connect (GtkCellArea *area,
205 GtkCellRenderer *renderer,
206 const gchar *attribute,
208 void gtk_cell_area_attribute_disconnect (GtkCellArea *area,
209 GtkCellRenderer *renderer,
210 const gchar *attribute);
212 /* Cell Properties */
213 void gtk_cell_area_class_install_cell_property (GtkCellAreaClass *aclass,
216 GParamSpec* gtk_cell_area_class_find_cell_property (GtkCellAreaClass *aclass,
217 const gchar *property_name);
218 GParamSpec** gtk_cell_area_class_list_cell_properties (GtkCellAreaClass *aclass,
219 guint *n_properties);
220 void gtk_cell_area_add_with_properties (GtkCellArea *area,
221 GtkCellRenderer *renderer,
222 const gchar *first_prop_name,
223 ...) G_GNUC_NULL_TERMINATED;
224 void gtk_cell_area_cell_set (GtkCellArea *area,
225 GtkCellRenderer *renderer,
226 const gchar *first_prop_name,
227 ...) G_GNUC_NULL_TERMINATED;
228 void gtk_cell_area_cell_get (GtkCellArea *area,
229 GtkCellRenderer *renderer,
230 const gchar *first_prop_name,
231 ...) G_GNUC_NULL_TERMINATED;
232 void gtk_cell_area_cell_set_valist (GtkCellArea *area,
233 GtkCellRenderer *renderer,
234 const gchar *first_property_name,
236 void gtk_cell_area_cell_get_valist (GtkCellArea *area,
237 GtkCellRenderer *renderer,
238 const gchar *first_property_name,
240 void gtk_cell_area_cell_set_property (GtkCellArea *area,
241 GtkCellRenderer *renderer,
242 const gchar *property_name,
243 const GValue *value);
244 void gtk_cell_area_cell_get_property (GtkCellArea *area,
245 GtkCellRenderer *renderer,
246 const gchar *property_name,
249 #define GTK_CELL_AREA_WARN_INVALID_CHILD_PROPERTY_ID(object, property_id, pspec) \
250 G_OBJECT_WARN_INVALID_PSPEC ((object), "cell property id", (property_id), (pspec))
254 void gtk_cell_area_grab_focus (GtkCellArea *area,
255 GtkDirectionType direction);
256 void gtk_cell_area_focus_leave (GtkCellArea *area,
257 GtkDirectionType direction,
259 void gtk_cell_area_update_focus (GtkCellArea *area);
260 void gtk_cell_area_set_can_focus (GtkCellArea *area,
262 gboolean gtk_cell_area_get_can_focus (GtkCellArea *area);
263 void gtk_cell_area_set_focus_cell (GtkCellArea *area,
264 GtkCellRenderer *renderer);
265 GtkCellRenderer *gtk_cell_area_get_focus_cell (GtkCellArea *area);
270 gint gtk_cell_area_get_cell_margin_left (GtkCellArea *area);
271 void gtk_cell_area_set_cell_margin_left (GtkCellArea *area,
273 gint gtk_cell_area_get_cell_margin_right (GtkCellArea *area);
274 void gtk_cell_area_set_cell_margin_right (GtkCellArea *area,
276 gint gtk_cell_area_get_cell_margin_top (GtkCellArea *area);
277 void gtk_cell_area_set_cell_margin_top (GtkCellArea *area,
279 gint gtk_cell_area_get_cell_margin_bottom (GtkCellArea *area);
280 void gtk_cell_area_set_cell_margin_bottom (GtkCellArea *area,
283 /* Functions for area implementations */
285 /* Distinguish the inner cell area from the whole requested area including margins */
286 void gtk_cell_area_inner_cell_area (GtkCellArea *area,
287 GdkRectangle *cell_area,
288 GdkRectangle *inner_cell_area);
290 /* Request the size of a cell while respecting the cell margins (requests are margin inclusive) */
291 void gtk_cell_area_request_renderer (GtkCellArea *area,
292 GtkCellRenderer *renderer,
293 GtkOrientation orientation,
301 #endif /* __GTK_CELL_AREA_H__ */