]>
Commit | Line | Data |
---|---|---|
004dec01 PZ |
1 | --- clutter-1.6.0/doc/cookbook/examples/cb-button.h.wiget 2011-02-03 14:52:55.838124992 +0100 |
2 | +++ clutter-1.6.0/doc/cookbook/examples/cb-button.h 2011-02-03 14:53:12.305129788 +0100 | |
3 | @@ -0,0 +1,84 @@ | |
4 | +/* inclusion guard */ | |
5 | +#ifndef __CB_BUTTON_H__ | |
6 | +#define __CB_BUTTON_H__ | |
7 | + | |
8 | +/* include any dependencies */ | |
9 | +#include <clutter/clutter.h> | |
10 | + | |
11 | +/* GObject implementation */ | |
12 | + | |
13 | +/* declare this function signature to remove compilation errors with -Wall; | |
14 | + * the cb_button_get_type() function is actually added via the | |
15 | + * G_DEFINE_TYPE macro in the .c file | |
16 | + */ | |
17 | +GType cb_button_get_type (void); | |
18 | + | |
19 | +/* GObject type macros */ | |
20 | +/* returns the class type identifier (GType) for CbButton */ | |
21 | +#define CB_TYPE_BUTTON (cb_button_get_type ()) | |
22 | + | |
23 | +/* cast obj to a CbButton object structure*/ | |
24 | +#define CB_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CB_TYPE_BUTTON, CbButton)) | |
25 | + | |
26 | +/* check whether obj is a CbButton */ | |
27 | +#define CB_IS_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CB_TYPE_BUTTON)) | |
28 | + | |
29 | +/* cast klass to CbButtonClass class structure */ | |
30 | +#define CB_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CB_TYPE_BUTTON, CbButtonClass)) | |
31 | + | |
32 | +/* check whether klass is a member of the CbButtonClass */ | |
33 | +#define CB_IS_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CB_TYPE_BUTTON)) | |
34 | + | |
35 | +/* get the CbButtonClass structure for a CbButton obj */ | |
36 | +#define CB_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CB_TYPE_BUTTON, CbButtonClass)) | |
37 | + | |
38 | +/* | |
39 | + * Private instance fields; see | |
40 | + * http://www.gotw.ca/gotw/024.htm for the rationale | |
41 | + */ | |
42 | +typedef struct _CbButtonPrivate CbButtonPrivate; | |
43 | +typedef struct _CbButton CbButton; | |
44 | +typedef struct _CbButtonClass CbButtonClass; | |
45 | + | |
46 | +/* object structure */ | |
47 | +struct _CbButton | |
48 | +{ | |
49 | + /*<private>*/ | |
50 | + ClutterActor parent_instance; | |
51 | + | |
52 | + /* structure containing private members */ | |
53 | + /*<private>*/ | |
54 | + CbButtonPrivate *priv; | |
55 | +}; | |
56 | + | |
57 | +/* class structure */ | |
58 | +struct _CbButtonClass | |
59 | +{ | |
60 | + /* signals */ | |
61 | + void (* clicked)(CbButton *button); | |
62 | + | |
63 | + /*<private>*/ | |
64 | + ClutterActorClass parent_class; | |
65 | +}; | |
66 | + | |
67 | +/* public API */ | |
68 | + | |
69 | +/* constructor - note this returns a ClutterActor instance */ | |
70 | +ClutterActor *cb_button_new (void); | |
71 | + | |
72 | +/* getter */ | |
73 | +G_CONST_RETURN gchar * cb_button_get_text (CbButton *self); | |
74 | + | |
75 | +/* setters - these are wrappers round functions | |
76 | + * which change properties of the internal actors | |
77 | + */ | |
78 | +void cb_button_set_text (CbButton *self, | |
79 | + const gchar *text); | |
80 | + | |
81 | +void cb_button_set_background_color (CbButton *self, | |
82 | + const ClutterColor *color); | |
83 | + | |
84 | +void cb_button_set_text_color (CbButton *self, | |
85 | + const ClutterColor *color); | |
86 | + | |
87 | +#endif /* __CB_BUTTON_H__ */ |