1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
|
/* gtkcellarea.h
*
* Copyright (C) 2010 Openismus GmbH
*
* Authors:
* Tristan Van Berkom <tristanvb@openismus.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#ifndef __GTK_CELL_AREA_H__
#define __GTK_CELL_AREA_H__
#include <gtk/gtkcellrenderer.h>
#include <gtk/gtkwidget.h>
#include <gtk/gtktreemodel.h>
G_BEGIN_DECLS
#define GTK_TYPE_CELL_AREA (gtk_cell_area_get_type ())
#define GTK_CELL_AREA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_AREA, GtkCellArea))
#define GTK_CELL_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CELL_AREA, GtkCellAreaClass))
#define GTK_IS_CELL_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_AREA))
#define GTK_IS_CELL_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CELL_AREA))
#define GTK_CELL_AREA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_AREA, GtkCellAreaClass))
typedef struct _GtkCellArea GtkCellArea;
typedef struct _GtkCellAreaClass GtkCellAreaClass;
typedef struct _GtkCellAreaPrivate GtkCellAreaPrivate;
typedef struct _GtkCellAreaContext GtkCellAreaContext;
/**
* GtkCellCallback:
* @renderer: the cell renderer to operate on
* @data: user-supplied data
*
* The type of the callback functions used for iterating over
* the cell renderers of a #GtkCellArea, see gtk_cell_area_forall().
*/
typedef void (*GtkCellCallback) (GtkCellRenderer *renderer,
gpointer data);
struct _GtkCellArea
{
GInitiallyUnowned parent_instance;
GtkCellAreaPrivate *priv;
};
struct _GtkCellAreaClass
{
GInitiallyUnownedClass parent_class;
/* vtable - not signals */
/* Basic methods */
void (* add) (GtkCellArea *area,
GtkCellRenderer *renderer);
void (* remove) (GtkCellArea *area,
GtkCellRenderer *renderer);
void (* forall) (GtkCellArea *area,
GtkCellCallback callback,
gpointer callback_data);
void (* get_cell_allocation) (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
GtkCellRenderer *renderer,
const GdkRectangle *cell_area,
GdkRectangle *allocation);
gint (* event) (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
GdkEvent *event,
const GdkRectangle *cell_area,
GtkCellRendererState flags);
void (* render) (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
cairo_t *cr,
const GdkRectangle *background_area,
const GdkRectangle *cell_area,
GtkCellRendererState flags,
gboolean paint_focus);
/* Geometry */
GtkCellAreaContext *(* create_context) (GtkCellArea *area);
GtkSizeRequestMode (* get_request_mode) (GtkCellArea *area);
void (* get_preferred_width) (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
void (* get_preferred_height_for_width) (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
gint width,
gint *minimum_height,
gint *natural_height);
void (* get_preferred_height) (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
void (* get_preferred_width_for_height) (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
gint height,
gint *minimum_width,
gint *natural_width);
/* Cell Properties */
void (* set_cell_property) (GtkCellArea *area,
GtkCellRenderer *renderer,
guint property_id,
const GValue *value,
GParamSpec *pspec);
void (* get_cell_property) (GtkCellArea *area,
GtkCellRenderer *renderer,
guint property_id,
GValue *value,
GParamSpec *pspec);
/* Focus */
gboolean (* can_focus) (GtkCellArea *area);
gboolean (* focus) (GtkCellArea *area,
GtkDirectionType direction);
gboolean (* activate) (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
const GdkRectangle *cell_area,
GtkCellRendererState flags);
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
void (*_gtk_reserved3) (void);
void (*_gtk_reserved4) (void);
void (*_gtk_reserved5) (void);
void (*_gtk_reserved6) (void);
void (*_gtk_reserved7) (void);
void (*_gtk_reserved8) (void);
};
GType gtk_cell_area_get_type (void) G_GNUC_CONST;
/* Basic methods */
void gtk_cell_area_add (GtkCellArea *area,
GtkCellRenderer *renderer);
void gtk_cell_area_remove (GtkCellArea *area,
GtkCellRenderer *renderer);
gboolean gtk_cell_area_has_renderer (GtkCellArea *area,
GtkCellRenderer *renderer);
void gtk_cell_area_forall (GtkCellArea *area,
GtkCellCallback callback,
gpointer callback_data);
void gtk_cell_area_get_cell_allocation (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
GtkCellRenderer *renderer,
const GdkRectangle *cell_area,
GdkRectangle *allocation);
gint gtk_cell_area_event (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
GdkEvent *event,
const GdkRectangle *cell_area,
GtkCellRendererState flags);
void gtk_cell_area_render (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
cairo_t *cr,
const GdkRectangle *background_area,
const GdkRectangle *cell_area,
GtkCellRendererState flags,
gboolean paint_focus);
void gtk_cell_area_set_style_detail (GtkCellArea *area,
const gchar *detail);
G_CONST_RETURN gchar *gtk_cell_area_get_style_detail (GtkCellArea *area);
/* Geometry */
GtkCellAreaContext *gtk_cell_area_create_context (GtkCellArea *area);
GtkSizeRequestMode gtk_cell_area_get_request_mode (GtkCellArea *area);
void gtk_cell_area_get_preferred_width (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
void gtk_cell_area_get_preferred_height_for_width (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
gint width,
gint *minimum_height,
gint *natural_height);
void gtk_cell_area_get_preferred_height (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
void gtk_cell_area_get_preferred_width_for_height (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
gint height,
gint *minimum_width,
gint *natural_width);
G_CONST_RETURN gchar *gtk_cell_area_get_current_path_string (GtkCellArea *area);
/* Attributes */
void gtk_cell_area_apply_attributes (GtkCellArea *area,
GtkTreeModel *tree_model,
GtkTreeIter *iter,
gboolean is_expander,
gboolean is_expanded);
void gtk_cell_area_attribute_connect (GtkCellArea *area,
GtkCellRenderer *renderer,
const gchar *attribute,
gint column);
void gtk_cell_area_attribute_disconnect (GtkCellArea *area,
GtkCellRenderer *renderer,
const gchar *attribute);
/* Cell Properties */
void gtk_cell_area_class_install_cell_property (GtkCellAreaClass *aclass,
guint property_id,
GParamSpec *pspec);
GParamSpec* gtk_cell_area_class_find_cell_property (GtkCellAreaClass *aclass,
const gchar *property_name);
GParamSpec** gtk_cell_area_class_list_cell_properties (GtkCellAreaClass *aclass,
guint *n_properties);
void gtk_cell_area_add_with_properties (GtkCellArea *area,
GtkCellRenderer *renderer,
const gchar *first_prop_name,
...) G_GNUC_NULL_TERMINATED;
void gtk_cell_area_cell_set (GtkCellArea *area,
GtkCellRenderer *renderer,
const gchar *first_prop_name,
...) G_GNUC_NULL_TERMINATED;
void gtk_cell_area_cell_get (GtkCellArea *area,
GtkCellRenderer *renderer,
const gchar *first_prop_name,
...) G_GNUC_NULL_TERMINATED;
void gtk_cell_area_cell_set_valist (GtkCellArea *area,
GtkCellRenderer *renderer,
const gchar *first_property_name,
va_list var_args);
void gtk_cell_area_cell_get_valist (GtkCellArea *area,
GtkCellRenderer *renderer,
const gchar *first_property_name,
va_list var_args);
void gtk_cell_area_cell_set_property (GtkCellArea *area,
GtkCellRenderer *renderer,
const gchar *property_name,
const GValue *value);
void gtk_cell_area_cell_get_property (GtkCellArea *area,
GtkCellRenderer *renderer,
const gchar *property_name,
GValue *value);
#define GTK_CELL_AREA_WARN_INVALID_CHILD_PROPERTY_ID(object, property_id, pspec) \
G_OBJECT_WARN_INVALID_PSPEC ((object), "cell property id", (property_id), (pspec))
/* Focus */
gboolean gtk_cell_area_can_focus (GtkCellArea *area);
gboolean gtk_cell_area_focus (GtkCellArea *area,
GtkDirectionType direction);
gboolean gtk_cell_area_activate (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
const GdkRectangle *cell_area,
GtkCellRendererState flags);
void gtk_cell_area_set_focus_cell (GtkCellArea *area,
GtkCellRenderer *renderer);
GtkCellRenderer *gtk_cell_area_get_focus_cell (GtkCellArea *area);
/* Focus siblings */
void gtk_cell_area_add_focus_sibling (GtkCellArea *area,
GtkCellRenderer *renderer,
GtkCellRenderer *sibling);
void gtk_cell_area_remove_focus_sibling (GtkCellArea *area,
GtkCellRenderer *renderer,
GtkCellRenderer *sibling);
gboolean gtk_cell_area_is_focus_sibling (GtkCellArea *area,
GtkCellRenderer *renderer,
GtkCellRenderer *sibling);
G_CONST_RETURN GList *gtk_cell_area_get_focus_siblings (GtkCellArea *area,
GtkCellRenderer *renderer);
GtkCellRenderer *gtk_cell_area_get_focus_from_sibling (GtkCellArea *area,
GtkCellRenderer *renderer);
/* Cell Activation/Editing */
void gtk_cell_area_set_edited_cell (GtkCellArea *area,
GtkCellRenderer *renderer);
GtkCellRenderer *gtk_cell_area_get_edited_cell (GtkCellArea *area);
void gtk_cell_area_set_edit_widget (GtkCellArea *area,
GtkCellEditable *editable);
GtkCellEditable *gtk_cell_area_get_edit_widget (GtkCellArea *area);
gboolean gtk_cell_area_activate_cell (GtkCellArea *area,
GtkWidget *widget,
GtkCellRenderer *renderer,
GdkEvent *event,
const GdkRectangle *cell_area,
GtkCellRendererState flags);
void gtk_cell_area_stop_editing (GtkCellArea *area,
gboolean canceled);
/* Margins */
gint gtk_cell_area_get_cell_margin_left (GtkCellArea *area);
void gtk_cell_area_set_cell_margin_left (GtkCellArea *area,
gint margin);
gint gtk_cell_area_get_cell_margin_right (GtkCellArea *area);
void gtk_cell_area_set_cell_margin_right (GtkCellArea *area,
gint margin);
gint gtk_cell_area_get_cell_margin_top (GtkCellArea *area);
void gtk_cell_area_set_cell_margin_top (GtkCellArea *area,
gint margin);
gint gtk_cell_area_get_cell_margin_bottom (GtkCellArea *area);
void gtk_cell_area_set_cell_margin_bottom (GtkCellArea *area,
gint margin);
/* Functions for area implementations */
/* Distinguish the inner cell area from the whole requested area including margins */
void gtk_cell_area_inner_cell_area (GtkCellArea *area,
const GdkRectangle *cell_area,
GdkRectangle *inner_area);
/* Aligns a cell renderer into cell_area by requesting it's size ... used for focus and cell edit areas */
void gtk_cell_area_aligned_cell_area (GtkCellArea *area,
GtkWidget *widget,
GtkCellRenderer *renderer,
const GdkRectangle *cell_area,
GdkRectangle *aligned_area);
/* Request the size of a cell while respecting the cell margins (requests are margin inclusive) */
void gtk_cell_area_request_renderer (GtkCellArea *area,
GtkCellRenderer *renderer,
GtkOrientation orientation,
GtkWidget *widget,
gint for_size,
gint *minimum_size,
gint *natural_size);
G_END_DECLS
#endif /* __GTK_CELL_AREA_H__ */
|