diff options
author | Woochan Lee <wc0917.lee@samsung.com> | 2017-01-16 11:48:48 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2017-01-16 11:48:49 +0900 |
commit | 746ac264254705f9365e4aeed9afb80edf39f6e8 (patch) | |
tree | 3068c10e6557d249353a9ebf229b3e57c77e47ee /src | |
parent | de92b55e32c278201e02f272433277ad73aa4f48 (diff) |
elm_multibuttonentry: Fix MBE got a wrong state.
Summary:
Even User set a MBE state as "shrink" when MBE created.
MBE has been changed the state as "none" during added items.
This patch will be fixed that bug state.
@fix
Test Plan:
Add below line after create mbe.
'elm_multibuttonentry_expanded_set(mbe, EINA_FALSE)'
Then Add items using item_append API.
See the result. mbe is not on shrink mode.
Reviewers: Hermet, jpeg, cedric
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4548
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/elementary/test.c | 2 | ||||
-rw-r--r-- | src/bin/elementary/test_multibuttonentry.c | 86 | ||||
-rw-r--r-- | src/lib/elementary/elc_multibuttonentry.c | 21 |
3 files changed, 99 insertions, 10 deletions
diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c index 22209ec80c..6e26387012 100644 --- a/src/bin/elementary/test.c +++ b/src/bin/elementary/test.c | |||
@@ -73,6 +73,7 @@ void test_entry8(void *data, Evas_Object *obj, void *event_info); | |||
73 | void test_entry_regex(void *data, Evas_Object *obj, void *event_info); | 73 | void test_entry_regex(void *data, Evas_Object *obj, void *event_info); |
74 | void test_entry_notepad(void *data, Evas_Object *obj, void *event_info); | 74 | void test_entry_notepad(void *data, Evas_Object *obj, void *event_info); |
75 | void test_multibuttonentry(void *data, Evas_Object *obj, void *event_info); | 75 | void test_multibuttonentry(void *data, Evas_Object *obj, void *event_info); |
76 | void test_multibuttonentry2(void *data, Evas_Object *obj, void *event_info); | ||
76 | void test_entry_anchor2(void *data, Evas_Object *obj, void *event_info); | 77 | void test_entry_anchor2(void *data, Evas_Object *obj, void *event_info); |
77 | void test_entry_anchor(void *data, Evas_Object *obj, void *event_info); | 78 | void test_entry_anchor(void *data, Evas_Object *obj, void *event_info); |
78 | void test_entry_emoticon(void *data, Evas_Object *obj, void *event_info); | 79 | void test_entry_emoticon(void *data, Evas_Object *obj, void *event_info); |
@@ -715,6 +716,7 @@ add_tests: | |||
715 | ADD_TEST(NULL, "Entries", "Entry Regex", test_entry_regex); | 716 | ADD_TEST(NULL, "Entries", "Entry Regex", test_entry_regex); |
716 | ADD_TEST(NULL, "Entries", "Entry Notepad", test_entry_notepad); | 717 | ADD_TEST(NULL, "Entries", "Entry Notepad", test_entry_notepad); |
717 | ADD_TEST(NULL, "Entries", "Multibuttonentry", test_multibuttonentry); | 718 | ADD_TEST(NULL, "Entries", "Multibuttonentry", test_multibuttonentry); |
719 | ADD_TEST(NULL, "Entries", "Multibuttonentry Shrink", test_multibuttonentry2); | ||
718 | ADD_TEST(NULL, "Entries", "Entry Anchor", test_entry_anchor); | 720 | ADD_TEST(NULL, "Entries", "Entry Anchor", test_entry_anchor); |
719 | ADD_TEST(NULL, "Entries", "Entry Anchor2", test_entry_anchor2); | 721 | ADD_TEST(NULL, "Entries", "Entry Anchor2", test_entry_anchor2); |
720 | ADD_TEST(NULL, "Entries", "Entry Emoticon", test_entry_emoticon); | 722 | ADD_TEST(NULL, "Entries", "Entry Emoticon", test_entry_emoticon); |
diff --git a/src/bin/elementary/test_multibuttonentry.c b/src/bin/elementary/test_multibuttonentry.c index f66fc8c3fb..e9738f3cf4 100644 --- a/src/bin/elementary/test_multibuttonentry.c +++ b/src/bin/elementary/test_multibuttonentry.c | |||
@@ -252,3 +252,89 @@ test_multibuttonentry(void *data EINA_UNUSED, | |||
252 | evas_object_resize(win, 320, 480); | 252 | evas_object_resize(win, 320, 480); |
253 | evas_object_show(win); | 253 | evas_object_show(win); |
254 | } | 254 | } |
255 | |||
256 | static Evas_Object* | ||
257 | _add_multibuttonentry_shrink(Evas_Object *parent) | ||
258 | { | ||
259 | Evas_Object *scr = NULL; | ||
260 | Evas_Object *mbe = NULL; | ||
261 | Evas_Object *btn = NULL; | ||
262 | void *data = NULL; | ||
263 | |||
264 | scr = elm_scroller_add(parent); | ||
265 | elm_scroller_bounce_set(scr, EINA_FALSE, EINA_TRUE); | ||
266 | elm_scroller_policy_set(scr, ELM_SCROLLER_POLICY_OFF,ELM_SCROLLER_POLICY_AUTO); | ||
267 | evas_object_show(scr); | ||
268 | |||
269 | mbe = elm_multibuttonentry_add(parent); | ||
270 | elm_object_text_set(mbe, "To: "); | ||
271 | elm_object_part_text_set(mbe, "guide", "Tap to add recipient"); | ||
272 | evas_object_size_hint_weight_set(mbe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
273 | evas_object_size_hint_align_set(mbe, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
274 | elm_object_content_set(scr, mbe); | ||
275 | elm_multibuttonentry_expanded_set(mbe, EINA_FALSE); | ||
276 | |||
277 | elm_multibuttonentry_item_append(mbe, "mbe1", _select_cb, NULL); | ||
278 | elm_multibuttonentry_item_append(mbe, "mbe2", _select_cb, NULL); | ||
279 | elm_multibuttonentry_item_append(mbe, "mbe3", _select_cb, NULL); | ||
280 | elm_multibuttonentry_item_append(mbe, "mbe4", _select_cb, NULL); | ||
281 | elm_multibuttonentry_item_append(mbe, "mbe5", _select_cb, NULL); | ||
282 | elm_multibuttonentry_item_append(mbe, "mbe6", _select_cb, NULL); | ||
283 | elm_multibuttonentry_item_append(mbe, "mbe7", _select_cb, NULL); | ||
284 | elm_multibuttonentry_item_append(mbe, "mbe8", _select_cb, NULL); | ||
285 | elm_multibuttonentry_item_append(mbe, "mbe9", _select_cb, NULL); | ||
286 | elm_multibuttonentry_item_append(mbe, "mbe10", _select_cb, NULL); | ||
287 | |||
288 | // Add item verify callback to Multibuttonentry | ||
289 | elm_multibuttonentry_item_filter_append(mbe, _item_filter_cb, data); | ||
290 | |||
291 | // Add "item,selected","item,added", "item,deleted", "clicked", "unfocused", | ||
292 | // "expanded", "contracted" and "contracted,state,changed" smart callback | ||
293 | evas_object_smart_callback_add(mbe, "item,selected", _item_selected_cb, NULL); | ||
294 | evas_object_smart_callback_add(mbe, "item,added", _item_added_cb, NULL); | ||
295 | evas_object_smart_callback_add(mbe, "item,deleted", _item_deleted_cb, NULL); | ||
296 | evas_object_smart_callback_add(mbe, "item,clicked", _item_clicked_cb, NULL); | ||
297 | |||
298 | evas_object_smart_callback_add(mbe, "clicked", _mbe_clicked_cb, NULL); | ||
299 | evas_object_smart_callback_add(mbe, "focused", _mbe_focused_cb, NULL); | ||
300 | evas_object_smart_callback_add(mbe, "unfocused", _mbe_unfocused_cb, NULL); | ||
301 | |||
302 | evas_object_smart_callback_add(mbe, "expanded", _expanded_cb, NULL); | ||
303 | evas_object_smart_callback_add(mbe, "contracted", _contracted_cb, NULL); | ||
304 | evas_object_smart_callback_add(mbe, "shrink,state,changed", _shrink_state_changed_cb, NULL); | ||
305 | evas_object_smart_callback_add(mbe, "item,longpressed", _longpressed_cb, NULL); | ||
306 | |||
307 | btn = _format_change_btn_add(mbe); | ||
308 | elm_object_part_content_set(parent, "box", btn); | ||
309 | |||
310 | evas_object_resize(mbe, 220, 300); | ||
311 | elm_object_focus_set(mbe, EINA_TRUE); | ||
312 | |||
313 | return scr; | ||
314 | } | ||
315 | |||
316 | void | ||
317 | test_multibuttonentry2(void *data EINA_UNUSED, | ||
318 | Evas_Object *obj EINA_UNUSED, | ||
319 | void *event_info EINA_UNUSED) | ||
320 | { | ||
321 | Evas_Object *win, *sc; | ||
322 | Evas_Object *ly; | ||
323 | char buf[PATH_MAX]; | ||
324 | |||
325 | win = elm_win_util_standard_add("multibuttonentry", "MultiButtonEntry"); | ||
326 | elm_win_autodel_set(win, EINA_TRUE); | ||
327 | |||
328 | ly = elm_layout_add(win); | ||
329 | snprintf(buf, sizeof(buf), "%s/objects/multibuttonentry.edj", elm_app_data_dir_get()); | ||
330 | elm_layout_file_set(ly, buf, "multibuttonentry_test"); | ||
331 | evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
332 | elm_win_resize_object_add(win, ly); | ||
333 | evas_object_show(ly); | ||
334 | |||
335 | sc = _add_multibuttonentry_shrink(ly); | ||
336 | elm_object_part_content_set(ly, "multibuttonentry", sc); | ||
337 | |||
338 | evas_object_resize(win, 320, 480); | ||
339 | evas_object_show(win); | ||
340 | } | ||
diff --git a/src/lib/elementary/elc_multibuttonentry.c b/src/lib/elementary/elc_multibuttonentry.c index 1accaa0157..2ab94b7dca 100644 --- a/src/lib/elementary/elc_multibuttonentry.c +++ b/src/lib/elementary/elc_multibuttonentry.c | |||
@@ -181,10 +181,7 @@ _shrink_mode_set(Evas_Object *obj, | |||
181 | else if (sd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT) | 181 | else if (sd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT) |
182 | evas_object_hide(sd->guide_text); | 182 | evas_object_hide(sd->guide_text); |
183 | else if (sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK) | 183 | else if (sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK) |
184 | { | 184 | evas_object_hide(sd->end); |
185 | evas_object_hide(sd->end); | ||
186 | sd->view_state = MULTIBUTTONENTRY_VIEW_NONE; | ||
187 | } | ||
188 | 185 | ||
189 | if (shrink == EINA_TRUE) | 186 | if (shrink == EINA_TRUE) |
190 | { | 187 | { |
@@ -266,12 +263,13 @@ _shrink_mode_set(Evas_Object *obj, | |||
266 | elm_box_pack_end(sd->box, sd->end); | 263 | elm_box_pack_end(sd->box, sd->end); |
267 | evas_object_show(sd->end); | 264 | evas_object_show(sd->end); |
268 | 265 | ||
269 | sd->view_state = MULTIBUTTONENTRY_VIEW_SHRINK; | ||
270 | efl_event_callback_legacy_call | ||
271 | (obj, ELM_MULTIBUTTONENTRY_EVENT_EXPAND_STATE_CHANGED, (void *)1); | ||
272 | break; | 266 | break; |
273 | } | 267 | } |
274 | } | 268 | } |
269 | |||
270 | sd->view_state = MULTIBUTTONENTRY_VIEW_SHRINK; | ||
271 | efl_event_callback_legacy_call | ||
272 | (obj, ELM_MULTIBUTTONENTRY_EVENT_EXPAND_STATE_CHANGED, (void *)1); | ||
275 | } | 273 | } |
276 | else | 274 | else |
277 | { | 275 | { |
@@ -840,9 +838,6 @@ _item_new(Elm_Multibuttonentry_Data *sd, | |||
840 | item->func = func; | 838 | item->func = func; |
841 | } | 839 | } |
842 | 840 | ||
843 | if (!elm_object_focus_get(obj) && sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK && sd->w_box) | ||
844 | _shrink_mode_set(obj, EINA_TRUE); | ||
845 | |||
846 | switch (pos) | 841 | switch (pos) |
847 | { | 842 | { |
848 | case MULTIBUTTONENTRY_POS_START: | 843 | case MULTIBUTTONENTRY_POS_START: |
@@ -943,6 +938,10 @@ _item_new(Elm_Multibuttonentry_Data *sd, | |||
943 | break; | 938 | break; |
944 | } | 939 | } |
945 | 940 | ||
941 | if (!elm_object_focus_get(obj) && sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK && sd->w_box) | ||
942 | _shrink_mode_set(obj, EINA_TRUE); | ||
943 | |||
944 | |||
946 | efl_event_callback_legacy_call | 945 | efl_event_callback_legacy_call |
947 | (obj, ELM_MULTIBUTTONENTRY_EVENT_ITEM_ADDED, eo_item); | 946 | (obj, ELM_MULTIBUTTONENTRY_EVENT_ITEM_ADDED, eo_item); |
948 | 947 | ||
@@ -1008,6 +1007,8 @@ _box_resize_cb(void *data, | |||
1008 | ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(data, sd); | 1007 | ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(data, sd); |
1009 | 1008 | ||
1010 | evas_object_geometry_get(sd->box, NULL, NULL, &w, &h); | 1009 | evas_object_geometry_get(sd->box, NULL, NULL, &w, &h); |
1010 | if ((w <= elm_config_finger_size_get()) || (h <= elm_config_finger_size_get())) return; | ||
1011 | |||
1011 | elm_box_padding_get(obj, &hpad, NULL); | 1012 | elm_box_padding_get(obj, &hpad, NULL); |
1012 | 1013 | ||
1013 | if (sd->h_box < h) | 1014 | if (sd->h_box < h) |