Enlightenment CVS committal Author : pfritz Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_combo.c ewl_combo.h ewl_context_menu.c ewl_context_menu.h Log Message: add ewl_combo_popup_container_set() =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_combo.c,v retrieving revision 1.51 retrieving revision 1.52 diff -u -3 -r1.51 -r1.52 --- ewl_combo.c 23 Mar 2007 22:06:30 -0000 1.51 +++ ewl_combo.c 26 Mar 2007 18:41:40 -0000 1.52 @@ -199,6 +199,27 @@ DRETURN_INT(combo->scrollable, DLEVEL_STABLE); } + +/** + * @param combo: The Ewl_Combo to use + * @param editable: The Container to use in the popup + * @return Returns no value + */ +void +ewl_combo_popup_container_set(Ewl_Combo *combo, Ewl_Container *c) +{ + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("combo", combo); + DCHECK_TYPE("combo", combo, EWL_COMBO_TYPE); + + if (combo->scrollable) + combo->scrollable = FALSE; + + ewl_context_menu_container_set(EWL_CONTEXT_MENU(combo->popup), c); + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + /** * @internal * @param w: UNUSED =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_combo.h,v retrieving revision 1.27 retrieving revision 1.28 diff -u -3 -r1.27 -r1.28 --- ewl_combo.h 17 Mar 2007 08:55:38 -0000 1.27 +++ ewl_combo.h 26 Mar 2007 18:41:40 -0000 1.28 @@ -69,6 +69,9 @@ unsigned int scrollable); unsigned int ewl_combo_scrollable_get(Ewl_Combo *combo); +void ewl_combo_popup_container_set(Ewl_Combo *combo, + Ewl_Container *c); + /* * Internally used callbacks, override at your own risk. =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_context_menu.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- ewl_context_menu.c 22 Mar 2007 19:29:12 -0000 1.7 +++ ewl_context_menu.c 26 Mar 2007 18:41:40 -0000 1.8 @@ -197,6 +197,11 @@ red = ewl_container_end_redirect_get(c); if (!red) red = c; + + /* we need to keep a reference to the old callbacks before we + * override them */ + cm->child_add = red->child_add; + cm->child_remove = red->child_remove; ewl_container_add_notify_set(red, ewl_context_menu_cb_child_add); ewl_container_remove_notify_set(red, ewl_context_menu_cb_child_remove); @@ -419,7 +424,7 @@ void ewl_context_menu_cb_child_add(Ewl_Container *c, Ewl_Widget *w) { - Ewl_Widget *cm; + Ewl_Context_Menu *cm; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR("c", c); @@ -427,14 +432,17 @@ DCHECK_TYPE("c", c, EWL_CONTAINER_TYPE); DCHECK_TYPE("w", w, EWL_WIDGET_TYPE); + cm = EWL_CONTEXT_MENU(ewl_embed_widget_find(EWL_WIDGET(c))); + + /* call the overridden callback first */ + if (cm->child_add) + cm->child_add(c, w); + if (ewl_widget_internal_is(w) || !ewl_widget_focusable_get(w)) DRETURN(DLEVEL_STABLE); - cm = EWL_WIDGET(ewl_embed_widget_find(EWL_WIDGET(c))); - if (EWL_MENU_IS(w)) { - - EWL_MENU_ITEM(w)->inmenu = cm; - } + if (EWL_MENU_IS(w)) + EWL_MENU_ITEM(w)->inmenu = EWL_WIDGET(cm); else ewl_callback_append(w, EWL_CALLBACK_CLICKED, ewl_context_menu_cb_child_clicked, cm); @@ -453,14 +461,20 @@ * @brief The child remove callback */ void -ewl_context_menu_cb_child_remove(Ewl_Container *c, Ewl_Widget *w, - int idx __UNUSED__) +ewl_context_menu_cb_child_remove(Ewl_Container *c, Ewl_Widget *w, int idx) { + Ewl_Context_Menu *cm; + DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR("c", c); DCHECK_PARAM_PTR("w", w); DCHECK_TYPE("c", c, EWL_CONTAINER_TYPE); DCHECK_TYPE("w", w, EWL_WIDGET_TYPE); + + cm = EWL_CONTEXT_MENU(ewl_embed_widget_find(EWL_WIDGET(c))); + /* call the overridden callback first */ + if (cm->child_remove) + cm->child_remove(c, w, idx); if (ewl_widget_internal_is(w) || !ewl_widget_focusable_get(w)) DRETURN(DLEVEL_STABLE); =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_context_menu.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- ewl_context_menu.h 17 Mar 2007 08:55:38 -0000 1.4 +++ ewl_context_menu.h 26 Mar 2007 18:41:40 -0000 1.5 @@ -44,6 +44,8 @@ Ewl_Popup popup; /**< Inherit from Ewl_Popup */ Ewl_Widget *open_menu; /**< a pointer to the current open submenu */ Ewl_Widget *container; /**< the container holding the children */ + Ewl_Child_Add child_add; /**< the overridden add cb of the container */ + Ewl_Child_Remove child_remove; /** < the overridden remove cb */ }; Ewl_Widget *ewl_context_menu_new(void); ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs