Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src


Modified Files:
        ewl_box.c ewl_box.h ewl_container.h ewl_debug.h ewl_overlay.c 
        ewl_row.c ewl_scrollpane.c ewl_tree.c ewl_tree.h 


Log Message:
Work on the tree code and scrollpane's, moving towards fixing the horizontal
scroll problem. ifdef'd the debug macros.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_box.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -3 -r1.64 -r1.65
--- ewl_box.c   24 Mar 2004 04:11:09 -0000      1.64
+++ ewl_box.c   21 Apr 2004 05:18:52 -0000      1.65
@@ -206,21 +206,29 @@
        if (b->homogeneous == h)
                DRETURN(DLEVEL_STABLE);
 
+       b->homogeneous = h;
+
        if (h) {
                ewl_callback_del(EWL_WIDGET(b), EWL_CALLBACK_CONFIGURE,
                                ewl_box_configure_cb);
                ewl_callback_append(EWL_WIDGET(b), EWL_CALLBACK_CONFIGURE,
                                ewl_box_configure_homogeneous_cb, NULL);
+               ewl_container_show_notify(EWL_CONTAINER(b),
+                                         ewl_box_child_homogeneous_show_cb);
+               ewl_container_hide_notify(EWL_CONTAINER(b),
+                                         ewl_box_child_homogeneous_show_cb);
        }
        else {
                ewl_callback_del(EWL_WIDGET(b), EWL_CALLBACK_CONFIGURE,
                                ewl_box_configure_homogeneous_cb);
                ewl_callback_append(EWL_WIDGET(b), EWL_CALLBACK_CONFIGURE,
                                ewl_box_configure_cb, NULL);
+               ewl_container_show_notify(EWL_CONTAINER(b),
+                                         ewl_box_child_show_cb);
+               ewl_container_hide_notify(EWL_CONTAINER(b),
+                                         ewl_box_child_hide_cb);
        }
 
-       b->homogeneous = h;
-
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
@@ -659,7 +667,7 @@
 void
 ewl_box_child_show_cb(Ewl_Container * c, Ewl_Widget * w)
 {
-       int             space = 0;
+       int size, space = 0;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
 
@@ -670,18 +678,43 @@
         * Base the info used on the orientation of the box.
         */
        if (EWL_BOX(c)->orientation == EWL_ORIENTATION_HORIZONTAL) {
-               ewl_object_set_preferred_w(EWL_OBJECT(c), PREFERRED_W(c) +
-                               ewl_object_get_preferred_w(EWL_OBJECT(w)) +
-                               space);
+               size = PREFERRED_W(c) +
+                       ewl_object_get_preferred_w(EWL_OBJECT(w)) + space;
+               ewl_object_set_preferred_w(EWL_OBJECT(c), size);
                ewl_container_prefer_largest(c, EWL_ORIENTATION_VERTICAL);
        }
        else {
-               ewl_object_set_preferred_h(EWL_OBJECT(c), PREFERRED_H(c) +
-                               ewl_object_get_preferred_h(EWL_OBJECT(w)) +
-                               space);
+               size = PREFERRED_H(c) +
+                       ewl_object_get_preferred_h(EWL_OBJECT(w)) + space;
+               ewl_object_set_preferred_h(EWL_OBJECT(c), size);
                ewl_container_prefer_largest(c, EWL_ORIENTATION_HORIZONTAL);
        }
 
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+void
+ewl_box_child_homogeneous_show_cb(Ewl_Container * c, Ewl_Widget * w)
+{
+       int numc;
+       int size, space = 0;
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       numc = ecore_list_nodes(c->children);
+       numc--;
+       if (numc)
+               space = EWL_BOX(c)->spacing;
+
+       ewl_container_prefer_largest(c, EWL_ORIENTATION_HORIZONTAL);
+       ewl_container_prefer_largest(c, EWL_ORIENTATION_VERTICAL);
+       if (EWL_BOX(c)->orientation == EWL_ORIENTATION_HORIZONTAL) {
+               size = (PREFERRED_W(c) + space) * numc - space;
+               ewl_object_set_preferred_w(EWL_OBJECT(c), size);
+       }
+       else {
+               size = (PREFERRED_H(c) + space) * numc - space;
+               ewl_object_set_preferred_h(EWL_OBJECT(c), size);
+       }
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_box.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -3 -r1.31 -r1.32
--- ewl_box.h   18 Mar 2004 03:41:23 -0000      1.31
+++ ewl_box.h   21 Apr 2004 05:18:52 -0000      1.32
@@ -72,6 +72,8 @@
                                        int size, Ewl_Orientation o);
 void            ewl_box_child_show_cb(Ewl_Container * c, Ewl_Widget * w);
 void            ewl_box_child_hide_cb(Ewl_Container * c, Ewl_Widget * w);
+void            ewl_box_child_homogeneous_show_cb(Ewl_Container * c,
+                                                 Ewl_Widget * w);
 
 void            ewl_box_configure_cb(Ewl_Widget * w, void *ev_data,
                                     void *user_data);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_container.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -3 -r1.35 -r1.36
--- ewl_container.h     5 Apr 2004 06:34:56 -0000       1.35
+++ ewl_container.h     21 Apr 2004 05:18:52 -0000      1.36
@@ -130,6 +130,7 @@
 int             ewl_container_parent_of(Ewl_Widget *c, Ewl_Widget *w);
 void            ewl_container_prefer_largest(Ewl_Container *c,
                                             Ewl_Orientation o);
+void            ewl_container_prefer_sum(Ewl_Container *c, Ewl_Orientation o);
 
 void            ewl_container_call_child_add(Ewl_Container *c, Ewl_Widget *w);
 void            ewl_container_call_child_remove(Ewl_Container *c, Ewl_Widget *w);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_debug.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- ewl_debug.h 26 Feb 2004 05:38:31 -0000      1.20
+++ ewl_debug.h 21 Apr 2004 05:18:52 -0000      1.21
@@ -1,4 +1,3 @@
-
 #ifndef __EWL_DEBUG_H__
 #define __EWL_DEBUG_H__
 
@@ -8,6 +7,8 @@
 
 inline void     ewl_print_warning(void);
 
+#ifdef DEBUG
+
 #define DENTER_FUNCTION(lvl) \
 { \
        if (ewl_config.debug.enable && (ewl_config.debug.level >= lvl)) \
@@ -70,16 +71,6 @@
        return num; \
 }
 
-#define D(lvl, fmt) \
-{ \
-       if (ewl_config.debug.enable && ewl_config.debug.level >= lvl) \
-         { \
-               fprintf(stderr, "<--> "); \
-               fprintf(stderr, fmt); \
-               fprintf(stderr, "\n"); \
-         } \
-}
-
 #define DERROR(fmt) \
 { \
        ewl_print_warning(); \
@@ -125,5 +116,29 @@
                return ret; \
          } \
 }
+#else
+
+#define DENTER_FUNCTION(lvl) 
+#define DLEAVE_FUNCTION(lvl)
+#define DRETURN(lvl) return
+#define DRETURN_PTR(ptr, lvl) return (void *)ptr
+#define DRETURN_FLOAT(num, lvl) return num
+#define DRETURN_INT(num, lvl) return num
+#define DERROR(fmt)
+#define DWARNING(fmt)
+#define DCHECK_PARAM_PTR(str, ptr) \
+{ \
+       if (!ptr) { \
+               return; \
+       } \
+}
+
+#define DCHECK_PARAM_PTR_RET(str, ptr, ret) \
+{ \
+       if (!ptr) { \
+               return ret; \
+       } \
+}
+#endif
 
 #endif                         /* __EWL_DEBUG_H__ */
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_overlay.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ewl_overlay.c       24 Mar 2004 04:11:09 -0000      1.4
+++ ewl_overlay.c       21 Apr 2004 05:18:52 -0000      1.5
@@ -93,14 +93,6 @@
 
        DENTER_FUNCTION(DLEVEL_STABLE);
 
-       /*
-        * Move the child within the bounds of the overlay.
-        */
-       if (ewl_object_get_current_x(EWL_OBJECT(child)) < CURRENT_X(o))
-               ewl_object_request_x(EWL_OBJECT(child), CURRENT_X(o));
-       if (ewl_object_get_current_y(EWL_OBJECT(child)) < CURRENT_Y(o))
-               ewl_object_request_y(EWL_OBJECT(child), CURRENT_Y(o));
-
        size = ewl_object_get_current_x(EWL_OBJECT(child)) +
                ewl_object_get_preferred_w(EWL_OBJECT(child)) - CURRENT_X(o);
        if (size > PREFERRED_W(o))
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_row.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- ewl_row.c   24 Mar 2004 04:11:09 -0000      1.26
+++ ewl_row.c   21 Apr 2004 05:18:52 -0000      1.27
@@ -81,15 +81,20 @@
                                           ewl_row_header_destroy_cb, row);
        }
 
+       row->header = header;
        if (header) {
                ewl_callback_append(EWL_WIDGET(header), EWL_CALLBACK_CONFIGURE,
                                ewl_row_header_configure_cb, row);
                ewl_callback_append(EWL_WIDGET(header), EWL_CALLBACK_DESTROY,
                                ewl_row_header_destroy_cb, row);
-       }
-       row->header = header;
 
-       ewl_widget_configure(EWL_WIDGET(row));
+               ewl_object_set_fill_policy(EWL_OBJECT(row),
+                                          EWL_FLAG_FILL_HFILL);
+
+               ewl_widget_configure(EWL_WIDGET(header));
+       }
+       else
+               ewl_widget_configure(EWL_WIDGET(row));
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -210,10 +215,11 @@
 void
 ewl_row_header_configure_cb(Ewl_Widget * w, void *ev_data, void *user_data)
 {
-       Ewl_Widget *row;
+       Ewl_Row *row;
 
-       row = EWL_WIDGET(user_data);
-       ewl_widget_configure(row);
+       row = EWL_ROW(user_data);
+       ewl_object_set_preferred_w(EWL_OBJECT(w), CURRENT_W(row->header));
+       ewl_widget_configure(EWL_WIDGET(row));
 }
 
 void
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_scrollpane.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -3 -r1.36 -r1.37
--- ewl_scrollpane.c    9 Apr 2004 06:15:32 -0000       1.36
+++ ewl_scrollpane.c    21 Apr 2004 05:18:52 -0000      1.37
@@ -281,8 +281,8 @@
        /*
         * Get the space needed by the scrolbars.
         */
-       vs_width = ewl_object_get_current_w(EWL_OBJECT(s->vscrollbar));
-       hs_height = ewl_object_get_current_h(EWL_OBJECT(s->hscrollbar));
+       vs_width = ewl_object_get_preferred_w(EWL_OBJECT(s->vscrollbar));
+       hs_height = ewl_object_get_preferred_h(EWL_OBJECT(s->hscrollbar));
 
        /*
         * Determine the space used by the contents.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_tree.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -3 -r1.35 -r1.36
--- ewl_tree.c  24 Mar 2004 04:11:09 -0000      1.35
+++ ewl_tree.c  21 Apr 2004 05:18:52 -0000      1.36
@@ -49,10 +49,19 @@
        DCHECK_PARAM_PTR_RET("tree", tree, FALSE);
        DCHECK_PARAM_PTR_RET("columns", columns, FALSE);
 
-       ewl_box_init(EWL_BOX(tree), EWL_ORIENTATION_VERTICAL);
-       ewl_widget_set_appearance(EWL_WIDGET(tree), "tree");
+       ewl_container_init(EWL_CONTAINER(tree), "tree");
+       ewl_container_show_notify(EWL_CONTAINER(tree),
+                                 (Ewl_Child_Show)ewl_tree_child_resize_cb);
+       ewl_container_hide_notify(EWL_CONTAINER(tree),
+                                 (Ewl_Child_Hide)ewl_tree_child_resize_cb);
+       ewl_container_resize_notify(EWL_CONTAINER(tree),
+                                   (Ewl_Child_Resize)ewl_tree_child_resize_cb);
        ewl_object_set_fill_policy(EWL_OBJECT(tree), EWL_FLAG_FILL_SHRINK |
                        EWL_FLAG_FILL_FILL);
+       tree->selected = ecore_list_new();
+
+       ewl_callback_append(EWL_WIDGET(tree), EWL_CALLBACK_CONFIGURE,
+                           ewl_tree_configure_cb, NULL);
 
        tree->ncols = columns;
 
@@ -68,12 +77,13 @@
                ewl_widget_show(button);
        }
 
-       ewl_callback_append(row, EWL_CALLBACK_SELECT, ewl_tree_row_select_cb,
-                           NULL);
        tree->header = row;
        ewl_container_append_child(EWL_CONTAINER(tree), row);
        ewl_widget_show(row);
 
+       ewl_callback_append(row, EWL_CALLBACK_SELECT, ewl_tree_row_select_cb,
+                           NULL);
+
        tree->scrollarea = ewl_scrollpane_new();
        ewl_container_append_child(EWL_CONTAINER(tree), tree->scrollarea);
        ewl_widget_show(tree->scrollarea);
@@ -391,6 +401,29 @@
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
+void ewl_tree_configure_cb(Ewl_Widget *w, void *ev_data, void *user_data)
+{
+       int h;
+       Ewl_Tree *tree = EWL_TREE(w);
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       ewl_object_request_geometry(EWL_OBJECT(tree->header), CURRENT_X(tree),
+                                   CURRENT_Y(tree), CURRENT_W(tree), 1);
+       h = ewl_object_get_current_h(EWL_OBJECT(tree->header));
+       ewl_object_request_geometry(EWL_OBJECT(tree->scrollarea),
+                                   CURRENT_X(tree), CURRENT_Y(tree) + h,
+                                   CURRENT_W(tree), CURRENT_H(tree) - h);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+void
+ewl_tree_child_resize_cb(Ewl_Container *c)
+{
+       ewl_container_prefer_largest(c, EWL_ORIENTATION_HORIZONTAL);
+       ewl_container_prefer_sum(c, EWL_ORIENTATION_VERTICAL);
+}
+
 /**
  * @return Returns a newly allocated node on success, NULL on failure.
  * @brief Allocate and initialize a new node
@@ -652,7 +685,7 @@
        node = EWL_TREE_NODE(w->parent);
        tree = node->tree;
 
-       tree->selected = w;
+       ecore_list_append(tree->selected, w);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_tree.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- ewl_tree.h  18 Mar 2004 03:41:23 -0000      1.19
+++ ewl_tree.h  21 Apr 2004 05:18:52 -0000      1.20
@@ -29,15 +29,12 @@
  */
 struct Ewl_Tree
 {
-       Ewl_Box box; /**< Inherit from Ewl_Box */
+       Ewl_Container  container;  /**< Inherit from Ewl_Container */
 
-       unsigned short ncols; /**< Number of columns in tree */
-       unsigned short nrows; /**< Number of rows in tree */
-
-       Ewl_Widget *header; /**< Array of widgets in the header */
-       Ewl_Widget *scrollarea; /**< Scrollable area containing box of rows */
-
-       Ewl_Widget *selected; /**< The currently selected row */
+       unsigned short ncols;      /**< Number of columns in tree */
+       Ewl_Widget    *header;     /**< Array of widgets in the header */
+       Ewl_Widget    *scrollarea; /**< Scrollable area of rows */
+       Ecore_List    *selected;   /**< The currently selected rows */
 };
 
 typedef struct _ewl_tree_node Ewl_Tree_Node;
@@ -105,6 +102,8 @@
 
 
 void ewl_tree_row_select_cb(Ewl_Widget *w, void *ev_data, void *user_data);
+void ewl_tree_configure_cb(Ewl_Widget *w, void *ev_data, void *user_data);
+void ewl_tree_child_resize_cb(Ewl_Container *c);
 
 /**
  * @}




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to