Git init
[framework/uifw/e17-extra-modules.git] / illume2-slp / src / e_illume.h
1 #ifndef E_ILLUME_H
2 # define E_ILLUME_H
3
4 #ifdef HAVE_GETTEXT
5 #define _(str) gettext(str)
6 #define d_(str, dom) dgettext(PACKAGE dom, str)
7 #else
8 #define _(str) (str)
9 #define d_(str, dom) (str)
10 #endif
11
12 /**
13  * @file e_illume.h
14  *
15  * This header provides the various defines, structures and functions that
16  * make writing Illume policies easier.
17  *
18  * For details on the available functions, see @ref E_Illume_Main_Group.
19  *
20  * For details on the configuration structure, see @ref E_Illume_Config_Group.
21  *
22  * For details on the Policy API, see @ref E_Illume_Policy_Group.
23  *
24  * For details on quickpanels, see @ref E_Illume_Quickpanel_Group.
25  */
26
27 /* include standard E header */
28 # include "e.h"
29
30 /* define all of our typedefs */
31 typedef struct _E_Illume_Policy_Api E_Illume_Policy_Api;
32 typedef struct _E_Illume_Policy E_Illume_Policy;
33 typedef struct _E_Illume_Config E_Illume_Config;
34 typedef struct _E_Illume_Config_Zone E_Illume_Config_Zone;
35 typedef struct _E_Illume_Quickpanel E_Illume_Quickpanel;
36 typedef struct _E_Illume_Quickpanel_Info E_Illume_Quickpanel_Info;
37
38 typedef enum _E_Illume_Quickpanel_Ani_Type
39 {
40    E_ILLUME_QUICKPANEL_ANI_NONE,
41    E_ILLUME_QUICKPANEL_ANI_SHOW,
42    E_ILLUME_QUICKPANEL_ANI_HIDE
43 } E_Illume_Quickpanel_Ani_Type;
44
45 /**
46  * @def E_ILLUME_POLICY_API_VERSION
47  * @brief Current version of the Policy API that is supported by the Illume
48  * module.
49  *
50  * @warning Policies not written to match this version will fail to load.
51  *
52  * @ingroup E_Illume_Policy_Group
53  */
54 # define E_ILLUME_POLICY_API_VERSION 2
55
56 /**
57  * @brief structure for policy API.
58  *
59  * @details When Illume tries to load a policy, it will check for the
60  * existince of this structure. If it is not found, the policy will fail
61  * to load.
62  *
63  * @warning This structure is required for Illume to load a policy.
64  *
65  * @ingroup E_Illume_Policy_Group
66  */
67 struct _E_Illume_Policy_Api
68 {
69    int version;
70    /**< The version of this policy. */
71
72    const char *name;
73    /**< The name of this policy. */
74    const char *label;
75    /**< The label of this policy that will be displayed in the Policy Selection dialog. */
76 };
77
78 /**
79  * @brief structure for policy
80  *
81  * This structure actually holds the policy functions that Illume will call
82  * at the appropriate times.
83  *
84  * @ingroup E_Illume_Policy_Group
85  */
86 struct _E_Illume_Policy
87 {
88    E_Object e_obj_inherit;
89
90    E_Illume_Policy_Api *api;
91    /**< pointer to the @ref E_Illume_Policy_Api structure.
92     * @warning Policies are required to implement this or they will fail to
93     * load. */
94
95    void *handle;
96
97    struct
98      {
99         void *(*init) (E_Illume_Policy *p);
100         /**< pointer to the function that Illume will call to initialize this
101          * policy. Typically, a policy would set the pointers to the functions
102          * that it supports in here.
103          * @warning Policies are required to implement this function. */
104
105         int (*shutdown) (E_Illume_Policy *p);
106         /**< pointer to the function that Illume will call to shutdown this
107          * policy. Typically, a policy would do any cleanup that it needs to
108          * do in here.
109          * @warning Policies are required to implement this function. */
110
111         void (*border_add) (E_Border *bd);
112         /**< pointer to the function that Illume will call when a new border
113          * gets added. @note This function is optional. */
114
115         void (*border_del) (E_Border *bd);
116         /**< pointer to the function that Illume will call when a border gets
117          * deleted. @note This function is optional. */
118
119         void (*border_focus_in) (E_Border *bd);
120         /**< pointer to the function that Illume will call when a border gets
121          * focus. @note This function is optional. */
122
123         void (*border_focus_out) (E_Border *bd);
124         /**< pointer to the function that Illume will call when a border loses
125          * focus. @note This function is optional. */
126
127         void (*border_activate) (E_Border *bd);
128         /**< pointer to the function that Illume will call when a border gets
129          * an activate message. @note This function is optional. */
130
131         void (*border_post_fetch) (E_Border *bd);
132         /**< pointer to the function that Illume will call when E signals a
133          * border post fetch. @note This function is optional. */
134
135         void (*border_post_assign) (E_Border *bd);
136         /**< pointer to the function that Illume will call when E signals a
137          * border post assign. @note This function is optional. */
138
139         void (*border_show) (E_Border *bd);
140         /**< pointer to the function that Illume will call when a border gets
141          * shown. @note This function is optional. */
142
143         void (*zone_layout) (E_Zone *zone);
144         /**< pointer to the function that Illume will call when a Zone needs
145          * to update it's layout. @note This function is optional. */
146
147         void (*zone_move_resize) (E_Zone *zone);
148         /**< pointer to the function that Illume will call when a Zone gets
149          * moved or resized. @note This function is optional. */
150
151         void (*zone_mode_change) (E_Zone *zone, Ecore_X_Atom mode);
152         /**< pointer to the function that Illume will call when the layout
153          * mode of a Zone changes. @note This function is optional. */
154
155         void (*zone_close) (E_Zone *zone);
156         /**< pointer to the function that Illume will call when the user has
157          * requested a border get closed. This is usually signaled from the
158          * Softkey window. @note This function is optional. */
159
160         void (*drag_start) (E_Border *bd);
161         /**< pointer to the function that Illume will call when the user has
162          * started to drag the Indicator/Softkey windows.
163          * @note This function is optional. */
164
165         void (*drag_end) (E_Border *bd);
166         /**< pointer to the function that Illume will call when the user has
167          * stopped draging the Indicator/Softkey windows.
168          * @note This function is optional. */
169
170         void (*focus_back) (E_Zone *zone);
171         /**< pointer to the function that Illume will call when the user has
172          * requested to cycle the focused border backwards. This is typically
173          * signalled from the Softkey window.
174          * @note This function is optional. */
175
176         void (*focus_forward) (E_Zone *zone);
177         /**< pointer to the function that Illume will call when the user has
178          * requested to cycle the focused border forward. This is typically
179          * signalled from the Softkey window.
180          * @note This function is optional. */
181
182         void (*property_change) (Ecore_X_Event_Window_Property *event);
183         /**< pointer to the function that Illume will call when properties
184          * change on a window. @note This function is optional. */
185
186         void (*window_focus_in) (Ecore_X_Event_Window_Focus_In *event);
187
188         void (*border_restack_request) (E_Border* bd, E_Border* sibling, int mode);
189         void (*border_stack) (E_Event_Border_Stack* ev);
190
191         void (*border_post_new_border) (E_Border *bd);
192
193         void (*border_pre_fetch) (E_Border *bd);
194         void (*window_configure_request) (Ecore_X_Event_Window_Configure_Request *event);
195
196         /* for visibility */
197         void (*window_create) (Ecore_X_Event_Window_Create *event);
198         void (*window_destroy) (Ecore_X_Event_Window_Destroy *event);
199         void (*window_reparent) (Ecore_X_Event_Window_Reparent *event);
200         void (*window_show) (Ecore_X_Event_Window_Show *event);
201         void (*window_hide) (Ecore_X_Event_Window_Hide *event);
202         void (*window_configure) (Ecore_X_Event_Window_Configure *event);
203
204         void (*window_sync_draw_done) (Ecore_X_Event_Client_Message *event);
205         void (*quickpanel_state_change) (Ecore_X_Event_Client_Message *event);
206      } funcs;
207 };
208
209
210 /**
211  * @brief structure for Illume configuration.
212  *
213  * @ingroup E_Illume_Config_Group
214  */
215 struct _E_Illume_Config
216 {
217    int version;
218
219    struct
220      {
221         struct
222           {
223              int duration;
224              /**< integer specifying the amount of time it takes for an
225               * animation to complete. */
226           } vkbd, quickpanel;
227      } animation;
228
229    struct
230      {
231         const char *name;
232         /**< the name of the currently active/selected policy. */
233         struct
234           {
235              const char *class;
236              /**< The window class to match on */
237              const char *name;
238              /**< The window name to match on */
239              const char *title;
240              /**< The window title to match on */
241              int type;
242              /**< The window type to match on */
243              struct
244                {
245                   int class;
246                   /**< flag to indicate if we should match on class */
247                   int name;
248                   /**< flag to indicate if we should match on name */
249                   int title;
250                   /**< flag to indicate if we should match on title */
251                   int type;
252                   /**< flag to indicate if we should match on type */
253                } match;
254           } vkbd, indicator, softkey, home;
255         Eina_List *zones;
256      } policy;
257
258    Eina_Bool use_mem_trim;
259 };
260
261 /**
262  * @brief structure for Illume zone configuration.
263  *
264  * @ingroup E_Illume_Config_Group
265  */
266 struct _E_Illume_Config_Zone
267 {
268    int id;
269    struct
270      {
271         int dual;
272         /**< integer specifying whice mode we are in (0 == single application mode, 1 == dual application mode) */
273         int side;
274         /**< interger specifying if we layout windows in top/bottom or left/right when in dual mode */
275      } mode;
276
277    /* NB: These are not configurable by user...just placeholders */
278    struct
279      {
280         int size;
281      } vkbd, indicator, softkey;
282 };
283
284 struct _E_Illume_Quickpanel_Info
285 {
286    E_Border *bd;
287    Eina_Bool draw_done;
288    int angle;
289
290    /* for mini controller */
291    Eina_Bool mini_controller;
292 };
293
294 /**
295  * @brief structure for Illume Quickpanels.
296  *
297  * @ingroup E_Illume_Quickpanel_Group
298  */
299 struct _E_Illume_Quickpanel
300 {
301    E_Object e_obj_inherit;
302
303    E_Zone *zone;
304    /**< the current zone on which this quickpanel belongs */
305    Eina_List *borders;
306    /**< a list of borders that this quickpanel contains */
307    Ecore_Timer *timer;
308    Ecore_Animator *animator;
309    Ecore_Event_Handler *key_hdl;
310    double start, len;
311    struct
312      {
313         int size, isize, adjust, adjust_start, adjust_end, dir;
314      } vert, horiz;
315
316    int angle;
317    int ani_type;
318
319    unsigned char visible;
320    /**< flag to indicate if the quickpanel is currently visible */
321
322    E_Popup *popup;
323    Ecore_Evas *ee;
324    Evas *evas;
325
326    Evas_Coord down_x, down_y;
327    int down_adjust;
328    Eina_Bool dragging : 1;
329    Eina_Bool down : 1;
330    Eina_Bool horiz_style : 1;
331
332    Evas_Object *ly_base;
333    Eina_Bool hide_trigger;
334
335    int popup_len;
336    int item_pos_y;
337    int threshold_y, move_x_min;
338    double scale;
339    E_Border *ind;
340
341    Eina_Bool is_lock;
342    Eina_List *hidden_mini_controllers;
343 };
344
345
346 /* define function prototypes that policies can use */
347 EAPI E_Illume_Config_Zone *e_illume_zone_config_get(int id);
348
349 /* general functions */
350 EAPI Eina_Bool e_illume_border_is_indicator(E_Border *bd);
351 EAPI Eina_Bool e_illume_border_is_keyboard(E_Border *bd);
352 EAPI Eina_Bool e_illume_border_is_dialog(E_Border *bd);
353 EAPI Eina_Bool e_illume_border_is_qt_frame(E_Border *bd);
354 EAPI Eina_Bool e_illume_border_is_fullscreen(E_Border *bd);
355 EAPI Eina_Bool e_illume_border_is_conformant(E_Border *bd);
356 EAPI Eina_Bool e_illume_border_is_quickpanel(E_Border *bd);
357 EAPI Eina_Bool e_illume_border_is_lock_screen(E_Border *bd);
358 EAPI Eina_Bool e_illume_border_is_notification(E_Border *bd);
359 EAPI Eina_Bool e_illume_border_is_utility(E_Border *bd);
360 EAPI Eina_Bool e_illume_border_is_sliding_win(E_Border *bd);
361
362 EAPI void e_illume_border_min_get(E_Border *bd, int *w, int *h);
363 EAPI E_Border *e_illume_border_at_xy_get(E_Zone *zone, int x, int y);
364 EAPI E_Border *e_illume_border_parent_get(E_Border *bd);
365 EAPI void e_illume_border_show(E_Border *bd);
366 EAPI void e_illume_border_hide(E_Border *bd);
367
368 /* indicator functions */
369 EAPI E_Border *e_illume_border_indicator_get(E_Zone *zone);
370 EAPI void e_illume_border_indicator_pos_get(E_Zone *zone, int *x, int *y);
371
372 /* quickpanel functions */
373 EAPI E_Illume_Quickpanel *e_illume_quickpanel_by_zone_get(E_Zone *zone);
374 EAPI Eina_List* e_illume_quickpanel_get (void);
375 EAPI void e_illume_quickpanel_show(E_Zone *zone, int isAni);
376 EAPI void e_illume_quickpanel_hide(E_Zone *zone, int isAni);
377
378 #endif