1 /*
2  * Clutter.
3  *
4  * An OpenGL based 'interactive canvas' library.
5  *
6  * Authored By Matthew Allum  <mallum@openedhand.com>
7  *             Jorn Baayen  <jorn@openedhand.com>
8  *             Emmanuele Bassi  <ebassi@openedhand.com>
9  *
10  * Copyright (C) 2006 OpenedHand
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public
14  * License as published by the Free Software Foundation; either
15  * version 2 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
24  */
25 
26 #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
27 #error "Only <clutter/clutter.h> can be included directly."
28 #endif
29 
30 #ifndef __CLUTTER_BEHAVIOUR_H__
31 #define __CLUTTER_BEHAVIOUR_H__
32 
33 #include <clutter/clutter-types.h>
34 
35 G_BEGIN_DECLS
36 
37 #define CLUTTER_TYPE_BEHAVIOUR clutter_behaviour_get_type()
38 
39 #define CLUTTER_BEHAVIOUR(obj) \
40   (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
41   CLUTTER_TYPE_BEHAVIOUR, ClutterBehaviour))
42 
43 #define CLUTTER_BEHAVIOUR_CLASS(klass) \
44   (G_TYPE_CHECK_CLASS_CAST ((klass), \
45   CLUTTER_TYPE_BEHAVIOUR, ClutterBehaviourClass))
46 
47 #define CLUTTER_IS_BEHAVIOUR(obj) \
48   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
49   CLUTTER_TYPE_BEHAVIOUR))
50 
51 #define CLUTTER_IS_BEHAVIOUR_CLASS(klass) \
52   (G_TYPE_CHECK_CLASS_TYPE ((klass), \
53   CLUTTER_TYPE_BEHAVIOUR))
54 
55 #define CLUTTER_BEHAVIOUR_GET_CLASS(obj) \
56   (G_TYPE_INSTANCE_GET_CLASS ((obj), \
57   CLUTTER_TYPE_BEHAVIOUR, ClutterBehaviourClass))
58 
59 typedef struct _ClutterBehaviourPrivate ClutterBehaviourPrivate;
60 typedef struct _ClutterBehaviourClass   ClutterBehaviourClass;
61 
62 /**
63  * ClutterBehaviourForeachFunc:
64  * @behaviour: the #ClutterBehaviour
65  * @actor: an actor driven by @behaviour
66  * @data: (closure): optional data passed to the function
67  *
68  * This function is passed to clutter_behaviour_actors_foreach() and
69  * will be called for each actor driven by @behaviour.
70  *
71  * Since: 0.2
72  *
73  * Deprecated: 1.6
74  */
75 typedef void (*ClutterBehaviourForeachFunc) (ClutterBehaviour *behaviour,
76                                              ClutterActor     *actor,
77                                              gpointer          data);
78 
79 /**
80  * ClutterBehaviour:
81  *
82  * #ClutterBehaviour-struct contains only private data and should
83  * be accessed with the functions below.
84  *
85  * Since: 0.2
86  *
87  * Deprecated: 1.6
88  */
89 struct _ClutterBehaviour
90 {
91   /*< private >*/
92   GObject parent;
93   ClutterBehaviourPrivate *priv;
94 };
95 
96 /**
97  * ClutterBehaviourClass:
98  * @alpha_notify: virtual function, called each time the #ClutterAlpha
99  *   computes a new alpha value; the actors to which the behaviour applies
100  *   should be changed in this function. Every subclass of #ClutterBehaviour
101  *   must implement this virtual function
102  * @applied: signal class handler for the ClutterBehaviour::applied signal
103  * @removed: signal class handler for the ClutterBehaviour::removed signal
104  *
105  * Base class for behaviours.
106  *
107  * Since: 0.2
108  *
109  * Deprecated: 1.6
110  */
111 struct _ClutterBehaviourClass
112 {
113   /*< private >*/
114   GObjectClass parent_class;
115 
116   /*< public >*/
117   /* vfunc, not signal */
118   void (*alpha_notify) (ClutterBehaviour *behave,
119                         gdouble           alpha_value);
120 
121   /* signals */
122   void (*applied)  (ClutterBehaviour *behave,
123 		    ClutterActor     *actor);
124   void (*removed)  (ClutterBehaviour *behave,
125 		    ClutterActor     *actor);
126 
127   /*< private >*/
128   /* padding, for future expansion */
129   void (*_clutter_behaviour1) (void);
130   void (*_clutter_behaviour2) (void);
131   void (*_clutter_behaviour3) (void);
132   void (*_clutter_behaviour4) (void);
133   void (*_clutter_behaviour5) (void);
134   void (*_clutter_behaviour6) (void);
135 };
136 
137 CLUTTER_DEPRECATED_IN_1_6
138 GType clutter_behaviour_get_type (void) G_GNUC_CONST;
139 
140 CLUTTER_DEPRECATED_IN_1_6
141 void          clutter_behaviour_apply          (ClutterBehaviour            *behave,
142                                                 ClutterActor                *actor);
143 CLUTTER_DEPRECATED_IN_1_6
144 void          clutter_behaviour_remove         (ClutterBehaviour            *behave,
145                                                 ClutterActor                *actor);
146 CLUTTER_DEPRECATED_IN_1_6
147 void          clutter_behaviour_remove_all     (ClutterBehaviour            *behave);
148 CLUTTER_DEPRECATED_IN_1_6
149 void          clutter_behaviour_actors_foreach (ClutterBehaviour            *behave,
150                                                 ClutterBehaviourForeachFunc  func,
151                                                 gpointer                     data);
152 CLUTTER_DEPRECATED_IN_1_6
153 gint          clutter_behaviour_get_n_actors   (ClutterBehaviour            *behave);
154 CLUTTER_DEPRECATED_IN_1_6
155 ClutterActor *clutter_behaviour_get_nth_actor  (ClutterBehaviour            *behave,
156 						gint                         index_);
157 CLUTTER_DEPRECATED_IN_1_6
158 GSList *      clutter_behaviour_get_actors     (ClutterBehaviour            *behave);
159 CLUTTER_DEPRECATED_IN_1_6
160 ClutterAlpha *clutter_behaviour_get_alpha      (ClutterBehaviour            *behave);
161 CLUTTER_DEPRECATED_IN_1_6
162 void          clutter_behaviour_set_alpha      (ClutterBehaviour            *behave,
163                                                 ClutterAlpha                *alpha);
164 CLUTTER_DEPRECATED_IN_1_6
165 gboolean      clutter_behaviour_is_applied     (ClutterBehaviour            *behave,
166 						ClutterActor                *actor);
167 
168 G_END_DECLS
169 
170 #endif /* __CLUTTER_BEHAVIOUR_H__ */
171