Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        Ewl.h.in Makefile.am ewl_box.c ewl_iconbox.c ewl_menubar.c 
        ewl_menubar.h ewl_separator.h 
Removed Files:
        ewl_menu_separator.c ewl_menu_separator.h 


Log Message:
- fix up the menu bar. Use the container funcs to add stuff to the bar now
  instead of special calls
- get rid of the ewl_menu_separator completly. Just use the ewl_separator
- formatting/type checking

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/Ewl.h.in,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- Ewl.h.in    24 Oct 2005 03:35:29 -0000      1.22
+++ Ewl.h.in    24 Oct 2005 04:39:57 -0000      1.23
@@ -308,7 +308,6 @@
 #include <ewl_image.h>
 #include <ewl_spectrum.h>
 #include <ewl_menu_item.h>
-#include <ewl_menu_separator.h>
 #include <ewl_menu_base.h>
 #include <ewl_imenu.h>
 #include <ewl_menu.h>
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/Makefile.am,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- Makefile.am 24 Oct 2005 03:35:29 -0000      1.13
+++ Makefile.am 24 Oct 2005 04:39:57 -0000      1.14
@@ -45,7 +45,6 @@
        ewl_menubar.h \
        ewl_menu_base.h \
        ewl_menu_item.h \
-       ewl_menu_separator.h \
        ewl_misc.h \
        ewl_notebook.h \
        ewl_object.h \
@@ -109,7 +108,6 @@
        ewl_menubar.c \
        ewl_menu_base.c \
        ewl_menu_item.c \
-       ewl_menu_separator.c \
        ewl_misc.c \
        ewl_notebook.c \
        ewl_object.c \
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_box.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- ewl_box.c   23 Oct 2005 05:11:31 -0000      1.11
+++ ewl_box.c   24 Oct 2005 04:39:57 -0000      1.12
@@ -136,7 +136,6 @@
        DCHECK_PARAM_PTR_RET("b", b, FALSE);
 
        w = EWL_WIDGET(b);
-       ewl_widget_inherit(w, "box");
 
        /*
         * Create the temporary layout lists now that they are needed.
@@ -151,6 +150,7 @@
                ewl_widget_destroy(EWL_WIDGET(b));
                DRETURN_INT(FALSE, DLEVEL_STABLE);
        }
+       ewl_widget_inherit(w, "box");
 
        /*
         * Set the appearance based on default orientation.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_iconbox.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -3 -r1.48 -r1.49
--- ewl_iconbox.c       24 Oct 2005 00:30:12 -0000      1.48
+++ ewl_iconbox.c       24 Oct 2005 04:39:57 -0000      1.49
@@ -184,7 +184,7 @@
        ewl_callback_append(ib->ewl_iconbox_context_menu_item, 
EWL_CALLBACK_MOUSE_DOWN, ewl_iconbox_expansion_cb, ib);
        ewl_widget_show(ib->ewl_iconbox_context_menu_item);
 
-       ib->ewl_iconbox_context_menu_item = ewl_menu_separator_new();
+       ib->ewl_iconbox_context_menu_item = ewl_separator_new();
        ewl_container_child_append(EWL_CONTAINER(ib->ewl_iconbox_context_menu), 
ib->ewl_iconbox_context_menu_item);
        ewl_widget_show(ib->ewl_iconbox_context_menu_item);
        ewl_widget_show(ib->ewl_iconbox_view_menu);
@@ -204,7 +204,7 @@
        ewl_container_child_append(EWL_CONTAINER(ib->ewl_iconbox_pane_inner), 
ib->icon_menu_floater);
 
 
-       ib->icon_menu_item = ewl_menu_separator_new();
+       ib->icon_menu_item = ewl_separator_new();
        ewl_container_child_append(EWL_CONTAINER(ib->icon_menu), 
ib->icon_menu_item);
        ewl_widget_show(ib->icon_menu_item);
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_menubar.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- ewl_menubar.c       10 Oct 2005 18:43:31 -0000      1.6
+++ ewl_menubar.c       24 Oct 2005 04:39:57 -0000      1.7
@@ -4,11 +4,11 @@
 #include "ewl_private.h"
 
 /**
- * @param orientation: the desirec orientation of the menubar
  * @return Returns NULL on failure, or a pointer to a new menubar on success.
  * @brief Allocate and initialize a new menubar widget
  */
-Ewl_Widget *ewl_menubar_new(Ewl_Orientation orientation)
+Ewl_Widget *
+ewl_menubar_new(void)
 {
        Ewl_Menubar *mb = NULL;
 
@@ -18,7 +18,7 @@
        if (!mb)
                DRETURN_PTR(NULL, DLEVEL_STABLE);
        
-       if (!ewl_menubar_init(mb, orientation)) {
+       if (!ewl_menubar_init(mb)) {
                ewl_widget_destroy(EWL_WIDGET(mb));
                mb = NULL;
        }
@@ -27,108 +27,121 @@
 }
 
 /**
+ * @return Returns NULL on failure or a pointer to a new horizontal menubar
+ * on success
+ */
+Ewl_Widget *
+ewl_hmenubar_new(void)
+{
+       Ewl_Widget *mb = NULL;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       mb = ewl_menubar_new();
+       if (!mb)
+               DRETURN_PTR(NULL, DLEVEL_STABLE);
+
+       ewl_menubar_orientation_set(EWL_MENUBAR(mb), 
EWL_ORIENTATION_HORIZONTAL);
+
+       DRETURN_PTR(mb, DLEVEL_STABLE);
+}
+
+/**
+ * @return Returns NULL on failure or a pointer to a new vertical menubar on
+ * success
+ */
+Ewl_Widget *
+ewl_vmenubar_new(void)
+{
+       Ewl_Widget *mb = NULL;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       mb = ewl_menubar_new();
+       if (!mb)
+               DRETURN_PTR(NULL, DLEVEL_STABLE);
+
+       ewl_menubar_orientation_set(EWL_MENUBAR(mb), EWL_ORIENTATION_VERTICAL);
+
+       DRETURN_PTR(mb, DLEVEL_STABLE);
+}
+
+/**
  * @param mb: the menubar to initialize
- * @param orientation: the orientation for the menubar
- * @return Returns 1 on success and 0 on failure
+ * @return Returns TRUE on success and FALSE on failure
  * @brief Initialize a menubar to default values
  */
-int ewl_menubar_init(Ewl_Menubar *mb, Ewl_Orientation orientation)
+int
+ewl_menubar_init(Ewl_Menubar *mb)
 {
-       Ewl_Widget *w = NULL;
-
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET("mb", mb, FALSE);
 
-       w = EWL_WIDGET(mb);
-
        if (!ewl_box_init(EWL_BOX(mb))) {
                DRETURN_INT(FALSE, DLEVEL_STABLE);
        }
+       ewl_widget_appearance_set(EWL_WIDGET(mb), "menubar");
+       ewl_widget_inherit(EWL_WIDGET(mb), "menubar");
 
-       ewl_box_orientation_set(EWL_BOX(mb), orientation);
-       if (orientation == EWL_ORIENTATION_HORIZONTAL) {
-               ewl_object_fill_policy_set(EWL_OBJECT(w),
-                               EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
-               mb->inner_box = EWL_BOX(ewl_hbox_new());
-               ewl_object_fill_policy_set(EWL_OBJECT(mb->inner_box),
-                               EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
-
-       } else if (orientation == EWL_ORIENTATION_VERTICAL) {
-               ewl_object_fill_policy_set(EWL_OBJECT(w),
-                               EWL_FLAG_FILL_VFILL | EWL_FLAG_FILL_HSHRINK);
-               mb->inner_box = EWL_BOX(ewl_vbox_new());
-               ewl_object_fill_policy_set(EWL_OBJECT(mb->inner_box),
-                               EWL_FLAG_FILL_VFILL | EWL_FLAG_FILL_HSHRINK);
-       }
+       mb->inner_box = ewl_hbox_new();
        ewl_container_child_append(EWL_CONTAINER(mb),
                                        EWL_WIDGET(mb->inner_box));
-
-       /*
-       ewl_object_fill_policy_set(EWL_OBJECT(mb->inner_box), 
-                                       EWL_FLAG_FILL_SHRINK);
-                                       */
        ewl_widget_internal_set(EWL_WIDGET(mb->inner_box), TRUE);
+       ewl_widget_show(EWL_WIDGET(mb->inner_box));
+
        ewl_container_redirect_set(EWL_CONTAINER(mb),
                                        EWL_CONTAINER(mb->inner_box));
 
-       ewl_widget_show(EWL_WIDGET(mb->inner_box));
+       ewl_menubar_orientation_set(mb, EWL_ORIENTATION_HORIZONTAL);
 
-       ewl_widget_appearance_set(w, "menubar");
-       ewl_widget_inherit(w, "menubar");
 
        DRETURN_INT(TRUE, DLEVEL_STABLE);
 }
 
 /**
- * @param mb: The Ewl_Menubar to add the menu too.
- * @param img: The image to place beside the menu.
- * @param title: The name to give the menu.
- * @return Returns NULL on failure and a new IMenu on success
- * @brief Creates a new menu and adds it to the menubar. Returns the menu to
- * be setup as required by the app.
+ * @param mb: The menubar to set the orientation on
+ * @param o: The orientation to set onto the menubar
+ * @return Returns no value.
  */
-Ewl_Widget *ewl_menubar_menu_add(Ewl_Menubar *mb, char *img, char *title)
+void
+ewl_menubar_orientation_set(Ewl_Menubar *mb, Ewl_Orientation o)
 {
-       Ewl_Widget *menu = NULL;
-
        DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR_RET("mb", mb, FALSE);
+       DCHECK_PARAM_PTR("mb", mb);
+       DCHECK_TYPE("mb", mb, "menubar");
 
-       menu = ewl_imenu_new();
-       ewl_menu_item_image_set(EWL_MENU_ITEM(menu), img);
-       ewl_menu_item_text_set(EWL_MENU_ITEM(menu), title);
-       ewl_container_child_append(EWL_CONTAINER(mb), menu);
-       ewl_object_fill_policy_set(EWL_OBJECT(menu), EWL_FLAG_FILL_NONE);
-       ewl_widget_show(menu);
+       ewl_box_orientation_set(EWL_BOX(mb), o);
+       if (o == EWL_ORIENTATION_HORIZONTAL) {
+               ewl_object_fill_policy_set(EWL_OBJECT(mb),
+                               EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
+               ewl_box_orientation_set(EWL_BOX(mb->inner_box), 
+                               EWL_ORIENTATION_HORIZONTAL);
+               ewl_object_fill_policy_set(EWL_OBJECT(mb->inner_box),
+                               EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
 
-       DRETURN_PTR(EWL_WIDGET(menu), DLEVEL_STABLE);
+       } else if (o == EWL_ORIENTATION_VERTICAL) {
+               ewl_object_fill_policy_set(EWL_OBJECT(mb),
+                               EWL_FLAG_FILL_VFILL | EWL_FLAG_FILL_HSHRINK);
+               ewl_box_orientation_set(EWL_BOX(mb->inner_box),
+                               EWL_ORIENTATION_VERTICAL);
+               ewl_object_fill_policy_set(EWL_OBJECT(mb->inner_box),
+                               EWL_FLAG_FILL_VFILL | EWL_FLAG_FILL_HSHRINK);
+       }
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
 /**
- * @param mb: The Ewl_Menubar to add the seperator too.
- * @return Returns NULL on failure and a new Seperator on success
- * @brief Creates a new seperator in the menubar and returns it to the app.
+ * @param mb: The menubar to get the orientation from
+ * @return Returns the orientation of the menubar
  */
-Ewl_Widget *ewl_menubar_seperator_add(Ewl_Menubar *mb)
+Ewl_Orientation
+ewl_menubar_orientation_get(Ewl_Menubar *mb)
 {
-       Ewl_Widget *separator = NULL;
-       Ewl_Orientation orient;
-
        DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR_RET("mb", mb, FALSE);
+       DCHECK_PARAM_PTR_RET("mb", mb, EWL_ORIENTATION_HORIZONTAL);
+       DCHECK_TYPE_RET("mb", mb, "menubar", EWL_ORIENTATION_HORIZONTAL);
 
-       orient = ewl_box_orientation_get(EWL_BOX(mb));
-       if (orient == EWL_ORIENTATION_HORIZONTAL)
-               orient = EWL_ORIENTATION_VERTICAL;
-       else if (orient == EWL_ORIENTATION_VERTICAL)
-               orient = EWL_ORIENTATION_HORIZONTAL;
-
-       separator = ewl_separator_new(orient);
-       ewl_container_child_append(EWL_CONTAINER(mb), separator);
-       ewl_widget_show(separator);
-
-       DRETURN_PTR(EWL_WIDGET(separator), DLEVEL_STABLE);
+       DRETURN_INT(ewl_box_orientation_get(EWL_BOX(mb)), DLEVEL_STABLE);
 }
 
-
-
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_menubar.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ewl_menubar.h       10 Apr 2005 05:05:18 -0000      1.4
+++ ewl_menubar.h       24 Oct 2005 04:39:57 -0000      1.5
@@ -32,27 +32,16 @@
 struct Ewl_Menubar
 {
        Ewl_Box          outer_box;  /**< Inherit from Ewl_Box */
-       Ewl_Box         *inner_box; /**< The box to pack the widgets into */
+       Ewl_Widget      *inner_box; /**< The box to pack the widgets into */
 };
 
-/**
- * @def ewl_hmenubar_new()
- * Shortcut to allocate a new horizontal Ewl_Menubar
- */
-#define ewl_hmenubar_new() ewl_menubar_new(EWL_ORIENTATION_HORIZONTAL)
-
-/**
- * @def ewl_vmenubar_new()
- * Shortcut to allocate a new vertical Ewl_Menubar
- */
-#define ewl_vmenubar_new() ewl_menubar_new(EWL_ORIENTATION_VERTICAL)
-
-Ewl_Widget     *ewl_menubar_new(Ewl_Orientation orientation);
-int             ewl_menubar_init(Ewl_Menubar *mb, Ewl_Orientation orientation);
-
+Ewl_Widget     *ewl_menubar_new(void);
+Ewl_Widget     *ewl_hmenubar_new(void);
+Ewl_Widget     *ewl_vmenubar_new(void);
+int             ewl_menubar_init(Ewl_Menubar *mb);
 
-Ewl_Widget *ewl_menubar_menu_add(Ewl_Menubar *mb, char *img, char *title);
-Ewl_Widget *ewl_menubar_seperator_add(Ewl_Menubar *mb);
+void            ewl_menubar_orientation_set(Ewl_Menubar *mb, Ewl_Orientation 
o);
+Ewl_Orientation         ewl_menubar_orientation_get(Ewl_Menubar *mb);
 
 /**
   * @}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_separator.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- ewl_separator.h     5 Oct 2005 05:50:06 -0000       1.5
+++ ewl_separator.h     24 Oct 2005 04:39:57 -0000      1.6
@@ -40,9 +40,9 @@
        Ewl_Orientation orientation; /**< Sets drawing horizontal or vertical */
 };
 
-Ewl_Widget     *ewl_separator_new();
-Ewl_Widget     *ewl_hseparator_new();
-Ewl_Widget     *ewl_vseparator_new();
+Ewl_Widget     *ewl_separator_new(void);
+Ewl_Widget     *ewl_hseparator_new(void);
+Ewl_Widget     *ewl_vseparator_new(void);
 int             ewl_separator_init(Ewl_Separator * s);
 void            ewl_separator_orientation_set(Ewl_Separator *s, 
Ewl_Orientation o);
 Ewl_Orientation ewl_separator_orientation_get(Ewl_Separator *s);




-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to