{
ELM_WIDGET_ITEM;
Evas_Object *button;
- void *data;
Evas_Coord vw, rw; // vw: visual width, real width
Eina_Bool visible: 1;
};
item = elm_widget_item_new(obj, Elm_Multibuttonentry_Item);
if (item)
{
+ elm_widget_item_data_set(item, data);
Evas_Coord rw, vw;
_resize_button(btn, &rw, &vw);
item->button = btn;
- item->data = data;
item->rw = rw;
item->vw = vw;
item->visible = EINA_TRUE;
elm_multibuttonentry_item_prepend(Evas_Object *obj, const char *label, void *data)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
Elm_Multibuttonentry_Item *item;
-
- if (!wd || !label) return NULL;
+ if (!label) return NULL;
item = _add_button_item(obj, label, MULTIBUTTONENTRY_POS_START, NULL, data);
return item;
}
elm_multibuttonentry_item_append(Evas_Object *obj, const char *label, void *data)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
Elm_Multibuttonentry_Item *item;
-
- if (!wd || !label) return NULL;
+ if (!label) return NULL;
item = _add_button_item(obj, label, MULTIBUTTONENTRY_POS_END, NULL, data);
return item;
}
elm_multibuttonentry_item_insert_before(Evas_Object *obj, Elm_Multibuttonentry_Item *before, const char *label, void *data)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
Elm_Multibuttonentry_Item *item;
-
- if (!wd || !label) return NULL;
+ if (!label) return NULL;
item = _add_button_item(obj, label, MULTIBUTTONENTRY_POS_BEFORE, before, data);
return item;
}
elm_multibuttonentry_item_insert_after(Evas_Object *obj, Elm_Multibuttonentry_Item *after, const char *label, void *data)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
Elm_Multibuttonentry_Item *item;
-
- if (!wd || !label) return NULL;
+ if (!label) return NULL;
item = _add_button_item(obj, label, MULTIBUTTONENTRY_POS_AFTER, after, data);
return item;
}
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
-
if (!wd) return NULL;
return wd->items;
}
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd || !wd->items) return NULL;
+ if (!wd) return NULL;
return eina_list_data_get(wd->items);
}
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd || !wd->items) return NULL;
+ if (!wd) return NULL;
return eina_list_data_get(eina_list_last(wd->items));
}
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd || !wd->current) return NULL;
+ if (!wd) return NULL;
return eina_list_data_get(wd->current);
}
EAPI void
elm_multibuttonentry_item_select(Elm_Multibuttonentry_Item *item, Eina_Bool selected)
{
- Widget_Data *wd;
- Eina_List *l;
- Elm_Multibuttonentry_Item *_item;
-
if (!item) return;
- ELM_CHECK_WIDTYPE(WIDGET(item), widtype);
- wd = elm_widget_data_get(WIDGET(item));
- if (!wd) return;
-
- EINA_LIST_FOREACH(wd->items, l, _item)
- {
- if (_item == item)
- {
- if (selected)
- _select_button(WIDGET(item), item->button);
- else
- _select_button(WIDGET(item), NULL);
- }
- }
+ if (selected) _select_button(WIDGET(item), item->button);
+ else _select_button(WIDGET(item), NULL);
}
EAPI void
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
-
_select_button(obj, NULL);
}
elm_multibuttonentry_clear(Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype);
+ Elm_Multibuttonentry_Item *item;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (wd->items)
{
- Elm_Multibuttonentry_Item *item;
EINA_LIST_FREE(wd->items, item)
{
elm_box_unpack(wd->box, item->button);
EAPI const char *
elm_multibuttonentry_item_label_get(const Elm_Multibuttonentry_Item *item)
{
- Widget_Data *wd;
- Eina_List *l;
- Elm_Multibuttonentry_Item *_item;
if (!item) return NULL;
- ELM_CHECK_WIDTYPE(WIDGET(item), widtype) NULL;
- wd = elm_widget_data_get(WIDGET(item));
- if (!wd || !wd->items) return NULL;
-
- EINA_LIST_FOREACH(wd->items, l, _item)
- {
- if (_item == item)
- return edje_object_part_text_get(_item->button, "elm.btn.text");
- }
-
- return NULL;
+ return edje_object_part_text_get(item->button, "elm.btn.text");
}
EAPI void
elm_multibuttonentry_item_label_set(Elm_Multibuttonentry_Item *item, const char *str)
{
- Widget_Data *wd;
- Eina_List *l;
- Elm_Multibuttonentry_Item *_item;
if (!item || !str) return;
- ELM_CHECK_WIDTYPE(WIDGET(item), widtype);
- wd = elm_widget_data_get(WIDGET(item));
- if (!wd || !wd->items) return;
-
- EINA_LIST_FOREACH(wd->items, l, _item)
- if (_item == item)
- {
- edje_object_part_text_set(_item->button, "elm.btn.text", str);
- _resize_button(_item->button, &_item->rw, &_item->vw);
- break;
- }
+ edje_object_part_text_set(item->button, "elm.btn.text", str);
+ _resize_button(item->button, &item->rw, &item->vw);
}
EAPI Elm_Multibuttonentry_Item *
Widget_Data *wd;
Eina_List *l;
Elm_Multibuttonentry_Item *_item;
+
if (!item) return NULL;
- ELM_CHECK_WIDTYPE(WIDGET(item), widtype) NULL;
wd = elm_widget_data_get(WIDGET(item));
- if (!wd || !wd->items) return NULL;
+ ELM_CHECK_WIDTYPE(WIDGET(item), widtype) NULL;
EINA_LIST_FOREACH(wd->items, l, _item)
- if (_item == item)
- {
- l = eina_list_prev(l);
- if (!l) return NULL;
- return eina_list_data_get(l);
- }
+ {
+ if (_item == item)
+ {
+ l = eina_list_prev(l);
+ if (!l) return NULL;
+ return eina_list_data_get(l);
+ }
+ }
return NULL;
}
Elm_Multibuttonentry_Item *_item;
if (!item) return NULL;
- ELM_CHECK_WIDTYPE(WIDGET(item), widtype) NULL;
wd = elm_widget_data_get(WIDGET(item));
- if (!wd || !wd->items) return NULL;
+ ELM_CHECK_WIDTYPE(WIDGET(item), widtype) NULL;
EINA_LIST_FOREACH(wd->items, l, _item)
- if (_item == item)
- {
- l = eina_list_next(l);
- if (!l) return NULL;
- return eina_list_data_get(l);
- }
+ {
+ if (_item == item)
+ {
+ l = eina_list_next(l);
+ if (!l) return NULL;
+ return eina_list_data_get(l);
+ }
+ }
return NULL;
}
elm_multibuttonentry_item_data_get(const Elm_Multibuttonentry_Item *item)
{
if (!item) return NULL;
- return item->data;
+ return elm_widget_item_data_get(item);
}
EAPI void
elm_multibuttonentry_item_data_set(Elm_Multibuttonentry_Item *item, void *data)
{
if (!item) return;
- item->data = data;
+ return elm_widget_item_data_set(item, data);
}
EAPI void