Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src


Modified Files:
        ewl_imenu.c ewl_menu.c ewl_menu_base.c ewl_menu_base.h 


Log Message:
Fixup for some of the imenu behavior.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_imenu.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- ewl_imenu.c 4 Mar 2004 00:29:21 -0000       1.17
+++ ewl_imenu.c 4 Apr 2004 22:28:14 -0000       1.18
@@ -72,7 +72,7 @@
        /*
         * Position the popup menu relative to the menu.
         */
-       if (EWL_MENU_ITEM(w)->submenu) {
+       if (EWL_MENU_ITEM(w)->inmenu) {
                ewl_floater_set_position(EWL_FLOATER(menu->base.popup),
                                         CURRENT_W(w), 0);
        }
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_menu.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- ewl_menu.c  5 Feb 2004 17:21:36 -0000       1.15
+++ ewl_menu.c  4 Apr 2004 22:28:14 -0000       1.16
@@ -79,7 +79,7 @@
        /*
         * Position the popup menu relative to the menu.
         */
-       if (EWL_MENU_ITEM(w)->submenu) {
+       if (EWL_MENU_ITEM(w)->inmenu) {
                xx = CURRENT_X(w) + CURRENT_W(w);
                yy = CURRENT_Y(w);
        } else {
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_menu_base.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- ewl_menu_base.c     24 Mar 2004 04:11:09 -0000      1.29
+++ ewl_menu_base.c     4 Apr 2004 22:28:14 -0000       1.30
@@ -37,8 +37,6 @@
        menu->popbox = ewl_vbox_new();
        ewl_object_set_alignment(EWL_OBJECT(menu->popbox),
                                 EWL_FLAG_ALIGN_LEFT | EWL_FLAG_ALIGN_TOP);
-       ewl_callback_append(EWL_WIDGET(menu->popbox), EWL_CALLBACK_MOUSE_DOWN,
-                           ewl_menu_popup_hold_cb, menu);
        ewl_widget_show(menu->popbox);
 
        /*
@@ -263,7 +261,9 @@
 ewl_menu_base_expand_cb(Ewl_Widget *w, void *ev_data, void *user_data)
 {
        Ewl_Widget *child;
+       Ewl_Container *pb;
        Ewl_Menu_Base *menu = EWL_MENU_BASE(w);
+       Ewl_Menu_Item *item = EWL_MENU_ITEM(w);
 
        DENTER_FUNCTION(DLEVEL_STABLE);
 
@@ -273,20 +273,36 @@
        if (!REALIZED(menu->popup))
                ewl_container_append_child(EWL_CONTAINER(menu->popup),
                                           menu->popbox);
-       ewl_widget_show(menu->popup);
 
-       if (EWL_MENU_ITEM(w)->submenu)
+       if (item->inmenu) {
+               if (!REALIZED(menu->popup)) {
+                       ewl_callback_append(menu->popup, EWL_CALLBACK_SHOW,
+                                           ewl_menu_base_popup_show_cb,
+                                           item->inmenu);
+                       ewl_callback_append(menu->popup, EWL_CALLBACK_HIDE,
+                                           ewl_menu_base_popup_hide_cb,
+                                           item->inmenu);
+               }
                ewl_object_set_minimum_w(EWL_OBJECT(menu->popup),
                                         CURRENT_W(menu));
+       }
+
+       pb = EWL_CONTAINER(menu->popbox);
 
-       ecore_list_goto_first(EWL_CONTAINER(menu->popbox)->children);
+       ecore_list_goto_first(pb->children);
 
-       while ((child = ecore_list_next(EWL_CONTAINER(menu->popbox)->children))) {
+       /*
+        * Give all the items in the submenu a reference to this popup.
+        */
+       while ((child = ecore_list_next(pb->children))) {
                if (ewl_widget_is_type(child, "menuitem")) {
-                       EWL_MENU_ITEM(child)->submenu = 1;
+                       item = EWL_MENU_ITEM(child);
+                       item->inmenu = menu->popup;
                }
        }
 
+       ewl_widget_show(menu->popup);
+
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
@@ -305,28 +321,38 @@
 }
 
 void
-ewl_menu_base_destroy_cb(Ewl_Widget * w, void *ev_data, void *user_data)
+ewl_menu_base_popup_hide_cb(Ewl_Widget * w, void *ev_data, void *user_data)
 {
-       Ewl_Menu_Base      *menu;
-
+       Ewl_Widget *ppop = user_data;
        DENTER_FUNCTION(DLEVEL_STABLE);
 
-       menu = EWL_MENU_BASE(w);
+       ewl_widget_hide(ppop);
 
-       if (menu->popup)
-               ewl_widget_destroy(menu->popup);
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+void
+ewl_menu_base_popup_show_cb(Ewl_Widget * w, void *ev_data, void *user_data)
+{
+       Ewl_Widget *ppop = user_data;
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       ewl_widget_show(ppop);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
 void
-ewl_menu_popup_hold_cb(Ewl_Widget * w, void *ev_data, void *user_data)
+ewl_menu_base_destroy_cb(Ewl_Widget * w, void *ev_data, void *user_data)
 {
-       Ewl_Menu_Base *menu;
+       Ewl_Menu_Base      *menu;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
 
-       menu  = EWL_MENU_BASE(user_data);
+       menu = EWL_MENU_BASE(w);
+
+       if (menu->popup)
+               ewl_widget_destroy(menu->popup);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_menu_base.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- ewl_menu_base.h     18 Mar 2004 03:41:23 -0000      1.14
+++ ewl_menu_base.h     4 Apr 2004 22:28:14 -0000       1.15
@@ -31,8 +31,7 @@
        Ewl_Container   container; /**< Inherit from Ewl_Container */
        Ewl_Widget     *icon; /**< The image in this menu item */
        Ewl_Widget     *text; /**< The text label for this menu item  */
-       int             submenu; /**< Indicates if this is inside a menu */
-       int             hold; /**< Indicates not to hide this on a deselect */
+       Ewl_Widget     *inmenu; /**< Set if inside a menu */
 };
 
 /**
@@ -74,6 +73,7 @@
        Ewl_Menu_Item   item; /**< Inherit from Ewl_Menu_Item */
        Ewl_Widget     *popup; /**< The popup portion of the menu */
        Ewl_Widget     *popbox; /**< Box for layout in popup */
+       int             hold; /**< Indicates not to hide this on a deselect */
 };
 
 Ewl_Widget     *ewl_menu_item_new(char *image, char *title);
@@ -92,13 +92,17 @@
 void ewl_menu_base_expand_cb(Ewl_Widget *w, void *ev_data, void *user_data);
 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_popup_hold_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_item_child_show_cb(Ewl_Container *parent, Ewl_Widget *child);
 void ewl_menu_item_child_resize_cb(Ewl_Container *parent, Ewl_Widget *child,
                             int size, Ewl_Orientation o);
 
+void ewl_menu_base_popup_show_cb(Ewl_Widget * w, void *ev_data,
+                                void *user_data);
+void ewl_menu_base_popup_hide_cb(Ewl_Widget * w, void *ev_data,
+                                void *user_data);
+
 /**
  * @}
  */




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to