Enlightenment CVS committal

Author  : lordchaos
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_iconbox.c ewl_text.c 


Log Message:
* Make Ewl_Text trigger value changed events on text insert/append/prepend etc
* None of the fill policies suited us for iconbox icon sizing (message me on 
IRC for my take on this) - so we made our own policy.  Seems to work well, 
except for the hardcoded initial size

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_iconbox.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -3 -r1.72 -r1.73
--- ewl_iconbox.c       15 Nov 2005 23:15:49 -0000      1.72
+++ ewl_iconbox.c       16 Nov 2005 03:54:07 -0000      1.73
@@ -4,6 +4,30 @@
 #include "ewl_private.h"
 
 
+int ewl_iconbox_icon_label_height_calculate(Ewl_IconBox_Icon* icon) {
+       int height=0;
+       int ww,hh;
+
+       
evas_object_textblock_size_native_get(EWL_TEXT(icon->w_label)->textblock, &ww, 
&hh);
+       height = CURRENT_H(icon->image) + hh;
+
+       
+
+       return height;
+}
+
+
+void ewl_iconbox_icon_floater_resize_cb(Ewl_Widget *w, void *ev_data, void 
*user_data) {
+       Ewl_IconBox_Icon* icon = EWL_ICONBOX_ICON(user_data);
+
+
+       
ewl_object_custom_h_set(EWL_OBJECT(icon->floater),ewl_iconbox_icon_label_height_calculate(EWL_ICONBOX_ICON(icon))
 );
+       
+       //printf("Resized floater to EWL_TEXT(%d)-TEXTBLOCK(%d) %d\n", 
CURRENT_H(icon->w_label), hh, height);
+}
+
+
+
 /*Ecore_List *ewl_iconbox_icon_list;*/
 
 /**
@@ -688,7 +712,7 @@
        EWL_ICONBOX_ICON(ib)->icon_box_parent = iconbox; /* Set our parent */
        
        ewl_object_fill_policy_set(EWL_OBJECT(ib), EWL_FLAG_FILL_FILL);
-       ewl_object_fill_policy_set(EWL_OBJECT(EWL_ICONBOX_ICON(ib)->floater), 
EWL_FLAG_FILL_FILL);
+       ewl_object_fill_policy_set(EWL_OBJECT(EWL_ICONBOX_ICON(ib)->floater), 
EWL_FLAG_FILL_SHRINK);
        
ewl_container_child_append(EWL_CONTAINER(EWL_ICONBOX_ICON(ib)->floater), ib);
 
 
@@ -709,26 +733,36 @@
        
ewl_object_current_size_get(EWL_OBJECT(iconbox->ewl_iconbox_scrollpane), 
&sw,&sh);
 
        if (iconbox->lx + iconbox->iw + (EWL_ICONBOX_ICON_PADDING) >= (sw - 
iconbox->iw)) {
-               //printf("%d + %d + %d >= %d, so next line (%s)\n", iconbox->lx 
, iconbox->iw , (EWL_ICONBOX_ICON_PADDING*2) , sw, name);
+               //printf("%d + %d + %d >= %d, so next line (%s)\n", 
+               //iconbox->lx , iconbox->iw , (EWL_ICONBOX_ICON_PADDING*2) , 
sw, name);
                
                iconbox->ly += EWL_ICONBOX_ICON_PADDING + iconbox->ih;
                iconbox->lx = 0;
        } else {
-               //printf("*** %d + %d + %d < %d, so stay (%s)\n", iconbox->lx , 
iconbox->iw , (EWL_ICONBOX_ICON_PADDING*2) , sw,name);
+               //printf("*** %d + %d + %d < %d, so stay (%s)\n", 
+               //iconbox->lx , iconbox->iw , (EWL_ICONBOX_ICON_PADDING*2) , 
sw,name);
+               
                iconbox->lx += EWL_ICONBOX_ICON_PADDING + iconbox->iw;  
        }
-
-       
-       
        /*----------------------*/
 
 
+       ewl_callback_append(EWL_ICONBOX_ICON(ib)->w_label, 
EWL_CALLBACK_VALUE_CHANGED, ewl_iconbox_icon_floater_resize_cb, ib);
+
+
        /*Show*/
        ewl_widget_show(EWL_ICONBOX_ICON(ib)->image);
        ewl_widget_show(EWL_ICONBOX_ICON(ib)->w_label);
        ewl_widget_show(EWL_ICONBOX_ICON(ib)->floater);
        ewl_widget_show(EWL_WIDGET(ib));
 
+
+       /*Calculate the correct height for the icon*/
+       /*ewl_object_custom_h_set(EWL_OBJECT(EWL_ICONBOX_ICON(ib)->floater), 
ewl_iconbox_icon_label_height_calculate(EWL_ICONBOX_ICON(ib)));*/
+       /*FIXME - at the moment, it appears we can't calculate the height 
+               yet - hard set for now*/
+       ewl_object_custom_h_set(EWL_OBJECT(EWL_ICONBOX_ICON(ib)->floater), 80);
+
        
 
        /* Add the callbacks for mouse */
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_text.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -3 -r1.48 -r1.49
--- ewl_text.c  13 Nov 2005 08:06:40 -0000      1.48
+++ ewl_text.c  16 Nov 2005 03:54:08 -0000      1.49
@@ -312,6 +312,8 @@
        ewl_text_text_insert(t, NULL, t->cursor_position);
        ewl_text_text_insert(t, text, t->cursor_position);
 
+       ewl_callback_call(EWL_WIDGET(t), EWL_CALLBACK_VALUE_CHANGED);
+
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
@@ -328,6 +330,8 @@
 
        ewl_text_text_insert(t, text, 0);
 
+       ewl_callback_call(EWL_WIDGET(t), EWL_CALLBACK_VALUE_CHANGED);
+
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
@@ -345,6 +349,8 @@
 
        ewl_text_text_insert(t, text, t->length);
 
+       ewl_callback_call(EWL_WIDGET(t), EWL_CALLBACK_VALUE_CHANGED);
+
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
@@ -432,6 +438,8 @@
        if (REALIZED(t))
                ewl_text_display(t);
 
+       ewl_callback_call(EWL_WIDGET(t), EWL_CALLBACK_VALUE_CHANGED);
+
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
@@ -493,6 +501,8 @@
        if (REALIZED(t))
                ewl_text_display(t);
 
+       ewl_callback_call(EWL_WIDGET(t), EWL_CALLBACK_VALUE_CHANGED);
+
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 




-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to