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