Enlightenment CVS committal
Author : pfritz
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src/lib
Modified Files:
ewl_box.c ewl_container.c ewl_container.h
Log Message:
add ewl_container_child_count_visible_get()
use this function in the box code, this solves some spacing problems
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_box.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -3 -r1.43 -r1.44
--- ewl_box.c 1 Jul 2007 18:45:51 -0000 1.43
+++ ewl_box.c 8 Jul 2007 19:08:56 -0000 1.44
@@ -301,7 +301,7 @@
ewl_box_cb_child_homogeneous_show(c, NULL);
}
else {
- int nodes, space;
+ int nodes;
ewl_callback_del(EWL_WIDGET(b), EWL_CALLBACK_CONFIGURE,
ewl_box_cb_configure_homogeneous);
@@ -316,15 +316,14 @@
/*
* calculate the new preferred size
*/
- nodes = ecore_dlist_nodes(c->children) - 1;
- space = (nodes > 1) ? b->spacing : 0;
+ nodes = ewl_container_child_count_visible_get(c) - 1;
if (b->orientation == EWL_ORIENTATION_HORIZONTAL) {
ewl_container_largest_prefer(c,
EWL_ORIENTATION_VERTICAL);
ewl_container_sum_prefer(c,
EWL_ORIENTATION_HORIZONTAL);
ewl_object_preferred_inner_w_set(EWL_OBJECT(b),
- PREFERRED_W(b) + space * nodes);
+ PREFERRED_W(b) + b->spacing * nodes);
}
else {
ewl_container_largest_prefer(c,
@@ -332,7 +331,7 @@
ewl_container_sum_prefer(c,
EWL_ORIENTATION_VERTICAL);
ewl_object_preferred_inner_h_set(EWL_OBJECT(b),
- PREFERRED_H(b) + space * nodes);
+ PREFERRED_H(b) + b->spacing * nodes);
}
}
@@ -377,10 +376,9 @@
w = EWL_WIDGET(b);
- nodes = ecore_dlist_nodes(EWL_CONTAINER(b)->children);
+ nodes = ewl_container_child_count_visible_get(EWL_CONTAINER(b)) - 1;
- if (nodes) {
- nodes--;
+ if (nodes > 0) {
if (b->orientation == EWL_ORIENTATION_HORIZONTAL)
ewl_object_preferred_inner_w_set(EWL_OBJECT(w),
PREFERRED_W(w) - (nodes * b->spacing) +
@@ -436,7 +434,7 @@
b = EWL_BOX(w);
- fill_count = ecore_dlist_nodes(EWL_CONTAINER(w)->children);
+ fill_count = ewl_container_child_count_visible_get(EWL_CONTAINER(w));
/*
* Catch the easy case, and return.
@@ -523,12 +521,7 @@
if (ecore_dlist_is_empty(EWL_CONTAINER(w)->children))
DRETURN(DLEVEL_STABLE);
- num = 0;
- ecore_dlist_goto_first(EWL_CONTAINER(w)->children);
- while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children))) {
- if (VISIBLE(child))
- num++;
- }
+ num = ewl_container_child_count_visible_get(EWL_CONTAINER(w));
if (!num)
DRETURN(DLEVEL_STABLE);
@@ -589,7 +582,8 @@
DCHECK_TYPE_RET("b", b, EWL_BOX_TYPE, 0);
DCHECK_PARAM_PTR_RET("spread", spread, 0);
- initial = *fill_size / ecore_dlist_nodes(EWL_CONTAINER(b)->children);
+ initial = *fill_size /
+ ewl_container_child_count_visible_get(EWL_CONTAINER(b));
/*
* Sort the children into lists dependant on their alignment within the
@@ -855,7 +849,7 @@
DCHECK_TYPE("c", c, EWL_BOX_TYPE);
DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
- if (ecore_dlist_nodes(c->children) > 1)
+ if (ewl_container_child_count_visible_get(c) > 1)
space = EWL_BOX(c)->spacing;
/*
@@ -906,7 +900,7 @@
DCHECK_PARAM_PTR("c", c);
DCHECK_TYPE("c", c, EWL_CONTAINER_TYPE);
- numc = ecore_dlist_nodes(c->children);
+ numc = ewl_container_child_count_visible_get(c);
if (numc > 1)
space = EWL_BOX(c)->spacing;
@@ -943,7 +937,7 @@
DCHECK_TYPE("c", c, EWL_BOX_TYPE);
DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
- if (ecore_dlist_nodes(c->children) > 1)
+ if (ewl_container_child_count_visible_get(c) > 1)
space = b->spacing;
if (b->orientation == EWL_ORIENTATION_HORIZONTAL) {
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_container.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -3 -r1.59 -r1.60
--- ewl_container.c 1 Apr 2007 21:48:06 -0000 1.59
+++ ewl_container.c 8 Jul 2007 19:08:56 -0000 1.60
@@ -465,6 +465,27 @@
DRETURN_INT(count, DLEVEL_STABLE);
}
+/**
+ * @param c: The container to get the child count from
+ * @return Returns the number of visible child widgets
+ * @brief Returns the number of visible child widgets in the container
+ *
+ * This function return the number of visible child widgets in this container,
+ * no matter if the container is set to redirect or not.
+ * Note: other than ewl_container_count_get() and
+ * ewl_container_count_internal_get() it does not return the number of
+ * children in the redirection end container.
+ */
+int
+ewl_container_child_count_visible_get(Ewl_Container *c)
+{
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET("c", c, 0);
+ DCHECK_TYPE_RET("c", c, EWL_CONTAINER_TYPE, 0);
+
+ DRETURN_INT(c->visible_children, DLEVEL_STABLE);
+}
+
static Ewl_Widget *
ewl_container_child_helper_get(Ewl_Container *parent, int index,
unsigned int skip)
@@ -1098,6 +1119,7 @@
DCHECK_TYPE("c", c, EWL_CONTAINER_TYPE);
DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
+ c->visible_children++;
if (c->child_show)
c->child_show(c, w);
@@ -1131,13 +1153,17 @@
if (DESTROYED(c))
DRETURN(DLEVEL_STABLE);
+ c->visible_children--;
+ if (c->visible_children < 0)
+ DWARNING("visible_children is %d\n", c->visible_children);
+
if (c->child_hide)
c->child_hide(c, w);
if (c->clip_box) {
const Evas_List *clippees;
clippees = evas_object_clipees_get(c->clip_box);
- if (!clippees)
+ if (!clippees)
evas_object_hide(c->clip_box);
}
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_container.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -3 -r1.31 -r1.32
--- ewl_container.h 4 Mar 2007 00:52:01 -0000 1.31
+++ ewl_container.h 8 Jul 2007 19:08:56 -0000 1.32
@@ -90,6 +90,7 @@
Ewl_Widget widget; /**< Inherit the basics of the widget. */
Ecore_DList *children; /**< List of children that are contained. */
+ int visible_children; /**< the number of visible children */
void *clip_box; /**< Clip box to bound widgets inside. */
@@ -141,6 +142,7 @@
Ewl_Container_Iterator i);
int ewl_container_child_count_get(Ewl_Container *c);
int ewl_container_child_count_internal_get(Ewl_Container *c);
+int ewl_container_child_count_visible_get(Ewl_Container *c);
void ewl_container_destroy(Ewl_Container *c);
void ewl_container_reset(Ewl_Container *c);
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs