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))))
174 ecore_imf_context_input_panel_show(imf_context);
176 wd->focused = EINA_TRUE;
177 evas_object_smart_callback_call(obj, "focused", NULL);
181 wd->focused = EINA_FALSE;
183 if (imf_context) ecore_imf_context_input_panel_hide(imf_context);
184 evas_object_smart_callback_call(obj, "unfocused", NULL);
189 _event_hook(Evas_Object *obj __UNUSED__, Evas_Object *src __UNUSED__, Evas_Callback_Type type __UNUSED__, void *event_info __UNUSED__)
195 _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
197 Widget_Data *wd = elm_widget_data_get(obj);
200 edje_object_signal_emit(wd->base, emission, source);
204 _sizing_eval(Evas_Object *obj)
206 Widget_Data *wd = elm_widget_data_get(obj);
207 Evas_Coord minw = -1, minh = -1;
208 Evas_Coord left, right, top, bottom;
211 evas_object_size_hint_min_get(wd->box, &minw, &minh);
212 edje_object_part_geometry_get(wd->base, "top.left.pad", NULL, NULL, &left, &top);
213 edje_object_part_geometry_get(wd->base, "bottom.right.pad", NULL, NULL, &right, &bottom);
215 minw += (left + right);
216 minh += (top + bottom);
218 evas_object_size_hint_min_set(obj, minw, minh);
222 _signal_mouse_clicked(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
224 Widget_Data *wd = elm_widget_data_get(data);
226 if (!wd || !wd->base) return;
227 wd->focused = EINA_TRUE;
230 Ecore_IMF_Context *imf_context = elm_entry_imf_context_get(wd->entry);
232 if (imf_context) ecore_imf_context_input_panel_show(imf_context);
233 evas_object_smart_callback_call(data, "clicked", NULL);
237 _changed_size_hint_cb(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
239 Evas_Object *eo = (Evas_Object *)data;
240 Widget_Data *wd = elm_widget_data_get(data);
247 _resize_cb(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
249 Widget_Data *wd = elm_widget_data_get(data);
253 evas_object_geometry_get(wd->box, NULL, NULL, &w, &h);
255 if (wd->h_box < h) evas_object_smart_callback_call (data, "expanded", NULL);
256 else if (wd->h_box > h) evas_object_smart_callback_call (data, "contracted", NULL);
265 _event_init(Evas_Object *obj)
267 Widget_Data *wd = elm_widget_data_get(obj);
269 if (!wd || !wd->base) return;
272 edje_object_signal_callback_add(wd->base, "mouse,clicked,1", "*", _signal_mouse_clicked, obj);
273 evas_object_event_callback_add(wd->base, EVAS_CALLBACK_KEY_UP, _evas_mbe_key_up_cb, obj);
278 evas_object_event_callback_add(wd->box, EVAS_CALLBACK_RESIZE, _resize_cb, obj);
279 evas_object_event_callback_add(wd->box, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hint_cb, obj);
284 evas_object_event_callback_add(wd->entry, EVAS_CALLBACK_KEY_UP, _entry_key_up_cb, obj);
285 evas_object_event_callback_add(wd->entry, EVAS_CALLBACK_KEY_DOWN, _entry_key_down_cb, obj);
286 evas_object_event_callback_add(wd->entry, EVAS_CALLBACK_RESIZE, _entry_resized_cb, obj);
287 evas_object_smart_callback_add(wd->entry, "changed", _entry_changed_cb, obj);
288 evas_object_smart_callback_add(wd->entry, "focused", _entry_focus_in_cb, obj);
289 evas_object_smart_callback_add(wd->entry, "unfocused", _entry_focus_out_cb, obj);
290 evas_object_smart_callback_add(wd->entry, "clicked", _entry_clicked_cb, obj);
295 _set_vis_guidetext(Evas_Object *obj)
297 Widget_Data *wd = elm_widget_data_get(obj);
300 elm_box_unpack(wd->box, wd->guidetext);
301 elm_box_unpack(wd->box, wd->entry);
302 if (wd->view_state == MULTIBUTTONENTRY_VIEW_CONTRACTED) return;
304 if (wd && (!eina_list_count(wd->items)) && wd->guidetext
305 && (!elm_widget_focus_get(obj)) && (!wd->focused) && (!wd->n_str))
307 evas_object_hide(wd->entry);
308 elm_box_pack_end(wd->box, wd->guidetext);
309 evas_object_show(wd->guidetext);
310 wd->view_state = MULTIBUTTONENTRY_VIEW_GUIDETEXT;
314 evas_object_hide(wd->guidetext);
315 elm_box_pack_end(wd->box, wd->entry);
316 evas_object_show(wd->entry);
317 if (elm_widget_focus_get(obj) || wd->focused)
319 elm_object_focus_set(wd->entry, EINA_TRUE);
320 wd->view_state = MULTIBUTTONENTRY_VIEW_ENTRY;
325 _contracted_state_set(Evas_Object *obj, int contracted)
327 Widget_Data *wd = elm_widget_data_get(obj);
329 Elm_Multibuttonentry_Item *item;
331 if (!wd || !wd->box) return;
332 if (wd->view_state == MULTIBUTTONENTRY_VIEW_ENTRY)
333 evas_object_hide(wd->entry);
334 else if (wd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT)
335 evas_object_hide(wd->guidetext);
336 else if (wd->view_state == MULTIBUTTONENTRY_VIEW_CONTRACTED)
338 evas_object_hide(wd->rect_for_end);
339 evas_object_hide(wd->end);
340 wd->view_state = MULTIBUTTONENTRY_VIEW_NONE;
345 Evas_Coord w=0, w_tmp=0;
346 Evas_Coord box_inner_item_width_padding = 0;
348 elm_box_padding_get(wd->box, &box_inner_item_width_padding, NULL);
349 // unpack all items and entry
350 elm_box_unpack_all(wd->box);
351 EINA_LIST_FOREACH(wd->items, l, item)
355 evas_object_hide(item->button);
356 item->visible = EINA_FALSE;
359 // pack buttons only 1line
364 elm_box_pack_end(wd->box, wd->label);
365 evas_object_size_hint_min_get(wd->label, &w_tmp, NULL);
367 w -= box_inner_item_width_padding;
371 int count = eina_list_count(wd->items);
372 Evas_Coord button_min_width = 0;
373 /* Evas_Coord button_min_height = 0; */
374 if (wd->end_type == MULTIBUTTONENTRY_CLOSED_IMAGE)
376 const char *size_str;
377 size_str = edje_object_data_get(wd->end, "closed_button_width");
378 if (size_str) button_min_width = (Evas_Coord)atoi(size_str);
380 size_str = edje_object_data_get(wd->end, "closed_button_height");
381 if (size_str) button_min_width = (Evas_Coord)atoi(size_str);
385 EINA_LIST_FOREACH(wd->items, l, item)
389 int w_label_count = 0;
392 elm_box_pack_end(wd->box, item->button);
393 evas_object_show(item->button);
394 item->visible = EINA_TRUE;
397 w -= box_inner_item_width_padding;
400 if (wd->end_type == MULTIBUTTONENTRY_CLOSED_LABEL)
404 snprintf(buf, sizeof(buf), "... + %d", count);
405 elm_object_text_set(wd->end, buf);
406 evas_object_size_hint_min_get(wd->end, &w_label_count, NULL);
409 if (w < 0 || w < w_label_count)
411 elm_box_unpack(wd->box, item->button);
412 evas_object_hide(item->button);
413 item->visible = EINA_FALSE;
416 snprintf(buf, sizeof(buf), "... + %d", count);
417 elm_object_text_set(wd->end, buf);
418 evas_object_size_hint_min_get(wd->end, &w_label_count, NULL);
420 elm_box_pack_end(wd->box, wd->end);
421 evas_object_show(wd->end);
423 wd->view_state = MULTIBUTTONENTRY_VIEW_CONTRACTED;
424 evas_object_smart_callback_call(obj, "contracted,state,changed", (void *)1);
428 else if (wd->end_type == MULTIBUTTONENTRY_CLOSED_IMAGE)
430 if (w < button_min_width)
433 Evas_Coord closed_height = 0;
434 const char *height_str = edje_object_data_get(wd->base, "closed_height");
436 if (height_str) closed_height = (Evas_Coord)atoi(height_str);
437 elm_box_unpack(wd->box, item->button);
438 evas_object_hide(item->button);
439 item->visible = EINA_FALSE;
442 rectSize = w - button_min_width;
443 if (!wd->rect_for_end)
445 Evas *e = evas_object_evas_get(obj);
446 wd->rect_for_end = evas_object_rectangle_add(e);
447 evas_object_color_set(wd->rect_for_end, 0, 0, 0, 0);
449 evas_object_size_hint_min_set(wd->rect_for_end, rectSize, closed_height * elm_scale_get());
450 elm_box_pack_end(wd->box, wd->rect_for_end);
451 evas_object_show(wd->rect_for_end);
453 elm_box_pack_end(wd->box, wd->end);
454 evas_object_show(wd->end);
456 wd->view_state = MULTIBUTTONENTRY_VIEW_CONTRACTED;
457 evas_object_smart_callback_call(obj, "contracted,state,changed", (void *)0);
466 // unpack all items and entry
467 elm_box_unpack_all(wd->box);
468 EINA_LIST_FOREACH(wd->items, l, item)
472 evas_object_hide(item->button);
473 item->visible = EINA_FALSE;
476 evas_object_hide(wd->end);
478 if (wd->rect_for_end) evas_object_hide(wd->rect_for_end);
480 // pack buttons only 1line
482 if (wd->label) elm_box_pack_end(wd->box, wd->label);
486 EINA_LIST_FOREACH(wd->items, l, item)
490 elm_box_pack_end(wd->box, item->button);
491 evas_object_show(item->button);
492 item->visible = EINA_TRUE;
496 wd->view_state = MULTIBUTTONENTRY_VIEW_NONE;
497 evas_object_smart_callback_call(obj, "contracted,state,changed", (void *)wd->contracted);
499 if (wd->view_state != MULTIBUTTONENTRY_VIEW_CONTRACTED)
501 _set_vis_guidetext(obj);
506 _view_update(Evas_Object *obj)
508 Evas_Coord width = 1, height = 1;
509 Widget_Data *wd = elm_widget_data_get(obj);
511 if (!wd || !wd->box || !wd->entry || !(wd->w_box > 0)) return;
516 elm_box_unpack(wd->box, wd->label);
517 elm_box_pack_start(wd->box, wd->label);
518 evas_object_size_hint_min_get(wd->label, &width, &height);
523 Evas_Coord guide_text_width = wd->w_box - width;
524 evas_object_size_hint_min_set(wd->guidetext, guide_text_width, height);
527 // update buttons in contracted mode
528 if (wd->view_state == MULTIBUTTONENTRY_VIEW_CONTRACTED)
529 _contracted_state_set(obj, 1);
532 _set_vis_guidetext(obj);
536 _set_label(Evas_Object *obj, const char* str)
538 Widget_Data *wd = elm_widget_data_get(obj);
540 if (!wd || !str) return;
543 Evas_Coord width, height, sum_width = 0;
544 evas_object_size_hint_min_set(wd->label, 0, 0);
545 evas_object_resize(wd->label, 0, 0);
546 edje_object_part_text_set(wd->label, "mbe.label", str);
548 if (!strcmp(str, ""))
550 /* FIXME: not work yet */
551 edje_object_signal_emit(wd->label, "elm,mbe,clear_text", "");
552 edje_object_part_geometry_get(wd->label, "mbe.label", NULL, NULL, &width, &height);
557 edje_object_signal_emit(wd->label, "elm,mbe,set_text", "");
558 edje_object_part_geometry_get(wd->label, "mbe.label", NULL, NULL, &width, &height);
562 edje_object_part_geometry_get(wd->label, "mbe.label.left.padding", NULL, NULL, &width, NULL);
565 edje_object_part_geometry_get(wd->label, "mbe.label.right.padding", NULL, NULL, &width, NULL);
568 evas_object_size_hint_min_set(wd->label, sum_width, height);
570 evas_object_show(wd->label);
575 _set_guidetext(Evas_Object *obj, const char* str)
577 Widget_Data *wd = elm_widget_data_get(obj);
579 if (!wd || !str) return;
582 if (! (wd->guidetext = edje_object_add (evas_object_evas_get (obj)))) return;
583 _elm_theme_object_set(obj, wd->guidetext, "multibuttonentry", "guidetext", elm_widget_style_get(obj));
584 evas_object_size_hint_weight_set(wd->guidetext, 0.0, EVAS_HINT_EXPAND);
585 evas_object_size_hint_align_set(wd->guidetext, EVAS_HINT_FILL, EVAS_HINT_FILL);
588 if (wd->guidetext) edje_object_part_text_set (wd->guidetext, "elm.text", str);
593 _change_current_button_state(Evas_Object *obj, Multibuttonentry_Button_State state)
595 Widget_Data *wd = elm_widget_data_get(obj);
596 Elm_Multibuttonentry_Item *item = NULL;
600 item = eina_list_data_get(wd->current);
602 if (item && item->button)
606 case MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT:
607 edje_object_signal_emit(item->button, "default", "");
610 case MULTIBUTTONENTRY_BUTTON_STATE_SELECTED:
611 edje_object_signal_emit(item->button, "focused", "");
612 evas_object_smart_callback_call(obj, "item,selected", item);
615 edje_object_signal_emit(item->button, "default", "");
623 _change_current_button(Evas_Object *obj, Evas_Object *btn)
625 Widget_Data *wd = elm_widget_data_get(obj);
627 Elm_Multibuttonentry_Item *item;
631 // change the state of previous button to "default"
632 _change_current_button_state(obj, MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT);
634 // change the current
635 EINA_LIST_FOREACH(wd->items, l, item)
637 if (item->button == btn)
643 // change the state of current button to "focused"
644 _change_current_button_state(obj, MULTIBUTTONENTRY_BUTTON_STATE_SELECTED);
648 _button_clicked(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
650 Widget_Data *wd = elm_widget_data_get(data);
652 Elm_Multibuttonentry_Item *item = NULL;
653 if (!wd || wd->view_state == MULTIBUTTONENTRY_VIEW_CONTRACTED) return;
655 _change_current_button(data, obj);
658 if ((item = eina_list_data_get(wd->current)) != NULL)
660 evas_object_smart_callback_call(data, "item,clicked", item);
661 _select_button(data, item->button);
666 _del_button_obj(Evas_Object *obj, Evas_Object *btn)
668 Widget_Data *wd = elm_widget_data_get(obj);
670 if (!wd || !btn) return;
672 evas_object_del(btn);
676 _del_button_item(Elm_Multibuttonentry_Item *item)
679 Elm_Multibuttonentry_Item *_item;
683 Evas_Object *obj = item->multibuttonentry;
684 wd = elm_widget_data_get(obj);
686 EINA_LIST_FOREACH(wd->items, l, _item)
690 wd->items = eina_list_remove(wd->items, _item);
691 elm_box_unpack(wd->box, _item->button);
693 evas_object_smart_callback_call(obj, "item,deleted", _item);
695 _del_button_obj(obj, _item->button);
698 if (wd->current == l)
703 if (wd->view_state == MULTIBUTTONENTRY_VIEW_CONTRACTED)
704 _contracted_state_set(obj, 1);
706 if (!eina_list_count(wd->items))
707 _set_vis_guidetext(obj);
711 _select_button(Evas_Object *obj, Evas_Object *btn)
713 Widget_Data *wd = elm_widget_data_get(obj);
718 _change_current_button(obj, btn);
719 if (elm_widget_focus_get(obj))
721 elm_object_focus_set(wd->entry, EINA_FALSE);
722 evas_object_focus_set(btn, EINA_TRUE);
727 _change_current_button_state(obj, MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT);
728 if (elm_widget_focus_get(obj))
729 elm_object_focus_set(wd->entry, EINA_TRUE);
734 _resize_button(Evas_Object *btn, Evas_Coord *realw, Evas_Coord *vieww)
737 Evas_Coord w_text, h_btn, padding_outer, padding_inner;
738 Evas_Coord w_btn = 0, button_max_width = 0;
739 const char *size_str;
740 const char *ellipsis = "<ellipsis=1.0>";
742 size_str = edje_object_data_get(btn, "button_max_size");
743 if (size_str) button_max_width = (Evas_Coord)atoi(size_str);
745 const char *button_text = edje_object_part_text_get(btn, "elm.btn.text");
747 // decide the size of button
748 edje_object_part_geometry_get(btn, "elm.base", NULL, NULL, NULL, &h_btn);
749 edje_object_part_geometry_get(btn, "elm.btn.text", NULL, NULL, &w_text, NULL);
750 edje_object_part_geometry_get(btn, "left.padding", NULL, NULL, &padding_outer, NULL);
751 edje_object_part_geometry_get(btn, "left.inner.padding", NULL, NULL, &padding_inner, NULL);
752 w_btn = w_text + 2*padding_outer + 2*padding_inner;
756 if (button_max_width < w_btn)
758 vw = button_max_width;
759 edje_object_part_text_set(btn, "elm.btn.text", ellipsis);
760 edje_object_part_text_append(btn, "elm.btn.text", button_text);
766 evas_object_resize(btn, vw, h_btn);
767 evas_object_size_hint_min_set(btn, vw, h_btn);
769 if (realw) *realw = rw;
770 if (vieww) *vieww = vw;
773 static Elm_Multibuttonentry_Item*
774 _add_button_item(Evas_Object *obj, const char *str, Multibuttonentry_Pos pos, const Elm_Multibuttonentry_Item *reference, void *data)
776 Elm_Multibuttonentry_Item *item;
778 Evas_Coord width, height;
779 char *str_utf8 = NULL;
781 Widget_Data *wd = elm_widget_data_get(obj);
783 if (!wd || !wd->box || !wd->entry) return NULL;
785 if ((wd->add_callback) && !wd->add_callback(obj, str, data, wd->add_callback_data)) return NULL;
787 //entry is cleared when text is made to button
788 elm_entry_entry_set(wd->entry, "");
790 // initialize entry size to be called entry's EVAS_CALLBACK_RESIZE even entry size's doesn't changed
791 evas_object_resize(wd->entry, 0, 0);
794 btn = edje_object_add(evas_object_evas_get(obj));
795 str_utf8 = elm_entry_markup_to_utf8(str);
797 _elm_theme_object_set(obj, btn, "multibuttonentry", "btn", elm_widget_style_get(obj));
798 edje_object_part_text_set(btn, "elm.btn.text", str_utf8);
799 edje_object_part_geometry_get(btn, "elm.btn.text", NULL, NULL, &width, &height);
801 evas_object_size_hint_min_set(btn, width, height);
803 edje_object_signal_callback_add(btn, "mouse,clicked,1", "*", _button_clicked, obj);
804 evas_object_size_hint_weight_set(btn, 0.0, 0.0);
805 evas_object_show(btn);
808 item = ELM_NEW(Elm_Multibuttonentry_Item);
812 _resize_button(btn, &rw, &vw);
813 item->multibuttonentry = obj;
818 item->visible = EINA_TRUE;
822 case MULTIBUTTONENTRY_POS_START:
823 wd->items = eina_list_prepend(wd->items, item);
824 if (wd->view_state == MULTIBUTTONENTRY_VIEW_CONTRACTED)
826 elm_widget_sub_object_add(obj, btn);
827 _contracted_state_set(obj, 1);
832 elm_box_pack_after(wd->box, btn, wd->label);
834 elm_box_pack_start(wd->box, btn);
835 if (wd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT)
836 _set_vis_guidetext(obj);
839 case MULTIBUTTONENTRY_POS_END:
840 wd->items = eina_list_append(wd->items, item);
841 if (wd->view_state == MULTIBUTTONENTRY_VIEW_CONTRACTED)
843 elm_widget_sub_object_add(obj, btn);
844 evas_object_hide(btn);
848 if (wd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT)
849 _set_vis_guidetext(obj);
851 elm_box_pack_before(wd->box, btn, wd->entry);
853 elm_box_pack_end(wd->box, btn);
856 case MULTIBUTTONENTRY_POS_BEFORE:
858 wd->items = eina_list_prepend_relative(wd->items, item, reference);
860 wd->items = eina_list_append(wd->items, item);
861 if (wd->view_state == MULTIBUTTONENTRY_VIEW_CONTRACTED)
863 elm_widget_sub_object_add(obj, btn);
864 evas_object_hide(btn);
865 _contracted_state_set(obj, 1);
870 elm_box_pack_before(wd->box, btn, reference->button);
873 if (wd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT)
874 _set_vis_guidetext(obj);
876 elm_box_pack_before(wd->box, btn, wd->entry);
878 elm_box_pack_end(wd->box, btn);
882 case MULTIBUTTONENTRY_POS_AFTER:
884 wd->items = eina_list_append_relative(wd->items, item, reference);
886 wd->items = eina_list_append(wd->items, item);
887 if (wd->view_state == MULTIBUTTONENTRY_VIEW_CONTRACTED)
889 elm_widget_sub_object_add(obj, btn);
890 _contracted_state_set(obj, 1);
895 elm_box_pack_after(wd->box, btn, reference->button);
898 if (wd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT)
899 _set_vis_guidetext(obj);
901 elm_box_pack_before(wd->box, btn, wd->entry);
903 elm_box_pack_end(wd->box, btn);
911 evas_object_smart_callback_call(obj, "item,added", item);
919 _add_button(Evas_Object *obj, char *str)
921 Widget_Data *wd = elm_widget_data_get(obj);
925 _add_button_item(obj, str, MULTIBUTTONENTRY_POS_END, NULL, NULL);
929 _evas_mbe_key_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
931 Widget_Data *wd = elm_widget_data_get(data);
932 Elm_Multibuttonentry_Item *item = NULL;
934 static char str[MAX_STR];
936 if (!wd || !wd->base || !wd->box) return;
938 strncpy(str, elm_entry_entry_get(wd->entry), MAX_STR);
939 str[MAX_STR - 1] = 0;
941 Evas_Event_Key_Up *ev = (Evas_Event_Key_Up*)event_info;
943 if (wd->last_btn_select)
945 if ((wd->current) && ( (strcmp (ev->keyname, "BackSpace") == 0) || (strcmp (ev->keyname, "BackSpace (") == 0)))
947 item = eina_list_data_get(wd->current);
950 _del_button_item(item);
951 elm_object_focus(wd->entry);
954 else if ((((!wd->current) && (wd->n_str == 0) && (strcmp (ev->keyname, "BackSpace") == 0))
955 || (strcmp (ev->keyname, "BackSpace (") == 0)))
957 item = eina_list_data_get(eina_list_last(wd->items));
959 _select_button(data, item->button);
963 wd->last_btn_select = EINA_TRUE;
967 _entry_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
969 Widget_Data *wd = elm_widget_data_get(data);
970 Evas_Event_Key_Down *ev = (Evas_Event_Key_Down *)event_info;
974 if ((wd->n_str == 1) && (strcmp(ev->keyname, "BackSpace") == 0 || (strcmp(ev->keyname, "BackSpace (") == 0 )))
975 wd->last_btn_select = EINA_FALSE;
979 _entry_key_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
981 Widget_Data *wd = elm_widget_data_get(data);
982 Evas_Event_Key_Up *ev = (Evas_Event_Key_Up *) event_info;
983 static char str[MAX_STR];
985 if (!wd || !wd->base || !wd->box) return;
987 strncpy(str, elm_entry_entry_get(wd->entry), MAX_STR);
988 str[MAX_STR - 1] = 0;
990 if ( (strcmp (str, "") != 0) && (strcmp (ev->keyname, "KP_Enter") == 0 || strcmp (ev->keyname, "Return") == 0 ))
992 _add_button(data, str);
999 _entry_clicked_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1001 Widget_Data *wd = elm_widget_data_get(data);
1004 _change_current_button_state(data, MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT);
1005 elm_object_focus_set(wd->entry, EINA_TRUE);
1009 _entry_focus_in_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1011 Widget_Data *wd = elm_widget_data_get(data);
1012 Elm_Multibuttonentry_Item *item = NULL;
1018 item = eina_list_data_get(wd->current);
1019 elm_object_focus_set(wd->entry, EINA_FALSE);
1020 evas_object_focus_set(item->button, EINA_TRUE);
1025 _entry_focus_out_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1027 Widget_Data *wd = elm_widget_data_get(data);
1030 static char str[MAX_STR];
1032 strncpy(str,elm_entry_entry_get(wd->entry), MAX_STR);
1033 str[MAX_STR -1] = 0;
1036 _add_button(data, str);
1040 _entry_changed_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1042 Widget_Data *wd = elm_widget_data_get(data);
1045 static char str[MAX_STR];
1047 strncpy(str, elm_entry_entry_get(wd->entry), MAX_STR);
1048 str[MAX_STR -1] = 0;
1050 wd->n_str = strlen(str);
1054 _entry_resized_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1056 Evas_Coord en_x, en_y, en_w, en_h;
1057 Evas_Coord bx_x, bx_y;
1059 Widget_Data *wd = elm_widget_data_get(data);
1062 evas_object_geometry_get(wd->entry, &en_x, &en_y, &en_w, &en_h);
1063 evas_object_geometry_get(wd->box, &bx_x, &bx_y, NULL, NULL);
1065 elm_widget_show_region_set(wd->box, en_x - bx_x, en_y - bx_y, en_w, en_h, EINA_TRUE);
1069 _view_init(Evas_Object *obj)
1071 Widget_Data *wd = elm_widget_data_get(obj);
1077 wd->box = elm_box_add (obj);
1078 if (!wd->box) return;
1079 elm_widget_sub_object_add(obj, wd->box);
1080 elm_box_layout_set(wd->box, _box_layout_cb, NULL, NULL);
1081 elm_box_homogeneous_set(wd->box, EINA_FALSE);
1082 edje_object_part_swallow(wd->base, "box.swallow", wd->box);
1086 wd->label = edje_object_add(evas_object_evas_get(obj));
1087 if (!wd->label) return;
1088 _elm_theme_object_set(obj, wd->label, "multibuttonentry", "label", elm_widget_style_get(obj));
1089 _set_label(obj, "");
1090 elm_widget_sub_object_add(obj, wd->label);
1095 if (! (wd->entry = elm_entry_add (obj))) return;
1096 elm_entry_scrollable_set(wd->entry, EINA_TRUE);
1097 elm_entry_single_line_set(wd->entry, EINA_TRUE);
1098 elm_entry_entry_set(wd->entry, "");
1099 elm_entry_cursor_end_set(wd->entry);
1100 elm_entry_input_panel_enabled_set(wd->entry, EINA_FALSE);
1101 evas_object_size_hint_min_set(wd->entry, MIN_W_ENTRY, 0);
1102 evas_object_size_hint_weight_set(wd->entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1103 evas_object_size_hint_align_set(wd->entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
1104 if (wd->box) elm_box_pack_end (wd->box, wd->entry);
1105 evas_object_show(wd->entry);
1106 wd->view_state = MULTIBUTTONENTRY_VIEW_ENTRY;
1111 const char *end_type = edje_object_data_get(wd->base, "closed_button_type");
1112 if (!end_type || !strcmp(end_type, "label"))
1114 if (! (wd->end = elm_label_add (obj))) return;
1115 elm_object_style_set(wd->end, "extended/multibuttonentry_default");
1116 wd->end_type = MULTIBUTTONENTRY_CLOSED_LABEL;
1120 const char *size_str;
1121 if (!(wd->end = edje_object_add(evas_object_evas_get(obj)))) return;
1122 _elm_theme_object_set(obj, wd->end, "multibuttonentry", "closedbutton", elm_widget_style_get(obj));
1123 Evas_Coord button_min_width = 0;
1124 Evas_Coord button_min_height = 0;
1126 size_str = edje_object_data_get(wd->end, "closed_button_width");
1127 if(size_str) button_min_width = (Evas_Coord)atoi(size_str);
1128 size_str = edje_object_data_get(wd->end, "closed_button_height");
1129 if(size_str) button_min_height = (Evas_Coord)atoi(size_str);
1131 wd->end_type = MULTIBUTTONENTRY_CLOSED_IMAGE;
1132 evas_object_size_hint_min_set(wd->end, button_min_width * elm_scale_get(), button_min_height * elm_scale_get());
1133 elm_widget_sub_object_add(obj, wd->end);
1139 _calculate_box_min_size(Evas_Object *box, Evas_Object_Box_Data *priv)
1141 Evas_Coord minw, minh, maxw, maxh, mnw, mnh, ww;
1142 Evas_Coord w, cw = 0, cmaxh = 0;
1144 Evas_Object_Box_Option *opt;
1147 /* FIXME: need to calc max */
1153 evas_object_geometry_get(box, NULL, NULL, &w, NULL);
1154 evas_object_size_hint_min_get(box, &minw, NULL);
1156 EINA_LIST_FOREACH(priv->children, l, opt)
1158 evas_object_size_hint_min_get(opt->obj, &mnw, &mnh);
1159 evas_object_size_hint_weight_get(opt->obj, &wx, NULL);
1163 if (mnw != -1 && (w - cw) >= mnw)
1178 if (cmaxh < mnh) cmaxh = mnh;
1183 evas_object_size_hint_min_set(box, minw, minh);
1187 _calculate_item_max_height(Evas_Object *box, Evas_Object_Box_Data *priv, int obj_index)
1189 Evas_Coord mnw, mnh, cw = 0, cmaxh = 0, w, ww;
1191 Evas_Object_Box_Option *opt;
1195 evas_object_geometry_get(box, NULL, NULL, &w, NULL);
1197 EINA_LIST_FOREACH(priv->children, l, opt)
1199 evas_object_size_hint_min_get(opt->obj, &mnw, &mnh);
1200 evas_object_size_hint_weight_get(opt->obj, &wx, NULL);
1204 if (mnw != -1 && (w - cw) >= mnw)
1214 if (index > obj_index) return cmaxh;
1220 if (cmaxh < mnh) cmaxh = mnh;
1229 _box_layout_cb(Evas_Object *o, Evas_Object_Box_Data *priv, void *data __UNUSED__)
1231 Evas_Coord x, y, w, h, xx, yy;
1234 Evas_Coord minw, minh, wdif, hdif;
1237 Evas_Object_Box_Option *opt;
1239 _calculate_box_min_size(o, priv);
1241 evas_object_geometry_get(o, &x, &y, &w, &h);
1243 evas_object_size_hint_min_get(o, &minw, &minh);
1244 evas_object_size_hint_align_get(o, &ax, &ay);
1245 count = eina_list_count(priv->children);
1248 x = x + ((w - minw) * (1.0 - ax));
1253 y = y + ((h - minh) * (1.0 - ay));
1262 Evas_Coord cw = 0, ch = 0, cmaxh = 0, obj_index = 0;
1264 EINA_LIST_FOREACH(priv->children, l, opt)
1266 Evas_Coord mnw, mnh, mxw, mxh;
1271 evas_object_size_hint_align_get(obj, &ax, &ay);
1272 evas_object_size_hint_weight_get(obj, &wx, &wy);
1273 evas_object_size_hint_min_get(obj, &mnw, &mnh);
1274 evas_object_size_hint_max_get(obj, &mxw, &mxh);
1277 if (ax == -1.0) {fw = 1; ax = 0.5;}
1278 if (ay == -1.0) {fh = 1; ay = 0.5;}
1279 if (wx > 0.0) xw = 1;
1280 if (wy > 0.0) xh = 1;
1281 Evas_Coord ww, hh, ow, oh;
1285 if (mnw != -1 && (w - cw) >= mnw)
1292 hh = _calculate_item_max_height(o, priv, obj_index);
1296 if ((mxw >= 0) && (mxw < ow)) ow = mxw;
1299 if ((mxh >= 0) && (mxh < oh)) oh = mxh;
1308 evas_object_move(obj,
1309 xx + cw + (Evas_Coord)(((double)(ww - ow)) * ax),
1310 yy + ch + (Evas_Coord)(((double)(hh - oh)) * ay));
1311 evas_object_resize(obj, ow, oh);
1314 if (cmaxh < hh) cmaxh = hh;
1321 elm_multibuttonentry_add(Evas_Object *parent)
1327 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
1329 ELM_SET_WIDTYPE(widtype, "multibuttonentry");
1330 elm_widget_type_set(obj, "multibuttonentry");
1331 elm_widget_sub_object_add(parent, obj);
1332 elm_widget_data_set(obj, wd);
1334 elm_widget_del_hook_set(obj, _del_hook);
1335 elm_widget_theme_hook_set(obj, _theme_hook);
1336 elm_widget_event_hook_set(obj, _event_hook);
1337 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
1338 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
1340 wd->base = edje_object_add(e);
1341 _elm_theme_object_set(obj, wd->base, "multibuttonentry", "base", "default");
1342 elm_widget_resize_object_set(obj, wd->base);
1343 elm_widget_can_focus_set(obj, EINA_TRUE);
1345 wd->view_state = MULTIBUTTONENTRY_VIEW_NONE;
1346 wd->focused = EINA_FALSE;
1347 wd->last_btn_select = EINA_TRUE;
1349 wd->rect_for_end= NULL;
1350 wd->add_callback = NULL;
1351 wd->add_callback_data = NULL;
1360 elm_multibuttonentry_entry_get(const Evas_Object *obj)
1362 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1363 Widget_Data *wd = elm_widget_data_get(obj);
1365 if (!wd) return NULL;
1371 elm_multibuttonentry_label_get(const Evas_Object *obj)
1373 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1374 Widget_Data *wd = elm_widget_data_get(obj);
1376 if (!wd) return NULL;
1377 if (wd->label) return edje_object_part_text_get(wd->label, "mbe.label");
1382 elm_multibuttonentry_label_set(Evas_Object *obj, const char *label)
1384 ELM_CHECK_WIDTYPE(obj, widtype);
1385 Widget_Data *wd = elm_widget_data_get(obj);
1389 _set_label(obj, label);
1391 _set_label(obj, "");
1395 elm_multibuttonentry_guide_text_get(const Evas_Object *obj)
1397 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1398 Widget_Data *wd = elm_widget_data_get(obj);
1400 if (!wd) return NULL;
1401 if (wd->guidetext) return edje_object_part_text_get(wd->guidetext, "elm.text");
1406 elm_multibuttonentry_guide_text_set(Evas_Object *obj, const char *guidetext)
1408 ELM_CHECK_WIDTYPE(obj, widtype);
1409 Widget_Data *wd = elm_widget_data_get(obj);
1413 _set_guidetext(obj, guidetext);
1415 _set_guidetext(obj, "");
1419 elm_multibuttonentry_contracted_state_get(const Evas_Object *obj)
1421 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1422 Widget_Data *wd = elm_widget_data_get(obj);
1425 return wd->view_state == MULTIBUTTONENTRY_VIEW_CONTRACTED ? 1 : 0;
1429 elm_multibuttonentry_contracted_state_set(Evas_Object *obj, int contracted)
1431 ELM_CHECK_WIDTYPE(obj, widtype);
1432 Widget_Data *wd = elm_widget_data_get(obj);
1434 if (!wd || !wd->box ||
1435 ((wd->view_state == MULTIBUTTONENTRY_VIEW_CONTRACTED) ? 1 : 0) == contracted) return;
1436 _contracted_state_set(obj, contracted);
1439 EAPI Elm_Multibuttonentry_Item *
1440 elm_multibuttonentry_item_add_start(Evas_Object *obj, const char *label, void *data)
1442 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1443 Widget_Data *wd = elm_widget_data_get(obj);
1444 Elm_Multibuttonentry_Item *item;
1446 if (!wd || !label) return NULL;
1447 item = _add_button_item(obj, label, MULTIBUTTONENTRY_POS_START, NULL, data);
1451 EAPI Elm_Multibuttonentry_Item *
1452 elm_multibuttonentry_item_add_end(Evas_Object *obj, const char *label, void *data)
1454 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1455 Widget_Data *wd = elm_widget_data_get(obj);
1456 Elm_Multibuttonentry_Item *item;
1458 if (!wd || !label) return NULL;
1459 item = _add_button_item(obj, label, MULTIBUTTONENTRY_POS_END, NULL, data);
1463 EAPI Elm_Multibuttonentry_Item *
1464 elm_multibuttonentry_item_add_before(Evas_Object *obj, const char *label, Elm_Multibuttonentry_Item *before, void *data)
1466 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1467 Widget_Data *wd = elm_widget_data_get(obj);
1468 Elm_Multibuttonentry_Item *item;
1470 if (!wd || !label) return NULL;
1471 item = _add_button_item(obj, label, MULTIBUTTONENTRY_POS_BEFORE, before, data);
1475 EAPI Elm_Multibuttonentry_Item *
1476 elm_multibuttonentry_item_add_after(Evas_Object *obj, const char *label, Elm_Multibuttonentry_Item *after, void *data)
1478 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1479 Widget_Data *wd = elm_widget_data_get(obj);
1480 Elm_Multibuttonentry_Item *item;
1482 if (!wd || !label) return NULL;
1483 item = _add_button_item(obj, label, MULTIBUTTONENTRY_POS_AFTER, after, data);
1487 EAPI const Eina_List *
1488 elm_multibuttonentry_items_get(const Evas_Object *obj)
1490 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1491 Widget_Data *wd = elm_widget_data_get(obj);
1493 if (!wd) return NULL;
1497 EAPI Elm_Multibuttonentry_Item *
1498 elm_multibuttonentry_item_first_get(const Evas_Object *obj)
1500 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1501 Widget_Data *wd = elm_widget_data_get(obj);
1503 if (!wd || !wd->items) return NULL;
1504 return eina_list_data_get(wd->items);
1507 EAPI Elm_Multibuttonentry_Item *
1508 elm_multibuttonentry_item_last_get(const Evas_Object *obj)
1510 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1511 Widget_Data *wd = elm_widget_data_get(obj);
1513 if (!wd || !wd->items) return NULL;
1514 return eina_list_data_get(eina_list_last(wd->items));
1517 EAPI Elm_Multibuttonentry_Item *
1518 elm_multibuttonentry_item_selected_get(const Evas_Object *obj)
1520 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1521 Widget_Data *wd = elm_widget_data_get(obj);
1523 if (!wd || !wd->current) return NULL;
1524 return eina_list_data_get(wd->current);
1528 elm_multibuttonentry_item_selected_set(Elm_Multibuttonentry_Item *item)
1532 Elm_Multibuttonentry_Item *_item;
1535 ELM_CHECK_WIDTYPE(item->multibuttonentry, widtype);
1536 wd = elm_widget_data_get(item->multibuttonentry);
1539 EINA_LIST_FOREACH(wd->items, l, _item)
1542 _select_button(item->multibuttonentry, item->button);
1547 elm_multibuttonentry_item_unselect_all(Evas_Object *obj)
1549 ELM_CHECK_WIDTYPE(obj, widtype);
1550 Widget_Data *wd = elm_widget_data_get(obj);
1553 _select_button(obj, NULL);
1557 elm_multibuttonentry_items_del(Evas_Object *obj)
1559 ELM_CHECK_WIDTYPE(obj, widtype);
1560 Widget_Data *wd = elm_widget_data_get(obj);
1565 Elm_Multibuttonentry_Item *item;
1566 EINA_LIST_FREE(wd->items, item)
1568 elm_box_unpack(wd->box, item->button);
1569 _del_button_obj(obj, item->button);
1579 elm_multibuttonentry_item_del(Elm_Multibuttonentry_Item *item)
1582 _del_button_item(item);
1586 elm_multibuttonentry_item_label_get(const Elm_Multibuttonentry_Item *item)
1590 Elm_Multibuttonentry_Item *_item;
1591 if (!item) return NULL;
1592 ELM_CHECK_WIDTYPE(item->multibuttonentry, widtype) NULL;
1593 wd = elm_widget_data_get(item->multibuttonentry);
1594 if (!wd || !wd->items) return NULL;
1596 EINA_LIST_FOREACH(wd->items, l, _item)
1599 return edje_object_part_text_get(_item->button, "elm.btn.text");
1606 elm_multibuttonentry_item_label_set(Elm_Multibuttonentry_Item *item, const char *str)
1610 Elm_Multibuttonentry_Item *_item;
1611 if (!item || !str) return;
1612 ELM_CHECK_WIDTYPE(item->multibuttonentry, widtype);
1613 wd = elm_widget_data_get(item->multibuttonentry);
1614 if (!wd || !wd->items) return;
1616 EINA_LIST_FOREACH(wd->items, l, _item)
1619 edje_object_part_text_set(_item->button, "elm.btn.text", str);
1620 _resize_button(_item->button, &_item->rw, &_item->vw);
1625 EAPI Elm_Multibuttonentry_Item *
1626 elm_multibuttonentry_item_prev(Elm_Multibuttonentry_Item *item)
1630 Elm_Multibuttonentry_Item *_item;
1631 if (!item) return NULL;
1632 ELM_CHECK_WIDTYPE(item->multibuttonentry, widtype) NULL;
1633 wd = elm_widget_data_get(item->multibuttonentry);
1634 if (!wd || !wd->items) return NULL;
1636 EINA_LIST_FOREACH(wd->items, l, _item)
1639 l = eina_list_prev(l);
1640 if (!l) return NULL;
1641 return eina_list_data_get(l);
1646 EAPI Elm_Multibuttonentry_Item *
1647 elm_multibuttonentry_item_next(Elm_Multibuttonentry_Item *item)
1651 Elm_Multibuttonentry_Item *_item;
1653 if (!item) return NULL;
1654 ELM_CHECK_WIDTYPE(item->multibuttonentry, widtype) NULL;
1655 wd = elm_widget_data_get(item->multibuttonentry);
1656 if (!wd || !wd->items) return NULL;
1658 EINA_LIST_FOREACH(wd->items, l, _item)
1661 l = eina_list_next(l);
1662 if (!l) return NULL;
1663 return eina_list_data_get(l);
1669 elm_multibuttonentry_item_data_get(const Elm_Multibuttonentry_Item *item)
1671 if (!item) return NULL;
1676 elm_multibuttonentry_item_data_set(Elm_Multibuttonentry_Item *item, void *data)
1683 elm_multibuttonentry_item_verify_callback_set(Evas_Object *obj, Elm_Multibuttonentry_Item_Verify_Callback func, void *data)
1685 ELM_CHECK_WIDTYPE(obj, widtype);
1686 Widget_Data *wd = elm_widget_data_get(obj);
1689 wd->add_callback = func;
1690 wd->add_callback_data = data;