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