From: Enlightenment C. <no...@cv...> - 2006-08-10 03:17:19
|
Enlightenment CVS committal Author : ningerso Project : e17 Module : libs/ewl Dir : e17/libs/ewl/src/lib Modified Files: ewl_container.c ewl_container.h Log Message: Propagate the enable and disable states to children of containers automatically. =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_container.c,v retrieving revision 1.44 retrieving revision 1.45 diff -u -3 -r1.44 -r1.45 --- ewl_container.c 11 Jul 2006 21:05:55 -0000 1.44 +++ ewl_container.c 10 Aug 2006 08:17:16 -0000 1.45 @@ -59,6 +59,10 @@ ewl_container_unrealize_cb, NULL); ewl_callback_append(w, EWL_CALLBACK_REPARENT, ewl_container_reparent_cb, NULL); + ewl_callback_append(w, EWL_CALLBACK_WIDGET_ENABLE, + ewl_container_enable_cb, NULL); + ewl_callback_append(w, EWL_CALLBACK_WIDGET_DISABLE, + ewl_container_disable_cb, NULL); DRETURN_INT(TRUE, DLEVEL_STABLE); } @@ -1256,6 +1260,70 @@ ecore_dlist_goto_first(EWL_CONTAINER(w)->children); while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children)) != NULL) { ewl_widget_reparent(child); + } + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + +/** + * @internal + * @param w: The widget to work with + * @param ev_data: UNUSED + * @param user_data: UNUSED + * @return Returns no value + * @brief When enabling a container, pass the signal to the children. + */ +void +ewl_container_enable_cb(Ewl_Widget *w, void *ev_data __UNUSED__, + void *user_data __UNUSED__) +{ + Ewl_Widget *child; + + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("w", w); + DCHECK_TYPE("w", w, EWL_WIDGET_TYPE); + + if (!EWL_CONTAINER(w)->children) + DRETURN(DLEVEL_STABLE); + + /* + * Reparent all of the containers children + */ + ecore_dlist_goto_first(EWL_CONTAINER(w)->children); + while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children)) != NULL) { + ewl_widget_enable(child); + } + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + +/** + * @internal + * @param w: The widget to work with + * @param ev_data: UNUSED + * @param user_data: UNUSED + * @return Returns no value + * @brief When enabling a container, pass the signal to the children. + */ +void +ewl_container_disable_cb(Ewl_Widget *w, void *ev_data __UNUSED__, + void *user_data __UNUSED__) +{ + Ewl_Widget *child; + + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("w", w); + DCHECK_TYPE("w", w, EWL_WIDGET_TYPE); + + if (!EWL_CONTAINER(w)->children) + DRETURN(DLEVEL_STABLE); + + /* + * Reparent all of the containers children + */ + ecore_dlist_goto_first(EWL_CONTAINER(w)->children); + while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children)) != NULL) { + ewl_widget_disable(child); } DLEAVE_FUNCTION(DLEVEL_STABLE); =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_container.h,v retrieving revision 1.22 retrieving revision 1.23 diff -u -3 -r1.22 -r1.23 --- ewl_container.h 11 Jul 2006 21:05:55 -0000 1.22 +++ ewl_container.h 10 Aug 2006 08:17:16 -0000 1.23 @@ -167,6 +167,8 @@ void ewl_container_configure_cb(Ewl_Widget * w, void *ev_data, void *user_data); void ewl_container_reparent_cb(Ewl_Widget * w, void *ev_data, void *user_data); void ewl_container_unrealize_cb(Ewl_Widget *w, void *ev_data, void *user_data); +void ewl_container_enable_cb(Ewl_Widget *w, void *ev_data, void *user_data); +void ewl_container_disable_cb(Ewl_Widget *w, void *ev_data, void *user_data); /** * @} |