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 
00119 typedef void *(*Ewl_Widget_Drag)(void);
00120 
00125 typedef struct Ewl_Widget Ewl_Widget;
00126 
00131 #define EWL_WIDGET(widget) ((Ewl_Widget *) widget)
00132 
00137 struct Ewl_Widget
00138 {
00139         Ewl_Object object; 
00140         Ewl_Widget *parent; 
00142         Ewl_Callback_Chain callbacks[EWL_CALLBACK_MAX + 1];
00144         Ewl_Attach_List *attach;       
00146         void *smart_object; 
00147         void *theme_object; 
00149         const char *theme_path;     
00150         const char *theme_group;    
00151         const char *theme_state;    
00152         const char *appearance;   
00153         const char *inheritance;  
00154         int layer;                
00156         Ecore_Hash *theme;          
00157         Ewl_Pair_List theme_text;   
00158         unsigned int flags;         
00159         unsigned char swallowed:1;
00160 };
00161 
00162 Ewl_Widget      *ewl_widget_new(void);
00163 int              ewl_widget_init(Ewl_Widget *w);
00164 void             ewl_widget_free(Ewl_Widget *w);
00165 
00166 void             ewl_widget_name_set(Ewl_Widget *w, const char *name);
00167 const char      *ewl_widget_name_get(Ewl_Widget *w);
00168 Ewl_Widget      *ewl_widget_name_find(const char *name);
00169 
00170 void             ewl_widget_reparent(Ewl_Widget *widget);
00171 void             ewl_widget_realize(Ewl_Widget *widget);
00172 void             ewl_widget_unrealize(Ewl_Widget *w);
00173 void             ewl_widget_reveal(Ewl_Widget *w);
00174 void             ewl_widget_obscure(Ewl_Widget *w);
00175 void             ewl_widget_show(Ewl_Widget *widget);
00176 void             ewl_widget_hide(Ewl_Widget *widget);
00177 void             ewl_widget_destroy(Ewl_Widget *widget);
00178 void             ewl_widget_configure(Ewl_Widget *widget);
00179 
00180 void             ewl_widget_data_set(Ewl_Widget *w, void *k, void *v);
00181 void            *ewl_widget_data_del(Ewl_Widget *w, void *k);
00182 void            *ewl_widget_data_get(Ewl_Widget *w, void *k);
00183 
00184 void             ewl_widget_state_set(Ewl_Widget *w, const char *state,
00185                                                 Ewl_State_Type flag);
00186 
00187 void             ewl_widget_theme_path_set(Ewl_Widget *w, const char *path);
00188 void             ewl_widget_appearance_set(Ewl_Widget *w, const char *appearance);
00189 const char      *ewl_widget_appearance_get(Ewl_Widget *w);
00190 char            *ewl_widget_appearance_path_get(Ewl_Widget *w);
00191 int              ewl_widget_appearance_path_size_get(Ewl_Widget *w);
00192 int              ewl_widget_appearance_path_copy(Ewl_Widget *w, char *buf,
00193                                                 int size);
00194 void             ewl_widget_appearance_part_text_set(Ewl_Widget *w, 
00195                                                      const char *part,
00196                                                      const char *text);
00197 const char      *ewl_widget_appearance_part_text_get(Ewl_Widget *w, const char *part);
00198 void             ewl_widget_appearance_text_set(Ewl_Widget *w, const char *text);
00199 const char      *ewl_widget_appearance_text_get(Ewl_Widget *w);
00200 
00201 void             ewl_widget_inherit(Ewl_Widget *widget, const char *type);
00202 
00203 unsigned int     ewl_widget_type_is(Ewl_Widget *widget, const char *type);
00204 unsigned int     ewl_widget_onscreen_is(Ewl_Widget *widget);
00205 
00206 void             ewl_widget_parent_set(Ewl_Widget *w, Ewl_Widget *p);
00207 Ewl_Widget      *ewl_widget_parent_get(Ewl_Widget *w);
00208 
00209 void             ewl_widget_enable(Ewl_Widget *w);
00210 void             ewl_widget_disable(Ewl_Widget *w);
00211 
00212 void             ewl_widget_print(Ewl_Widget *w);
00213 void             ewl_widget_print_verbose(Ewl_Widget *w);
00214 void             ewl_widget_tree_print(Ewl_Widget *w);
00215 
00216 void             ewl_widget_layer_top_set(Ewl_Widget *w, int top);
00217 int              ewl_widget_layer_top_get(Ewl_Widget *w);
00218 void             ewl_widget_layer_priority_set(Ewl_Widget *w, int layer);
00219 int              ewl_widget_layer_priority_get(Ewl_Widget *w);
00220 
00221 void             ewl_widget_internal_set(Ewl_Widget *w, unsigned int val);
00222 unsigned int     ewl_widget_internal_is(Ewl_Widget *w);
00223 
00224 void             ewl_widget_unmanaged_set(Ewl_Widget *w, unsigned int val);
00225 unsigned int     ewl_widget_unmanaged_is(Ewl_Widget *w);
00226 
00227 void             ewl_widget_focus_send(Ewl_Widget *w);
00228 Ewl_Widget      *ewl_widget_focused_get(void);
00229 
00230 void             ewl_widget_tab_order_append(Ewl_Widget *w);
00231 void             ewl_widget_tab_order_prepend(Ewl_Widget *w);
00232 void             ewl_widget_tab_order_insert(Ewl_Widget *w, unsigned int idx);
00233 void             ewl_widget_tab_order_insert_before(Ewl_Widget *w, Ewl_Widget *before);
00234 void             ewl_widget_tab_order_insert_after(Ewl_Widget *w, Ewl_Widget *after);
00235 void             ewl_widget_tab_order_remove(Ewl_Widget *w);
00236 
00237 void             ewl_widget_focusable_set(Ewl_Widget *w, unsigned int val);
00238 unsigned int     ewl_widget_focusable_get(Ewl_Widget *w);
00239 
00240 void             ewl_widget_ignore_focus_change_set(Ewl_Widget *w, unsigned int val);
00241 unsigned int     ewl_widget_ignore_focus_change_get(Ewl_Widget *w);
00242 
00243 void             ewl_widget_color_set(Ewl_Widget *w, unsigned int r, unsigned int g,
00244                                                         unsigned int b, unsigned int a);
00245 void             ewl_widget_color_get(Ewl_Widget *w, unsigned int *r, unsigned int *g,
00246                                                         unsigned int *b, unsigned int *a);
00247 
00248 int              ewl_widget_parent_of(Ewl_Widget *c, Ewl_Widget *w);
00249 
00250 void             ewl_widget_flags_add(Ewl_Widget *o, unsigned int flags,
00251                                       unsigned int mask);
00252 void             ewl_widget_flags_remove(Ewl_Widget *o, unsigned int flags,
00253                                          unsigned int mask);
00254 
00261 #define ewl_widget_flags_get(o, mask) \
00262         (EWL_WIDGET(o)->flags & mask)
00263 
00271 #define ewl_widget_flags_has(o, check_flags, mask) \
00272         (!!(EWL_WIDGET(o)->flags & ((check_flags) & mask)))
00273 
00281 #define ewl_widget_flags_has_all(o, check_flags, mask) \
00282         ((EWL_WIDGET(o)->flags & ((check_flags) & mask)) == ((check_flags) & mask))
00283 
00284 
00292 #define ewl_widget_recursive_set(o, val) \
00293         (val ? ewl_widget_flags_add(o, EWL_FLAG_PROPERTY_RECURSIVE, \
00294                                     EWL_FLAGS_PROPERTY_MASK) : \
00295          ewl_widget_flags_remove(o, EWL_FLAG_PROPERTY_RECURSIVE, \
00296                                     EWL_FLAGS_PROPERTY_MASK));
00297 
00304 #define ewl_widget_recursive_get(o) \
00305         (ewl_widget_flags_get(o, EWL_FLAG_PROPERTY_RECURSIVE))
00306 
00314 #define ewl_widget_toplevel_set(o, val) \
00315         (val ? ewl_widget_flags_add(o, EWL_FLAG_PROPERTY_TOPLEVEL, \
00316                                     EWL_FLAGS_PROPERTY_MASK) : \
00317          ewl_widget_flags_remove(o, EWL_FLAG_PROPERTY_TOPLEVEL, \
00318                                     EWL_FLAGS_PROPERTY_MASK));
00319 
00326 #define ewl_widget_toplevel_get(o) \
00327         (ewl_widget_flags_get(o, EWL_FLAG_PROPERTY_TOPLEVEL))
00328 
00335 #define ewl_widget_state_add(o, state) \
00336         ewl_widget_flags_add(o, state, EWL_FLAGS_STATE_MASK)
00337 
00344 #define ewl_widget_state_remove(o, state) \
00345         ewl_widget_flags_remove(o, state, EWL_FLAGS_STATE_MASK)
00346 
00353 #define ewl_widget_state_has(o, state) \
00354         ewl_widget_flags_has(o, state, EWL_FLAGS_STATE_MASK)
00355 
00362 #define ewl_widget_state_get(o, state) \
00363         ewl_widget_flags_get(o, state, EWL_FLAGS_STATE_MASK)
00364 
00371 #define ewl_widget_queued_add(o, queued) \
00372         ewl_widget_flags_add(o, queued, EWL_FLAGS_QUEUED_MASK)
00373 
00378 #define ewl_widget_queued_remove(o, queued) \
00379         ewl_widget_flags_remove(o, queued, EWL_FLAGS_QUEUED_MASK)
00380 
00385 #define ewl_widget_queued_has(o, queued) \
00386         ewl_widget_flags_has(o, queued, EWL_FLAGS_QUEUED_MASK)
00387 
00392 #define ewl_widget_queued_get(o, queued) \
00393         ewl_widget_flags_get(o, queued, EWL_FLAGS_QUEUED_MASK)
00394 
00399 #define ewl_widget_visible_add(o, visible) \
00400         ewl_widget_flags_add(o, visible, EWL_FLAGS_VISIBLE_MASK)
00401 
00406 #define ewl_widget_visible_remove(o, visible) \
00407         ewl_widget_flags_remove(o, visible, EWL_FLAGS_VISIBLE_MASK)
00408 
00413 #define ewl_widget_visible_has(o, visible) \
00414         ewl_widget_flags_has(o, visible, EWL_FLAGS_VISIBLE_MASK)
00415 
00420 #define ewl_widget_visible_get(o, visible) \
00421         ewl_widget_flags_get(o, visible, EWL_FLAGS_VISIBLE_MASK)
00422 
00427 #define RECURSIVE(o) (EWL_WIDGET(o)->flags & EWL_FLAG_PROPERTY_RECURSIVE)
00428 
00433 #define REALIZED(o) (EWL_WIDGET(o)->flags & EWL_FLAG_VISIBLE_REALIZED)
00434 
00439 #define VISIBLE(o) (EWL_WIDGET(o)->flags & EWL_FLAG_VISIBLE_SHOWN)
00440 
00445 #define REVEALED(o) (EWL_WIDGET(o)->flags & EWL_FLAG_VISIBLE_REVEALED)
00446 
00451 #define HIDDEN(o) (!(EWL_WIDGET(o)->flags & EWL_FLAG_VISIBLE_SHOWN))
00452 
00457 #define DESTROYED(o) (ewl_widget_queued_has(EWL_WIDGET(o), \
00458                                         EWL_FLAG_QUEUED_SCHEDULED_DESTROY) \
00459                         || ewl_widget_queued_has(EWL_WIDGET(o), \
00460                                         EWL_FLAG_QUEUED_PROCESS_DESTROY))
00461 
00466 #define CONFIGURED(o) (ewl_widget_queued_has(EWL_WIDGET(o), \
00467                                         EWL_FLAG_QUEUED_SCHEDULED_CONFIGURE) \
00468                         || ewl_widget_queued_has(EWL_WIDGET(o), \
00469                                         EWL_FLAG_QUEUED_PROCESS_CONFIGURE))
00470 
00475 #define DISABLED(o) (ewl_widget_state_has(EWL_WIDGET(o), EWL_FLAG_STATE_DISABLED))
00476 
00483 #define ewl_widget_in_tab_list_get(o) \
00484         (ewl_widget_flags_get(o, EWL_FLAG_PROPERTY_IN_TAB_LIST))
00485 
00493 #define ewl_widget_in_tab_list_set(o, val) \
00494         (val ? ewl_widget_flags_add(o, EWL_FLAG_PROPERTY_IN_TAB_LIST, \
00495                                     EWL_FLAGS_PROPERTY_MASK) : \
00496          ewl_widget_flags_remove(o, EWL_FLAG_PROPERTY_IN_TAB_LIST, \
00497                                     EWL_FLAGS_PROPERTY_MASK));
00498 
00499 
00500 
00501 #define UNMANAGED(w) (EWL_WIDGET(w)->flags & EWL_FLAG_PROPERTY_UNMANAGED)
00502 #define TOPLAYERED(w) (EWL_WIDGET(w)->flags & EWL_FLAG_PROPERTY_TOPLAYERED)
00503 
00504 /*
00505  * Internally used callbacks, override at your own risk.
00506  */
00507 void ewl_widget_cb_show(Ewl_Widget *w, void *ev_data, void *user_data);
00508 void ewl_widget_cb_hide(Ewl_Widget *w, void *ev_data, void *user_data);
00509 void ewl_widget_cb_reveal(Ewl_Widget *w, void *ev_data, void *user_data);
00510 void ewl_widget_cb_obscure(Ewl_Widget *w, void *ev_data, void *user_data);
00511 void ewl_widget_cb_realize(Ewl_Widget *w, void *ev_data, void *user_data);
00512 void ewl_widget_cb_unrealize(Ewl_Widget *w, void *ev_data, void *user_data);
00513 void ewl_widget_cb_configure(Ewl_Widget *w, void *ev_data, void *user_data);
00514 void ewl_widget_cb_reparent(Ewl_Widget *w, void *ev_data, void *user_data);
00515 void ewl_widget_cb_enable(Ewl_Widget *w, void *ev_data, void *user_data);
00516 void ewl_widget_cb_disable(Ewl_Widget *w, void *ev_data, void *user_data);
00517 void ewl_widget_cb_focus_in(Ewl_Widget *w, void *ev_data, void *user_data);
00518 void ewl_widget_cb_focus_out(Ewl_Widget *w, void *ev_data, void *user_data);
00519 void ewl_widget_cb_mouse_in(Ewl_Widget *w, void *ev_data, void *user_data);
00520 void ewl_widget_cb_mouse_out(Ewl_Widget *w, void *ev_data, void *user_data);
00521 void ewl_widget_cb_mouse_down(Ewl_Widget *w, void *ev_data, void *user_data);
00522 void ewl_widget_cb_mouse_up(Ewl_Widget *w, void *ev_data, void *user_data);
00523 void ewl_widget_cb_mouse_move(Ewl_Widget *w, void *ev_data, void *user_data);
00524 
00529 #endif

Copyright © Enlightenment.org

Enlightened Widget Library Documentation Generated: Fri Jan 23 21:56:25 2009