1 #ifndef E_TYPEDEFS
2 #ifndef E_GADGET_H
3 # define E_GADGET_H
4 
5 
6 /** SMART CALLBACKS:
7  -------------------------------
8  * called by gadget site internals on gadget site object:
9 
10  * have a gadget object as event_info
11  * {
12       "gadget_added"
13        - a new gadget was added to the gadget site by the user
14       "gadget_created"
15        - a gadget object was created on the site
16       "gadget_destroyed"
17        - a gadget object was destroyed on the site; all objects created by the
18          gadget infrastructure are now dead
19        - do not watch both this and EVAS_CALLBACK_DEL, as the ordering of these
20          callbacks is not consistent
21       "gadget_moved"
22        - a gadget is preparing to move from its current site
23       "gadget_removed"
24        - a gadget was removed from the gadget site by the user
25        - the gadget should remove its config when this is triggered
26  * }
27 
28  * have NULL as event_info
29  * {
30       "gadget_site_anchor"
31        - the anchor of the gadget site changed
32       "gadget_site_gravity"
33        - the gravity of the gadget site changed
34       "gadget_site_locked"
35        - the gadget site's visibility has been locked (must be visible)
36       "gadget_site_unlocked"
37        - the gadget site's visibility has been unlocked (can be hidden)
38  * }
39 
40  * have E_Menu as event_info
41  * {
42       "gadget_site_owner_menu"
43        - the owner (parent object) of the site should add any owner-specific items
44        in this callback (eg. settings)
45       "gadget_site_style_menu"
46        - the owner (parent object) of the site should add any style-specific items
47        in this callback (eg. plain, inset)
48  * }
49 
50  * have Evas_Object as event_info
51  * {
52       "gadget_site_popup"
53       - a popup has been triggered from the site; the site must remain visible until
54       the passed popup object has been hidden
55       - event_info is the Evas_Object of the popup
56  * }
57  -------------------------------
58  -------------------------------
59  * called externally on gadget site
60    "gadget_site_dropped"
61      - called on a target site when a gadget site is dropped on it
62      - event_info is the dropped site
63      - all gadgets on the dropped site will be moved to the target site
64    "gadget_site_style"
65      - called on a target site when its owner has executed a style change
66      - event_info is NULL
67      - triggers restyling of all contained gadgets
68  -------------------------------
69  -------------------------------
70  * called by gadget internals on gadget object:
71    "gadget_menu"
72      - called on a gadget object when the "gadget_menu" action has been triggered
73      - event_info is an E_Menu object
74      - if a configure callback has been passed with e_gadget_configure_cb_set(),
75        a "Settings" item will be automatically added with this callback
76    "gadget_reparent"
77      - called on a gadget object when the gadget has been reparented
78      - parent object is event_info
79      - indicates that the gadget should watch this new object for EVAS_CALLBACK_RESIZE
80      - event_info will be NULL in the case that the reparenting removes the parent
81  -------------------------------
82  -------------------------------
83  * called externally by gadget on gadget object:
84    "gadget_popup"
85      - called on a gadget object by the gadget when the gadget creates a popup which
86      requires that the gadget remain visible for the lifetime of the popup
87      - event_info is the Evas_Object of the popup
88  */
89 
90 #include "e_gadget_types.h"
91 
92 typedef Evas_Object *(*E_Gadget_Create_Cb)(Evas_Object *parent, int *id, E_Gadget_Site_Orient orient);
93 typedef Evas_Object *(*E_Gadget_External_Create_Cb)(Evas_Object *parent, const char *type, int *id, E_Gadget_Site_Orient orient);
94 typedef Evas_Object *(*E_Gadget_Configure_Cb)(Evas_Object *gadget);
95 typedef void (*E_Gadget_Menu_Populate_Cb)(Evas_Object *gadget, E_Menu *m);
96 typedef void (*E_Gadget_Context_Cb)(Evas_Object *site, Evas_Object *g, unsigned int timestamp);
97 typedef void (*E_Gadget_Wizard_End_Cb)(void *data, int id);
98 typedef Evas_Object *(*E_Gadget_Wizard_Cb)(E_Gadget_Wizard_End_Cb cb, void *data, Evas_Object *site);
99 typedef Evas_Object *(*E_Gadget_External_Wizard_Cb)(E_Gadget_Wizard_End_Cb cb, void *data, const char *type, Evas_Object *site);
100 typedef void (*E_Gadget_Style_Cb)(Evas_Object *owner, Eina_Stringshare *name, Evas_Object *g);
101 typedef char *(*E_Gadget_External_Name_Cb)(const char *type);
102 
103 EINTERN void e_gadget_init(void);
104 EINTERN void e_gadget_shutdown(void);
105 EINTERN void e_gadget_site_rename(const char *name, const char *newname);
106 
107 E_API Evas_Object *e_gadget_site_add(E_Gadget_Site_Orient orient, const char *name);
108 E_API Evas_Object *e_gadget_site_auto_add(E_Gadget_Site_Orient orient, const char *name);
109 E_API void e_gadget_site_del(Evas_Object *obj);
110 E_API E_Gadget_Site_Anchor e_gadget_site_anchor_get(Evas_Object *obj);
111 E_API void e_gadget_site_owner_setup(Evas_Object *obj, E_Gadget_Site_Anchor an, E_Gadget_Style_Cb cb, E_Gadget_Context_Cb context_cb, E_Gadget_Context_Cb context_cancel_cb);
112 E_API E_Gadget_Site_Orient e_gadget_site_orient_get(Evas_Object *obj);
113 E_API E_Gadget_Site_Gravity e_gadget_site_gravity_get(Evas_Object *obj);
114 E_API void e_gadget_site_gravity_set(Evas_Object *obj, E_Gadget_Site_Gravity gravity);
115 E_API void e_gadget_site_gadget_add(Evas_Object *obj, const char *type, Eina_Bool demo);
116 E_API void e_gadget_site_gadget_external_add(Evas_Object *obj, const char *domain, const char *type, Eina_Bool demo);
117 E_API Eina_List *e_gadget_site_gadgets_list(Evas_Object *obj);
118 E_API Eina_Bool e_gadget_site_is_desklock(Evas_Object *obj);
119 
120 E_API void e_gadget_configure_cb_set(Evas_Object *g, E_Gadget_Configure_Cb cb);
121 E_API void e_gadget_configure(Evas_Object *g);
122 E_API void e_gadget_menu_populate_cb_set(Evas_Object *g, E_Gadget_Menu_Populate_Cb cb);
123 E_API void e_gadget_menu_populate(Evas_Object *g, E_Menu *m);
124 
125 E_API Evas_Object *e_gadget_site_get(Evas_Object *g);
126 E_API Eina_Stringshare *e_gadget_type_get(Evas_Object *g);
127 
128 E_API void e_gadget_type_add(const char *type, E_Gadget_Create_Cb callback, E_Gadget_Wizard_Cb wizard);
129 E_API void e_gadget_type_del(const char *type);
130 E_API void e_gadget_external_type_add(const char *domain, const char *type, E_Gadget_External_Create_Cb callback, E_Gadget_External_Wizard_Cb wizard);
131 E_API void e_gadget_external_type_del(const char *domain, const char *type);
132 E_API void e_gadget_external_type_name_cb_set(const char *domain, const char *type, E_Gadget_External_Name_Cb name);
133 E_API Eina_Iterator *e_gadget_type_iterator_get(void);
134 /* delete a gadget and its config */
135 E_API void e_gadget_del(Evas_Object *g);
136 /* drop region initially matches gadget size, resizes to match returned object's size
137  * handler is removed when returned object is deleted
138  */
139 E_API Evas_Object *e_gadget_drop_handler_add(Evas_Object *g, void *data,
140                                         void (*enter_cb)(void *data, const char *type, void *event),
141                                         void (*move_cb)(void *data, const char *type, void *event),
142                                         void (*leave_cb)(void *data, const char *type, void *event),
143                                         void (*drop_cb)(void *data, const char *type, void *event),
144                                         const char **types, unsigned int num_types);
145 
146 E_API Evas_Object *e_gadget_util_layout_style_init(Evas_Object *g, Evas_Object *style);
147 E_API void e_gadget_util_ctxpopup_place(Evas_Object *g, Evas_Object *ctx, Evas_Object *pos_obj);
148 E_API void e_gadget_util_allow_deny_ctxpopup(Evas_Object *g, const char *text, Evas_Smart_Cb allow_cb, Evas_Smart_Cb deny_cb, const void *data);
149 
150 E_API Evas_Object *e_gadget_editor_add(Evas_Object *parent, Evas_Object *site);
151 E_API Evas_Object *e_gadget_site_edit(Evas_Object *site);
152 E_API void e_gadget_site_desklock_edit(void);
153 E_API void e_gadget_site_desktop_edit(Evas_Object *site);
154 #endif
155 #endif
156