Check widget can now do icons like radio button.

Should make it possible to eliminate bug in screen res dialog now.


SVN revision: 23945
This commit is contained in:
Christopher Michael 2006-07-15 14:59:51 +00:00
parent 5ac23c5fbd
commit da9348e584
2 changed files with 56 additions and 0 deletions

View File

@ -7,6 +7,7 @@ typedef struct _E_Widget_Data E_Widget_Data;
struct _E_Widget_Data
{
Evas_Object *o_check;
Evas_Object *o_icon;
int *valptr;
};
@ -88,6 +89,60 @@ e_widget_check_checked_get(Evas_Object *check)
return ret;
}
EAPI Evas_Object *
e_widget_check_icon_add(Evas *evas, char *label, char *icon, int icon_w, int icon_h, int *val)
{
Evas_Object *obj, *o, *o2;
E_Widget_Data *wd;
Evas_Coord mw, mh;
obj = e_widget_add(evas);
e_widget_del_hook_set(obj, _e_wid_del_hook);
e_widget_focus_hook_set(obj, _e_wid_focus_hook);
e_widget_activate_hook_set(obj, _e_wid_activate_hook);
e_widget_disable_hook_set(obj, _e_wid_disable_hook);
wd = calloc(1, sizeof(E_Widget_Data));
wd->valptr = val;
e_widget_data_set(obj, wd);
o = edje_object_add(evas);
wd->o_check = o;
e_theme_edje_object_set(o, "base/theme/widgets",
"widgets/check_icon");
edje_object_signal_callback_add(o, "toggled", "*", _e_wid_signal_cb1, obj);
edje_object_part_text_set(o, "label", label);
evas_object_show(o);
if (label)
{
edje_object_signal_emit(o, "label_visible", "");
edje_object_message_signal_process(o);
}
if (icon)
{
o2 = edje_object_add(evas);
wd->o_icon = o2;
e_util_edje_icon_set(o2, icon);
edje_extern_object_min_size_set(o2, icon_w, icon_h);
edje_object_part_swallow(wd->o_check, "icon_swallow", o2);
evas_object_show(o2);
e_widget_sub_object_add(obj, o2);
}
edje_object_size_min_calc(o, &mw, &mh);
e_widget_min_size_set(obj, mw, mh);
if (wd->valptr)
{
if (*(wd->valptr)) edje_object_signal_emit(o, "toggle_on", "");
}
e_widget_sub_object_add(obj, o);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_focus_steal, obj);
e_widget_resize_object_set(obj, o);
return obj;
}
static void
_e_wid_del_hook(Evas_Object *obj)
{

View File

@ -9,6 +9,7 @@
EAPI Evas_Object *e_widget_check_add(Evas *evas, char *label, int *val);
EAPI void e_widget_check_checked_set(Evas_Object *check, int checked);
EAPI int e_widget_check_checked_get(Evas_Object *check);
EAPI Evas_Object *e_widget_check_icon_add(Evas *evas, char *label, char *icon, int icon_w, int icon_h, int *val);
#endif
#endif