Download

Support

lib/ewl_widget.h

Go to the documentation of this file.
00001 /* vim: set sw=8 ts=8 sts=8 expandtab: */
00002 #ifndef EWL_WIDGET_H
00003 #define EWL_WIDGET_H
00004 
00026 #define EWL_WIDGET_TYPE "widget"
00027 
00032 #define EWL_WIDGET_IS(w) (ewl_widget_type_is(EWL_WIDGET(w), EWL_WIDGET_TYPE))
00033 
00037 typedef struct Ewl_Attach_List Ewl_Attach_List;
00038 
00042 struct Ewl_Attach_List
00043 {
00044         void **list;                
00045         unsigned int direct:1;      
00046         unsigned int len:31;        
00047 };
00048 
00052 typedef struct Ewl_Pair Ewl_Pair;
00053 
00058 #define EWL_PAIR(p) ((Ewl_Pair *)p)
00059 
00063 struct Ewl_Pair
00064 {
00065         const char *key;        
00066         char *value;            
00067 };
00068 
00072 typedef struct Ewl_Pair_List Ewl_Pair_List;
00073 
00077 struct Ewl_Pair_List
00078 {
00079         Ewl_Pair **list;        
00080         unsigned int direct:1;  
00081         unsigned int len:31;    
00082 };
00083 
00087 typedef struct Ewl_Callback_Chain Ewl_Callback_Chain;
00088 
00092 struct Ewl_Callback_Chain
00093 {
00094         void **list;            
00095         unsigned char mask;     
00096         unsigned char len;      
00097         unsigned char index;    
00098 };
00099 
00103 typedef struct Ewl_Color_Set Ewl_Color_Set;
00104 
00108 struct Ewl_Color_Set
00109 {
00110         unsigned char r,        
00111                       g,        
00112                       b,        
00113                       a;        
00114 };
00115 
00120 typedef struct Ewl_Widget Ewl_Widget;
00121 
00126 #define EWL_WIDGET(widget) ((Ewl_Widget *) widget)
00127 
00132 struct Ewl_Widget
00133 {
00134         Ewl_Object object; 
00135         Ewl_Widget *parent; 
00137         Ewl_Callback_Chain callbacks[EWL_CALLBACK_MAX + 1];
00139         Ewl_Attach_List *attach;       
00141         void *smart_object; 
00142         void *theme_object; 
00144         const char *theme_path;     
00145         const char *theme_group;    
00146         const char *appearance;     
00147         const char *inheritance;  
00148         const char *custom_state; 
00149         int layer;                
00151         Ecore_Hash *theme;          
00152         Ewl_Pair_List theme_text;   
00153         unsigned int flags;         
00154         unsigned short states;        
00155         unsigned short inherited_states;  
00157         unsigned char swallowed:1;
00158 };
00159 
00160 Ewl_Widget      *ewl_widget_new(void);
00161 int              ewl_widget_init(Ewl_Widget *w);
00162 void             ewl_widget_free(Ewl_Widget *w);
00163 
00164 void             ewl_widget_name_set(Ewl_Widget *w, const char *name);
00165 const char      *ewl_widget_name_get(Ewl_Widget *w);
00166 Ewl_Widget      *ewl_widget_name_find(const char *name);
00167 
00168 void             ewl_widget_reparent(Ewl_Widget *widget);
00169 void             ewl_widget_realize(Ewl_Widget *widget);
00170 void             ewl_widget_realize_force(Ewl_Widget *widget);
00171 void             ewl_widget_unrealize(Ewl_Widget *w);
00172 void             ewl_widget_reveal(Ewl_Widget *w);
00173 void             ewl_widget_obscure(Ewl_Widget *w);
00174 void             ewl_widget_show(Ewl_Widget *widget);
00175 void             ewl_widget_hide(Ewl_Widget *widget);
00176 void             ewl_widget_destroy(Ewl_Widget *widget);
00177 void             ewl_widget_configure(Ewl_Widget *widget);
00178 
00179 void             ewl_widget_data_set(Ewl_Widget *w, void *k, void *v);
00180 void            *ewl_widget_data_del(Ewl_Widget *w, void *k);
00181 void            *ewl_widget_data_get(Ewl_Widget *w, void *k);
00182 
00183 void             ewl_widget_state_add(Ewl_Widget *w, Ewl_State state);
00184 void             ewl_widget_state_remove(Ewl_Widget *w, Ewl_State state);
00185 unsigned int     ewl_widget_state_has(Ewl_Widget *w, Ewl_State state);
00186 void             ewl_widget_inherited_state_add(Ewl_Widget *w, Ewl_State state);
00187 void             ewl_widget_inherited_state_remove(Ewl_Widget *w, Ewl_State state);
00188 unsigned int     ewl_widget_inherited_state_has(Ewl_Widget *w, Ewl_State state);
00189 unsigned int     ewl_widget_applied_state_has(Ewl_Widget *w, Ewl_State state);
00190 void             ewl_widget_custom_state_set(Ewl_Widget *w, const char *cst,
00191                                                 Ewl_Durability dur);
00192 
00193 void             ewl_widget_theme_path_set(Ewl_Widget *w, const char *path);
00194 void             ewl_widget_appearance_set(Ewl_Widget *w, const char *appearance);
00195 const char      *ewl_widget_appearance_get(Ewl_Widget *w);
00196 char            *ewl_widget_appearance_path_get(Ewl_Widget *w);
00197 int              ewl_widget_appearance_path_size_get(Ewl_Widget *w);
00198 int              ewl_widget_appearance_path_copy(Ewl_Widget *w, char *buf,
00199                                                 int size);
00200 void             ewl_widget_appearance_part_text_set(Ewl_Widget *w, 
00201                                                      const char *part,
00202                                                      const char *text);
00203 const char      *ewl_widget_appearance_part_text_get(Ewl_Widget *w, const char *part);
00204 void             ewl_widget_appearance_text_set(Ewl_Widget *w, const char *text);
00205 const char      *ewl_widget_appearance_text_get(Ewl_Widget *w);
00206 
00207 void             ewl_widget_inherit(Ewl_Widget *widget, const char *type);
00208 
00209 unsigned int     ewl_widget_type_is(Ewl_Widget *widget, const char *type);
00210 unsigned int     ewl_widget_onscreen_is(Ewl_Widget *widget);
00211 
00212 void             ewl_widget_parent_set(Ewl_Widget *w, Ewl_Widget *p);
00213 Ewl_Widget      *ewl_widget_parent_get(Ewl_Widget *w);
00214 
00215 void             ewl_widget_enable(Ewl_Widget *w);
00216 void             ewl_widget_disable(Ewl_Widget *w);
00217 
00218 void             ewl_widget_print(Ewl_Widget *w);
00219 void             ewl_widget_print_verbose(Ewl_Widget *w);
00220 void             ewl_widget_tree_print(Ewl_Widget *w);
00221 
00222 void             ewl_widget_layer_top_set(Ewl_Widget *w, int top);
00223 int              ewl_widget_layer_top_get(Ewl_Widget *w);
00224 void             ewl_widget_layer_priority_set(Ewl_Widget *w, int layer);
00225 int              ewl_widget_layer_priority_get(Ewl_Widget *w);
00226 
00227 void             ewl_widget_internal_set(Ewl_Widget *w, unsigned int val);
00228 unsigned int     ewl_widget_internal_is(Ewl_Widget *w);
00229 
00230 void             ewl_widget_unmanaged_set(Ewl_Widget *w, unsigned int val);
00231 unsigned int     ewl_widget_unmanaged_is(Ewl_Widget *w);
00232 
00233 void             ewl_widget_focus_send(Ewl_Widget *w);
00234 Ewl_Widget      *ewl_widget_focused_get(void);
00235 
00236 void             ewl_widget_tab_order_append(Ewl_Widget *w);
00237 void             ewl_widget_tab_order_prepend(Ewl_Widget *w);
00238 void             ewl_widget_tab_order_insert(Ewl_Widget *w, unsigned int idx);
00239 void             ewl_widget_tab_order_insert_before(Ewl_Widget *w, Ewl_Widget *before);
00240 void             ewl_widget_tab_order_insert_after(Ewl_Widget *w, Ewl_Widget *after);
00241 void             ewl_widget_tab_order_remove(Ewl_Widget *w);
00242 
00243 void             ewl_widget_focusable_set(Ewl_Widget *w, unsigned int val);
00244 unsigned int     ewl_widget_focusable_get(Ewl_Widget *w);
00245 
00246 void             ewl_widget_ignore_focus_change_set(Ewl_Widget *w, unsigned int val);
00247 unsigned int     ewl_widget_ignore_focus_change_get(Ewl_Widget *w);
00248 
00249 void             ewl_widget_color_set(Ewl_Widget *w, unsigned int r, unsigned int g,
00250                                                         unsigned int b, unsigned int a);
00251 void             ewl_widget_color_get(Ewl_Widget *w, unsigned int *r, unsigned int *g,
00252                                                         unsigned int *b, unsigned int *a);
00253 
00254 int              ewl_widget_parent_of(Ewl_Widget *c, Ewl_Widget *w);
00255 
00256 void             ewl_widget_flags_add(Ewl_Widget *o, unsigned int flags,
00257                                       unsigned int mask);
00258 void             ewl_widget_flags_remove(Ewl_Widget *o, unsigned int flags,
00259                                          unsigned int mask);
00260 
00267 #define ewl_widget_flags_get(o, mask) \
00268         (EWL_WIDGET(o)->flags & mask)
00269 
00277 #define ewl_widget_flags_has(o, check_flags, mask) \
00278         (!!(EWL_WIDGET(o)->flags & ((check_flags) & mask)))
00279 
00287 #define ewl_widget_flags_has_all(o, check_flags, mask) \
00288         ((EWL_WIDGET(o)->flags & ((check_flags) & mask)) == ((check_flags) & mask))
00289 
00290 
00298 #define ewl_widget_recursive_set(o, val) \
00299         (val ? ewl_widget_flags_add(o, EWL_FLAG_PROPERTY_RECURSIVE, \
00300                                     EWL_FLAGS_PROPERTY_MASK) : \
00301          ewl_widget_flags_remove(o, EWL_FLAG_PROPERTY_RECURSIVE, \
00302                                     EWL_FLAGS_PROPERTY_MASK));
00303 
00310 #define ewl_widget_recursive_get(o) \
00311         (ewl_widget_flags_get(o, EWL_FLAG_PROPERTY_RECURSIVE))
00312 
00320 #define ewl_widget_toplevel_set(o, val) \
00321         (val ? ewl_widget_flags_add(o, EWL_FLAG_PROPERTY_TOPLEVEL, \
00322                                     EWL_FLAGS_PROPERTY_MASK) : \
00323          ewl_widget_flags_remove(o, EWL_FLAG_PROPERTY_TOPLEVEL, \
00324                                     EWL_FLAGS_PROPERTY_MASK));
00325 
00332 #define ewl_widget_toplevel_get(o) \
00333         (ewl_widget_flags_get(o, EWL_FLAG_PROPERTY_TOPLEVEL))
00334 
00341 #define ewl_widget_queued_add(o, queued) \
00342         ewl_widget_flags_add(o, queued, EWL_FLAGS_QUEUED_MASK)
00343 
00348 #define ewl_widget_queued_remove(o, queued) \
00349         ewl_widget_flags_remove(o, queued, EWL_FLAGS_QUEUED_MASK)
00350 
00355 #define ewl_widget_queued_has(o, queued) \
00356         ewl_widget_flags_has(o, queued, EWL_FLAGS_QUEUED_MASK)
00357 
00362 #define ewl_widget_queued_get(o, queued) \
00363         ewl_widget_flags_get(o, queued, EWL_FLAGS_QUEUED_MASK)
00364 
00369 #define ewl_widget_visible_add(o, visible) \
00370         ewl_widget_flags_add(o, visible, EWL_FLAGS_VISIBLE_MASK)
00371 
00376 #define ewl_widget_visible_remove(o, visible) \
00377         ewl_widget_flags_remove(o, visible, EWL_FLAGS_VISIBLE_MASK)
00378 
00383 #define ewl_widget_visible_has(o, visible) \
00384         ewl_widget_flags_has(o, visible, EWL_FLAGS_VISIBLE_MASK)
00385 
00390 #define ewl_widget_visible_get(o, visible) \
00391         ewl_widget_flags_get(o, visible, EWL_FLAGS_VISIBLE_MASK)
00392 
00397 #define RECURSIVE(o) (EWL_WIDGET(o)->flags & EWL_FLAG_PROPERTY_RECURSIVE)
00398 
00403 #define REALIZED(o) (EWL_WIDGET(o)->flags & EWL_FLAG_VISIBLE_REALIZED)
00404 
00409 #define VISIBLE(o) (EWL_WIDGET(o)->flags & EWL_FLAG_VISIBLE_SHOWN)
00410 
00415 #define REVEALED(o) (EWL_WIDGET(o)->flags & EWL_FLAG_VISIBLE_REVEALED)
00416 
00421 #define HIDDEN(o) (!(EWL_WIDGET(o)->flags & EWL_FLAG_VISIBLE_SHOWN))
00422 
00427 #define DESTROYED(o) (ewl_widget_queued_has(EWL_WIDGET(o), \
00428                                         EWL_FLAG_QUEUED_SCHEDULED_DESTROY) \
00429                         || ewl_widget_queued_has(EWL_WIDGET(o), \
00430                                         EWL_FLAG_QUEUED_PROCESS_DESTROY))
00431 
00436 #define CONFIGURED(o) (ewl_widget_queued_has(EWL_WIDGET(o), \
00437                                         EWL_FLAG_QUEUED_SCHEDULED_CONFIGURE) \
00438                         || ewl_widget_queued_has(EWL_WIDGET(o), \
00439                                         EWL_FLAG_QUEUED_PROCESS_CONFIGURE))
00440 
00445 #define DISABLED(o) (ewl_widget_applied_state_has(EWL_WIDGET(o), EWL_STATE_DISABLED))
00446 
00453 #define ewl_widget_in_tab_list_get(o) \
00454         (ewl_widget_flags_get(o, EWL_FLAG_PROPERTY_IN_TAB_LIST))
00455 
00463 #define ewl_widget_in_tab_list_set(o, val) \
00464         (val ? ewl_widget_flags_add(o, EWL_FLAG_PROPERTY_IN_TAB_LIST, \
00465                                     EWL_FLAGS_PROPERTY_MASK) : \
00466          ewl_widget_flags_remove(o, EWL_FLAG_PROPERTY_IN_TAB_LIST, \
00467                                     EWL_FLAGS_PROPERTY_MASK));
00468 
00469 
00470 
00471 #define UNMANAGED(w) (EWL_WIDGET(w)->flags & EWL_FLAG_PROPERTY_UNMANAGED)
00472 #define TOPLAYERED(w) (EWL_WIDGET(w)->flags & EWL_FLAG_PROPERTY_TOPLAYERED)
00473 
00474 /*
00475  * Internally used callbacks, override at your own risk.
00476  */
00477 void ewl_widget_cb_show(Ewl_Widget *w, void *ev_data, void *user_data);
00478 void ewl_widget_cb_hide(Ewl_Widget *w, void *ev_data, void *user_data);
00479 void ewl_widget_cb_reveal(Ewl_Widget *w, void *ev_data, void *user_data);
00480 void ewl_widget_cb_obscure(Ewl_Widget *w, void *ev_data, void *user_data);
00481 void ewl_widget_cb_realize(Ewl_Widget *w, void *ev_data, void *user_data);
00482 void ewl_widget_cb_unrealize(Ewl_Widget *w, void *ev_data, void *user_data);
00483 void ewl_widget_cb_configure(Ewl_Widget *w, void *ev_data, void *user_data);
00484 void ewl_widget_cb_reparent(Ewl_Widget *w, void *ev_data, void *user_data);
00485 void ewl_widget_cb_mouse_down(Ewl_Widget *w, void *ev_data, void *user_data);
00486 void ewl_widget_cb_mouse_up(Ewl_Widget *w, void *ev_data, void *user_data);
00487 void ewl_widget_cb_mouse_move(Ewl_Widget *w, void *ev_data, void *user_data);
00488 
00493 #endif

Copyright © Enlightenment.org

Enlightened Widget Library Documentation Generated: Sun Sep 27 01:48:49 2009