1 #ifndef __FOO_OBJECT_H__
2 #define __FOO_OBJECT_H__
4 #include <glib-object.h>
5 #include <gio/gio.h> /* GAsyncReadyCallback */
8 #define FOO_SUCCESS_INT 0x1138
10 #define FOO_DEFINE_SHOULD_BE_EXPOSED "should be exposed"
12 #define FOO_PIE_IS_TASTY 3.14159
14 #define FOO_TYPE_INTERFACE (foo_interface_get_type ())
15 #define FOO_INTERFACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), FOO_TYPE_INTERFACE, FooInterface))
16 #define FOO_IS_INTERFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), FOO_TYPE_INTERFACE))
17 #define FOO_INTERFACE_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), FOO_TYPE_INTERFACE, FooInterfaceIface))
19 #define FOO_TYPE_SUBINTERFACE (foo_sub_interface_get_type ())
20 #define FOO_SUBINTERFACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), FOO_TYPE_SUBINTERFACE, FooSubInterface))
21 #define FOO_IS_SUBINTERFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), FOO_TYPE_SUBINTERFACE))
22 #define FOO_SUBINTERFACE_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), FOO_TYPE_SUBINTERFACE, FooSubInterfaceIface))
25 #define FOO_TYPE_OBJECT (foo_object_get_type ())
26 #define FOO_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), FOO_TYPE_OBJECT, FooObject))
27 #define FOO_IS_OBJECT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), FOO_TYPE_OBJECT))
29 #define FOO_TYPE_SUBOBJECT (foo_subobject_get_type ())
30 #define FOO_SUBOBJECT(subobject) (G_TYPE_CHECK_INSTANCE_CAST ((subobject), FOO_TYPE_SUBOBJECT, FooSubobject))
31 #define FOO_IS_SUBOBJECT(subobject) (G_TYPE_CHECK_INSTANCE_TYPE ((subobject), FOO_TYPE_SUBOBJECT))
33 #define FOO_TYPE_BUFFER (foo_buffer_get_type ())
34 #define FOO_BUFFER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), FOO_TYPE_BUFFER, FooBuffer))
35 #define FOO_IS_BUFFER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), FOO_TYPE_BUFFER))
37 #define FOO_TYPE_OTHER_OBJECT (foo_other_object_get_type ())
38 #define FOO_OTHER_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), FOO_TYPE_OTHER_OBJECT, FooOtherObject))
39 #define FOO_IS_OTHER_OBJECT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), FOO_TYPE_OTHER_OBJECT))
41 typedef struct _FooInterface FooInterface;
42 typedef struct _FooInterfaceIface FooInterfaceIface;
43 typedef struct _FooSubInterface FooSubInterface;
44 typedef struct _FooSubInterfaceIface FooSubInterfaceIface;
45 typedef struct _FooObject FooObject;
46 typedef struct _FooObjectClass FooObjectClass;
47 typedef struct _FooSubobject FooSubobject;
48 typedef struct _FooSubobjectClass FooSubobjectClass;
49 typedef struct _FooBuffer FooBuffer;
50 typedef struct _FooBufferClass FooBufferClass;
51 typedef struct _FooOtherObject FooOtherObject;
52 typedef struct _FooOtherObjectClass FooOtherObjectClass;
54 struct _FooInterfaceIface
56 GTypeInterface parent_iface;
58 void (*do_foo) (FooInterface *self, int x);
61 GType foo_interface_get_type (void) G_GNUC_CONST;
63 void foo_interface_do_foo (FooInterface *iface, int x);
65 void foo_interface_static_method (int x);
67 struct _FooSubInterfaceIface
69 GTypeInterface parent_iface;
73 void (*destroy_event) (FooSubInterface *self);
77 void (*do_bar) (FooSubInterface *self);
79 /* explicitly test un-named parameters */
80 void (*do_moo) (FooSubInterface *self, int, gpointer);
82 void (*do_baz) (FooSubInterface *self, GCallback callback, gpointer data);
85 GType foo_sub_interface_get_type (void) G_GNUC_CONST;
87 void foo_sub_interface_do_bar (FooSubInterface *self);
88 void foo_sub_interface_do_moo (FooSubInterface *self, int, gpointer);
89 void foo_sub_interface_do_baz (FooSubInterface *self,
95 GObject parent_instance;
100 struct _FooObjectClass
102 GObjectClass parent_class;
104 gboolean (* virtual_method) (FooObject *object, int first_param);
106 /* Intended to match GFile */
107 void (*read_fn) (FooObject *object, int offset, int length);
109 /* Test reserved stuff */
110 GCallback _reserved[4];
113 gint foo_init (void);
115 GType foo_object_get_type (void) G_GNUC_CONST;
116 FooObject* foo_object_new (void);
117 UtilityObject* foo_object_external_type (FooObject *object);
118 GObject* foo_object_new_as_super (void);
120 void foo_object_various (FooObject *object, void *data, GType some_type);
122 void foo_object_take_all (FooObject *object, int x, ...);
124 typedef gpointer FooObjectCookie;
126 FooObjectCookie foo_object_new_cookie (FooObject *object, const char *target);
128 void foo_object_is_it_time_yet (FooObject *object, time_t time);
130 const char * foo_object_get_name (FooObject *object);
132 char * foo_object_dup_name (FooObject *object);
134 void foo_object_handle_glyph (FooObject *object, UtilityGlyph glyph);
136 gboolean foo_object_virtual_method (FooObject *object, int first_param);
138 void foo_object_read (FooObject *object, int offset, int length);
140 int foo_object_static_meth (void);
142 void foo_object_skipped_method (FooObject *object);
146 FooObject parent_instance;
149 struct _FooSubobjectClass
151 FooObjectClass parent_class;
154 GType foo_subobject_get_type (void) G_GNUC_CONST;
155 FooSubobject* foo_subobject_new (void);
157 FooObject * foo_object_get_default (void);
159 GType foo_buffer_get_type (void);
161 void foo_buffer_some_method (FooBuffer *buffer);
163 GType foo_other_object_get_type (void) G_GNUC_CONST;
172 GType foo_enum_type_get_type (void);
174 int foo_enum_type_method (FooEnumType foo_enum);
176 FooEnumType foo_enum_type_returnv (int x);
180 FOO_FLAGS_FIRST = 1 << 0,
181 FOO_FLAGS_SECOND = 1 << 1,
182 FOO_FLAGS_THIRD = 1 << 2
185 GType foo_flags_type_get_type (void);
197 FOO_FLAGS_ETT = 1 << 0,
198 FOO_FLAGS_TVA = 1 << 1,
199 FOO_FLAGS_FYRA = 1 << 2
204 FOO_ENUM_FULLNAME_ONE = 1,
205 FOO_ENUM_FULLNAME_TWO,
206 FOO_ENUM_FULLNAME_THREE
216 typedef struct _FooBoxed FooBoxed;
218 GType foo_boxed_get_type (void) G_GNUC_CONST;
219 FooBoxed* foo_boxed_new (void);
220 void foo_boxed_method (FooBoxed* boxed);
222 /* This one tests capitalization handling with respect to DBus */
223 typedef struct _FooDBusData FooDBusData;
224 GType foo_dbus_data_get_type (void) G_GNUC_CONST;
225 void foo_dbus_data_method (FooDBusData* dbusdata);
227 /* FIXME: Scanner does not support this yet
228 const char *FOO_CONSTANT_STR = "foo-constant-str";
229 const int FOO_CONSTANT_INT = 10;
230 const float FOO_CONSTANT_FLOAT = 10;
234 typedef gboolean (* FooCallback) (FooObject *foo, gboolean b, gpointer data);
236 /* Invalid comments, should be ignored */
241 typedef struct _FooStruct FooStruct;
242 typedef struct _FooStructPrivate FooStructPrivate;
246 FooStructPrivate *priv;
250 typedef struct _FooRectangle FooRectangle;
261 foo_method_external_references (UtilityObject *object,
266 void foo_rectangle_add(FooRectangle *r1, const FooRectangle *r2);
268 FooRectangle * foo_rectangle_new (int x, int y, int width, int height);
271 typedef struct _FooEventAny FooEventAny;
272 typedef struct _FooEventExpose FooEventExpose;
274 typedef union _FooEvent FooEvent;
281 struct _FooEventExpose
291 FooEventExpose expose;
294 typedef void FooXEvent;
296 /* And now some boxed variants */
298 typedef struct _FooBRect FooBRect;
306 GType foo_brect_get_type (void);
308 FooBRect *foo_brect_new (double x, double y);
310 void foo_brect_add (FooBRect *b1, FooBRect *b2);
312 typedef union _FooBUnion FooBUnion;
321 typedef union _FooUnion FooUnion;
328 typedef struct _FooUtilityStruct FooUtilityStruct;
329 struct _FooUtilityStruct
334 typedef struct _FooThingWithArray FooThingWithArray;
335 struct _FooThingWithArray
343 FooBUnion *foo_bunion_new (void);
345 GType foo_bunion_get_type (void);
347 int foo_bunion_get_contained_type (FooBUnion *bunion);
349 void foo_test_unsigned_qualifier (unsigned int unsigned_param);
350 void foo_test_unsigned_type (unsigned unsigned_param);
352 void foo_test_string_array (char **array);
354 void foo_test_string_array_with_g (gchar **array);
356 GArray *foo_test_array (void);
358 const char * foo_test_const_char_retval (void);
359 const FooStruct * foo_test_const_struct_retval (void);
360 void foo_test_const_char_param (const char * param);
361 void foo_test_const_struct_param (const FooStruct * param);
363 typedef void (*FooVarargsCallback) (const char * param, ...);
364 void foo_test_varargs_callback (gint i, FooVarargsCallback callback);
365 void foo_test_varargs_callback2 (FooVarargsCallback callback);
366 void foo_test_varargs_callback3 (FooVarargsCallback callback,
367 FooVarargsCallback callback2);
369 /* Make sure callbacks get the right scope by default */
370 void foo_async_ready_callback(GCancellable *cancellable,
371 GAsyncReadyCallback callback,
373 void foo_destroy_notify_callback(FooCallback callback,
375 GDestroyNotify destroy);
382 GType foo_error_get_type (void);
384 GQuark foo_error_quark (void);
388 FOO_LAYER_DESKTOP = 0,
389 FOO_LAYER_BOTTOM = 1,
390 FOO_LAYER_NORMAL = 2,
391 FOO_LAYER_TOP = 4, /* Same as DOCK; see EWMH and bug 330717 */
393 FOO_LAYER_FULLSCREEN = 5,
394 FOO_LAYER_FOCUSED_WINDOW = 6,
395 FOO_LAYER_OVERRIDE_REDIRECT = 7,
404 /* Should be skipped */
405 void foo_some_variant (guint x, va_list args);
406 void foo_some_variant_ptr (guint x, va_list *args);
409 * FooSkippable: (skip)
410 * @FOO_SKIPPABLE_ONE: a skippable enum value
411 * @FOO_SKIPPABLE_TWO: another skippable enum value
413 * Some type that is only interesting from C and should not be
414 * exposed to language bindings.
420 void foo_skip_me (FooSkippable fs);
422 typedef struct _FooForeignStruct FooForeignStruct;
424 struct _FooForeignStruct
429 FooForeignStruct* foo_foreign_struct_new (void);
430 FooForeignStruct* foo_foreign_struct_copy (FooForeignStruct *original);
432 /* This one should be a global, not a method on UtilityObject since
433 * it's a separate namespace.
435 void foo_object_a_global_method (UtilityObject *obj);
437 FooOtherObject * foo_object_append_new_stack_layer (FooObject *obj, int x);
439 #endif /* __FOO_OBJECT_H__ */