Add combo_item widget, custom layout for the combo is working again.
This commit is contained in:
parent
ae938125cf
commit
5ee6ba6380
@ -1,7 +1,12 @@
|
||||
/* vim: set sw=3 ts=3 sts=3 expandtab: */
|
||||
group {
|
||||
name: "ecdb/button";
|
||||
min: 50 30;
|
||||
alias: "ecdb/combo_item";
|
||||
|
||||
data {
|
||||
item: "ecdb/combo_item/minw" 50;
|
||||
item: "ecdb/combo_item/minh" 30;
|
||||
}
|
||||
|
||||
parts {
|
||||
part {
|
||||
|
@ -394,12 +394,12 @@ group {
|
||||
}
|
||||
|
||||
rel2 {
|
||||
relative: 1.0 1.0;
|
||||
relative: 1.0 0.0;
|
||||
offset: -1 -1;
|
||||
}
|
||||
|
||||
box {
|
||||
layout: "vertical";
|
||||
layout: "min_size";
|
||||
padding: 0 2;
|
||||
align: 0.0 0.5;
|
||||
}
|
||||
@ -409,6 +409,16 @@ group {
|
||||
state: "active" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
color: 255 255 255 255;
|
||||
|
||||
rel1 {
|
||||
relative: 0.0 0.0;
|
||||
offset: 0 0;
|
||||
}
|
||||
|
||||
rel2 {
|
||||
relative: 1.0 1.0;
|
||||
offset: -1 -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ _combo_cb_clicked(void *data, Evas_Object *obj, void *event_info)
|
||||
if ((drive->write_speeds[i]) <= 0)
|
||||
continue;
|
||||
|
||||
b = ecdb_button_add(c2, NULL);
|
||||
b = ecdb_combo_item_add(c2, NULL);
|
||||
|
||||
if ((drive->profile_name) && (drive->profile_name[0] != '\0'))
|
||||
{
|
||||
@ -152,7 +152,7 @@ _combo_cb_clicked(void *data, Evas_Object *obj, void *event_info)
|
||||
}
|
||||
|
||||
snprintf(buf, sizeof(buf), "%dX (%dkb/s)", speed, drive->write_speeds[i]);
|
||||
ecdb_button_label_set(b, buf);
|
||||
ecdb_combo_item_label_set(b, buf);
|
||||
ecdb_combo_append(c2, b);
|
||||
evas_object_show(b);
|
||||
}
|
||||
@ -214,8 +214,8 @@ ecdb_burn_data_page_show(void)
|
||||
|
||||
EINA_LIST_FOREACH(em->drives, l, drive)
|
||||
{
|
||||
b = ecdb_button_add(c1, NULL);
|
||||
ecdb_button_label_set(b, drive->product);
|
||||
b = ecdb_combo_item_add(c1, NULL);
|
||||
ecdb_combo_item_label_set(b, drive->product);
|
||||
evas_object_smart_callback_add(b, "clicked", _combo_cb_clicked, c2);
|
||||
ecdb_combo_append(c1, b);
|
||||
evas_object_show(b);
|
||||
|
@ -147,7 +147,7 @@ _combo_cb_clicked(void *data, Evas_Object *obj, void *event_info)
|
||||
if ((drive->write_speeds[i]) <= 0)
|
||||
continue;
|
||||
|
||||
b = ecdb_button_add(c2, NULL);
|
||||
b = ecdb_combo_item_add(c2, NULL);
|
||||
|
||||
if ((drive->profile_name) && (drive->profile_name[0] != '\0'))
|
||||
{
|
||||
@ -164,7 +164,7 @@ _combo_cb_clicked(void *data, Evas_Object *obj, void *event_info)
|
||||
}
|
||||
|
||||
snprintf(buf, sizeof(buf), "%dX (%dkb/s)", speed, drive->write_speeds[i]);
|
||||
ecdb_button_label_set(b, buf);
|
||||
ecdb_combo_item_label_set(b, buf);
|
||||
ecdb_combo_append(c2, b);
|
||||
evas_object_show(b);
|
||||
}
|
||||
@ -229,8 +229,8 @@ ecdb_burn_image_page_show(void)
|
||||
|
||||
EINA_LIST_FOREACH(em->drives, l, drive)
|
||||
{
|
||||
b = ecdb_button_add(c1, NULL);
|
||||
ecdb_button_label_set(b, drive->product);
|
||||
b = ecdb_combo_item_add(c1, NULL);
|
||||
ecdb_combo_item_label_set(b, drive->product);
|
||||
evas_object_smart_callback_add(b, "clicked", _combo_cb_clicked, c2);
|
||||
ecdb_combo_append(c1, b);
|
||||
evas_object_show(b);
|
||||
|
@ -131,8 +131,8 @@ ecdb_erase_page_show(void)
|
||||
|
||||
EINA_LIST_FOREACH(em->drives, l, drive)
|
||||
{
|
||||
d = ecdb_button_add(b, NULL);
|
||||
ecdb_button_label_set(d, drive->product);
|
||||
d = ecdb_combo_item_add(b, NULL);
|
||||
ecdb_combo_item_label_set(d, drive->product);
|
||||
ecdb_combo_append(b, d);
|
||||
evas_object_show(d);
|
||||
}
|
||||
|
@ -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"))
|
||||
|
@ -9,6 +9,11 @@ void ecdb_button_label_set(Evas_Object *b, const char *label);
|
||||
void ecdb_button_icon_set(Evas_Object *b, const char *group);
|
||||
const char *ecdb_button_label_get(Evas_Object *b);
|
||||
|
||||
Evas_Object *ecdb_combo_item_add(Evas_Object *parent, const char *name);
|
||||
void ecdb_combo_item_label_set(Evas_Object *ci, const char *label);
|
||||
void ecdb_combo_item_icon_set(Evas_Object *ci, const char *group);
|
||||
const char *ecdb_combo_item_label_get(Evas_Object *ci);
|
||||
|
||||
Evas_Object *ecdb_check_add(Evas_Object *parent, const char *name);
|
||||
void ecdb_check_label_set(Evas_Object *c, const char *label);
|
||||
void ecdb_check_states_set(Evas_Object *c, const char *ystate,
|
||||
|
Loading…
Reference in New Issue
Block a user