diff --git a/legacy/elementary/data/themes/default.edc b/legacy/elementary/data/themes/default.edc index 287a7e3326..1324c90fca 100644 --- a/legacy/elementary/data/themes/default.edc +++ b/legacy/elementary/data/themes/default.edc @@ -4815,8 +4815,6 @@ collections { mouse_events: 0; description { state: "default" 0.0; -// aspect: 6.4 6.4; -// aspect_preference: HORIZONTAL; align: 0.0 0.0; min: 0 10; rel1 { @@ -5209,4 +5207,412 @@ collections { } } } + group { name: "elm/list/item_compress/default"; + data.item: "stacking" "above"; + data.item: "selectraise" "on"; + images { + image: "bt_sm_base1.png" COMP; + image: "bt_sm_shine.png" COMP; + image: "bt_sm_hilight.png" COMP; + image: "ilist_1.png" COMP; + image: "ilist_item_shadow.png" COMP; + } + parts { + part { + name: "base_sh"; + mouse_events: 0; + description { + state: "default" 0.0; + align: 0.0 0.0; + min: 0 10; + rel1 { + to: "base"; + relative: 0.0 1.0; + offset: 0 0; + } + rel2 { + to: "base"; + relative: 1.0 1.0; + offset: -1 0; + } + image { + normal: "ilist_item_shadow.png"; + } + fill.smooth: 0; + } + } + part { + name: "base"; + mouse_events: 0; + description { + state: "default" 0.0; + image { + normal: "ilist_1.png"; + border: 2 2 2 2; + } + fill.smooth: 0; + } + } + part { name: "bg"; + mouse_events: 0; + description { state: "default" 0.0; + visible: 0; + color: 255 255 255 0; + rel1 { + relative: 0.0 0.0; + offset: -5 -5; + } + rel2 { + relative: 1.0 1.0; + offset: 4 4; + } + image { + normal: "bt_sm_base1.png"; + border: 6 6 6 6; + } + } + description { state: "selected" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 255; + rel1 { + relative: 0.0 0.0; + offset: -2 -2; + } + rel2 { + relative: 1.0 1.0; + offset: 1 1; + } + } + } + part { + name: "elm.swallow.icon"; + type: SWALLOW; + description { + state: "default" 0.0; + align: 0.0 0.5; + rel1 { + relative: 0.0 0.0; + offset: 4 4; + } + rel2 { + relative: 0.0 1.0; + offset: 4 -5; + } + } + } + part { + name: "elm.swallow.end"; + type: SWALLOW; + description { + state: "default" 0.0; + align: 1.0 0.5; + rel1 { + relative: 1.0 0.0; + offset: -5 4; + } + rel2 { + relative: 1.0 1.0; + offset: -5 -5; + } + } + } + part { + name: "elm.text"; + type: TEXT; + effect: SOFT_SHADOW; + mouse_events: 0; + scale: 1; + description { + state: "default" 0.0; + min: 16 16; + rel1 { + to_x: "elm.swallow.icon"; + relative: 1.0 0.0; + offset: 0 4; + } + rel2 { + to_x: "elm.swallow.end"; + relative: 0.0 1.0; + offset: -1 -5; + } + color: 0 0 0 255; + color3: 0 0 0 0; + text { + font: "Sans"; + size: 10; +// min: 1 1; + min: 0 1; + align: 0.0 0.5; + } + } + description { state: "selected" 0.0; + inherit: "default" 0.0; + color: 224 224 224 255; + color3: 0 0 0 64; + } + } + part { name: "fg1"; + mouse_events: 0; + description { state: "default" 0.0; + visible: 0; + color: 255 255 255 0; + rel1.to: "bg"; + rel2.relative: 1.0 0.5; + rel2.to: "bg"; + image { + normal: "bt_sm_hilight.png"; + border: 6 6 6 0; + } + } + description { state: "selected" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 255; + } + } + part { name: "fg2"; + mouse_events: 0; + description { state: "default" 0.0; + visible: 0; + color: 255 255 255 0; + rel1.to: "bg"; + rel2.to: "bg"; + image { + normal: "bt_sm_shine.png"; + border: 6 6 6 0; + } + } + description { state: "selected" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 255; + } + } + part { + name: "event"; + type: RECT; + repeat_events: 1; + description { + state: "default" 0.0; + color: 0 0 0 0; + } + } + } + programs { + program { + name: "go_active"; + signal: "elm,state,selected"; + source: "elm"; + action: STATE_SET "selected" 0.0; + target: "bg"; + target: "fg1"; + target: "fg2"; + target: "elm.text"; + } + program { + name: "go_passive"; + signal: "elm,state,unselected"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "bg"; + target: "fg1"; + target: "fg2"; + target: "elm.text"; + transition: LINEAR 0.1; + } + } + } + group { name: "elm/list/item_compress_odd/default"; + data.item: "stacking" "below"; + data.item: "selectraise" "on"; + images { + image: "bt_sm_base1.png" COMP; + image: "bt_sm_shine.png" COMP; + image: "bt_sm_hilight.png" COMP; + image: "ilist_2.png" COMP; + } + parts { + part { + name: "base"; + mouse_events: 0; + description { + state: "default" 0.0; + image { + normal: "ilist_2.png"; + border: 2 2 2 2; + } + fill.smooth: 0; + } + } + part { name: "bg"; + mouse_events: 0; + description { state: "default" 0.0; + visible: 0; + color: 255 255 255 0; + rel1 { + relative: 0.0 0.0; + offset: -5 -5; + } + rel2 { + relative: 1.0 1.0; + offset: 4 4; + } + image { + normal: "bt_sm_base1.png"; + border: 6 6 6 6; + } + } + description { state: "selected" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 255; + rel1 { + relative: 0.0 0.0; + offset: -2 -2; + } + rel2 { + relative: 1.0 1.0; + offset: 1 1; + } + } + } + part { + name: "elm.swallow.icon"; + type: SWALLOW; + description { + state: "default" 0.0; + align: 0.0 0.5; + rel1 { + relative: 0.0 0.0; + offset: 4 4; + } + rel2 { + relative: 0.0 1.0; + offset: 4 -5; + } + } + } + part { + name: "elm.swallow.end"; + type: SWALLOW; + description { + state: "default" 0.0; + align: 1.0 0.5; + rel1 { + relative: 1.0 0.0; + offset: -5 4; + } + rel2 { + relative: 1.0 1.0; + offset: -5 -5; + } + } + } + part { + name: "elm.text"; + type: TEXT; + effect: SOFT_SHADOW; + mouse_events: 0; + scale: 1; + description { + state: "default" 0.0; + min: 16 16; + rel1 { + to_x: "elm.swallow.icon"; + relative: 1.0 0.0; + offset: 0 4; + } + rel2 { + to_x: "elm.swallow.end"; + relative: 0.0 1.0; + offset: -1 -5; + } + color: 0 0 0 255; + color3: 0 0 0 0; + text { + font: "Sans"; + size: 10; +// min: 1 1; + min: 0 1; + align: 0.0 0.5; + } + } + description { state: "selected" 0.0; + inherit: "default" 0.0; + color: 224 224 224 255; + color3: 0 0 0 64; + } + } + part { name: "fg1"; + mouse_events: 0; + description { state: "default" 0.0; + visible: 0; + color: 255 255 255 0; + rel1.to: "bg"; + rel2.relative: 1.0 0.5; + rel2.to: "bg"; + image { + normal: "bt_sm_hilight.png"; + border: 6 6 6 0; + } + } + description { state: "selected" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 255; + } + } + part { name: "fg2"; + mouse_events: 0; + description { state: "default" 0.0; + visible: 0; + color: 255 255 255 0; + rel1.to: "bg"; + rel2.to: "bg"; + image { + normal: "bt_sm_shine.png"; + border: 6 6 6 0; + } + } + description { state: "selected" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 255; + } + } + part { + name: "event"; + type: RECT; + repeat_events: 1; + description { + state: "default" 0.0; + color: 0 0 0 0; + } + } + } + programs { + program { + name: "go_active"; + signal: "elm,state,selected"; + source: "elm"; + action: STATE_SET "selected" 0.0; + target: "bg"; + target: "fg1"; + target: "fg2"; + target: "elm.text"; + } + program { + name: "go_passive"; + signal: "elm,state,unselected"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "bg"; + target: "fg1"; + target: "fg2"; + target: "elm.text"; + transition: LINEAR 0.1; + } + } + } } diff --git a/legacy/elementary/src/bin/test.c b/legacy/elementary/src/bin/test.c index ad3b890943..bf88134c82 100644 --- a/legacy/elementary/src/bin/test.c +++ b/legacy/elementary/src/bin/test.c @@ -1574,6 +1574,181 @@ my_bt_20(void *data, Evas_Object *obj, void *event_info) evas_object_show(win); } +static void +my_bt_21(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *win, *bg, *li, *ic, *ic2, *bx; + char buf[PATH_MAX]; + + win = elm_win_add(NULL, "list-2", ELM_WIN_BASIC); + elm_win_title_set(win, "List 2"); + elm_win_autodel_set(win, 1); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, 1.0, 1.0); + evas_object_show(bg); + + li = elm_list_add(win); + elm_win_resize_object_add(win, li); + evas_object_size_hint_weight_set(li, 1.0, 1.0); + elm_list_horizontal_mode_set(li, ELM_LIST_LIMIT); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR); + elm_icon_file_set(ic, buf, NULL); + elm_list_item_append(li, "Hello", ic, NULL, NULL, NULL); + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR); + elm_icon_scale_set(ic, 0, 0); + elm_icon_file_set(ic, buf, NULL); + elm_list_item_append(li, "world", ic, NULL, NULL, NULL); + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "edit"); + elm_icon_scale_set(ic, 0, 0); + elm_list_item_append(li, ".", ic, NULL, NULL, NULL); + + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "delete"); + elm_icon_scale_set(ic, 0, 0); + ic2 = elm_icon_add(win); + elm_icon_standard_set(ic2, "clock"); + elm_icon_scale_set(ic2, 0, 0); + elm_list_item_append(li, "How", ic, ic2, NULL, NULL); + + bx = elm_box_add(win); + elm_box_horizontal_set(bx, 1); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR); + elm_icon_file_set(ic, buf, NULL); + elm_icon_scale_set(ic, 0, 0); + evas_object_size_hint_align_set(ic, 0.5, 0.5); + elm_box_pack_end(bx, ic); + evas_object_show(ic); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR); + elm_icon_file_set(ic, buf, NULL); + elm_icon_scale_set(ic, 0, 0); + evas_object_size_hint_align_set(ic, 0.5, 0.0); + elm_box_pack_end(bx, ic); + evas_object_show(ic); + elm_list_item_append(li, "are", bx, NULL, NULL, NULL); + + elm_list_item_append(li, "you", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "doing", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "out", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "there", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "today", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "?", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "Here", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "are", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "some", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "more", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "items", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "Longer label.", NULL, NULL, NULL, NULL); + + elm_list_go(li); + + evas_object_show(li); + + evas_object_resize(win, 320, 300); + evas_object_show(win); +} + +static void +my_bt_22(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *win, *bg, *li, *ic, *ic2, *bx; + char buf[PATH_MAX]; + + win = elm_win_add(NULL, "list-3", ELM_WIN_BASIC); + elm_win_title_set(win, "List 3"); + elm_win_autodel_set(win, 1); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, 1.0, 1.0); + evas_object_show(bg); + + li = elm_list_add(win); + elm_win_resize_object_add(win, li); + evas_object_size_hint_weight_set(li, 1.0, 1.0); + elm_list_horizontal_mode_set(li, ELM_LIST_COMPRESS); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR); + elm_icon_file_set(ic, buf, NULL); + elm_list_item_append(li, "Hello", ic, NULL, NULL, NULL); + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR); + elm_icon_scale_set(ic, 0, 0); + elm_icon_file_set(ic, buf, NULL); + elm_list_item_append(li, "world", ic, NULL, NULL, NULL); + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "edit"); + elm_icon_scale_set(ic, 0, 0); + elm_list_item_append(li, ".", ic, NULL, NULL, NULL); + + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "delete"); + elm_icon_scale_set(ic, 0, 0); + ic2 = elm_icon_add(win); + elm_icon_standard_set(ic2, "clock"); + elm_icon_scale_set(ic2, 0, 0); + elm_list_item_append(li, "How", ic, ic2, NULL, NULL); + + bx = elm_box_add(win); + elm_box_horizontal_set(bx, 1); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR); + elm_icon_file_set(ic, buf, NULL); + elm_icon_scale_set(ic, 0, 0); + evas_object_size_hint_align_set(ic, 0.5, 0.5); + elm_box_pack_end(bx, ic); + evas_object_show(ic); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR); + elm_icon_file_set(ic, buf, NULL); + elm_icon_scale_set(ic, 0, 0); + evas_object_size_hint_align_set(ic, 0.5, 0.0); + elm_box_pack_end(bx, ic); + evas_object_show(ic); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR); + elm_icon_file_set(ic, buf, NULL); + elm_icon_scale_set(ic, 0, 0); + evas_object_size_hint_align_set(ic, 0.0, 1.0); + elm_box_pack_end(bx, ic); + evas_object_show(ic); + elm_list_item_append(li, "are", bx, NULL, NULL, NULL); + + elm_list_item_append(li, "you", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "doing", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "out", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "there", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "today", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "?", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "Here", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "are", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "some", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "more", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "items", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "Is this label long enough?", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "Maybe this one is even longer so we can test long long items.", NULL, NULL, NULL, NULL); + + elm_list_go(li); + + evas_object_show(li); + + evas_object_resize(win, 320, 300); + evas_object_show(win); +} + static void my_win_main(void) { @@ -1807,6 +1982,20 @@ my_win_main(void) elm_box_pack_end(bx, bt); evas_object_show(bt); + bt = elm_button_add(win); + elm_button_label_set(bt, "List 2"); + evas_object_smart_callback_add(bt, "clicked", my_bt_21, NULL); + evas_object_size_hint_align_set(bt, -1.0, 0.0); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_button_label_set(bt, "List 3"); + evas_object_smart_callback_add(bt, "clicked", my_bt_22, NULL); + evas_object_size_hint_align_set(bt, -1.0, 0.0); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + /* set an initial window size */ evas_object_resize(win, 320, 520); /* show the window */ diff --git a/legacy/elementary/src/lib/elm_list.c b/legacy/elementary/src/lib/elm_list.c index eaa2975233..3f36afcd7b 100644 --- a/legacy/elementary/src/lib/elm_list.c +++ b/legacy/elementary/src/lib/elm_list.c @@ -26,6 +26,8 @@ struct _Item Evas_Bool is_even : 1; Evas_Bool fixed : 1; Evas_Bool selected : 1; + Evas_Bool dummy_icon : 1; + Evas_Bool dummy_end : 1; }; static void _del_hook(Evas_Object *obj); @@ -45,6 +47,8 @@ _sizing_eval(Evas_Object *obj) Widget_Data *wd = elm_widget_data_get(obj); Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; + evas_object_size_hint_min_get(wd->scroller, &minw, &minh); + evas_object_size_hint_max_get(wd->scroller, &maxw, &maxh); evas_object_size_hint_min_set(obj, minw, minh); evas_object_size_hint_max_set(obj, maxw, maxh); } @@ -149,6 +153,7 @@ _fix_items(Evas_Object *obj) Widget_Data *wd = elm_widget_data_get(obj); Eina_List *l; Evas_Coord minw[2] = { 0, 0 }, minh[2] = { 0, 0 }; + Evas_Coord mw, mh; int i, redo = 0; for (l = wd->items; l; l = l->next) @@ -177,7 +182,6 @@ _fix_items(Evas_Object *obj) wd->minh[1] = minh[1]; redo = 1; } - printf("%ix%i | %ix%i\n", minw[0], minh[0], minw[1], minh[1]); for (i = 0, l = wd->items; l; l = l->next, i++) { Item *it = l->data; @@ -185,10 +189,21 @@ _fix_items(Evas_Object *obj) if ((it->even != it->is_even) || (!it->fixed) || (redo)) { const char *stacking; - if (it->even) - _elm_theme_set(it->base, "list", "item", "default"); + + if (wd->mode == ELM_LIST_COMPRESS) + { + if (it->even) + _elm_theme_set(it->base, "list", "item_compress", "default"); + else + _elm_theme_set(it->base, "list", "item_compress_odd", "default"); + } else - _elm_theme_set(it->base, "list", "item_odd", "default"); + { + if (it->even) + _elm_theme_set(it->base, "list", "item", "default"); + else + _elm_theme_set(it->base, "list", "item_odd", "default"); + } stacking = edje_object_data_get(it->base, "stacking"); if (stacking) { @@ -198,20 +213,21 @@ _fix_items(Evas_Object *obj) evas_object_raise(it->base); } edje_object_part_text_set(it->base, "elm.text", it->label); - if ((!it->icon) && (minw[0] > 0)) + if ((!it->icon) && (minh[0] > 0)) { it->icon = evas_object_rectangle_add(evas_object_evas_get(it->base)); evas_object_color_set(it->icon, 0, 0, 0, 0); + it->dummy_icon = 1; } - if ((!it->end) && (minw[1] > 0)) + if ((!it->end) && (minh[1] > 0)) { it->end = evas_object_rectangle_add(evas_object_evas_get(it->base)); evas_object_color_set(it->end, 0, 0, 0, 0); + it->dummy_end = 1; } if (it->icon) { edje_extern_object_min_size_set(it->icon, minw[0], minh[0]); - printf("|%s| %ix%i\n", it->label, minw[0], minh[0]); edje_object_part_swallow(it->base, "elm.swallow.icon", it->icon); } if (it->end) @@ -221,19 +237,21 @@ _fix_items(Evas_Object *obj) } if (!it->fixed) { - Evas_Coord minw, minh; - edje_object_message_signal_process(it->base); - edje_object_size_min_calc(it->base, &minw, &minh); - if (wd->mode == ELM_LIST_COMPRESS) minw = 0; - printf("-- %ix%i\n", minw, minh); - evas_object_size_hint_min_set(it->base, minw, minh); + edje_object_size_min_calc(it->base, &mw, &mh); + evas_object_size_hint_min_set(it->base, mw, mh); evas_object_show(it->base); } it->fixed = 1; it->is_even = it->even; } } + mw = 0; mh = 0; + evas_object_size_hint_min_get(wd->box, &mw, &mh); + if (wd->mode == ELM_LIST_LIMIT) + elm_scroller_content_min_limit(wd->scroller, 1, 0); + else + elm_scroller_content_min_limit(wd->scroller, 0, 0); _sizing_eval(obj); } @@ -328,6 +346,10 @@ elm_list_horizontal_mode_set(Evas_Object *obj, Elementary_List_Mode mode) Widget_Data *wd = elm_widget_data_get(obj); if (wd->mode == mode) return; wd->mode = mode; + if (wd->mode == ELM_LIST_LIMIT) + elm_scroller_content_min_limit(wd->scroller, 1, 0); + else + elm_scroller_content_min_limit(wd->scroller, 0, 0); } EAPI const Elm_List_Item * @@ -343,6 +365,7 @@ elm_list_items_get(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (wd->selected) return wd->selected; + // FIXME: implement return wd->items; } @@ -379,3 +402,19 @@ elm_list_item_data_get(Elm_List_Item *item) Item *it = (Item *)item; return it->data; } + +EAPI Evas_Object * +elm_list_item_icon_get(Elm_List_Item *item) +{ + Item *it = (Item *)item; + if (it->dummy_icon) return NULL; + return it->icon; +} + +EAPI Evas_Object * +elm_list_item_end_get(Elm_List_Item *item) +{ + Item *it = (Item *)item; + if (it->dummy_end) return NULL; + return it->end; +} diff --git a/legacy/elementary/src/lib/elm_scroller.c b/legacy/elementary/src/lib/elm_scroller.c index ac9df011f1..be39c10f1d 100644 --- a/legacy/elementary/src/lib/elm_scroller.c +++ b/legacy/elementary/src/lib/elm_scroller.c @@ -70,6 +70,7 @@ _sizing_eval(Evas_Object *obj) edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh); if (wd->min_w) w = vmw + minw; if (wd->min_h) h = vmh + minh; + printf("%i : %i + %i\n",wd->min_w, vmw, minw); evas_object_size_hint_min_set(obj, w, h); }