diff options
author | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2020-04-26 13:15:33 +0100 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2020-04-26 13:16:11 +0100 |
commit | cd7b594466e3e9c470541b5f61069eb683e0729b (patch) | |
tree | 40616ac02e89366610da196b3dbb8fe1ebd2904d | |
parent | d261dca06c748675add162a0dd1c7bfd992eae1d (diff) | |
download | efl-cd7b594466e3e9c470541b5f61069eb683e0729b.tar.gz |
elm - combobox - pretty borken but make it a little less
add some tests so i can see smaller comboboxes with padding and fix
the scaling which was broken.
-rw-r--r-- | src/bin/elementary/test_combobox.c | 40 | ||||
-rw-r--r-- | src/lib/elementary/elc_combobox.c | 6 |
2 files changed, 41 insertions, 5 deletions
diff --git a/src/bin/elementary/test_combobox.c b/src/bin/elementary/test_combobox.c index ee68a3bdaf..62d21d0913 100644 --- a/src/bin/elementary/test_combobox.c +++ b/src/bin/elementary/test_combobox.c @@ -111,7 +111,7 @@ void test_combobox(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { - Evas_Object *win, *bx, *combobox; + Evas_Object *win, *bx, *combobox, *fr; Elm_Genlist_Item_Class *itc; win = elm_win_util_standard_add("combobox", "Combobox"); elm_win_autodel_set(win, EINA_TRUE); @@ -129,6 +129,26 @@ test_combobox(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, itc->func.filter_get = gl_filter_get; itc->func.del = NULL; + fr = elm_frame_add(win); + elm_object_style_set(fr, "pad_huge"); + evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, 0); + elm_box_pack_end(bx, fr); + evas_object_show(fr); + + combobox = elm_combobox_add(win); + evas_object_size_hint_weight_set(combobox, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(combobox, EVAS_HINT_FILL, 0); + elm_object_part_text_set(combobox, "guide", "Short List"); + evas_object_smart_callback_add(combobox, "expanded", + _combobox_expanded_cb, NULL); + for (int i = 0; i < 5; i++) + elm_genlist_item_append(combobox, itc, (void *)(uintptr_t)i, + NULL, ELM_GENLIST_ITEM_NONE, NULL, + (void*)(uintptr_t)(i * 10)); + elm_object_content_set(fr, combobox); + evas_object_show(combobox); + combobox = elm_combobox_add(win); evas_object_size_hint_weight_set(combobox, EVAS_HINT_EXPAND, 0); evas_object_size_hint_align_set(combobox, EVAS_HINT_FILL, 0); @@ -178,6 +198,24 @@ test_combobox(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, elm_box_pack_end(bx, combobox); evas_object_show(combobox); + fr = elm_frame_add(win); + elm_object_style_set(fr, "pad_huge"); + evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, 0); + elm_box_pack_end(bx, fr); + evas_object_show(fr); + + combobox = elm_combobox_add(win); + evas_object_size_hint_weight_set(combobox, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(combobox, EVAS_HINT_FILL, 0); + elm_object_part_text_set(combobox, "guide", "Short List"); + for (int i = 0; i < 5; i++) + elm_genlist_item_append(combobox, itc, (void *)(uintptr_t)i, + NULL, ELM_GENLIST_ITEM_NONE, NULL, + (void*)(uintptr_t)(i * 10)); + elm_object_content_set(fr, combobox); + evas_object_show(combobox); + evas_object_resize(win, 320, 500); evas_object_show(win); diff --git a/src/lib/elementary/elc_combobox.c b/src/lib/elementary/elc_combobox.c index 200745a97b..49a91c0012 100644 --- a/src/lib/elementary/elc_combobox.c +++ b/src/lib/elementary/elc_combobox.c @@ -209,10 +209,8 @@ _table_resize(void *data) else win_y_offset = obj_y; if (current_height < win_y_offset) - evas_object_size_hint_min_set(sd->spacer, obj_w * elm_config_scale_get(), - current_height + (2 * elm_config_scale_get())); - else evas_object_size_hint_min_set(sd->spacer, obj_w * elm_config_scale_get(), - win_y_offset * elm_config_scale_get()); + evas_object_size_hint_min_set(sd->spacer, obj_w, current_height); + else evas_object_size_hint_min_set(sd->spacer, obj_w, win_y_offset); } } |