update for beta release
[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              int resize_before; /* resize app window before hide animation */
251              /**< integer specifying the amount of time it takes for an 
252               * animation to complete. */
253           } vkbd, quickpanel;
254      } animation;
255
256    struct 
257      {
258         const char *name;
259         /**< the name of the currently active/selected policy. */
260         struct 
261           {
262              const char *class;
263              /**< The window class to match on */
264              const char *name;
265              /**< The window name to match on */
266              const char *title;
267              /**< The window title to match on */
268              int type;
269              /**< The window type to match on */
270              struct 
271                {
272                   int class;
273                   /**< flag to indicate if we should match on class */
274                   int name;
275                   /**< flag to indicate if we should match on name */
276                   int title;
277                   /**< flag to indicate if we should match on title */
278                   int type;
279                   /**< flag to indicate if we should match on type */
280                } match;
281           } vkbd, indicator, softkey, home;
282         Eina_List *zones;
283      } policy;
284 };
285
286 /**
287  * @brief structure for Illume zone configuration.
288  * 
289  * @ingroup E_Illume_Config_Group
290  */
291 struct _E_Illume_Config_Zone 
292 {
293    int id;
294    struct 
295      {
296         int dual;
297         /**< integer specifying whice mode we are in (0 == single application mode, 1 == dual application mode) */
298         int side;
299         /**< interger specifying if we layout windows in top/bottom or left/right when in dual mode */
300      } mode;
301
302    /* NB: These are not configurable by user...just placeholders */
303    struct 
304      {
305         int size;
306      } vkbd, indicator, softkey;
307 };
308
309 /**
310  * @brief structure for Illume Quickpanels.
311  * 
312  * @ingroup E_Illume_Quickpanel_Group
313  */
314 struct _E_Illume_Quickpanel 
315 {
316    E_Object e_obj_inherit;
317
318    E_Zone *zone;
319    /**< the current zone on which this quickpanel belongs */
320    Eina_List *borders;
321    /**< a list of borders that this quickpanel contains */
322    Ecore_Timer *timer;
323    Ecore_Animator *animator;
324    Ecore_X_Window clickwin;
325    Ecore_Event_Handler *mouse_hdl;
326    double start, len;
327    struct 
328      {
329         int size, isize, adjust, adjust_start, adjust_end, dir;
330      } vert, horiz;
331    unsigned char visible : 1;
332    /**< flag to indicate if the quickpanel is currently visible */
333 };
334
335
336 /* define function prototypes that policies can use */
337 EAPI E_Illume_Config_Zone *e_illume_zone_config_get(int id);
338
339 /* general functions */
340 EAPI Eina_Bool e_illume_border_is_indicator(E_Border *bd);
341 EAPI Eina_Bool e_illume_border_is_softkey(E_Border *bd);
342 EAPI Eina_Bool e_illume_border_is_keyboard(E_Border *bd);
343 EAPI Eina_Bool e_illume_border_is_home(E_Border *bd);
344 EAPI Eina_Bool e_illume_border_is_splash(E_Border *bd);
345 EAPI Eina_Bool e_illume_border_is_dialog(E_Border *bd);
346 EAPI Eina_Bool e_illume_border_is_qt_frame(E_Border *bd);
347 EAPI Eina_Bool e_illume_border_is_fullscreen(E_Border *bd);
348 EAPI Eina_Bool e_illume_border_is_conformant(E_Border *bd);
349 EAPI Eina_Bool e_illume_border_is_quickpanel(E_Border *bd);
350 EAPI Eina_Bool e_illume_border_is_fixed_size(E_Border *bd);
351
352 EAPI void e_illume_border_min_get(E_Border *bd, int *w, int *h);
353 EAPI E_Border *e_illume_border_at_xy_get(E_Zone *zone, int x, int y);
354 EAPI E_Border *e_illume_border_parent_get(E_Border *bd);
355 EAPI void e_illume_border_show(E_Border *bd);
356 EAPI void e_illume_border_hide(E_Border *bd);
357
358 /* indicator functions */
359 EAPI E_Border *e_illume_border_indicator_get(E_Zone *zone);
360 EAPI void e_illume_border_indicator_pos_get(E_Zone *zone, int *x, int *y);
361
362 /* softkey functions */
363 EAPI E_Border *e_illume_border_softkey_get(E_Zone *zone);
364 EAPI void e_illume_border_softkey_pos_get(E_Zone *zone, int *x, int *y);
365
366 /* keyboard functions */
367 EAPI E_Illume_Keyboard *e_illume_keyboard_get(void);
368 EAPI void e_illume_keyboard_safe_app_region_get(E_Zone *zone, int *x, int *y, int *w, int *h);
369
370 /* home functions */
371 EAPI E_Border *e_illume_border_home_get(E_Zone *zone);
372 EAPI Eina_List *e_illume_border_home_borders_get(E_Zone *zone);
373
374 /* quickpanel functions */
375 EAPI E_Illume_Quickpanel *e_illume_quickpanel_by_zone_get(E_Zone *zone);
376 EAPI void e_illume_quickpanel_show(E_Zone *zone);
377 EAPI void e_illume_quickpanel_hide(E_Zone *zone);
378
379 #endif