Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/test


Modified Files:
        Makefile.am ewl_menu_bar_test.c ewl_test.c ewl_test.h 


Log Message:
add an Ewl_Menubar widget

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/test/Makefile.am,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -3 -r1.45 -r1.46
--- Makefile.am 23 Aug 2004 21:39:41 -0000      1.45
+++ Makefile.am 6 Sep 2004 22:24:41 -0000       1.46
@@ -27,6 +27,7 @@
                                        ewl_image_test.c \
                                        ewl_imenu_test.c \
                                        ewl_menu_test.c \
+                                       ewl_menu_bar_test.c \
                                        ewl_notebook_test.c \
                                        ewl_password_test.c \
                                        ewl_progressbar_test.c \
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/test/ewl_menu_bar_test.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ewl_menu_bar_test.c 20 Oct 2003 05:05:48 -0000      1.3
+++ ewl_menu_bar_test.c 6 Sep 2004 22:24:41 -0000       1.4
@@ -1,62 +1,102 @@
 #include "ewl_test.h"
 
+static Ewl_Widget *menubar_button;
 
-extern Ewl_Widget *main_menu;
+void
+__destroy_menubar_test_window(Ewl_Widget *w, void *ev_data, void *user_data)
+{
+    ewl_widget_destroy(w);
 
+    ewl_callback_append(menubar_button, EWL_CALLBACK_CLICKED,
+                            __create_menubar_test_window, NULL);
+    return;
+    ev_data = NULL;
+    user_data = NULL;
+}
 
-Ewl_Widget     *
-ewl_menu_bar_test_create(void)
+void
+__create_menubar_test_window(Ewl_Widget *w, void *ev_data, void *user_data)
 {
-       Ewl_Widget     *main_menu_bar;
-       Ewl_Widget     *file_menu, *test_menu, *help_menu;
-       Ewl_Widget     *smi_file, *smi_windows, *smi_help;
-
-       main_menu_bar = ewl_menu_bar_new();
-       file_menu = ewl_menu_new();
-       test_menu = ewl_menu_new();
-       help_menu = ewl_menu_new();
-
-       EWL_MENU_ITEM_SUBMENU_NEW(smi_file, "File", NULL, main_menu_bar,
-                                 file_menu);
-       EWL_MENU_ITEM_SUBMENU_NEW(smi_windows, "Test", NULL, main_menu_bar,
-                                 test_menu);
-       EWL_MENU_ITEM_SUBMENU_NEW(smi_help, "Help", NULL, main_menu_bar,
-                                 help_menu);
-
-       {
-               Ewl_Widget     *mi_exit;
-
-               EWL_MENU_ITEM_NEW(mi_exit, "Exit", NULL, file_menu);
-               ewl_callback_append(EWL_OBJECT(mi_exit),
-                                   EWL_WIDGET_CALLBACK_CLICKED,
-                                   __ewl_test_exit, NULL);
-       }
-
-       {
-               Ewl_Widget     *mi_box_h, *mi_box_v, *mi_button, *mi_image;
-               Ewl_Widget     *mi_menu, *mi_rotate_factory, *mi_table;
-               Ewl_Widget     *mi_text, *mi_window;
-
-               EWL_MENU_ITEM_NEW(mi_box_h, "Ewl_Box_Horizontal", NULL,
-                                 test_menu);
-               EWL_MENU_ITEM_NEW(mi_box_v, "Ewl_Box_Vertical", NULL,
-                                 test_menu);
-               EWL_MENU_ITEM_NEW(mi_button, "Ewl_Button", NULL, test_menu);
-               EWL_MENU_ITEM_NEW(mi_image, "Ewl_Image", NULL, test_menu);
-               EWL_MENU_ITEM_SUBMENU_NEW(mi_menu, "Ewl_Menu", NULL, test_menu,
-                                         main_menu);
-               EWL_MENU_ITEM_NEW(mi_rotate_factory, "Ewl_Rotate_Factory", NULL,
-                                 test_menu);
-               EWL_MENU_ITEM_NEW(mi_table, "Ewl_Table", NULL, test_menu);
-               EWL_MENU_ITEM_NEW(mi_text, "Ewl_Text", NULL, test_menu);
-               EWL_MENU_ITEM_NEW(mi_window, "Ewl_Window", NULL, test_menu);
-       }
+    Ewl_Widget *menubar_win = NULL, *box = NULL;
+    Ewl_Widget *h_menubar = NULL, *v_menubar = NULL;
 
-       {
-               Ewl_Widget     *mi_about;
+    ewl_callback_del(w, EWL_CALLBACK_CLICKED, 
+                            __create_menubar_test_window);
 
-               EWL_MENU_ITEM_NEW(mi_about, "About", NULL, help_menu);
-       }
+    menubar_button = w;
 
-       return main_menu_bar;
+    menubar_win = ewl_window_new();
+    ewl_window_title_set(EWL_WINDOW(menubar_win), "Menubar Test");
+    ewl_window_name_set(EWL_WINDOW(menubar_win), "EWL Test Application");
+    ewl_window_class_set(EWL_WINDOW(menubar_win), "EFL Test Application");
+    ewl_object_minimum_size_set(EWL_OBJECT(menubar_win), 300, 300);
+    ewl_callback_append(menubar_win, EWL_CALLBACK_DELETE_WINDOW,
+                        __destroy_menubar_test_window, NULL);
+    ewl_widget_show(menubar_win);
+
+    box = ewl_vbox_new();
+    ewl_container_child_append(EWL_CONTAINER(menubar_win), box);
+    ewl_widget_show(box);
+
+    h_menubar = ewl_hmenubar_new();
+    {
+        int i;
+        Ewl_Widget *item;
+        char *m_items[] = {"File",
+                            "Test",
+                            "About",
+                            NULL};
+        for(i = 0; m_items[i] != NULL; i++) {
+            Ewl_Widget *foo;
+            item = ewl_menubar_menu_add(EWL_MENUBAR(h_menubar), NULL, m_items[i]);
+
+            foo = ewl_menu_item_new(NULL, "foo");
+            ewl_container_child_append(EWL_CONTAINER(item), foo);
+            ewl_widget_show(foo);
+
+            foo = ewl_menu_item_new(NULL, "foobar");
+            ewl_container_child_append(EWL_CONTAINER(item), foo);
+            ewl_widget_show(foo);
+
+            if (i != 0 && (i % 1) == 0) 
+                ewl_menubar_seperator_add(EWL_MENUBAR(h_menubar));
+        }
+    }
+    ewl_container_child_append(EWL_CONTAINER(box), h_menubar);
+    ewl_widget_show(h_menubar);
+
+    v_menubar = ewl_vmenubar_new();
+    {
+        int i;
+        Ewl_Widget *item;
+        char *m_items[] = {"About",
+                            "Left",
+                            "Right",
+                            "foo",
+                            NULL};
+        for(i = 0; m_items[i] != NULL; i++) {
+            Ewl_Widget *foo;
+            item = ewl_menubar_menu_add(EWL_MENUBAR(v_menubar), NULL, m_items[i]);
+
+            foo = ewl_menu_item_new(NULL, "foo");
+            ewl_container_child_append(EWL_CONTAINER(item), foo);
+            ewl_widget_show(foo);
+
+            foo = ewl_menu_item_new(NULL, "foobar");
+            ewl_container_child_append(EWL_CONTAINER(item), foo);
+            ewl_widget_show(foo);
+
+            if (i != 0 && (i % 2) == 0) 
+                ewl_menubar_seperator_add(EWL_MENUBAR(v_menubar));
+        }
+    }
+    ewl_container_child_append(EWL_CONTAINER(box), v_menubar);
+    ewl_widget_show(v_menubar);
+
+    return;
+    ev_data = NULL;
+    user_data = NULL;
 }
+
+
+
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/test/ewl_test.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -3 -r1.75 -r1.76
--- ewl_test.c  24 Aug 2004 04:38:19 -0000      1.75
+++ ewl_test.c  6 Sep 2004 22:24:41 -0000       1.76
@@ -80,6 +80,7 @@
                { "Image",       __create_image_test_window,       "ewl_image_test.c" 
},
                { "IMenu",       __create_imenu_test_window,       "ewl_imenu_test.c" 
},
                { "Menu",        __create_menu_test_window,        "ewl_menu_test.c" },
+               { "Menubar",     __create_menubar_test_window,     
"ewl_menubar_test.c" },
                { "Notebook",    __create_notebook_test_window,    
"ewl_notebook_test.c" },
                { "Password",    __create_password_test_window,    
"ewl_password_test.c" },
                { "Progressbar", __create_progressbar_test_window, 
"ewl_progressbar_test.c" },
@@ -103,6 +104,7 @@
                "Provides a widget for displaying evas\nloadable images, and edjes.",
                "Defines a menu used internally. The\ncontents on the menu are not 
drawn\noutside of the Evas.",
                "Defines the basic menu classes that\nare extended to an actual 
menu\nimplementation by inheriting classes\nsuch as Ewl_Menu and Ewl_IMenu.",
+               "Defines a menubar that can be used to hold menus.",
                "Provides a container whose children\nare pages that can be 
switched\nbetween using tab labels along one\nedge",
                "Defines the Ewl_Password class to allow\nfor single line obscured 
text.",
                "Provides a statusbar from a given value.",
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/test/ewl_test.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- ewl_test.h  23 Aug 2004 21:39:47 -0000      1.9
+++ ewl_test.h  6 Sep 2004 22:24:41 -0000       1.10
@@ -24,6 +24,7 @@
 void __create_image_test_window         (Ewl_Widget * w, void *ev_data, void 
*user_data);
 void __create_imenu_test_window         (Ewl_Widget * w, void *ev_data, void 
*user_data);
 void __create_menu_test_window          (Ewl_Widget * w, void *ev_data, void 
*user_data);
+void __create_menubar_test_window       (Ewl_Widget * w, void *ev_data, void 
*user_data);
 void __create_notebook_test_window      (Ewl_Widget * w, void *ev_data, void 
*user_data);
 void __create_password_test_window      (Ewl_Widget * w, void *ev_data, void 
*user_data);
 void __create_progressbar_test_window   (Ewl_Widget * w, void *ev_data, void 
*user_data);




-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to