Add combo_item widget, custom layout for the combo is working again.

This commit is contained in:
Jaime Thomas
2008-12-24 18:59:22 +00:00
parent ae938125cf
commit 5ee6ba6380
7 changed files with 99 additions and 35 deletions

View File

@@ -117,6 +117,49 @@ ecdb_button_label_get(Evas_Object *b)
return edje_object_part_text_get(b, "ecdb.label");
}
/************************* COMBO ITEM ****************************************/
void
_combo_item_click_cb_call(void *data, Evas_Object *obj, const char *emission,
const char *source)
{
evas_object_smart_callback_call(obj, "clicked", NULL);
}
Evas_Object *
ecdb_combo_item_add(Evas_Object *parent, const char *name)
{
Evas_Object *ci;
ci = ecdb_widget_add(parent, name);
edje_object_file_set(ci, em->theme_path, "ecdb/combo_item");
edje_object_signal_callback_add(ci, "clicked", "ecdb",
_combo_item_click_cb_call, ci);
return ci;
}
void
ecdb_combo_item_label_set(Evas_Object *ci, const char *label)
{
edje_object_part_text_set(ci, "ecdb.label", label);
}
void
ecdb_combo_item_icon_set(Evas_Object *ci, const char *group)
{
Evas_Object *icon;
icon = ecdb_widget_add(ci, "ecdb.swallow.icon");
edje_object_file_set(icon, em->theme_path, group);
evas_object_show(icon);
}
const char *
ecdb_combo_item_label_get(Evas_Object *ci)
{
return edje_object_part_text_get(ci, "ecdb.label");
}
/************************* CHECK *********************************************/
typedef struct _Check_Data Check_Data;
@@ -412,33 +455,31 @@ struct _Combo_Data
Evas_Object *, int);
};
/*
static void
_combo_min_size(Evas_Object *o, Evas_Object_Box_Data *p, void *data)
{
Eina_List *l;
Evas_Object_Box_Option *opt;
int offset_x, offset_y;
int w, h, y;
int wt, ht, xt, yt;
int x, y, w, h;
int xc, yc, wc, hc;
if (eina_list_count(p->children) <= 0)
return;
evas_object_geometry_get(o, &offset_x, &offset_y, &w, &h);
y = offset_y + (h / 2);
evas_object_geometry_get(o, &x, &y, &w, &h);
p->children = eina_list_nth_list(p->children, 0);
opt = eina_list_nth(p->children, 0);
h = 30;
edje_object_size_min_get(opt->obj, NULL, &h);
h /= eina_list_count(p->children);
if (h < 1) h = 1;
EINA_LIST_FOREACH(p->children, l, opt)
{
evas_object_resize(opt->obj, w, h);
evas_object_move(opt->obj, offset_x, y);
evas_object_geometry_get(opt->obj, &xc, &yc, &wc, &hc);
if ((wc != w) || (hc != h))
evas_object_resize(opt->obj, w, h);
if ((xc != x) || (yc != y))
evas_object_move(opt->obj, x, y);
y += h;
}
}
*/
// Axis preferential -- for now vertical
const char *
@@ -579,8 +620,8 @@ ecdb_combo_add(Evas_Object *parent, const char *name)
edje_object_file_set(cd->popup, em->theme_path, "ecdb/combo/popup");
edje_object_signal_callback_add(cd->back, "ecdb,combo,back,dismiss", "ecdb",
_combo_moveable_click_cb, c);
//edje_box_layout_register("min_size", _combo_min_size, NULL, NULL, NULL,
// NULL);
edje_box_layout_register("min_size", _combo_min_size, NULL, NULL, NULL,
NULL);
evas_object_pass_events_set(cd->popup, 1);
evas_object_show(cd->popup);
@@ -621,7 +662,7 @@ ecdb_combo_expand(Evas_Object *c)
Eina_Iterator *it;
Evas_Object *o;
const Evas_Object *box;
const char *location;
const char *location, *min_size;
char buf[1024];
int x, y, w, h, h2, padding;
@@ -647,17 +688,20 @@ ecdb_combo_expand(Evas_Object *c)
evas_object_box_padding_get(box, NULL, &padding);
h2 = -padding;
/* Now resize the attached object... There is code to do this in the
* layout, which makes more sense. However, it goes into an infinite loop,
* so resize here for now
*/
it = evas_object_box_iterator_new(edje_object_part_object_get(cd->popup,
"ecdb.box"));
while (eina_iterator_next(it, (void **)&o))
{
edje_object_size_min_get(o, NULL, &h);
evas_object_resize(o, w, h);
h2 += h + padding;
min_size = edje_object_data_get(o, "ecdb/combo_item/minh");
if (min_size)
{
h2 += atoi(min_size);
}
else
{
printf("THEME ERROR! MISSING REQUIRED MINIMUM DATA VALUE\n");
}
h2 += padding;
}
if (!strcmp(location, "top"))