glade-widget.h 16 KB
Newer Older
Jose Maria Celorio's avatar
Jose Maria Celorio committed
1
2
3
#ifndef __GLADE_WIDGET_H__
#define __GLADE_WIDGET_H__

4
#include <gladeui/glade-widget-adaptor.h>
5
#include <gladeui/glade-widget-action.h>
6
7
8
#include <gladeui/glade-signal.h>
#include <gladeui/glade-property.h>

9
10
#include <glib.h>
#include <glib-object.h>
Tristan Van Berkom's avatar
Removed    
Tristan Van Berkom committed
11

Jose Maria Celorio's avatar
Jose Maria Celorio committed
12
G_BEGIN_DECLS
13
14
15
 
#define GLADE_TYPE_WIDGET            (glade_widget_get_type ())
#define GLADE_WIDGET(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_WIDGET, GladeWidget))
16
#define GLADE_WIDGET_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_WIDGET, GladeWidgetClass))
17
#define GLADE_IS_WIDGET(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_WIDGET))
18
19
#define GLADE_IS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_WIDGET))
#define GLADE_WIDGET_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GLADE_TYPE_WIDGET, GladeWidgetClass))
Jose Maria Celorio's avatar
Jose Maria Celorio committed
20

21
22
typedef struct _GladeWidgetClass   GladeWidgetClass;
typedef struct _GladeWidgetPrivate GladeWidgetPrivate;
Paolo Borelli's avatar
Paolo Borelli committed
23
24
25

struct _GladeWidget
{
26
  GInitiallyUnowned parent_instance;
Jose Maria Celorio's avatar
Jose Maria Celorio committed
27

28
  GladeWidgetPrivate *priv;
Jose Maria Celorio's avatar
Jose Maria Celorio committed
29
30
};

31
struct _GladeWidgetClass
32
{
33
  GInitiallyUnownedClass parent_class;
34

35
36
37
  void         (*add_child)               (GladeWidget *, GladeWidget *, gboolean);
  void         (*remove_child)            (GladeWidget *, GladeWidget *);
  void         (*replace_child)           (GladeWidget *, GObject *, GObject *);
38

39
40
  void         (*add_signal_handler)	(GladeWidget *, GladeSignal *);
  void         (*remove_signal_handler)	(GladeWidget *, GladeSignal *);
41
  void         (*change_signal_handler)	(GladeWidget *, GladeSignal *);
42

43
44
45
46
47
48
49
50
51
52
53
54
55
56
  gint         (*button_press_event)      (GladeWidget *, GdkEvent *);
  gint         (*button_release_event)    (GladeWidget *, GdkEvent *);
  gint         (*motion_notify_event)     (GladeWidget *, GdkEvent *);

  gboolean     (*event)                   (GladeWidget *, GdkEvent *);

  void   (* glade_reserved1)   (void);
  void   (* glade_reserved2)   (void);
  void   (* glade_reserved3)   (void);
  void   (* glade_reserved4)   (void);
  void   (* glade_reserved5)   (void);
  void   (* glade_reserved6)   (void);
  void   (* glade_reserved7)   (void);
  void   (* glade_reserved8)   (void);
57
};
Jose Maria Celorio's avatar
Jose Maria Celorio committed
58

59
60
61
62
63
#define IS_GLADE_WIDGET_EVENT(event)		 \
	((event) == GDK_BUTTON_PRESS ||		 \
	 (event) == GDK_BUTTON_RELEASE ||	 \
	 (event) == GDK_MOTION_NOTIFY)

64
65
66
/*******************************************************************************
                                  General api
 *******************************************************************************/
67

Tristan Van Berkom's avatar
Tristan Van Berkom committed
68
GType                   glade_widget_get_type		    (void);
69

Tristan Van Berkom's avatar
updated    
Tristan Van Berkom committed
70
GladeWidget            *glade_widget_get_from_gobject       (gpointer          object);
71

72
73
74
75
gboolean                glade_widget_add_verify             (GladeWidget      *parent,
							     GladeWidget      *child,
							     gboolean          user_feedback);

76
void                    glade_widget_add_child              (GladeWidget      *parent,
77
78
							     GladeWidget      *child,
							     gboolean          at_mouse);
79

80
81
void                    glade_widget_remove_child           (GladeWidget      *parent,
							     GladeWidget      *child);
82

83
84
void                    glade_widget_replace                (GladeWidget      *parent,
							     GObject          *old_object,
Tristan Van Berkom's avatar
Tristan Van Berkom committed
85
							     GObject          *new_object);
86
87
88
 
void                    glade_widget_rebuild                (GladeWidget      *gwidget);
 
89
90
GladeWidget            *glade_widget_dup                    (GladeWidget      *template_widget,
							     gboolean          exact);
91
92
93

GList                  *glade_widget_get_signal_list        (GladeWidget      *widget);

94
95
void                    glade_widget_copy_signals           (GladeWidget      *widget,
							     GladeWidget      *template_widget);
96
void                    glade_widget_copy_properties        (GladeWidget      *widget,
97
98
99
							     GladeWidget      *template_widget,
							     gboolean          copy_parentless,
							     gboolean          exact);
100

101
102
void                    glade_widget_set_packing_properties (GladeWidget      *widget,
							     GladeWidget      *container);
103
104
105
106

GList                  *glade_widget_get_properties         (GladeWidget      *widget);
GList                  *glade_widget_get_packing_properties (GladeWidget      *widget);

107
108
GladeProperty          *glade_widget_get_property           (GladeWidget      *widget,
							     const gchar      *id_property);
109
 
110
111
GladeProperty          *glade_widget_get_pack_property      (GladeWidget      *widget,
							     const gchar      *id_property);
112

113
114
GList                  *glade_widget_dup_properties         (GladeWidget      *dest_widget,
							     GList            *template_props,
115
116
117
                                                             gboolean          as_load,
							     gboolean          copy_parentless,
							     gboolean          exact);
118

119
120
void                    glade_widget_remove_property        (GladeWidget      *widget,
							     const gchar      *id_property);
121
 
Tristan Van Berkom's avatar
Tristan Van Berkom committed
122
void                    glade_widget_show                   (GladeWidget      *widget);
123
 
Tristan Van Berkom's avatar
Tristan Van Berkom committed
124
void                    glade_widget_hide                   (GladeWidget      *widget);
125
 
126
void                    glade_widget_add_signal_handler     (GladeWidget      *widget,
127
							     const GladeSignal      *signal_handler);
128
 
129
void                    glade_widget_remove_signal_handler  (GladeWidget      *widget,
130
							     const GladeSignal      *signal_handler);
131
 
132
void                    glade_widget_change_signal_handler  (GladeWidget      *widget,
133
134
							     const GladeSignal      *old_signal_handler,
							     const GladeSignal      *new_signal_handler);
135
 
136
137
GPtrArray *             glade_widget_list_signal_handlers   (GladeWidget      *widget,
							     const gchar      *signal_name);
138
 
Tristan Van Berkom's avatar
updated    
Tristan Van Berkom committed
139
140
gboolean                glade_widget_has_decendant          (GladeWidget      *widget,
							     GType             type);
141
 
142
143
gboolean                glade_widget_event                  (GladeWidget      *gwidget,
							     GdkEvent         *event);
144

145
146
147
gboolean                glade_widget_placeholder_relation   (GladeWidget      *parent, 
							     GladeWidget      *widget);

148
GladeWidgetAction      *glade_widget_get_action             (GladeWidget *widget,
149
150
							     const gchar *action_path);

151
GladeWidgetAction      *glade_widget_get_pack_action        (GladeWidget *widget,
152
153
							     const gchar *action_path);

154
155
156
GList                  *glade_widget_get_actions            (GladeWidget *widget);
GList                  *glade_widget_get_pack_actions       (GladeWidget *widget);

157
158
159
160
161
162
163
164
gboolean                glade_widget_set_action_sensitive   (GladeWidget *widget,
							     const gchar *action_path,
							     gboolean     sensitive);

gboolean                glade_widget_set_pack_action_sensitive (GladeWidget *widget,
								const gchar *action_path,
								gboolean     sensitive);

165
166
167
gboolean                glade_widget_set_action_visible     (GladeWidget *widget,
							     const gchar *action_path,
							     gboolean     sensitive);
168

169
170
171
gboolean                glade_widget_set_pack_action_visible (GladeWidget *widget,
							      const gchar *action_path,
							      gboolean     sensitive);
172

173
174
175
176
void                    glade_widget_write                  (GladeWidget     *widget,
							     GladeXmlContext *context,
							     GladeXmlNode    *node);

177
void                    glade_widget_write_child            (GladeWidget     *widget,
178
							     GladeWidget     *child,
179
180
181
							     GladeXmlContext *context,
							     GladeXmlNode    *node);

182
183
184
185
void                    glade_widget_write_signals          (GladeWidget     *widget,
							     GladeXmlContext *context,
							     GladeXmlNode    *node);

186
187
188
189
190
void                    glade_widget_write_placeholder      (GladeWidget     *parent,
							     GObject         *object,
							     GladeXmlContext *context,
							     GladeXmlNode    *node);
	
191
192
193
194
195
GladeWidget            *glade_widget_read                   (GladeProject     *project,
							     GladeWidget      *parent,
							     GladeXmlNode     *node,
							     const gchar      *internal);

196
197
198
void                    glade_widget_read_child             (GladeWidget      *widget,
							     GladeXmlNode     *node);

199
200
201
202
203
204

void                    glade_widget_write_special_child_prop (GladeWidget     *parent, 
							       GObject         *object,
							       GladeXmlContext *context,
							       GladeXmlNode    *node);

205
206
207
void                    glade_widget_set_child_type_from_node (GladeWidget         *parent,
							       GObject             *child,
							       GladeXmlNode        *node);
208

209
210
211
212
213
GladeEditorProperty    *glade_widget_create_editor_property (GladeWidget      *widget,
							     const gchar      *property,
							     gboolean          packing,
							     gboolean          use_command);

214
gchar                  *glade_widget_generate_path_name     (GladeWidget      *widget);
215
216
217
218

gboolean                glade_widget_is_ancestor            (GladeWidget      *widget,
							     GladeWidget      *ancestor);

219
220
221
/*******************************************************************************
                      Project, object property references
 *******************************************************************************/
222
 
Tristan Van Berkom's avatar
Tristan Van Berkom committed
223
224
void                    glade_widget_add_prop_ref           (GladeWidget      *widget,
							     GladeProperty    *property);
225
 
Tristan Van Berkom's avatar
Tristan Van Berkom committed
226
227
228
void                    glade_widget_remove_prop_ref        (GladeWidget      *widget,
							     GladeProperty    *property);

229
230
GList                  *glade_widget_list_prop_refs         (GladeWidget      *widget);

231
232
GladeProperty          *glade_widget_get_parentless_widget_ref (GladeWidget  *widget);

233
234
235

GList                  *glade_widget_get_parentless_reffed_widgets (GladeWidget *widget);

236
237
238
/*******************************************************************************
            Functions that deal with properties on the runtime object
 *******************************************************************************/
239

240
241
242
void                    glade_widget_object_set_property    (GladeWidget      *widget,
							     const gchar      *property_name,
							     const GValue     *value);
243

244
245
246
void                    glade_widget_object_get_property    (GladeWidget      *widget,
							     const gchar      *property_name,
							     GValue           *value);
247

248
249
250
251
void                    glade_widget_child_set_property     (GladeWidget      *widget,
							     GladeWidget      *child,
							     const gchar      *property_name,
							     const GValue     *value);
252

253
254
255
256
257
void                    glade_widget_child_get_property     (GladeWidget      *widget,
							     GladeWidget      *child,
							     const gchar      *property_name,
							     GValue           *value);

258
259
260
/*******************************************************************************
                   GladeProperty api convenience wrappers
 *******************************************************************************/
261
 
Tristan Van Berkom's avatar
Tristan Van Berkom committed
262
263
264
gboolean                glade_widget_property_get           (GladeWidget      *widget,
							     const gchar      *id_property,
							     ...);
265
 
Tristan Van Berkom's avatar
Tristan Van Berkom committed
266
267
268
gboolean                glade_widget_property_set           (GladeWidget      *widget,
							     const gchar      *id_property,
							     ...);
269
 
Tristan Van Berkom's avatar
Tristan Van Berkom committed
270
271
272
gboolean                glade_widget_pack_property_get      (GladeWidget      *widget,
							     const gchar      *id_property,
							     ...);
273
 
Tristan Van Berkom's avatar
Tristan Van Berkom committed
274
275
276
gboolean                glade_widget_pack_property_set      (GladeWidget      *widget,
							     const gchar      *id_property,
							     ...);
277
 
Tristan Van Berkom's avatar
Tristan Van Berkom committed
278
279
gboolean                glade_widget_property_reset         (GladeWidget      *widget,
							     const gchar      *id_property);
280
 
Tristan Van Berkom's avatar
Tristan Van Berkom committed
281
282
gboolean                glade_widget_pack_property_reset    (GladeWidget      *widget,
							     const gchar      *id_property);
283
 
Tristan Van Berkom's avatar
Tristan Van Berkom committed
284
285
gboolean                glade_widget_property_default       (GladeWidget      *widget,
							     const gchar      *id_property);
286
 
287
gboolean                glade_widget_property_original_default (GladeWidget      *widget,
288
								const gchar      *id_property);
289
 
Tristan Van Berkom's avatar
Tristan Van Berkom committed
290
291
gboolean                glade_widget_pack_property_default  (GladeWidget      *widget,
							     const gchar      *id_property);
292
 
Tristan Van Berkom's avatar
Tristan Van Berkom committed
293
294
295
296
gboolean                glade_widget_property_set_sensitive (GladeWidget      *widget,
							     const gchar      *id_property,
							     gboolean          sensitive,
							     const gchar      *reason);
297
 
Tristan Van Berkom's avatar
Tristan Van Berkom committed
298
299
300
301
gboolean                glade_widget_pack_property_set_sensitive (GladeWidget      *widget,
								  const gchar      *id_property,
								  gboolean          sensitive,
								  const gchar      *reason);
302
 
Tristan Van Berkom's avatar
Tristan Van Berkom committed
303
304
305
gboolean                glade_widget_property_set_enabled   (GladeWidget      *widget,
							     const gchar      *id_property,
							     gboolean          enabled);
306
 
Tristan Van Berkom's avatar
Tristan Van Berkom committed
307
308
309
310
gboolean                glade_widget_pack_property_set_enabled (GladeWidget      *widget,
								const gchar      *id_property,
								gboolean          enabled);

311
 
312
313
314
gboolean                glade_widget_property_set_save_always (GladeWidget      *widget,
							       const gchar      *id_property,
							       gboolean          setting);
315
 
316
317
318
319
gboolean                glade_widget_pack_property_set_save_always (GladeWidget      *widget,
								    const gchar      *id_property,
								    gboolean          setting);

320
321
322
323
324
325
326
327
328
gchar                  *glade_widget_property_string        (GladeWidget      *widget,
							     const gchar      *id_property,
							     const GValue     *value);


gchar                  *glade_widget_pack_property_string   (GladeWidget      *widget,
							     const gchar      *id_property,
							     const GValue     *value);

329
330
331
/*******************************************************************************
                                  Accessors
 *******************************************************************************/
332

333
334
void                    glade_widget_set_name		    (GladeWidget      *widget,
							     const gchar      *name);
335
 
336
G_CONST_RETURN gchar   *glade_widget_get_name               (GladeWidget      *widget);
337

338
339
void                    glade_widget_set_internal	    (GladeWidget      *widget,
							     const gchar      *internal);
340
 
341
G_CONST_RETURN gchar   *glade_widget_get_internal           (GladeWidget      *widget);
342

343
GObject                *glade_widget_get_object             (GladeWidget      *widget);
344

345
346
void                    glade_widget_set_project	    (GladeWidget      *widget,
							     GladeProject     *project);
347
 
348
GladeProject           *glade_widget_get_project            (GladeWidget      *widget);
349
350
351
352
353

void                    glade_widget_set_in_project         (GladeWidget      *widget,
							     gboolean          in_project);
gboolean                glade_widget_in_project             (GladeWidget      *widget);

354
GladeWidgetAdaptor     *glade_widget_get_adaptor            (GladeWidget      *widget);
355
 
Tristan Van Berkom's avatar
Tristan Van Berkom committed
356
GladeWidget            *glade_widget_get_parent             (GladeWidget      *widget);
357
 
Tristan Van Berkom's avatar
Tristan Van Berkom committed
358
359
void                    glade_widget_set_parent             (GladeWidget      *widget,
							     GladeWidget      *parent);
360

361
362
GList                  *glade_widget_get_children	    (GladeWidget* widget);

363
GladeWidget            *glade_widget_get_toplevel           (GladeWidget      *widget);
364
 
365
gboolean                glade_widget_superuser              (void);
366
 
367
void                    glade_widget_push_superuser         (void);
368
 
369
void                    glade_widget_pop_superuser          (void);
370

371
372
void                    glade_widget_set_support_warning    (GladeWidget      *widget,
							     const gchar      *warning);
373
G_CONST_RETURN gchar   *glade_widget_support_warning        (GladeWidget      *widget);
374

375
376
377
void                    glade_widget_lock                   (GladeWidget      *widget,
							     GladeWidget      *locked);
void                    glade_widget_unlock                 (GladeWidget      *widget);
378

379
380
381
382
GladeWidget            *glade_widget_get_locker             (GladeWidget      *widget);

GList                  *glade_widget_list_locked_widgets    (GladeWidget      *widget);

383
384
void                    glade_widget_support_changed        (GladeWidget      *widget);

385
386
387
GtkTreeModel           *glade_widget_get_signal_model       (GladeWidget      *widget);


Jose Maria Celorio's avatar
Jose Maria Celorio committed
388
389
G_END_DECLS

390
#endif /* __GLADE_WIDGET_H__ */