Enlightenment CVS committal
Author : dj2
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src/lib
Modified Files:
ewl_imenu.c ewl_imenu.h
Log Message:
- rename Ewl_IMenu to Ewl_Imenu
- formatting /type checking
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_imenu.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- ewl_imenu.c 10 Oct 2005 18:43:31 -0000 1.5
+++ ewl_imenu.c 24 Oct 2005 00:54:07 -0000 1.6
@@ -7,37 +7,42 @@
* @return Returns a pointer to a new menu on success, NULL on failure.
* @brief Create a new internal menu
*/
-Ewl_Widget *ewl_imenu_new(void)
+Ewl_Widget *
+ewl_imenu_new(void)
{
- Ewl_IMenu *menu;
+ Ewl_Imenu *menu;
DENTER_FUNCTION(DLEVEL_STABLE);
- menu = NEW(Ewl_IMenu, 1);
+ menu = NEW(Ewl_Imenu, 1);
if (!menu)
DRETURN_PTR(NULL, DLEVEL_STABLE);
- ewl_imenu_init(menu);
+ if (!ewl_imenu_init(menu)) {
+ ewl_widget_destroy(EWL_WIDGET(menu));
+ menu = NULL;
+ }
DRETURN_PTR(EWL_WIDGET(menu), DLEVEL_STABLE);
}
-
/**
* @param menu: the menu to initialize
* @return Returns no value.
* @brief Initialize an internal menu to starting values
*/
-void ewl_imenu_init(Ewl_IMenu * menu)
+int
+ewl_imenu_init(Ewl_Imenu *menu)
{
DENTER_FUNCTION(DLEVEL_STABLE);
-
- DCHECK_PARAM_PTR("menu", menu);
+ DCHECK_PARAM_PTR_RET("menu", menu, FALSE);
/*
* Initialize the defaults of the inherited fields.
*/
- ewl_menu_base_init(EWL_MENU_BASE(menu));
+ if (!ewl_menu_base_init(EWL_MENU_BASE(menu)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
ewl_widget_inherit(EWL_WIDGET(menu), "imenu");
ewl_callback_append(EWL_WIDGET(menu), EWL_CALLBACK_SELECT,
@@ -60,16 +65,20 @@
ewl_object_alignment_set(EWL_OBJECT(menu->base.popup),
EWL_FLAG_ALIGN_LEFT | EWL_FLAG_ALIGN_TOP);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
-void ewl_imenu_configure_cb(Ewl_Widget *w, void *ev_data __UNUSED__,
+void
+ewl_imenu_configure_cb(Ewl_Widget *w, void *ev_data __UNUSED__,
void *user_data __UNUSED__)
{
- Ewl_IMenu *menu = EWL_IMENU(w);
+ Ewl_Imenu *menu;
DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR("w", w);
+ DCHECK_TYPE("w", w, "widget");
+ menu = EWL_IMENU(w);
/*
* Position the popup menu relative to the menu.
*/
@@ -85,23 +94,25 @@
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
-void ewl_imenu_expand_cb(Ewl_Widget * w, void *ev_data __UNUSED__,
+void
+ewl_imenu_expand_cb(Ewl_Widget *w, void *ev_data __UNUSED__,
void *user_data __UNUSED__)
{
- Ewl_IMenu *menu;
- Ewl_Embed *emb;
+ Ewl_Imenu *menu;
+ Ewl_Embed *emb;
DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR("w", w);
+ DCHECK_TYPE("w", w, "widget");
menu = EWL_IMENU(w);
-
if (!REALIZED(menu->base.popup)) {
emb = ewl_embed_widget_find(w);
ewl_container_child_append(EWL_CONTAINER(emb),
menu->base.popup);
}
-
ewl_widget_show(menu->base.popup);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
+
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_imenu.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ewl_imenu.h 10 Oct 2005 18:43:31 -0000 1.3
+++ ewl_imenu.h 24 Oct 2005 00:54:07 -0000 1.4
@@ -18,34 +18,32 @@
/**
* A simple internal menu, it is limited to drawing within the current evas.
*/
-typedef struct Ewl_IMenu Ewl_IMenu;
+typedef struct Ewl_Imenu Ewl_Imenu;
/**
* @def EWL_IMENU(menu)
- * Typecasts a pointer to an Ewl_IMenu pointer.
+ * Typecasts a pointer to an Ewl_Imenu pointer.
*/
-#define EWL_IMENU(menu) ((Ewl_IMenu *) menu)
+#define EWL_IMENU(menu) ((Ewl_Imenu *) menu)
/**
- * @struct Ewl_IMenu
+ * @struct Ewl_Imenu
* Inherits from the Ewl_Menu_Base and does not extend the structure, but
* provides policy for drawing on the current evas.
*/
-struct Ewl_IMenu
+struct Ewl_Imenu
{
Ewl_Menu_Base base;
};
-Ewl_Widget *ewl_imenu_new(void);
-void ewl_imenu_init(Ewl_IMenu * menu);
+Ewl_Widget *ewl_imenu_new(void);
+int ewl_imenu_init(Ewl_Imenu *menu);
/*
* Internally used callbacks, override at your own risk.
*/
-void ewl_imenu_configure_cb(Ewl_Widget *w, void *ev_data,
- void *user_data);
-void ewl_imenu_expand_cb(Ewl_Widget * w, void *ev_data,
- void *user_data);
+void ewl_imenu_configure_cb(Ewl_Widget *w, void *ev_data, void *user_data);
+void ewl_imenu_expand_cb(Ewl_Widget *w, void *ev_data, void *user_data);
/**
* @}
-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs