Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src


Modified Files:
        ewl_container.c ewl_container.h ewl_object.c ewl_row.c 
        ewl_row.h ewl_tree.h 


Log Message:
Fixup the calls to the container_init function. Fill out the table code a bit
more.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_container.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -3 -r1.28 -r1.29
--- ewl_container.c     19 Feb 2003 02:18:05 -0000      1.28
+++ ewl_container.c     20 Feb 2003 05:17:40 -0000      1.29
@@ -26,7 +26,7 @@
  */
 void
 ewl_container_init(Ewl_Container * c, char *appearance, Ewl_Child_Add add,
-                  Ewl_Child_Remove remove, Ewl_Child_Resize rs)
+                  Ewl_Child_Resize rs, Ewl_Child_Remove remove)
 {
        Ewl_Widget     *w;
 
@@ -430,6 +430,46 @@
         */
        while ((w = ewd_list_goto_last(c->children)))
                ewl_container_remove_child(c, w);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * ewl_container_prefer_largest - set preferred size to widest child
+ * @c: the container to change preferred size
+ *
+ * Returns no value. This function can be used by any container which wishes
+ * to set it's preferred width to that of it's widest child.
+ */
+void
+ewl_container_prefer_largest(Ewl_Container *c, Ewl_Orientation o)
+{
+       Ewl_Object *child;
+       int curr_size, max_size = 0;
+       unsigned int (*get_size)(Ewl_Object *object);
+       void (*set_size)(Ewl_Object *object, unsigned int size);
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       DCHECK_PARAM_PTR("c", c);
+
+       if (o == EWL_ORIENTATION_HORIZONTAL) {
+               get_size = ewl_object_get_preferred_w;
+               set_size = ewl_object_set_preferred_w;
+       }
+       else {
+               get_size = ewl_object_get_preferred_h;
+               set_size = ewl_object_set_preferred_h;
+       }
+
+       ewd_list_goto_first(c->children);
+       while ((child = ewd_list_next(c->children))) {
+               curr_size = get_size(child);
+               if (curr_size > max_size)
+                       max_size = curr_size;
+       }
+
+       set_size(EWL_OBJECT(c), max_size);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_container.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- ewl_container.h     19 Feb 2003 02:18:05 -0000      1.16
+++ ewl_container.h     20 Feb 2003 05:17:40 -0000      1.17
@@ -56,8 +56,8 @@
 };
 
 void            ewl_container_init(Ewl_Container * widget, char *appearance,
-                                  Ewl_Child_Add add, Ewl_Child_Remove remove,
-                                  Ewl_Child_Resize rs);
+                                  Ewl_Child_Add add, Ewl_Child_Resize rs,
+                                  Ewl_Child_Remove remove);
 void            ewl_container_add_notify(Ewl_Container * container,
                                         Ewl_Child_Add add);
 void            ewl_container_remove_notify(Ewl_Container * container,
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_object.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- ewl_object.c        19 Feb 2003 02:18:06 -0000      1.27
+++ ewl_object.c        20 Feb 2003 05:17:40 -0000      1.28
@@ -277,9 +277,11 @@
 
        add = INSET_HORIZONTAL(o) + PADDING_HORIZONTAL(o);
 
+       /*
        if (PREFERRED_W(o) < MINIMUM_W(o))
                temp = MINIMUM_W(o);
        else
+       */
                temp = PREFERRED_W(o);
 
        temp += add;
@@ -301,14 +303,16 @@
 
        add = INSET_VERTICAL(o) + PADDING_VERTICAL(o);
 
+       /*
        if (PREFERRED_H(o) < MINIMUM_H(o))
-               add += MINIMUM_H(o);
+               temp = MINIMUM_H(o);
        else
-               add += PREFERRED_H(o);
+       */
+               temp = PREFERRED_H(o);
 
        temp += add;
 
-       DRETURN_INT(add, DLEVEL_STABLE);
+       DRETURN_INT(temp, DLEVEL_STABLE);
 }
 
 /**
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_row.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ewl_row.c   19 Feb 2003 02:18:06 -0000      1.4
+++ ewl_row.c   20 Feb 2003 05:17:40 -0000      1.5
@@ -53,20 +53,35 @@
 }
 
 /**
- * ewl_row_set_column_table - set the table of constraints on cell widths
+ * ewl_row_set_column_bounds - set the table of constraints on cell widths
  * @row: the row to change the column table
- * @colw: the array of column widths, NULL causes no constraints
+ * @base: base position for finding column widths, NULL causes no constraints
+ * @bounds: the array of column width bounds, NULL causes no constraints
  *
- * Returns no value. The table of widths for @row is changed to @colw, if
- * @colw is NULL, then each cell is given it's preferred size.
+ * Returns no value. The table of widths for @row is changed to @bounds, rows
+ * calculate their actual width based on the position of @base. You must set
+ * both of these variables to set one. It is strongly recommended that you add
+ * a configure callback to the widget that contains this table and base to be
+ * notified when the values change. If @base or @bounds is NULL, then each cell
+ * is given it's preferred size.
  */
-void ewl_row_set_column_table(Ewl_Row *row, int n, unsigned int **colw)
+void
+ewl_row_set_column_bounds(Ewl_Row *row, int n, unsigned int *base,
+               unsigned int **bounds)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
 
        DCHECK_PARAM_PTR("row", row);
 
-       row->colw = colw;
+       if (!base || !bounds) {
+               row->base = NULL;
+               row->bounds = NULL;
+       }
+       else {
+               row->base = base;
+               row->bounds = bounds;
+       }
+
        ewl_widget_configure(EWL_WIDGET(row));
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -88,19 +103,20 @@
        x = CURRENT_X(w);
        ewd_list_goto_first(c->children);
 
-       /*
-        * Look up the widths and heights from it's column width table.
-        */
        int i = 0;
        while ((child = ewd_list_next(c->children))) {
-               if (row->colw && row->colw[i]) {
-                       ewl_object_request_geometry(child, x, CURRENT_Y(w),
-                                       *row->colw[i], PREFERRED_H(child));
+               ewl_object_request_position(child, x, CURRENT_Y(w));
+
+               if (row->bounds && row->bounds[i]) {
+                       ewl_object_request_w(child,
+                                       *row->base + *row->bounds[i] - x);
                }
                else {
-                       ewl_object_request_geometry(child, x, CURRENT_Y(w),
-                                       PREFERRED_W(child), PREFERRED_H(child));
+                       ewl_object_request_w(child,
+                                       ewl_object_get_preferred_w(child));
                }
+               ewl_object_request_h(child,
+                               ewl_object_get_preferred_h(EWL_OBJECT(w)));
                i++;
        }
 
@@ -124,7 +140,7 @@
                ewl_object_set_preferred_h(EWL_OBJECT(c), size);
        }
 
-       ewl_object_set_preferred_w(EWL_OBJECT(c), PREFERRED_W(w) +
+       ewl_object_set_preferred_w(EWL_OBJECT(c), PREFERRED_W(c) +
                        ewl_object_get_preferred_w(EWL_OBJECT(w)));
 }
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_row.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ewl_row.h   19 Feb 2003 02:18:06 -0000      1.4
+++ ewl_row.h   20 Feb 2003 05:17:40 -0000      1.5
@@ -12,7 +12,8 @@
        Ewl_Container container;
        Ewl_Object *max;
 
-       unsigned int **colw;
+       unsigned int *base;
+       unsigned int **bounds;
 };
 
 Ewl_Widget *ewl_row_new();
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_tree.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ewl_tree.h  2 Feb 2003 21:03:24 -0000       1.1
+++ ewl_tree.h  20 Feb 2003 05:17:40 -0000      1.2
@@ -19,7 +19,9 @@
        unsigned int *colw;
        unsigned int *rowh;
 
-       unsigned int def_rowh;
+       unsigned int **colbases;
+       unsigned int **colbounds;
+
        int indent;
 };
 




-------------------------------------------------------
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
The most comprehensive and flexible code editor you can use.
Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
www.slickedit.com/sourceforge
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to