1 #include <Elementary.h>
7 typedef enum _Multibuttonentry_Pos
9 MULTIBUTTONENTRY_POS_START,
10 MULTIBUTTONENTRY_POS_END,
11 MULTIBUTTONENTRY_POS_BEFORE,
12 MULTIBUTTONENTRY_POS_AFTER,
13 MULTIBUTTONENTRY_POS_NUM
14 } Multibuttonentry_Pos;
16 typedef enum _Multibuttonentry_Button_State
18 MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT,
19 MULTIBUTTONENTRY_BUTTON_STATE_SELECTED,
20 MULTIBUTTONENTRY_BUTTON_STATE_NUM
21 } Multibuttonentry_Button_State;
23 typedef enum _MultiButtonEntry_Closed_Button_Type
25 MULTIBUTTONENTRY_CLOSED_IMAGE,
26 MULTIBUTTONENTRY_CLOSED_LABEL
27 } MultiButtonEntry_Closed_Button_Type;
29 typedef enum _Multibuttonentry_View_State
31 MULTIBUTTONENTRY_VIEW_NONE,
32 MULTIBUTTONENTRY_VIEW_GUIDETEXT,
33 MULTIBUTTONENTRY_VIEW_ENTRY,
34 MULTIBUTTONENTRY_VIEW_CONTRACTED
35 } Multibuttonentry_View_State;
37 struct _Multibuttonentry_Item
39 Evas_Object *multibuttonentry;
42 Evas_Coord vw, rw; // vw: visual width, real width
46 typedef struct _Widget_Data Widget_Data;
53 Evas_Object *guidetext;
54 Evas_Object *end; // used to represent the total number of invisible buttons
56 Evas_Object *rect_for_end;
57 MultiButtonEntry_Closed_Button_Type end_type;
63 Multibuttonentry_View_State view_state;
65 Evas_Coord w_box, h_box;
68 Eina_Bool last_btn_select: 1;
69 Elm_Multibuttonentry_Item_Verify_Callback add_callback;
70 void *add_callback_data;
73 static const char *widtype = NULL;
74 static void _del_hook(Evas_Object *obj);
75 static void _theme_hook(Evas_Object *obj);
76 static void _on_focus_hook(void *data __UNUSED__, Evas_Object *obj);
77 static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src, Evas_Callback_Type type, void *event_info);
78 static void _sizing_eval(Evas_Object *obj);
79 static void _changed_size_hint_cb(void *data, Evas *evas, Evas_Object *obj, void *event);
80 static void _resize_cb(void *data, Evas *evas, Evas_Object *obj, void *event);
81 static void _event_init(Evas_Object *obj);
82 static void _contracted_state_set(Evas_Object *obj, int contracted);
83 static void _view_update(Evas_Object *obj);
84 static void _set_label(Evas_Object *obj, const char *str);
85 static void _change_current_button_state(Evas_Object *obj, Multibuttonentry_Button_State state);
86 static void _change_current_button(Evas_Object *obj, Evas_Object *btn);
87 static void _button_clicked(void *data, Evas_Object *obj, const char *emission, const char *source);
88 static void _del_button_obj(Evas_Object *obj, Evas_Object *btn);
89 static void _del_button_item(Elm_Multibuttonentry_Item *item);
90 static void _select_button(Evas_Object *obj, Evas_Object *btn);
91 static Elm_Multibuttonentry_Item *_add_button_item(Evas_Object *obj, const char *str, Multibuttonentry_Pos pos,
92 const Elm_Multibuttonentry_Item *reference, void *data);
93 static void _add_button(Evas_Object *obj, char *str);
94 static void _evas_mbe_key_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
95 static void _entry_changed_cb(void *data, Evas_Object *obj, void *event_info);
96 static void _entry_key_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
97 static void _entry_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
98 static void _entry_resized_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info);
99 static void _entry_focus_in_cb(void *data, Evas_Object *obj, void *event_info);
100 static void _entry_focus_out_cb(void *data, Evas_Object *obj, void *event_info);
101 static void _entry_clicked_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__);
102 static void _view_init(Evas_Object *obj);
103 static void _set_vis_guidetext(Evas_Object *obj);
104 static void _calculate_box_min_size(Evas_Object *box, Evas_Object_Box_Data *priv);
105 static Evas_Coord _calculate_item_max_height(Evas_Object *box, Evas_Object_Box_Data *priv, int obj_index);
106 static void _box_layout_cb(Evas_Object *o, Evas_Object_Box_Data *priv, void *data);
109 _del_hook(Evas_Object *obj)
111 Widget_Data *wd = elm_widget_data_get(obj);
116 Elm_Multibuttonentry_Item *item;
117 EINA_LIST_FREE(wd->items, item)
119 _del_button_obj(obj, item->button);
126 if (wd->entry) evas_object_del (wd->entry);
127 if (wd->label) evas_object_del (wd->label);
128 if (wd->guidetext) evas_object_del (wd->guidetext);
129 if (wd->end) evas_object_del (wd->end);
130 if (wd->rect_for_end) evas_object_del(wd->rect_for_end);
134 _theme_hook(Evas_Object *obj)
136 Widget_Data *wd = elm_widget_data_get(obj);
138 Elm_Multibuttonentry_Item *item;
142 _elm_theme_object_set(obj, wd->base, "multibuttonentry", "base", elm_widget_style_get(obj));
143 if (wd->box) edje_object_part_swallow (wd->base, "box.swallow", wd->box);
144 edje_object_scale_set(wd->base, elm_widget_scale_get(obj) * _elm_config->scale);
146 EINA_LIST_FOREACH(wd->items, l, item)
149 _elm_theme_object_set(obj, item->button, "multibuttonentry", "btn", elm_widget_style_get (obj));
150 edje_object_scale_set(item->button, elm_widget_scale_get(obj) * _elm_config->scale);
157 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
159 Widget_Data *wd = elm_widget_data_get(obj);
163 Ecore_IMF_Context *imf_context = elm_entry_imf_context_get(wd->entry);
165 if (elm_widget_focus_get(obj))
167 if ((imf_context) && (wd->current))
169 ecore_imf_context_input_panel_show(imf_context);
171 else if ((imf_context) && ((!wd->current) || (!eina_list_count(wd->items))))
173 if (wd->entry) elm_entry_cursor_end_set(wd->entry);
175 ecore_imf_context_input_panel_show(imf_context);
177 wd->focused = EINA_TRUE;
178 evas_object_smart_callback_call(obj, "focused", NULL);
182 wd->focused = EINA_FALSE;
184 if (imf_context) ecore_imf_context_input_panel_hide(imf_context);
185 evas_object_smart_callback_call(obj, "unfocused", NULL);
190 _event_hook(Evas_Object *obj __UNUSED__, Evas_Object *src __UNUSED__, Evas_Callback_Type type __UNUSED__, void *event_info __UNUSED__)
196 _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
198 Widget_Data *wd = elm_widget_data_get(obj);
201 edje_object_signal_emit(wd->base, emission, source);
205 _sizing_eval(Evas_Object *obj)
207 Widget_Data *wd = elm_widget_data_get(obj);
208 Evas_Coord minw = -1, minh = -1;
209 Evas_Coord left, right, top, bottom;
212 evas_object_size_hint_min_get(wd->box, &minw, &minh);
213 edje_object_part_geometry_get(wd->base, "top.left.pad", NULL, NULL, &left, &top);
214 edje_object_part_geometry_get(wd->base, "bottom.right.pad", NULL, NULL, &right, &bottom);
216 minw += (left + right);
217 minh += (top + bottom);
219 evas_object_size_hint_min_set(obj, minw, minh);
223 _signal_mouse_clicked(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
225 Widget_Data *wd = elm_widget_data_get(data);
227 if (!wd || !wd->base) return;
228 wd->focused = EINA_TRUE;
231 Ecore_IMF_Context *imf_context = elm_entry_imf_context_get(wd->entry);
233 if (imf_context) ecore_imf_context_input_panel_show(imf_context);
234 evas_object_smart_callback_call(data, "clicked", NULL);
238 _changed_size_hint_cb(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
240 Evas_Object *eo = (Evas_Object *)data;
241 Widget_Data *wd = elm_widget_data_get(data);
248 _resize_cb(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
250 Widget_Data *wd = elm_widget_data_get(data);
254 evas_object_geometry_get(wd->box, NULL, NULL, &w, &h);
256 if (wd->h_box < h) evas_object_smart_callback_call (data, "expanded", NULL);
257 else if (wd->h_box > h) evas_object_smart_callback_call (data, "contracted", NULL);
266 _event_init(Evas_Object *obj)
268 Widget_Data *wd = elm_widget_data_get(obj);
270 if (!wd || !wd->base) return;
273 edje_object_signal_callback_add(wd->base, "mouse,clicked,1", "*", _signal_mouse_clicked, obj);
274 evas_object_event_callback_add(wd->base, EVAS_CALLBACK_KEY_UP, _evas_mbe_key_up_cb, obj);
279 evas_object_event_callback_add(wd->box, EVAS_CALLBACK_RESIZE, _resize_cb, obj);
280 evas_object_event_callback_add(wd->box, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hint_cb, obj);
285 evas_object_event_callback_add(wd->entry, EVAS_CALLBACK_KEY_UP, _entry_key_up_cb, obj);
286 evas_object_event_callback_add(wd->entry, EVAS_CALLBACK_KEY_DOWN, _entry_key_down_cb, obj);
287 evas_object_event_callback_add(wd->entry, EVAS_CALLBACK_RESIZE, _entry_resized_cb, obj);
288 evas_object_smart_callback_add(wd->entry, "changed", _entry_changed_cb, obj);
289 evas_object_smart_callback_add(wd->entry, "focused", _entry_focus_in_cb, obj);
290 evas_object_smart_callback_add(wd->entry, "unfocused", _entry_focus_out_cb, obj);
291 evas_object_smart_callback_add(wd->entry, "clicked", _entry_clicked_cb, obj);
296 _set_vis_guidetext(Evas_Object *obj)
298 Widget_Data *wd = elm_widget_data_get(obj);
301 elm_box_unpack(wd->box, wd->guidetext);
302 elm_box_unpack(wd->box, wd->entry);
303 if (wd->view_state == MULTIBUTTONENTRY_VIEW_CONTRACTED) return;
305 if (wd && (!eina_list_count(wd->items)) && wd->guidetext
306 && (!elm_widget_focus_get(obj)) && (!wd->focused) && (!wd->n_str))
308 evas_object_hide(wd->entry);
309 elm_box_pack_end(wd->box, wd->guidetext);
310 evas_object_show(wd->guidetext);
311 wd->view_state = MULTIBUTTONENTRY_VIEW_GUIDETEXT;
315 evas_object_hide(wd->guidetext);
316 elm_box_pack_end(wd->box, wd->entry);
317 evas_object_show(wd->entry);
318 if (elm_widget_focus_get(obj) || wd->focused)
320 elm_object_focus_set(wd->entry, EINA_TRUE);
321 wd->view_state = MULTIBUTTONENTRY_VIEW_ENTRY;
326 _contracted_state_set(Evas_Object *obj, int contracted)
328 Widget_Data *wd = elm_widget_data_get(obj);
330 Elm_Multibuttonentry_Item *item;
332 if (!wd || !wd->box) return;
333 if (wd->view_state == MULTIBUTTONENTRY_VIEW_ENTRY)
334 evas_object_hide(wd->entry);
335 else if (wd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT)
336 evas_object_hide(wd->guidetext);
337 else if (wd->view_state == MULTIBUTTONENTRY_VIEW_CONTRACTED)
339 evas_object_hide(wd->rect_for_end);
340 evas_object_hide(wd->end);
341 wd->view_state = MULTIBUTTONENTRY_VIEW_NONE;
346 Evas_Coord w=0, w_tmp=0;
347 Evas_Coord box_inner_item_width_padding = 0;
349 elm_box_padding_get(wd->box, &box_inner_item_width_padding, NULL);
350 // unpack all items and entry
351 elm_box_unpack_all(wd->box);
352 EINA_LIST_FOREACH(wd->items, l, item)
356 evas_object_hide(item->button);
357 item->visible = EINA_FALSE;
360 // pack buttons only 1line
365 elm_box_pack_end(wd->box, wd->label);
366 evas_object_size_hint_min_get(wd->label, &w_tmp, NULL);
368 w -= box_inner_item_width_padding;
372 int count = eina_list_count(wd->items);
373 Evas_Coord button_min_width = 0;
374 /* Evas_Coord button_min_height = 0; */
375 if (wd->end_type == MULTIBUTTONENTRY_CLOSED_IMAGE)
377 const char *size_str;
378 size_str = edje_object_data_get(wd->end, "closed_button_width");
379 if (size_str) button_min_width = (Evas_Coord)atoi(size_str);
381 size_str = edje_object_data_get(wd->end, "closed_button_height");
382 if (size_str) button_min_width = (Evas_Coord)atoi(size_str);
386 EINA_LIST_FOREACH(wd->items, l, item)
390 int w_label_count = 0;
393 elm_box_pack_end(wd->box, item->button);
394 evas_object_show(item->button);
395 item->visible = EINA_TRUE;
398 w -= box_inner_item_width_padding;
401 if (wd->end_type == MULTIBUTTONENTRY_CLOSED_LABEL)
405 snprintf(buf, sizeof(buf), "... + %d", count);
406 elm_object_text_set(wd->end, buf);
407 evas_object_size_hint_min_get(wd->end, &w_label_count, NULL);
410 if (w < 0 || w < w_label_count)
412 elm_box_unpack(wd->box, item->button);
413 evas_object_hide(item->button);
414 item->visible = EINA_FALSE;
417 snprintf(buf, sizeof(buf), "... + %d", count);
418 elm_object_text_set(wd->end, buf);
419 evas_object_size_hint_min_get(wd->end, &w_label_count, NULL);
421 elm_box_pack_end(wd->box, wd->end);
422 evas_object_show(wd->end);
424 wd->view_state = MULTIBUTTONENTRY_VIEW_CONTRACTED;
425 evas_object_smart_callback_call(obj, "contracted,state,changed", (void *)1);
429 else if (wd->end_type == MULTIBUTTONENTRY_CLOSED_IMAGE)
431 if (w < button_min_width)
434 Evas_Coord closed_height = 0;
435 const char *height_str = edje_object_data_get(wd->base, "closed_height");
437 if (height_str) closed_height = (Evas_Coord)atoi(height_str);
438 elm_box_unpack(wd->box, item->button);
439 evas_object_hide(item->button);
440 item->visible = EINA_FALSE;
443 rectSize = w - button_min_width;
444 if (!wd->rect_for_end)
446 Evas *e = evas_object_evas_get(obj);
447 wd->rect_for_end = evas_object_rectangle_add(e);
448 evas_object_color_set(wd->rect_for_end, 0, 0, 0, 0);
450 evas_object_size_hint_min_set(wd->rect_for_end, rectSize, closed_height * elm_scale_get());
451 elm_box_pack_end(wd->box, wd->rect_for_end);
452 evas_object_show(wd->rect_for_end);
454 elm_box_pack_end(wd->box, wd->end);
455 evas_object_show(wd->end);
457 wd->view_state = MULTIBUTTONENTRY_VIEW_CONTRACTED;
458 evas_object_smart_callback_call(obj, "contracted,state,changed", (void *)0);
467 // unpack all items and entry
468 elm_box_unpack_all(wd->box);
469 EINA_LIST_FOREACH(wd->items, l, item)
473 evas_object_hide(item->button);
474 item->visible = EINA_FALSE;
477 evas_object_hide(wd->end);
479 if (wd->rect_for_end) evas_object_hide(wd->rect_for_end);
481 // pack buttons only 1line
483 if (wd->label) elm_box_pack_end(wd->box, wd->label);
487 EINA_LIST_FOREACH(wd->items, l, item)
491 elm_box_pack_end(wd->box, item->button);
492 evas_object_show(item->button);
493 item->visible = EINA_TRUE;
497 wd->view_state = MULTIBUTTONENTRY_VIEW_NONE;
498 evas_object_smart_callback_call(obj, "contracted,state,changed", (void *)wd->contracted);
500 if (wd->view_state != MULTIBUTTONENTRY_VIEW_CONTRACTED)
502 _set_vis_guidetext(obj);
507 _view_update(Evas_Object *obj)
509 Evas_Coord width = 1, height = 1;
510 Widget_Data *wd = elm_widget_data_get(obj);
512 if (!wd || !wd->box || !wd->entry || !(wd->w_box > 0)) return;
517 elm_box_unpack(wd->box, wd->label);
518 elm_box_pack_start(wd->box, wd->label);
519 evas_object_size_hint_min_get(wd->label, &width, &height);
524 Evas_Coord guide_text_width = wd->w_box - width;
525 evas_object_size_hint_min_set(wd->guidetext, guide_text_width, height);
528 // update buttons in contracted mode
529 if (wd->view_state == MULTIBUTTONENTRY_VIEW_CONTRACTED)
530 _contracted_state_set(obj, 1);
533 _set_vis_guidetext(obj);
537 _set_label(Evas_Object *obj, const char* str)
539 Widget_Data *wd = elm_widget_data_get(obj);
541 if (!wd || !str) return;
544 Evas_Coord width, height, sum_width = 0;
545 evas_object_size_hint_min_set(wd->label, 0, 0);
546 evas_object_resize(wd->label, 0, 0);
547 edje_object_part_text_set(wd->label, "mbe.label", str);
549 if (!strcmp(str, ""))
551 /* FIXME: not work yet */
552 edje_object_signal_emit(wd->label, "elm,mbe,clear_text", "");
553 edje_object_part_geometry_get(wd->label, "mbe.label", NULL, NULL, &width, &height);
558 edje_object_signal_emit(wd->label, "elm,mbe,set_text", "");
559 edje_object_part_geometry_get(wd->label, "mbe.label", NULL, NULL, &width, &height);
563 edje_object_part_geometry_get(wd->label, "mbe.label.left.padding", NULL, NULL, &width, NULL);
566 edje_object_part_geometry_get(wd->label, "mbe.label.right.padding", NULL, NULL, &width, NULL);
569 evas_object_size_hint_min_set(wd->label, sum_width, height);
571 evas_object_show(wd->label);
576 _set_guidetext(Evas_Object *obj, const char* str)
578 Widget_Data *wd = elm_widget_data_get(obj);
580 if (!wd || !str) return;
583 if (! (wd->guidetext = edje_object_add (evas_object_evas_get (obj)))) return;
584 _elm_theme_object_set(obj, wd->guidetext, "multibuttonentry", "guidetext", elm_widget_style_get(obj));
585 evas_object_size_hint_weight_set(wd->guidetext, 0.0, EVAS_HINT_EXPAND);
586 evas_object_size_hint_align_set(wd->guidetext, EVAS_HINT_FILL, EVAS_HINT_FILL);
589 if (wd->guidetext) edje_object_part_text_set (wd->guidetext, "elm.text", str);
594 _change_current_button_state(Evas_Object *obj, Multibuttonentry_Button_State state)
596 Widget_Data *wd = elm_widget_data_get(obj);
597 Elm_Multibuttonentry_Item *item = NULL;
601 item = eina_list_data_get(wd->current);
603 if (item && item->button)
607 case MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT:
608 edje_object_signal_emit(item->button, "default", "");
611 case MULTIBUTTONENTRY_BUTTON_STATE_SELECTED:
612 edje_object_signal_emit(item->button, "focused", "");
613 evas_object_smart_callback_call(obj, "item,selected", item);
616 edje_object_signal_emit(item->button, "default", "");
624 _change_current_button(Evas_Object *obj, Evas_Object *btn)
626 Widget_Data *wd = elm_widget_data_get(obj);
628 Elm_Multibuttonentry_Item *item;
632 // change the state of previous button to "default"
633 _change_current_button_state(obj, MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT);
635 // change the current
636 EINA_LIST_FOREACH(wd->items, l, item)
638 if (item->button == btn)
644 // change the state of current button to "focused"
645 _change_current_button_state(obj, MULTIBUTTONENTRY_BUTTON_STATE_SELECTED);
649 _button_clicked(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
651 Widget_Data *wd = elm_widget_data_get(data);
653 Elm_Multibuttonentry_Item *item = NULL;
654 if (!wd || wd->view_state == MULTIBUTTONENTRY_VIEW_CONTRACTED) return;
656 _select_button(data, obj);
658 if ((wd->current) && ((item = eina_list_data_get(wd->current)) != NULL))
659 evas_object_smart_callback_call(data, "item,clicked", item);
663 _del_button_obj(Evas_Object *obj, Evas_Object *btn)
665 Widget_Data *wd = elm_widget_data_get(obj);
667 if (!wd || !btn) return;
669 evas_object_del(btn);
673 _del_button_item(Elm_Multibuttonentry_Item *item)
676 Elm_Multibuttonentry_Item *_item;
680 Evas_Object *obj = item->multibuttonentry;
681 wd = elm_widget_data_get(obj);
683 EINA_LIST_FOREACH(wd->items, l, _item)
687 wd->items = eina_list_remove(wd->items, _item);
688 elm_box_unpack(wd->box, _item->button);
690 evas_object_smart_callback_call(obj, "item,deleted", _item);
692 _del_button_obj(obj, _item->button);
695 if (wd->current == l)
700 if (wd->view_state == MULTIBUTTONENTRY_VIEW_CONTRACTED)
701 _contracted_state_set(obj, 1);
703 if (!eina_list_count(wd->items))
704 _set_vis_guidetext(obj);
708 _select_button(Evas_Object *obj, Evas_Object *btn)
710 Widget_Data *wd = elm_widget_data_get(obj);
715 _change_current_button(obj, btn);
716 if (elm_widget_focus_get(obj))
718 elm_object_focus_set(wd->entry, EINA_FALSE);
719 evas_object_focus_set(btn, EINA_TRUE);
724 _change_current_button_state(obj, MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT);
725 if (elm_widget_focus_get(obj))
726 elm_object_focus_set(wd->entry, EINA_TRUE);
731 _resize_button(Evas_Object *btn, Evas_Coord *realw, Evas_Coord *vieww)
734 Evas_Coord w_text, h_btn, padding_outer, padding_inner;
735 Evas_Coord w_btn = 0, button_max_width = 0;
736 const char *size_str;
737 const char *ellipsis = "<ellipsis=1.0>";
739 size_str = edje_object_data_get(btn, "button_max_size");
740 if (size_str) button_max_width = (Evas_Coord)atoi(size_str);
742 const char *button_text = edje_object_part_text_get(btn, "elm.btn.text");
744 // decide the size of button
745 edje_object_part_geometry_get(btn, "elm.base", NULL, NULL, NULL, &h_btn);
746 edje_object_part_geometry_get(btn, "elm.btn.text", NULL, NULL, &w_text, NULL);
747 edje_object_part_geometry_get(btn, "left.padding", NULL, NULL, &padding_outer, NULL);
748 edje_object_part_geometry_get(btn, "left.inner.padding", NULL, NULL, &padding_inner, NULL);
749 w_btn = w_text + 2*padding_outer + 2*padding_inner;
753 if (button_max_width < w_btn)
755 vw = button_max_width;
756 edje_object_part_text_set(btn, "elm.btn.text", ellipsis);
757 edje_object_part_text_append(btn, "elm.btn.text", button_text);
763 evas_object_resize(btn, vw, h_btn);
764 evas_object_size_hint_min_set(btn, vw, h_btn);
766 if (realw) *realw = rw;
767 if (vieww) *vieww = vw;
770 static Elm_Multibuttonentry_Item*
771 _add_button_item(Evas_Object *obj, const char *str, Multibuttonentry_Pos pos, const Elm_Multibuttonentry_Item *reference, void *data)
773 Elm_Multibuttonentry_Item *item;
775 Evas_Coord width, height;
776 char *str_utf8 = NULL;
778 Widget_Data *wd = elm_widget_data_get(obj);
780 if (!wd || !wd->box || !wd->entry) return NULL;
782 if ((wd->add_callback) && !wd->add_callback(obj, str, data, wd->add_callback_data)) return NULL;
784 //entry is cleared when text is made to button
785 elm_entry_entry_set(wd->entry, "");
787 // initialize entry size to be called entry's EVAS_CALLBACK_RESIZE even entry size's doesn't changed
788 evas_object_resize(wd->entry, 0, 0);
791 btn = edje_object_add(evas_object_evas_get(obj));
792 str_utf8 = elm_entry_markup_to_utf8(str);
794 _elm_theme_object_set(obj, btn, "multibuttonentry", "btn", elm_widget_style_get(obj));
795 edje_object_part_text_set(btn, "elm.btn.text", str_utf8);
796 edje_object_part_geometry_get(btn, "elm.btn.text", NULL, NULL, &width, &height);
798 evas_object_size_hint_min_set(btn, width, height);
800 edje_object_signal_callback_add(btn, "mouse,clicked,1", "*", _button_clicked, obj);
801 evas_object_size_hint_weight_set(btn, 0.0, 0.0);
802 evas_object_show(btn);
805 item = ELM_NEW(Elm_Multibuttonentry_Item);
809 _resize_button(btn, &rw, &vw);
810 item->multibuttonentry = obj;
815 item->visible = EINA_TRUE;
819 case MULTIBUTTONENTRY_POS_START:
820 wd->items = eina_list_prepend(wd->items, item);
821 if (wd->view_state == MULTIBUTTONENTRY_VIEW_CONTRACTED)
823 elm_widget_sub_object_add(obj, btn);
824 _contracted_state_set(obj, 1);
829 elm_box_pack_after(wd->box, btn, wd->label);
831 elm_box_pack_start(wd->box, btn);
832 if (wd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT)
833 _set_vis_guidetext(obj);
836 case MULTIBUTTONENTRY_POS_END:
837 wd->items = eina_list_append(wd->items, item);
838 if (wd->view_state == MULTIBUTTONENTRY_VIEW_CONTRACTED)
840 elm_widget_sub_object_add(obj, btn);
841 evas_object_hide(btn);
845 if (wd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT)
846 _set_vis_guidetext(obj);
848 elm_box_pack_before(wd->box, btn, wd->entry);
850 elm_box_pack_end(wd->box, btn);
853 case MULTIBUTTONENTRY_POS_BEFORE:
855 wd->items = eina_list_prepend_relative(wd->items, item, reference);
857 wd->items = eina_list_append(wd->items, item);
858 if (wd->view_state == MULTIBUTTONENTRY_VIEW_CONTRACTED)
860 elm_widget_sub_object_add(obj, btn);
861 evas_object_hide(btn);
862 _contracted_state_set(obj, 1);
867 elm_box_pack_before(wd->box, btn, reference->button);
870 if (wd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT)
871 _set_vis_guidetext(obj);
873 elm_box_pack_before(wd->box, btn, wd->entry);
875 elm_box_pack_end(wd->box, btn);
879 case MULTIBUTTONENTRY_POS_AFTER:
881 wd->items = eina_list_append_relative(wd->items, item, reference);
883 wd->items = eina_list_append(wd->items, item);
884 if (wd->view_state == MULTIBUTTONENTRY_VIEW_CONTRACTED)
886 elm_widget_sub_object_add(obj, btn);
887 _contracted_state_set(obj, 1);
892 elm_box_pack_after(wd->box, btn, reference->button);
895 if (wd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT)
896 _set_vis_guidetext(obj);
898 elm_box_pack_before(wd->box, btn, wd->entry);
900 elm_box_pack_end(wd->box, btn);
908 evas_object_smart_callback_call(obj, "item,added", item);
916 _add_button(Evas_Object *obj, char *str)
918 Widget_Data *wd = elm_widget_data_get(obj);
922 _add_button_item(obj, str, MULTIBUTTONENTRY_POS_END, NULL, NULL);
926 _evas_mbe_key_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
928 Widget_Data *wd = elm_widget_data_get(data);
929 Elm_Multibuttonentry_Item *item = NULL;
931 static char str[MAX_STR];
933 if (!wd || !wd->base || !wd->box) return;
935 strncpy(str, elm_entry_entry_get(wd->entry), MAX_STR);
936 str[MAX_STR - 1] = 0;
938 Evas_Event_Key_Up *ev = (Evas_Event_Key_Up*)event_info;
940 if (wd->last_btn_select)
942 if ((wd->current) && ( (strcmp (ev->keyname, "BackSpace") == 0) || (strcmp (ev->keyname, "BackSpace (") == 0)))
944 item = eina_list_data_get(wd->current);
947 _del_button_item(item);
948 elm_object_focus(wd->entry);
951 else if ((((!wd->current) && (wd->n_str == 0) && (strcmp (ev->keyname, "BackSpace") == 0))
952 || (strcmp (ev->keyname, "BackSpace (") == 0)))
954 item = eina_list_data_get(eina_list_last(wd->items));
956 _select_button(data, item->button);
960 wd->last_btn_select = EINA_TRUE;
964 _entry_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
966 Widget_Data *wd = elm_widget_data_get(data);
967 Evas_Event_Key_Down *ev = (Evas_Event_Key_Down *)event_info;
971 if ((wd->n_str == 1) && (strcmp(ev->keyname, "BackSpace") == 0 || (strcmp(ev->keyname, "BackSpace (") == 0 )))
972 wd->last_btn_select = EINA_FALSE;
976 _entry_key_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
978 Widget_Data *wd = elm_widget_data_get(data);
979 Evas_Event_Key_Up *ev = (Evas_Event_Key_Up *) event_info;
980 static char str[MAX_STR];
982 if (!wd || !wd->base || !wd->box) return;
984 strncpy(str, elm_entry_entry_get(wd->entry), MAX_STR);
985 str[MAX_STR - 1] = 0;
987 if ( (strcmp (str, "") != 0) && (strcmp (ev->keyname, "KP_Enter") == 0 || strcmp (ev->keyname, "Return") == 0 ))
989 _add_button(data, str);
996 _entry_clicked_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
998 Widget_Data *wd = elm_widget_data_get(data);
1001 _change_current_button_state(data, MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT);
1002 elm_object_focus_set(wd->entry, EINA_TRUE);
1006 _entry_focus_in_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1008 Widget_Data *wd = elm_widget_data_get(data);
1009 Elm_Multibuttonentry_Item *item = NULL;
1015 item = eina_list_data_get(wd->current);
1016 elm_object_focus_set(wd->entry, EINA_FALSE);
1017 evas_object_focus_set(item->button, EINA_TRUE);
1022 _entry_focus_out_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1024 Widget_Data *wd = elm_widget_data_get(data);
1027 static char str[MAX_STR];
1029 strncpy(str,elm_entry_entry_get(wd->entry), MAX_STR);
1030 str[MAX_STR -1] = 0;
1033 _add_button(data, str);
1037 _entry_changed_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1039 Widget_Data *wd = elm_widget_data_get(data);
1042 static char str[MAX_STR];
1044 strncpy(str, elm_entry_entry_get(wd->entry), MAX_STR);
1045 str[MAX_STR -1] = 0;
1047 wd->n_str = strlen(str);
1051 _entry_resized_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1053 Evas_Coord en_x, en_y, en_w, en_h;
1055 Widget_Data *wd = elm_widget_data_get(data);
1058 evas_object_geometry_get(wd->entry, &en_x, &en_y, &en_w, &en_h);
1061 elm_widget_show_region_set(wd->entry, en_x, en_y, en_w, en_h, EINA_TRUE);
1065 _view_init(Evas_Object *obj)
1067 Widget_Data *wd = elm_widget_data_get(obj);
1073 wd->box = elm_box_add (obj);
1074 if (!wd->box) return;
1075 elm_widget_sub_object_add(obj, wd->box);
1076 elm_box_layout_set(wd->box, _box_layout_cb, NULL, NULL);
1077 elm_box_homogeneous_set(wd->box, EINA_FALSE);
1078 edje_object_part_swallow(wd->base, "box.swallow", wd->box);
1082 wd->label = edje_object_add(evas_object_evas_get(obj));
1083 if (!wd->label) return;
1084 _elm_theme_object_set(obj, wd->label, "multibuttonentry", "label", elm_widget_style_get(obj));
1085 _set_label(obj, "");
1086 elm_widget_sub_object_add(obj, wd->label);
1091 if (! (wd->entry = elm_entry_add (obj))) return;
1092 elm_entry_scrollable_set(wd->entry, EINA_TRUE);
1093 elm_entry_single_line_set(wd->entry, EINA_TRUE);
1094 elm_entry_entry_set(wd->entry, "");
1095 elm_entry_input_panel_enabled_set(wd->entry, EINA_FALSE);
1096 evas_object_size_hint_min_set(wd->entry, MIN_W_ENTRY, 0);
1097 evas_object_size_hint_weight_set(wd->entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1098 evas_object_size_hint_align_set(wd->entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
1099 if (wd->box) elm_box_pack_end (wd->box, wd->entry);
1100 evas_object_show(wd->entry);
1101 wd->view_state = MULTIBUTTONENTRY_VIEW_ENTRY;
1106 const char *end_type = edje_object_data_get(wd->base, "closed_button_type");
1107 if (!end_type || !strcmp(end_type, "label"))
1109 if (! (wd->end = elm_label_add (obj))) return;
1110 elm_object_style_set(wd->end, "extended/multibuttonentry_default");
1111 wd->end_type = MULTIBUTTONENTRY_CLOSED_LABEL;
1115 const char *size_str;
1116 if (!(wd->end = edje_object_add(evas_object_evas_get(obj)))) return;
1117 _elm_theme_object_set(obj, wd->end, "multibuttonentry", "closedbutton", elm_widget_style_get(obj));
1118 Evas_Coord button_min_width = 0;
1119 Evas_Coord button_min_height = 0;
1121 size_str = edje_object_data_get(wd->end, "closed_button_width");
1122 if(size_str) button_min_width = (Evas_Coord)atoi(size_str);
1123 size_str = edje_object_data_get(wd->end, "closed_button_height");
1124 if(size_str) button_min_height = (Evas_Coord)atoi(size_str);
1126 wd->end_type = MULTIBUTTONENTRY_CLOSED_IMAGE;
1127 evas_object_size_hint_min_set(wd->end, button_min_width * elm_scale_get(), button_min_height * elm_scale_get());
1128 elm_widget_sub_object_add(obj, wd->end);
1134 _calculate_box_min_size(Evas_Object *box, Evas_Object_Box_Data *priv)
1136 Evas_Coord minw, minh, maxw, maxh, mnw, mnh, ww;
1137 Evas_Coord w, cw = 0, cmaxh = 0;
1139 Evas_Object_Box_Option *opt;
1142 /* FIXME: need to calc max */
1148 evas_object_geometry_get(box, NULL, NULL, &w, NULL);
1149 evas_object_size_hint_min_get(box, &minw, NULL);
1151 EINA_LIST_FOREACH(priv->children, l, opt)
1153 evas_object_size_hint_min_get(opt->obj, &mnw, &mnh);
1154 evas_object_size_hint_weight_get(opt->obj, &wx, NULL);
1158 if (mnw != -1 && (w - cw) >= mnw)
1173 if (cmaxh < mnh) cmaxh = mnh;
1178 evas_object_size_hint_min_set(box, minw, minh);
1182 _calculate_item_max_height(Evas_Object *box, Evas_Object_Box_Data *priv, int obj_index)
1184 Evas_Coord mnw, mnh, cw = 0, cmaxh = 0, w, ww;
1186 Evas_Object_Box_Option *opt;
1190 evas_object_geometry_get(box, NULL, NULL, &w, NULL);
1192 EINA_LIST_FOREACH(priv->children, l, opt)
1194 evas_object_size_hint_min_get(opt->obj, &mnw, &mnh);
1195 evas_object_size_hint_weight_get(opt->obj, &wx, NULL);
1199 if (mnw != -1 && (w - cw) >= mnw)
1209 if (index > obj_index) return cmaxh;
1215 if (cmaxh < mnh) cmaxh = mnh;
1224 _box_layout_cb(Evas_Object *o, Evas_Object_Box_Data *priv, void *data __UNUSED__)
1226 Evas_Coord x, y, w, h, xx, yy;
1229 Evas_Coord minw, minh, wdif, hdif;
1232 Evas_Object_Box_Option *opt;
1234 _calculate_box_min_size(o, priv);
1236 evas_object_geometry_get(o, &x, &y, &w, &h);
1238 evas_object_size_hint_min_get(o, &minw, &minh);
1239 evas_object_size_hint_align_get(o, &ax, &ay);
1240 count = eina_list_count(priv->children);
1243 x = x + ((w - minw) * (1.0 - ax));
1248 y = y + ((h - minh) * (1.0 - ay));
1257 Evas_Coord cw = 0, ch = 0, cmaxh = 0, obj_index = 0;
1259 EINA_LIST_FOREACH(priv->children, l, opt)
1261 Evas_Coord mnw, mnh, mxw, mxh;
1266 evas_object_size_hint_align_get(obj, &ax, &ay);
1267 evas_object_size_hint_weight_get(obj, &wx, &wy);
1268 evas_object_size_hint_min_get(obj, &mnw, &mnh);
1269 evas_object_size_hint_max_get(obj, &mxw, &mxh);
1272 if (ax == -1.0) {fw = 1; ax = 0.5;}
1273 if (ay == -1.0) {fh = 1; ay = 0.5;}
1274 if (wx > 0.0) xw = 1;
1275 if (wy > 0.0) xh = 1;
1276 Evas_Coord ww, hh, ow, oh;
1280 if (mnw != -1 && (w - cw) >= mnw)
1287 hh = _calculate_item_max_height(o, priv, obj_index);
1291 if ((mxw >= 0) && (mxw < ow)) ow = mxw;
1294 if ((mxh >= 0) && (mxh < oh)) oh = mxh;
1303 evas_object_move(obj,
1304 xx + cw + (Evas_Coord)(((double)(ww - ow)) * ax),
1305 yy + ch + (Evas_Coord)(((double)(hh - oh)) * ay));
1306 evas_object_resize(obj, ow, oh);
1309 if (cmaxh < hh) cmaxh = hh;
1316 elm_multibuttonentry_add(Evas_Object *parent)
1322 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
1324 ELM_SET_WIDTYPE(widtype, "multibuttonentry");
1325 elm_widget_type_set(obj, "multibuttonentry");
1326 elm_widget_sub_object_add(parent, obj);
1327 elm_widget_data_set(obj, wd);
1329 elm_widget_del_hook_set(obj, _del_hook);
1330 elm_widget_theme_hook_set(obj, _theme_hook);
1331 elm_widget_event_hook_set(obj, _event_hook);
1332 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
1333 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
1335 wd->base = edje_object_add(e);
1336 _elm_theme_object_set(obj, wd->base, "multibuttonentry", "base", "default");
1337 elm_widget_resize_object_set(obj, wd->base);
1338 elm_widget_can_focus_set(obj, EINA_TRUE);
1340 wd->view_state = MULTIBUTTONENTRY_VIEW_NONE;
1341 wd->focused = EINA_FALSE;
1342 wd->last_btn_select = EINA_TRUE;
1344 wd->rect_for_end= NULL;
1345 wd->add_callback = NULL;
1346 wd->add_callback_data = NULL;
1355 elm_multibuttonentry_entry_get(const Evas_Object *obj)
1357 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1358 Widget_Data *wd = elm_widget_data_get(obj);
1360 if (!wd) return NULL;
1366 elm_multibuttonentry_label_get(const Evas_Object *obj)
1368 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1369 Widget_Data *wd = elm_widget_data_get(obj);
1371 if (!wd) return NULL;
1372 if (wd->label) return edje_object_part_text_get(wd->label, "mbe.label");
1377 elm_multibuttonentry_label_set(Evas_Object *obj, const char *label)
1379 ELM_CHECK_WIDTYPE(obj, widtype);
1380 Widget_Data *wd = elm_widget_data_get(obj);
1384 _set_label(obj, label);
1386 _set_label(obj, "");
1390 elm_multibuttonentry_guide_text_get(const Evas_Object *obj)
1392 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1393 Widget_Data *wd = elm_widget_data_get(obj);
1395 if (!wd) return NULL;
1396 if (wd->guidetext) return edje_object_part_text_get(wd->guidetext, "elm.text");
1401 elm_multibuttonentry_guide_text_set(Evas_Object *obj, const char *guidetext)
1403 ELM_CHECK_WIDTYPE(obj, widtype);
1404 Widget_Data *wd = elm_widget_data_get(obj);
1408 _set_guidetext(obj, guidetext);
1410 _set_guidetext(obj, "");
1414 elm_multibuttonentry_contracted_state_get(const Evas_Object *obj)
1416 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1417 Widget_Data *wd = elm_widget_data_get(obj);
1420 return wd->view_state == MULTIBUTTONENTRY_VIEW_CONTRACTED ? 1 : 0;
1424 elm_multibuttonentry_contracted_state_set(Evas_Object *obj, int contracted)
1426 ELM_CHECK_WIDTYPE(obj, widtype);
1427 Widget_Data *wd = elm_widget_data_get(obj);
1429 if (!wd || !wd->box ||
1430 ((wd->view_state == MULTIBUTTONENTRY_VIEW_CONTRACTED) ? 1 : 0) == contracted) return;
1431 _contracted_state_set(obj, contracted);
1434 EAPI Elm_Multibuttonentry_Item *
1435 elm_multibuttonentry_item_add_start(Evas_Object *obj, const char *label, void *data)
1437 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1438 Widget_Data *wd = elm_widget_data_get(obj);
1439 Elm_Multibuttonentry_Item *item;
1441 if (!wd || !label) return NULL;
1442 item = _add_button_item(obj, label, MULTIBUTTONENTRY_POS_START, NULL, data);
1446 EAPI Elm_Multibuttonentry_Item *
1447 elm_multibuttonentry_item_add_end(Evas_Object *obj, const char *label, void *data)
1449 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1450 Widget_Data *wd = elm_widget_data_get(obj);
1451 Elm_Multibuttonentry_Item *item;
1453 if (!wd || !label) return NULL;
1454 item = _add_button_item(obj, label, MULTIBUTTONENTRY_POS_END, NULL, data);
1458 EAPI Elm_Multibuttonentry_Item *
1459 elm_multibuttonentry_item_add_before(Evas_Object *obj, const char *label, Elm_Multibuttonentry_Item *before, void *data)
1461 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1462 Widget_Data *wd = elm_widget_data_get(obj);
1463 Elm_Multibuttonentry_Item *item;
1465 if (!wd || !label) return NULL;
1466 item = _add_button_item(obj, label, MULTIBUTTONENTRY_POS_BEFORE, before, data);
1470 EAPI Elm_Multibuttonentry_Item *
1471 elm_multibuttonentry_item_add_after(Evas_Object *obj, const char *label, Elm_Multibuttonentry_Item *after, void *data)
1473 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1474 Widget_Data *wd = elm_widget_data_get(obj);
1475 Elm_Multibuttonentry_Item *item;
1477 if (!wd || !label) return NULL;
1478 item = _add_button_item(obj, label, MULTIBUTTONENTRY_POS_AFTER, after, data);
1482 EAPI const Eina_List *
1483 elm_multibuttonentry_items_get(const Evas_Object *obj)
1485 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1486 Widget_Data *wd = elm_widget_data_get(obj);
1488 if (!wd) return NULL;
1492 EAPI Elm_Multibuttonentry_Item *
1493 elm_multibuttonentry_item_first_get(const Evas_Object *obj)
1495 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1496 Widget_Data *wd = elm_widget_data_get(obj);
1498 if (!wd || !wd->items) return NULL;
1499 return eina_list_data_get(wd->items);
1502 EAPI Elm_Multibuttonentry_Item *
1503 elm_multibuttonentry_item_last_get(const Evas_Object *obj)
1505 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1506 Widget_Data *wd = elm_widget_data_get(obj);
1508 if (!wd || !wd->items) return NULL;
1509 return eina_list_data_get(eina_list_last(wd->items));
1512 EAPI Elm_Multibuttonentry_Item *
1513 elm_multibuttonentry_item_selected_get(const Evas_Object *obj)
1515 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1516 Widget_Data *wd = elm_widget_data_get(obj);
1518 if (!wd || !wd->current) return NULL;
1519 return eina_list_data_get(wd->current);
1523 elm_multibuttonentry_item_selected_set(Elm_Multibuttonentry_Item *item)
1527 Elm_Multibuttonentry_Item *_item;
1530 ELM_CHECK_WIDTYPE(item->multibuttonentry, widtype);
1531 wd = elm_widget_data_get(item->multibuttonentry);
1534 EINA_LIST_FOREACH(wd->items, l, _item)
1537 _select_button(item->multibuttonentry, item->button);
1542 elm_multibuttonentry_item_unselect_all(Evas_Object *obj)
1544 ELM_CHECK_WIDTYPE(obj, widtype);
1545 Widget_Data *wd = elm_widget_data_get(obj);
1548 _select_button(obj, NULL);
1552 elm_multibuttonentry_items_del(Evas_Object *obj)
1554 ELM_CHECK_WIDTYPE(obj, widtype);
1555 Widget_Data *wd = elm_widget_data_get(obj);
1560 Elm_Multibuttonentry_Item *item;
1561 EINA_LIST_FREE(wd->items, item)
1563 elm_box_unpack(wd->box, item->button);
1564 _del_button_obj(obj, item->button);
1574 elm_multibuttonentry_item_del(Elm_Multibuttonentry_Item *item)
1577 _del_button_item(item);
1581 elm_multibuttonentry_item_label_get(const Elm_Multibuttonentry_Item *item)
1585 Elm_Multibuttonentry_Item *_item;
1586 if (!item) return NULL;
1587 ELM_CHECK_WIDTYPE(item->multibuttonentry, widtype) NULL;
1588 wd = elm_widget_data_get(item->multibuttonentry);
1589 if (!wd || !wd->items) return NULL;
1591 EINA_LIST_FOREACH(wd->items, l, _item)
1594 return edje_object_part_text_get(_item->button, "elm.btn.text");
1601 elm_multibuttonentry_item_label_set(Elm_Multibuttonentry_Item *item, const char *str)
1605 Elm_Multibuttonentry_Item *_item;
1606 if (!item || !str) return;
1607 ELM_CHECK_WIDTYPE(item->multibuttonentry, widtype);
1608 wd = elm_widget_data_get(item->multibuttonentry);
1609 if (!wd || !wd->items) return;
1611 EINA_LIST_FOREACH(wd->items, l, _item)
1614 edje_object_part_text_set(_item->button, "elm.btn.text", str);
1615 _resize_button(_item->button, &_item->rw, &_item->vw);
1620 EAPI Elm_Multibuttonentry_Item *
1621 elm_multibuttonentry_item_prev(Elm_Multibuttonentry_Item *item)
1625 Elm_Multibuttonentry_Item *_item;
1626 if (!item) return NULL;
1627 ELM_CHECK_WIDTYPE(item->multibuttonentry, widtype) NULL;
1628 wd = elm_widget_data_get(item->multibuttonentry);
1629 if (!wd || !wd->items) return NULL;
1631 EINA_LIST_FOREACH(wd->items, l, _item)
1634 l = eina_list_prev(l);
1635 if (!l) return NULL;
1636 return eina_list_data_get(l);
1641 EAPI Elm_Multibuttonentry_Item *
1642 elm_multibuttonentry_item_next(Elm_Multibuttonentry_Item *item)
1646 Elm_Multibuttonentry_Item *_item;
1648 if (!item) return NULL;
1649 ELM_CHECK_WIDTYPE(item->multibuttonentry, widtype) NULL;
1650 wd = elm_widget_data_get(item->multibuttonentry);
1651 if (!wd || !wd->items) return NULL;
1653 EINA_LIST_FOREACH(wd->items, l, _item)
1656 l = eina_list_next(l);
1657 if (!l) return NULL;
1658 return eina_list_data_get(l);
1664 elm_multibuttonentry_item_data_get(const Elm_Multibuttonentry_Item *item)
1666 if (!item) return NULL;
1671 elm_multibuttonentry_item_data_set(Elm_Multibuttonentry_Item *item, void *data)
1678 elm_multibuttonentry_item_verify_callback_set(Evas_Object *obj, Elm_Multibuttonentry_Item_Verify_Callback func, void *data)
1680 ELM_CHECK_WIDTYPE(obj, widtype);
1681 Widget_Data *wd = elm_widget_data_get(obj);
1684 wd->add_callback = func;
1685 wd->add_callback_data = data;