Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_container.c ewl_container.h Log Message: - add calls to the container to get children and indexes taking internal widgets into account =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_container.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -3 -r1.32 -r1.33 --- ewl_container.c 8 Feb 2006 05:02:25 -0000 1.32 +++ ewl_container.c 8 Feb 2006 23:30:00 -0000 1.33 @@ -428,13 +428,9 @@ DRETURN_INT(count, DLEVEL_STABLE); } -/** - * @param parent: The container to get the child from - * @param index: The child index to return - * @return Returns the widget at the given index, or NULL if not found - */ -Ewl_Widget * -ewl_container_child_get(Ewl_Container *parent, int index) +static Ewl_Widget * +ewl_container_child_helper_get(Ewl_Container *parent, int index, + unsigned int skip) { Ewl_Container *container = NULL; Ewl_Widget *child; @@ -450,7 +446,7 @@ ecore_list_goto_first(container->children); while ((child = ecore_list_next(container->children))) { - if (ewl_widget_internal_is(child)) continue; + if (skip && ewl_widget_internal_is(child)) continue; if (count == index) break; count ++; } @@ -459,12 +455,47 @@ } /** - * @param parent: The container to search - * @param w: The child to search for - * @return Returns the index of the child in the parent + * @param parent: The container to get the child from + * @param index: The child index to return + * @return Returns the widget at the given index, or NULL if not found */ -unsigned int -ewl_container_child_index_get(Ewl_Container *parent, Ewl_Widget *w) +Ewl_Widget * +ewl_container_child_get(Ewl_Container *parent, int index) +{ + Ewl_Widget *w; + + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR_RET("parent", parent, NULL); + DCHECK_TYPE_RET("parent", parent, EWL_CONTAINER_TYPE, NULL); + + w = ewl_container_child_helper_get(parent, index, TRUE); + + DRETURN_PTR(w, DLEVEL_STABLE); +} + +/** + * @param parent: The container to get the child from + * @param index: The child index to return + * @return Returns the widget at the given index including internal widgets, + * or NULL if not found + */ +Ewl_Widget * +ewl_container_child_internal_get(Ewl_Container *parent, int index) +{ + Ewl_Widget *w; + + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR_RET("parent", parent, NULL); + DCHECK_TYPE_RET("parent", parent, EWL_CONTAINER_TYPE, NULL); + + w = ewl_container_child_helper_get(parent, index, FALSE); + + DRETURN_PTR(w, DLEVEL_STABLE); +} + +static unsigned int +ewl_container_child_index_helper_get(Ewl_Container *parent, Ewl_Widget *w, + unsigned int skip) { unsigned int idx = 0; Ewl_Container *container; @@ -481,7 +512,7 @@ ecore_list_goto_first(container->children); while ((child = ecore_list_next(container->children))) { - if (ewl_widget_internal_is(child)) continue; + if (skip && ewl_widget_internal_is(child)) continue; if (child == w) break; idx ++; } @@ -490,6 +521,49 @@ } /** + * @param parent: The container to search + * @param w: The child to search for + * @return Returns the index of the child in the parent + */ +unsigned int +ewl_container_child_index_get(Ewl_Container *parent, Ewl_Widget *w) +{ + unsigned int idx = 0; + + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR_RET("parent", parent, idx); + DCHECK_PARAM_PTR_RET("w", w, idx); + DCHECK_TYPE_RET("parent", parent, EWL_CONTAINER_TYPE, idx); + DCHECK_TYPE_RET("w", w, EWL_WIDGET_TYPE, idx); + + idx = ewl_container_child_index_helper_get(parent, w, TRUE); + + DRETURN_INT(idx, DLEVEL_STABLE); +} + +/** + * @param parent: The container to search + * @param w: The child to search for + * @return Returns the index of the child in the parent including internal + * widgets + */ +unsigned int +ewl_container_child_index_internal_get(Ewl_Container *parent, Ewl_Widget *w) +{ + unsigned int idx = 0; + + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR_RET("parent", parent, idx); + DCHECK_PARAM_PTR_RET("w", w, idx); + DCHECK_TYPE_RET("parent", parent, EWL_CONTAINER_TYPE, idx); + DCHECK_TYPE_RET("w", w, EWL_WIDGET_TYPE, idx); + + idx = ewl_container_child_index_helper_get(parent, w, FALSE); + + DRETURN_INT(idx, DLEVEL_STABLE); +} + +/** * @param w: the child widget that has had it's preferred size changed * @param size: the amount of change in size * @param o: the orientation of the size change =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_container.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- ewl_container.h 8 Feb 2006 04:52:52 -0000 1.14 +++ ewl_container.h 8 Feb 2006 23:30:01 -0000 1.15 @@ -118,8 +118,11 @@ void ewl_container_child_resize(Ewl_Widget *w, int size, Ewl_Orientation o); Ewl_Widget *ewl_container_child_get(Ewl_Container *parent, int index); +Ewl_Widget *ewl_container_child_internal_get(Ewl_Container *parent, int index); unsigned int ewl_container_child_index_get(Ewl_Container *parent, Ewl_Widget *child); +unsigned int ewl_container_child_index_internal_get(Ewl_Container *parent, + Ewl_Widget *child); void ewl_container_child_iterate_begin(Ewl_Container *c); Ewl_Widget *ewl_container_child_next(Ewl_Container *c); void ewl_container_child_iterator_set(Ewl_Container *c, ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs