Enlightenment CVS committal Author : codewarrior Project : e17 Module : proto
Dir : e17/proto/enhance/src/lib Modified Files: enhance.c enhance_private.h enhance_widget.c Log Message: - enhance support dialogs now. action area packing options not yet supported. you can pack normal widgets and buttons with response_ids too. =================================================================== RCS file: /cvs/e/e17/proto/enhance/src/lib/enhance.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- enhance.c 18 May 2006 19:09:01 -0000 1.7 +++ enhance.c 11 Jul 2006 03:16:41 -0000 1.8 @@ -1,15 +1,6 @@ #include "enhance_private.h" -static void _e_property_handle(Enhance *en, EXML_Node *node); -static void _e_signal_handle(Enhance *en, EXML_Node *node); -static void _e_traverse_packing_xml(Enhance *en, E_Widget *widget); -static void _e_traverse_property_xml(Enhance *en); -static void _e_traverse_signal_xml(Enhance *en); -static void _e_traverse_child_xml(Enhance *en); -static E_Widget *_e_traverse_widget_xml(Enhance *en); -static void _e_traverse_xml(Enhance *en); -static Ecore_Hash*_en_stock_items_hash=NULL; -static void _en_stock_items_hash_init(void); +static Ecore_Hash *_en_stock_items_hash = NULL; typedef struct _En_Stock_Item { @@ -367,7 +358,7 @@ #endif -static void +void _e_property_handle(Enhance *en, EXML_Node *node) { char *name; @@ -423,7 +414,13 @@ \ value = node->value; - if(!strcmp(name, "visible")) + if(!strcmp(name, "response_id")) + { + PROPERTY_STR; + etk_object_data_set(ETK_OBJECT(wid->wid), "response_id", strdup(value)); + } + + else if(!strcmp(name, "visible")) { PROPERTY_BOOL; etk_object_properties_set(ETK_OBJECT(wid->wid), "visible", value, NULL); @@ -483,8 +480,10 @@ else if(!strcmp(name, "title")) { - IF_PARENT_CLASS("GtkWindow") + IF_PARENT_CLASS("GtkWindow") etk_window_title_set(ETK_WINDOW(wid->wid), node->value); + IF_PARENT_CLASS("GtkDialog") + etk_window_title_set(ETK_WINDOW(wid->wid), node->value); } else if(!strcmp(name, "decorated")) @@ -627,7 +626,7 @@ } } -static void +void _e_signal_handle(Enhance *en, EXML_Node *node) { E_Widget *wid; @@ -669,7 +668,7 @@ ETK_CALLBACK(func), data); } -static void +void _e_traverse_packing_xml(Enhance *en, E_Widget *widget) { EXML *xml; @@ -752,7 +751,7 @@ exml_up(xml); } -static void + void _e_traverse_property_xml(Enhance *en) { EXML *xml; @@ -764,7 +763,7 @@ _e_property_handle(en, node); } -static void +void _e_traverse_signal_xml(Enhance *en) { EXML *xml; @@ -777,7 +776,7 @@ } -static void +void _e_traverse_child_xml(Enhance *en) { EXML *xml; @@ -835,7 +834,7 @@ exml_up(xml); } -static E_Widget * +E_Widget * _e_traverse_widget_xml(Enhance *en) { EXML *xml; @@ -877,7 +876,7 @@ return widget; } -static void +void _e_traverse_xml(Enhance *en) { EXML *xml; @@ -952,11 +951,10 @@ Enhance * enhance_new() -{ - Enhance *en; - - en = E_NEW(1, Enhance); +{ + Enhance *en = NULL; + en = E_NEW(1, Enhance); return en; } @@ -1010,19 +1008,19 @@ #endif } -static void +void _en_stock_items_hash_init(void) { - int size, i; - - /* the hash table is build only once */ - if (!_en_stock_items_hash) - { - _en_stock_items_hash = ecore_hash_new(ecore_str_hash, ecore_str_compare); - size = sizeof(en_stock_items)/sizeof(en_stock_items[0]); - for (i=0; i<size; i++) - { - ecore_hash_set(_en_stock_items_hash, en_stock_items[i].str, (Etk_Stock_Id *)en_stock_items[i].id); - } - } + int size, i; + + /* the hash table is build only once */ + if (!_en_stock_items_hash) + { + _en_stock_items_hash = ecore_hash_new(ecore_str_hash, ecore_str_compare); + size = sizeof(en_stock_items)/sizeof(en_stock_items[0]); + for (i=0; i<size; i++) + { + ecore_hash_set(_en_stock_items_hash, en_stock_items[i].str, (Etk_Stock_Id *)en_stock_items[i].id); + } + } } =================================================================== RCS file: /cvs/e/e17/proto/enhance/src/lib/enhance_private.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- enhance_private.h 7 Feb 2006 00:34:32 -0000 1.1 +++ enhance_private.h 11 Jul 2006 03:16:41 -0000 1.2 @@ -19,4 +19,14 @@ typedef void (*etk_callback_type)(void); +void _e_property_handle(Enhance *en, EXML_Node *node); +void _e_signal_handle(Enhance *en, EXML_Node *node); +void _e_traverse_packing_xml(Enhance *en, E_Widget *widget); +void _e_traverse_property_xml(Enhance *en); +void _e_traverse_signal_xml(Enhance *en); +void _e_traverse_child_xml(Enhance *en); +E_Widget *_e_traverse_widget_xml(Enhance *en); +void _e_traverse_xml(Enhance *en); +void _en_stock_items_hash_init(void); + #endif =================================================================== RCS file: /cvs/e/e17/proto/enhance/src/lib/enhance_widget.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- enhance_widget.c 1 Jun 2006 08:20:37 -0000 1.6 +++ enhance_widget.c 11 Jul 2006 03:16:41 -0000 1.7 @@ -2,6 +2,7 @@ static E_Widget *_e_widget_new(Enhance *en, EXML_Node *node, Etk_Widget *etk_widget, char *id); static E_Widget *_e_widget_window_handle(Enhance *en, EXML_Node *node); +static E_Widget *_e_widget_dialog_handle(Enhance *en, EXML_Node *node); static E_Widget *_e_widget_scrolled_view_handle(Enhance *en, EXML_Node *node); static E_Widget *_e_widget_viewport_handle(Enhance *en, EXML_Node *node); static E_Widget *_e_widget_vbox_handle(Enhance *en, EXML_Node *node); @@ -31,6 +32,33 @@ static E_Widget *_e_widget_hslider_handle(Enhance *en, EXML_Node *node); static E_Widget *_e_widget_vslider_handle(Enhance *en, EXML_Node *node); +static EXML_Node *find_node(EXML_Node *node, char *key, char *value) +{ + Ecore_List *props; + EXML_Node *prop; + + props = node->children; + ecore_list_goto_first(props); + prop = ecore_list_current(props); + while(prop != NULL) + { + if(ecore_hash_get(prop->attributes, key)) + { + if(!strcmp(ecore_hash_get(prop->attributes, key), value)) + return prop; + } + if(prop->children) + { + EXML_Node *ret; + if((ret = find_node(prop, key, value))) + return ret; + } + + prop = ecore_list_next(props); + } + return NULL; +} + static E_Widget * _e_widget_new(Enhance *en, EXML_Node *node, Etk_Widget *etk_widget, char *id) { @@ -63,6 +91,119 @@ } static E_Widget * +_e_widget_dialog_handle(Enhance *en, EXML_Node *node) +{ + E_Widget *dia; + char *id; + EXML_Node *prop; + + id = ecore_hash_get(node->attributes, "id"); + if(!id) return NULL; + + dia = _e_widget_new(en, node, etk_dialog_new(), id); + + if((prop = find_node(node, "internal-child", "action_area"))) + { + if((prop = find_node(prop, "class", "GtkHButtonBox"))) + { + EXML_Node *button_box_child; + + exml_goto_node(en->xml, prop); /* go to button box */ + exml_down(en->xml); /* go to first property */ + button_box_child = exml_get(en->xml); + while(button_box_child) + { + char *tmp; + if(!strcmp(button_box_child->tag, "child")) + { + /* we found the <child> tag, we need to go deeper */ + EXML_Node *widget; + + exml_down(en->xml); + widget = exml_get(en->xml); + while(widget) + { + if(!strcmp(widget->tag, "widget")) + { + /* we found the <widget> tag to add into the + * action area */ + E_Widget *e_widget; + + e_widget = _e_traverse_widget_xml(en); + + if(ETK_IS_BUTTON(e_widget->wid)) + { + char *response_id_str; + + response_id_str = etk_object_data_get( + ETK_OBJECT(e_widget->wid), + "response_id"); + + if(response_id_str) + { + int response_id; + + response_id = atoi(response_id_str); + etk_dialog_pack_button_in_action_area( + ETK_DIALOG(dia->wid), ETK_BUTTON(e_widget->wid), + response_id, ETK_FALSE, ETK_FALSE, + 0, ETK_FALSE); + } + else + etk_dialog_pack_widget_in_action_area( + ETK_DIALOG(dia->wid), e_widget->wid, + ETK_FALSE, ETK_FALSE, 0, ETK_FALSE); + } + else + etk_dialog_pack_widget_in_action_area( + ETK_DIALOG(dia->wid), e_widget->wid, + ETK_FALSE, ETK_FALSE, 0, ETK_FALSE); + } + exml_goto_node(en->xml, widget); + if(exml_next(en->xml)) + widget = exml_get(en->xml); + else + widget = NULL; + } + } + exml_goto_node(en->xml, button_box_child); + if((tmp = exml_next_nomove(en->xml))) + button_box_child = exml_get(en->xml); + else + button_box_child = NULL; + } + } + } + + prop = find_node(node, "internal-child", "action_area"); + exml_goto_node(en->xml, prop); + exml_next_nomove(en->xml); + { + EXML_Node *child; + EXML_Node *widget; + + child = exml_get(en->xml); /* go to next <child>, content here */ + exml_down(en->xml); /* go widget */ + widget = exml_get(en->xml); + if(!strcmp(widget->tag, "widget")) + { + E_Widget *wid; + + wid = _e_traverse_widget_xml(en); + etk_dialog_pack_in_main_area( + ETK_DIALOG(dia->wid), wid->wid, + ETK_FALSE, ETK_FALSE, 0, ETK_FALSE); + } + + } + + exml_goto_node(en->xml, node); + exml_next(en->xml); + + return dia; +} + +static E_Widget * _e_widget_scrolled_view_handle(Enhance *en, EXML_Node *node) { E_Widget *view; @@ -625,6 +766,8 @@ if(!strcmp(class, "GtkWindow")) return _e_widget_window_handle(en, node); + else if(!strcmp(class, "GtkDialog")) + return _e_widget_dialog_handle(en, node); else if(!strcmp(class, "GtkVBox")) return _e_widget_vbox_handle(en, node); else if(!strcmp(class, "GtkVButtonBox")) @@ -706,6 +849,14 @@ { etk_container_add(ETK_CONTAINER(parent->wid), child->wid); } + if(!strcmp(parent_class, "GtkDialog")) + { + char *c_parent_class; + + c_parent_class = ecore_hash_get(child->node->attributes, "internal-child"); + printf("packing into dialog %s!\n", c_parent_class); + etk_dialog_pack_in_main_area(ETK_DIALOG(parent->wid), child->wid, ETK_TRUE, ETK_TRUE, 0, ETK_FALSE); + } if(!strcmp(parent_class, "GtkFrame")) { if(child->packing) @@ -791,11 +942,18 @@ ETK_MENU_ITEM(child->wid)); } else if(!strcmp(parent_class, "GtkVBox") || !strcmp(parent_class, "GtkHBox") || - !strcmp(parent_class, "GtkVButtonBox") || !strcmp(parent_class, "GtkButtonHBox")) + !strcmp(parent_class, "GtkVButtonBox") || !strcmp(parent_class, "GtkHButtonBox")) { Etk_Bool expand = ETK_TRUE; Etk_Bool fill = ETK_TRUE; int padding = 0; + + char *c_parent_class; + + c_parent_class = ecore_hash_get(child->node->attributes, "class"); + printf("packing into vbox %s!\n", c_parent_class); + + if(child->packing) { ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs