Enlightenment CVS committal Author : lordchaos Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_iconbox.c Log Message: * Make icon labels display/contract correctly =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_iconbox.c,v retrieving revision 1.85 retrieving revision 1.86 diff -u -3 -r1.85 -r1.86 --- ewl_iconbox.c 29 Nov 2005 07:05:51 -0000 1.85 +++ ewl_iconbox.c 29 Nov 2005 07:24:32 -0000 1.86 @@ -3,6 +3,8 @@ #include "ewl_macros.h" #include "ewl_private.h" +#define ICON_LABEL_INITIAL 50 + int ewl_iconbox_icon_label_height_calculate(Ewl_IconBox_Icon* icon) { int height=0; @@ -17,9 +19,12 @@ } -void ewl_iconbox_icon_floater_resize(Ewl_IconBox_Icon *icon) { +void ewl_iconbox_icon_floater_resize(Ewl_Widget *w __UNUSED__, void *ev_data, void* user_data) { + Ewl_IconBox_Icon* icon = EWL_ICONBOX_ICON(w); int height = ewl_iconbox_icon_label_height_calculate(icon); + ewl_callback_del(w, EWL_CALLBACK_CONFIGURE, ewl_iconbox_icon_floater_resize); + if (height >0) { ewl_object_custom_h_set(EWL_OBJECT(icon->floater), height); } @@ -484,7 +489,11 @@ } - ewl_iconbox_icon_floater_resize(icon); + /* Overestimate the label height to begin with, to give the text room to expand */ + if (REALIZED(EWL_WIDGET(icon))) { + ewl_object_custom_h_set( EWL_OBJECT(icon->floater), CURRENT_H(icon->image) + ICON_LABEL_INITIAL); + ewl_callback_append(EWL_WIDGET(icon), EWL_CALLBACK_CONFIGURE, ewl_iconbox_icon_floater_resize, icon); + } } @@ -744,8 +753,7 @@ ewl_floater_follow_set(EWL_FLOATER( EWL_ICONBOX_ICON(ib)->floater ), iconbox->ewl_iconbox_pane_inner); - /*Set the label*/ - ewl_iconbox_icon_label_setup(EWL_ICONBOX_ICON(ib), name); + EWL_ICONBOX_ICON(ib)->icon_box_parent = iconbox; /* Set our parent */ @@ -784,20 +792,23 @@ } /*----------------------*/ - /*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)); + /*Set the label*/ + ewl_iconbox_icon_label_setup(EWL_ICONBOX_ICON(ib), name); + - /*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 */ ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs