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:
- when moving to a specifc index in the container skip over internal widgets
- add function to get the index of a specifc widget

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_container.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- ewl_container.c     17 Dec 2005 21:55:55 -0000      1.20
+++ ewl_container.c     22 Dec 2005 23:42:40 -0000      1.21
@@ -240,6 +240,9 @@
 void
 ewl_container_child_insert(Ewl_Container *pc, Ewl_Widget *child, int index)
 {
+       Ewl_Widget *cur;
+       int idx = 0;
+
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("pc", pc);
        DCHECK_PARAM_PTR("child", child);
@@ -257,7 +260,14 @@
        while (pc->redirect)
                pc = pc->redirect;
 
-       ecore_list_goto_index(pc->children, index);
+       ecore_list_goto_first(pc->children);
+       while ((cur = ecore_list_next(pc->children)))
+       {
+               if (ewl_widget_internal_is(cur)) continue;
+
+               idx++;
+               if (idx == index) break;
+       }
        ecore_list_insert(pc->children, child);
        ewl_widget_parent_set(child, EWL_WIDGET(pc));
        ewl_container_child_add_call(pc, child);
@@ -388,6 +398,37 @@
 }
 
 /**
+ * @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;
+       Ewl_Container *container;
+       Ewl_Widget *child;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR_RET("parent", parent, idx);
+       DCHECK_PARAM_PTR_RET("w", w, idx);
+       DCHECK_TYPE_RET("parent", parent, "container", idx);
+       DCHECK_TYPE_RET("w", w, "widget", idx);
+
+       container = parent;
+       while (container->redirect) container = container->redirect;
+
+       ecore_list_goto_first(container->children);
+       while ((child = ecore_list_next(container->children))) {
+               if (ewl_widget_internal_is(child)) continue;
+               if (child == w) break;
+               idx ++;
+       }
+
+       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.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- ewl_container.h     13 Nov 2005 06:48:55 -0000      1.8
+++ ewl_container.h     22 Dec 2005 23:42:40 -0000      1.9
@@ -114,6 +114,8 @@
 void            ewl_container_child_resize(Ewl_Widget *w, int size,
                                           Ewl_Orientation o);
 Ewl_Widget     *ewl_container_child_get(Ewl_Container *parent, int index);
+unsigned int   ewl_container_child_index_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://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to