summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--ChangeLog6
-rw-r--r--src/lib/elc_multibuttonentry.c85
-rw-r--r--src/lib/elc_multibuttonentry.h24
4 files changed, 96 insertions, 20 deletions
diff --git a/AUTHORS b/AUTHORS
index a4fb364f6..1ea7e24e6 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -60,3 +60,4 @@ Davide Andreoli (davemds) <dave@gurumeditation.it>
60Michal Pakula vel Rutka <m.pakula@samsung.com> 60Michal Pakula vel Rutka <m.pakula@samsung.com>
61Thiep Ha <thiep.ha@samsung.com> 61Thiep Ha <thiep.ha@samsung.com>
62Artem Popov <artem.popov@samsung.com> 62Artem Popov <artem.popov@samsung.com>
63Minseok Kim <minseok3.kim@samsung.com>
diff --git a/ChangeLog b/ChangeLog
index 80c695c7b..66cb862b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -259,3 +259,9 @@
2592012-07-3 Cedric Bail 2592012-07-3 Cedric Bail
260 260
261 * Initialize Emotion when necessary. 261 * Initialize Emotion when necessary.
262
2632012-07-3 Minseok Kim
264
265 * Add elm_multibuttonentry_editable_set() and
266 elm_multibuttonentry_editable_get()
267
diff --git a/src/lib/elc_multibuttonentry.c b/src/lib/elc_multibuttonentry.c
index 3ca8b91ea..0b4ecf9a0 100644
--- a/src/lib/elc_multibuttonentry.c
+++ b/src/lib/elc_multibuttonentry.c
@@ -78,6 +78,8 @@ struct _Widget_Data
78 Eina_Bool last_btn_select: 1; 78 Eina_Bool last_btn_select: 1;
79 Elm_Multibuttonentry_Item_Filter_Cb add_callback; 79 Elm_Multibuttonentry_Item_Filter_Cb add_callback;
80 void *add_callback_data; 80 void *add_callback_data;
81
82 Eina_Bool editable;
81 }; 83 };
82 84
83static void _del_hook(Evas_Object *obj); 85static void _del_hook(Evas_Object *obj);
@@ -204,15 +206,18 @@ _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
204 206
205 if (elm_widget_focus_get(obj)) 207 if (elm_widget_focus_get(obj))
206 { 208 {
207 if ((wd->selected_it)) 209 if (wd->editable)
208 {
209 elm_entry_input_panel_show(wd->entry);
210 }
211 else if (((!wd->selected_it) || (!eina_list_count(wd->items))))
212 { 210 {
213 if (wd->entry) elm_entry_cursor_end_set(wd->entry); 211 if ((wd->selected_it))
214 _view_update(obj); 212 {
215 elm_entry_input_panel_show(wd->entry); 213 elm_entry_input_panel_show(wd->entry);
214 }
215 else if (((!wd->selected_it) || (!eina_list_count(wd->items))))
216 {
217 if (wd->entry) elm_entry_cursor_end_set(wd->entry);
218 _view_update(obj);
219 elm_entry_input_panel_show(wd->entry);
220 }
216 } 221 }
217 wd->focused = EINA_TRUE; 222 wd->focused = EINA_TRUE;
218 evas_object_smart_callback_call(obj, SIG_FOCUSED, NULL); 223 evas_object_smart_callback_call(obj, SIG_FOCUSED, NULL);
@@ -269,8 +274,11 @@ _signal_mouse_clicked(void *data, Evas_Object *obj __UNUSED__, const char *emiss
269 wd->focused = EINA_TRUE; 274 wd->focused = EINA_TRUE;
270 _view_update(data); 275 _view_update(data);
271 276
272 elm_entry_input_panel_show(wd->entry); 277 if (wd->editable)
273 elm_object_focus_set(wd->entry, EINA_TRUE); 278 {
279 elm_entry_input_panel_show(wd->entry);
280 elm_object_focus_set(wd->entry, EINA_TRUE);
281 }
274 282
275 evas_object_smart_callback_call(data, SIG_CLICKED, NULL); 283 evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
276} 284}
@@ -358,11 +366,17 @@ _set_vis_guidetext(Evas_Object *obj)
358 else 366 else
359 { 367 {
360 evas_object_hide(wd->guidetext); 368 evas_object_hide(wd->guidetext);
361 elm_box_pack_end(wd->box, wd->entry); 369
362 evas_object_show(wd->entry); 370 if (wd->editable)
363 if (elm_widget_focus_get(obj) || wd->focused) 371 {
364 if (!wd->selected_it) 372 elm_box_pack_end(wd->box, wd->entry);
365 elm_object_focus_set(wd->entry, EINA_TRUE); 373 evas_object_show(wd->entry);
374 if (elm_widget_focus_get(obj) || wd->focused)
375 {
376 if (!wd->selected_it)
377 elm_object_focus_set(wd->entry, EINA_TRUE);
378 }
379 }
366 wd->view_state = MULTIBUTTONENTRY_VIEW_ENTRY; 380 wd->view_state = MULTIBUTTONENTRY_VIEW_ENTRY;
367 } 381 }
368} 382}
@@ -776,7 +790,7 @@ _select_button(Evas_Object *obj, Evas_Object *btn)
776 else 790 else
777 { 791 {
778 _change_current_button_state(obj, MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT); 792 _change_current_button_state(obj, MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT);
779 if (elm_widget_focus_get(obj)) 793 if (elm_widget_focus_get(obj) && wd->editable)
780 elm_object_focus_set(wd->entry, EINA_TRUE); 794 elm_object_focus_set(wd->entry, EINA_TRUE);
781 } 795 }
782} 796}
@@ -908,7 +922,7 @@ _add_button_item(Evas_Object *obj, const char *str, Multibuttonentry_Pos pos, co
908 { 922 {
909 if (wd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT) 923 if (wd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT)
910 _set_vis_guidetext(obj); 924 _set_vis_guidetext(obj);
911 if (wd->entry) 925 if (wd->entry && wd->editable)
912 elm_box_pack_before(wd->box, btn, wd->entry); 926 elm_box_pack_before(wd->box, btn, wd->entry);
913 else 927 else
914 elm_box_pack_end(wd->box, btn); 928 elm_box_pack_end(wd->box, btn);
@@ -933,7 +947,7 @@ _add_button_item(Evas_Object *obj, const char *str, Multibuttonentry_Pos pos, co
933 { 947 {
934 if (wd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT) 948 if (wd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT)
935 _set_vis_guidetext(obj); 949 _set_vis_guidetext(obj);
936 if (wd->entry) 950 if (wd->entry && wd->editable)
937 elm_box_pack_before(wd->box, btn, wd->entry); 951 elm_box_pack_before(wd->box, btn, wd->entry);
938 else 952 else
939 elm_box_pack_end(wd->box, btn); 953 elm_box_pack_end(wd->box, btn);
@@ -958,7 +972,7 @@ _add_button_item(Evas_Object *obj, const char *str, Multibuttonentry_Pos pos, co
958 { 972 {
959 if (wd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT) 973 if (wd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT)
960 _set_vis_guidetext(obj); 974 _set_vis_guidetext(obj);
961 if (wd->entry) 975 if (wd->entry && wd->editable)
962 elm_box_pack_before(wd->box, btn, wd->entry); 976 elm_box_pack_before(wd->box, btn, wd->entry);
963 else 977 else
964 elm_box_pack_end(wd->box, btn); 978 elm_box_pack_end(wd->box, btn);
@@ -1011,7 +1025,7 @@ _evas_mbe_key_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
1011 (strcmp(ev->keyname, "Delete") == 0))) 1025 (strcmp(ev->keyname, "Delete") == 0)))
1012 { 1026 {
1013 item = (Elm_Multibuttonentry_Item *)wd->selected_it; 1027 item = (Elm_Multibuttonentry_Item *)wd->selected_it;
1014 if (item) 1028 if (item && wd->editable)
1015 { 1029 {
1016 _del_button_item(item); 1030 _del_button_item(item);
1017 elm_widget_item_free(item); 1031 elm_widget_item_free(item);
@@ -1462,6 +1476,7 @@ elm_multibuttonentry_add(Evas_Object *parent)
1462 wd->rect_for_end = NULL; 1476 wd->rect_for_end = NULL;
1463 wd->add_callback = NULL; 1477 wd->add_callback = NULL;
1464 wd->add_callback_data = NULL; 1478 wd->add_callback_data = NULL;
1479 wd->editable = EINA_TRUE;
1465 1480
1466 evas_object_smart_callbacks_descriptions_set(obj, _signals); 1481 evas_object_smart_callbacks_descriptions_set(obj, _signals);
1467 1482
@@ -1508,6 +1523,36 @@ elm_multibuttonentry_expanded_set(Evas_Object *obj, Eina_Bool expanded)
1508 1523
1509} 1524}
1510 1525
1526EAPI void
1527elm_multibuttonentry_editable_set(Evas_Object *obj, Eina_Bool editable)
1528{
1529 ELM_CHECK_WIDTYPE(obj, widtype);
1530 Widget_Data *wd = elm_widget_data_get(obj);
1531 if (!wd) return;
1532 if (wd->editable == editable) return;
1533 wd->editable = editable;
1534
1535 if (wd->entry)
1536 {
1537 if (wd->editable)
1538 evas_object_show(wd->entry);
1539 else
1540 {
1541 elm_entry_input_panel_hide(wd->entry);
1542 evas_object_hide(wd->entry);
1543 }
1544 }
1545}
1546
1547EAPI Eina_Bool
1548elm_multibuttonentry_editable_get(const Evas_Object *obj)
1549{
1550 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1551 Widget_Data *wd = elm_widget_data_get(obj);
1552 if (!wd) return -1;
1553 return wd->editable;
1554}
1555
1511EAPI Elm_Object_Item * 1556EAPI Elm_Object_Item *
1512elm_multibuttonentry_item_prepend(Evas_Object *obj, const char *label, Evas_Smart_Cb func, void *data) 1557elm_multibuttonentry_item_prepend(Evas_Object *obj, const char *label, Evas_Smart_Cb func, void *data)
1513{ 1558{
diff --git a/src/lib/elc_multibuttonentry.h b/src/lib/elc_multibuttonentry.h
index af3ce8784..f44e375ec 100644
--- a/src/lib/elc_multibuttonentry.h
+++ b/src/lib/elc_multibuttonentry.h
@@ -314,5 +314,29 @@ EAPI void elm_multibuttonentry_item_filter_prepend(Evas_Ob
314EAPI void elm_multibuttonentry_item_filter_remove(Evas_Object *obj, Elm_Multibuttonentry_Item_Filter_Cb func, void *data); 314EAPI void elm_multibuttonentry_item_filter_remove(Evas_Object *obj, Elm_Multibuttonentry_Item_Filter_Cb func, void *data);
315 315
316/** 316/**
317 * Sets if the multibuttonentry is to be editable or not.
318 *
319 * @param obj The multibuttonentry object
320 * @param editable If EINA_TRUE, user can add/delete item in multibuttonentry, if not, the multibuttonentry is non-editable.
321 *
322 * @ingroup Multibuttonentry
323 *
324 * @since 1.1
325 */
326EAPI void elm_multibuttonentry_editable_set(Evas_Object *obj, Eina_Bool editable);
327
328/**
329 * Gets whether the multibuttonentry is editable or not.
330 *
331 * @param obj The multibuttonentry object
332 * @return EINA_TRUE if the multibuttonentry is editable by the user. EINA_FALSE if not.
333 *
334 * @ingroup Multibuttonentry
335 *
336 * @since 1.1
337 */
338EAPI Eina_Bool elm_multibuttonentry_editable_get(const Evas_Object *obj);
339
340/**
317 * @} 341 * @}
318 */ 342 */