Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src


Modified Files:
        ewl_box.c 


Log Message:
Fix for the box slowly growing as parts are hidden and shown.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_box.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -3 -r1.45 -r1.46
--- ewl_box.c   21 Feb 2003 23:04:17 -0000      1.45
+++ ewl_box.c   1 Apr 2003 20:00:48 -0000       1.46
@@ -48,6 +48,7 @@
 
 static void     __ewl_box_setup();
 static void     __ewl_box_add(Ewl_Container * c, Ewl_Widget * w);
+static void     __ewl_box_remove(Ewl_Container * c, Ewl_Widget * w);
 static void     __ewl_box_child_resize(Ewl_Container * c, Ewl_Widget * w,
                                       int size, Ewl_Orientation o);
 static void     __ewl_box_configure(Ewl_Widget * w, void *ev_data,
@@ -115,10 +116,10 @@
         */
        if (o == EWL_ORIENTATION_HORIZONTAL)
                ewl_container_init(EWL_CONTAINER(b), "hbox", __ewl_box_add,
-                               __ewl_box_child_resize, NULL);
+                               __ewl_box_child_resize, __ewl_box_remove);
        else
                ewl_container_init(EWL_CONTAINER(b), "vbox", __ewl_box_add,
-                               __ewl_box_child_resize, NULL);
+                               __ewl_box_child_resize, __ewl_box_remove);
 
        ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, __ewl_box_configure,
                             NULL);
@@ -577,6 +578,40 @@
        info->pref_fill_set(EWL_OBJECT(c), osize + temp +
                        (ewd_list_nodes(c->children) > 1 ?
                         EWL_BOX(c)->spacing : 0));
+}
+
+static void
+__ewl_box_remove(Ewl_Container * c, Ewl_Widget * w)
+{
+       int space = 0;
+       Ewl_Box *b = EWL_BOX(c);
+
+       if (ewd_list_nodes(c->children) > 1)
+               space = b->spacing;
+
+       if (b->orientation == EWL_ORIENTATION_HORIZONTAL) {
+               ewl_object_set_preferred_w(EWL_OBJECT(c),
+                               PREFERRED_W(c) -
+                               ewl_object_get_preferred_w(EWL_OBJECT(w)) -
+                               space);
+
+               if (w == b->max_align) {
+                       ewl_container_prefer_largest(c,
+                                       EWL_ORIENTATION_HORIZONTAL);
+                       b->max_align = NULL;
+               }
+       }
+       else {
+               ewl_object_set_preferred_h(EWL_OBJECT(c),
+                               PREFERRED_H(c) - 
+                               ewl_object_get_preferred_h(EWL_OBJECT(w)) -
+                               space);
+               if (w == b->max_align) {
+                       ewl_container_prefer_largest(c,
+                                       EWL_ORIENTATION_HORIZONTAL);
+                       b->max_align = NULL;
+               }
+       }
 }
 
 /*




-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb: 
Dedicated Hosting for just $79/mo with 500 GB of bandwidth! 
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to