Combo works now, added a label widget, and use stringshare for the constant drive info stuff.
This commit is contained in:
@ -59,6 +59,12 @@ ecdb_button_icon_set(Evas_Object *b, const char *group)
|
||||
evas_object_show(icon);
|
||||
}
|
||||
|
||||
const char *
|
||||
ecdb_button_label_get(Evas_Object *b)
|
||||
{
|
||||
return edje_object_part_text_get(b, "ecdb.label");
|
||||
}
|
||||
|
||||
/************************* CHECK *********************************************/
|
||||
|
||||
Evas_Object *
|
||||
@ -290,7 +296,11 @@ struct _Combo_Data
|
||||
Evas_Object *popup;
|
||||
unsigned int expanded;
|
||||
unsigned int count;
|
||||
int selected;
|
||||
const char *name;
|
||||
const char *header;
|
||||
Evas_Object * (*create_header)(Evas_Object *, const char *name,
|
||||
Evas_Object *, int);
|
||||
};
|
||||
|
||||
static void
|
||||
@ -348,6 +358,7 @@ _combo_del(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
cd = evas_object_data_get(data, "cd");
|
||||
|
||||
eina_stringshare_del(cd->name);
|
||||
eina_stringshare_del(cd->header);
|
||||
FREE(cd);
|
||||
}
|
||||
|
||||
@ -375,7 +386,31 @@ _combo_hide(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
static void
|
||||
_combo_clicked(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
printf("object clicked...\n");
|
||||
Combo_Data *cd;
|
||||
Evas_Object *swallow, *header;
|
||||
Eina_Iterator *it;
|
||||
int i = 0;
|
||||
|
||||
cd = evas_object_data_get(data, "cd");
|
||||
swallow = edje_object_part_swallow_get(data, "ecdb.header.swallow");
|
||||
if (swallow)
|
||||
evas_object_del(swallow);
|
||||
|
||||
it = evas_object_box_iterator_new(edje_object_part_object_get(cd->popup,
|
||||
"ecdb.box"));
|
||||
while (eina_iterator_next(it, (void **)&swallow))
|
||||
{
|
||||
if (swallow == obj)
|
||||
break;
|
||||
i++;
|
||||
}
|
||||
|
||||
// Should I send the part name? The the normal widget_add would handle
|
||||
// the swallowing
|
||||
cd->selected = i;
|
||||
header = cd->create_header(data, "ecdb.header.swallow", swallow, i);
|
||||
edje_object_signal_emit(data, "ecdb,combo,header,swallow", "ecdb");
|
||||
ecdb_combo_collapse(data);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -441,6 +476,7 @@ ecdb_combo_add(Evas_Object *parent, const char *name)
|
||||
|
||||
cd->parent = parent;
|
||||
cd->name = eina_stringshare_add(name);
|
||||
cd->selected = -1;
|
||||
evas_object_data_set(c, "cd", cd);
|
||||
|
||||
return c;
|
||||
@ -449,7 +485,12 @@ ecdb_combo_add(Evas_Object *parent, const char *name)
|
||||
void
|
||||
ecdb_combo_header_set(Evas_Object *c, const char *text)
|
||||
{
|
||||
Combo_Data *cd;
|
||||
|
||||
cd = evas_object_data_get(c, "cd");
|
||||
edje_object_part_text_set(c, "ecdb.header", text);
|
||||
eina_stringshare_del(cd->header);
|
||||
cd->header = eina_stringshare_add(text);
|
||||
}
|
||||
|
||||
void
|
||||
@ -527,3 +568,33 @@ ecdb_combo_collapse(Evas_Object *c)
|
||||
cd->expanded = 0;
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_combo_header_create_set(Evas_Object *c, Evas_Object * (*func)
|
||||
(Evas_Object *c, const char *name,
|
||||
Evas_Object *clicked, int idx))
|
||||
{
|
||||
Combo_Data *cd;
|
||||
|
||||
cd = evas_object_data_get(c, "cd");
|
||||
cd->create_header = func;
|
||||
}
|
||||
|
||||
|
||||
/******************************* Label ***************************************/
|
||||
|
||||
Evas_Object *
|
||||
ecdb_label_add(Evas_Object *parent, const char *name)
|
||||
{
|
||||
Evas_Object *l;
|
||||
|
||||
l = ecdb_widget_add(parent, name);
|
||||
edje_object_file_set(l, em->theme_path, "ecdb/label");
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_label_text_set(Evas_Object *l, const char *text)
|
||||
{
|
||||
edje_object_part_text_set(l, "ecdb.label", text);
|
||||
}
|
||||
|
Reference in New Issue
Block a user