Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src


Modified Files:
        ewl_menu_base.c ewl_menu_base.h 


Log Message:
Some progress towards working menus.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_menu_base.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- ewl_menu_base.c     19 Nov 2003 20:18:34 -0000      1.20
+++ ewl_menu_base.c     22 Dec 2003 06:04:57 -0000      1.21
@@ -40,10 +40,11 @@
        ewl_widget_show(menu->popbox);
 
        /*
-        * The add notifier makes sure newly added children go in the popup
+        * Redirect the container so that newly added children go in the popup
         * menu.
         */
-       ewl_container_add_notify(EWL_CONTAINER(menu), ewl_menu_add_cb);
+       ewl_container_set_redirect(EWL_CONTAINER(menu),
+                                  EWL_CONTAINER(menu->popbox));
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -65,7 +66,6 @@
                DRETURN_PTR(NULL, DLEVEL_STABLE);
 
        ewl_menu_item_init(item, image, text);
-       ewl_container_add_notify(EWL_CONTAINER(item), ewl_menu_add_cb);
 
        DRETURN_PTR(EWL_WIDGET(item), DLEVEL_STABLE);
 }
@@ -87,14 +87,18 @@
        DCHECK_PARAM_PTR("item", item);
 
        /*
-        * Initialize the inherited fields and override an appearance setting
-        * and the recursive setting. This will cause clicks to stop at this
-        * level.
+        * Initialize the inherited container fields.
         */
        ewl_container_init(EWL_CONTAINER(item), "menuitem",
                        ewl_menu_item_add_cb, ewl_menu_item_resize_cb, NULL);
        ewl_object_set_fill_policy(EWL_OBJECT(item), EWL_FLAG_FILL_HFILL);
 
+       ewl_callback_append(EWL_WIDGET(item), EWL_CALLBACK_CONFIGURE,
+                           ewl_menu_item_configure_cb, NULL);
+
+       /*
+        * Intercept mouse events this will cause callbacks to on this widget.
+        */
        ewl_container_intercept_callback(EWL_CONTAINER(item),
                        EWL_CALLBACK_CLICKED);
        ewl_container_intercept_callback(EWL_CONTAINER(item),
@@ -191,6 +195,30 @@
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
+void
+ewl_menu_item_configure_cb(Ewl_Widget *w, void *ev_data, void *user_data)
+{
+       int x;
+       Ewl_Container *c;
+       Ewl_Widget *child;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       c = EWL_CONTAINER(w);
+       x = CURRENT_X(w);
+       ewd_list_goto_first(c->children);
+       while ((child = ewd_list_next(c->children))) {
+               int width;
+
+               width = ewl_object_get_preferred_w(EWL_OBJECT(child));
+               ewl_object_place(EWL_OBJECT(child), x, CURRENT_Y(w), width,
+                                CURRENT_H(w));
+               x += width;
+       }
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
 void ewl_menu_item_add_cb(Ewl_Container *parent, Ewl_Widget *child)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
@@ -213,30 +241,6 @@
        else
                ewl_object_set_preferred_w(EWL_OBJECT(parent),
                                PREFERRED_W(parent) + size);
-
-       DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-void ewl_menu_add_cb(Ewl_Container * parent, Ewl_Widget * child)
-{
-       Ewl_IMenu      *menu;
-       Ewl_Menu_Item  *item;
-
-       DENTER_FUNCTION(DLEVEL_STABLE);
-
-       menu = EWL_IMENU(parent);
-       item = EWL_MENU_ITEM(parent);
-
-       /*
-        * Place the newly added child in the popup menu.
-        */
-       if (child != item->icon && child != item->text)
-               ewl_container_append_child(EWL_CONTAINER(menu->base.popbox),
-                               child);
-       else
-               ewl_menu_item_add_cb(parent, child);
-
-       EWL_MENU_ITEM(child)->submenu = TRUE;
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_menu_base.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- ewl_menu_base.h     25 Nov 2003 07:47:29 -0000      1.10
+++ ewl_menu_base.h     22 Dec 2003 06:04:57 -0000      1.11
@@ -92,6 +92,7 @@
 void ewl_menu_base_collapse_cb(Ewl_Widget * w, void *ev_data, void *user_data);
 void ewl_menu_base_destroy_cb(Ewl_Widget * w, void *ev_data, void *user_data);
 
+void ewl_menu_item_configure_cb(Ewl_Widget *w, void *ev_data, void *user_data);
 void ewl_menu_add_cb(Ewl_Container * parent, Ewl_Widget * child);
 void ewl_menu_item_add_cb(Ewl_Container *parent, Ewl_Widget *child);
 void ewl_menu_item_resize_cb(Ewl_Container *parent, Ewl_Widget *child,




-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to