New list layout: horizontal.

Now one can set lists to dispose its items horizontally, too.
elm_list_horizontal_mode_set(), whose name was bogus and would
conflict with the new methods, got renamed to elm_mode_set(), along
with the getters.

This is coming along to help a widget using lists which has a
horizontal mode. The default theme for horizontal items is kinda ugly
for default lists, but one can always improve it :) (in a hurry
now).

Also, I'm introducing a new mode for Elementary lists: expand.



SVN revision: 53640
This commit is contained in:
Gustavo Lima Chaves 2010-10-19 20:19:12 +00:00
parent 0121df333c
commit 7d4f42fe00
9 changed files with 1241 additions and 172 deletions

View File

@ -11523,6 +11523,814 @@ collections {
}
}
///////////////////////////////////////////////////////////////////////////////
group { name: "elm/list/h_item/default";
data.item: "stacking" "above";
images {
image: "bt_sm_base1.png" COMP;
image: "bt_sm_shine.png" COMP;
image: "bt_sm_hilight.png" COMP;
image: "ilist_1_h.png" COMP;
image: "ilist_item_shadow_h.png" COMP;
}
parts {
part {
name: "event";
type: RECT;
repeat_events: 1;
description {
state: "default" 0.0;
color: 0 0 0 0;
}
}
part {
name: "base_sh";
mouse_events: 0;
description {
state: "default" 0.0;
align: 0.0 0.0;
min: 10 0;
fixed: 1 1;
rel1 {
to: "base";
relative: 1.0 0.0;
offset: 0 0;
}
rel2 {
to: "base";
relative: 1.0 1.0;
offset: 0 -1;
}
image {
normal: "ilist_item_shadow_h.png";
}
fill.smooth: 0;
}
}
part {
name: "base";
mouse_events: 0;
description {
state: "default" 0.0;
image {
normal: "ilist_1_h.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;
}
image.middle: SOLID;
}
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;
fixed: 0 1;
align: 0.5 0.0;
rel1 {
relative: 0.0 0.0;
offset: 4 4;
}
rel2 {
relative: 1.0 0.0;
offset: -5 4;
}
}
}
part { name: "elm.swallow.end";
type: SWALLOW;
description { state: "default" 0.0;
fixed: 0 1;
align: 0.5 1.0;
rel1 {
relative: 0.0 1.0;
offset: 4 -5;
}
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;
fixed: 0 1;
rel1 {
to_x: "elm.swallow.icon";
relative: 0.0 1.0;
offset: 4 4;
}
rel2 {
to_x: "elm.swallow.end";
relative: 1.0 0.0;
offset: -5 -1;
}
color: 0 0 0 255;
color3: 0 0 0 0;
text {
font: "Sans";
size: 10;
min: 1 1;
align: 0.5 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;
}
}
}
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/h_item_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_h.png" COMP;
}
parts {
part {
name: "event";
type: RECT;
repeat_events: 1;
description {
state: "default" 0.0;
color: 0 0 0 0;
}
}
part {
name: "base";
mouse_events: 0;
description {
state: "default" 0.0;
image {
normal: "ilist_2_h.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;
}
image.middle: SOLID;
}
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;
fixed: 0 1;
align: 0.5 0.0;
rel1 {
relative: 0.0 0.0;
offset: 4 4;
}
rel2 {
relative: 1.0 0.0;
offset: -5 4;
}
}
}
part {
name: "elm.swallow.end";
type: SWALLOW;
description { state: "default" 0.0;
fixed: 0 1;
align: 0.5 1.0;
rel1 {
relative: 0.0 1.0;
offset: 4 -5;
}
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;
fixed: 1 1;
rel1 {
to_x: "elm.swallow.icon";
relative: 0.0 1.0;
offset: 4 4;
}
rel2 {
to_x: "elm.swallow.end";
relative: 1.0 0.0;
offset: -5 -1;
}
color: 0 0 0 255;
color3: 0 0 0 0;
text {
font: "Sans";
size: 10;
min: 1 1;
align: 0.5 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;
}
}
}
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/h_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_h.png" COMP;
image: "ilist_item_shadow_h.png" COMP;
}
parts {
part {
name: "event";
type: RECT;
repeat_events: 1;
description {
state: "default" 0.0;
color: 0 0 0 0;
}
}
part {
name: "base_sh";
mouse_events: 0;
description { state: "default" 0.0;
fixed: 1 1;
align: 0.0 0.0;
min: 10 0;
rel1 {
to: "base";
relative: 1.0 0.0;
offset: 0 0;
}
rel2 {
to: "base";
relative: 1.0 1.0;
offset: 0 -1;
}
image {
normal: "ilist_item_shadow_h.png";
}
fill.smooth: 0;
}
}
part {
name: "base";
mouse_events: 0;
description {
state: "default" 0.0;
image {
normal: "ilist_1_h.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;
}
image.middle: SOLID;
}
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;
fixed: 0 1;
align: 0.5 0.0;
rel1 {
relative: 0.0 0.0;
offset: 4 4;
}
rel2 {
relative: 1.0 0.0;
offset: -5 4;
}
}
}
part { name: "elm.swallow.end";
type: SWALLOW;
description { state: "default" 0.0;
fixed: 0 1;
align: 0.5 1.0;
rel1 {
relative: 0.0 1.0;
offset: 4 -5;
}
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;
fixed: 1 1;
rel1 {
to_x: "elm.swallow.icon";
relative: 0.0 1.0;
offset: 4 4;
}
rel2 {
to_x: "elm.swallow.end";
relative: 1.0 0.0;
offset: -5 -1;
}
color: 0 0 0 255;
color3: 0 0 0 0;
text {
font: "Sans";
size: 10;
min: 1 1;
align: 0.5 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;
}
}
}
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/h_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_h.png" COMP;
}
parts {
part {
name: "event";
type: RECT;
repeat_events: 1;
description {
state: "default" 0.0;
color: 0 0 0 0;
}
}
part {
name: "base";
mouse_events: 0;
description {
state: "default" 0.0;
image {
normal: "ilist_2_h.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;
}
image.middle: SOLID;
}
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;
fixed: 0 1;
align: 0.5 0.0;
rel1 {
relative: 0.0 0.0;
offset: 4 4;
}
rel2 {
relative: 1.0 0.0;
offset: -5 4;
}
}
}
part { name: "elm.swallow.end";
type: SWALLOW;
description { state: "default" 0.0;
fixed: 0 1;
align: 0.5 1.0;
rel1 {
relative: 0.0 1.0;
offset: 4 -5;
}
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;
fixed: 1 1;
rel1 {
to_x: "elm.swallow.icon";
relative: 0.0 1.0;
offset: 4 4;
}
rel2 {
to_x: "elm.swallow.end";
relative: 1.0 0.0;
offset: -5 -1;
}
color: 0 0 0 255;
color3: 0 0 0 0;
text {
font: "Sans";
size: 10;
min: 1 1;
align: 0.5 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;
}
}
}
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/slider/horizontal/default";
images {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 B

View File

@ -34,6 +34,7 @@ void test_anchorblock(void *data, Evas_Object *obj, void *event_info);
void test_toolbar(void *data, Evas_Object *obj, void *event_info);
void test_hoversel(void *data, Evas_Object *obj, void *event_info);
void test_list(void *data, Evas_Object *obj, void *event_info);
void test_list_horizontal(void *data, Evas_Object *obj, void *event_info);
void test_list2(void *data, Evas_Object *obj, void *event_info);
void test_list3(void *data, Evas_Object *obj, void *event_info);
void test_list4(void *data, Evas_Object *obj, void *event_info);
@ -250,6 +251,7 @@ my_win_main(char *autorun)
ADD_TEST("Toolbar", test_toolbar);
ADD_TEST("Hoversel", test_hoversel);
ADD_TEST("List", test_list);
ADD_TEST("List - Horizontal", test_list_horizontal);
ADD_TEST("List 2", test_list2);
ADD_TEST("List 3", test_list3);
ADD_TEST("List 4", test_list4);

View File

@ -27,6 +27,7 @@ test_list(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info _
li = elm_list_add(win);
elm_win_resize_object_add(win, li);
elm_list_mode_set(li, ELM_LIST_LIMIT);
evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
ic = elm_icon_add(win);
@ -148,6 +149,132 @@ test_list(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info _
evas_object_show(win);
}
void
test_list_horizontal(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Evas_Object *win, *bg, *li, *ic, *ic2, *bx, *tb2, *bt;
char buf[PATH_MAX];
Elm_List_Item *it1, *it2, *it3, *it4;
win = elm_win_add(NULL, "list", ELM_WIN_BASIC);
elm_win_title_set(win, "List");
elm_win_autodel_set(win, EINA_TRUE);
bg = elm_bg_add(win);
elm_win_resize_object_add(win, bg);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(bg);
li = elm_list_add(win);
elm_list_horizontal_set(li, EINA_TRUE);
elm_list_mode_set(li, ELM_LIST_LIMIT);
elm_win_resize_object_add(win, li);
evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
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, 1, 1);
it1 = 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);
it2 = elm_list_item_append(li, "How", ic, ic2, NULL, NULL);
bx = elm_box_add(win);
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);
it3 = 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);
it4 = elm_list_item_append(li, "And", NULL, NULL, NULL, NULL);
elm_list_item_append(li, "here", NULL, NULL, NULL, NULL);
elm_list_item_append(li, "we", NULL, NULL, NULL, NULL);
elm_list_item_append(li, "are", NULL, NULL, NULL, NULL);
elm_list_item_append(li, "done", NULL, NULL, NULL, NULL);
elm_list_item_append(li, "with", NULL, NULL, NULL, NULL);
elm_list_item_append(li, "items.", NULL, NULL, NULL, NULL);
elm_list_go(li);
evas_object_show(li);
tb2 = elm_table_add(win);
evas_object_size_hint_weight_set(tb2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, tb2);
bt = elm_button_add(win);
elm_button_label_set(bt, "Hello");
evas_object_smart_callback_add(bt, "clicked", my_show_it, it1);
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, 0.5, 0.9);
elm_table_pack(tb2, bt, 0, 0, 1, 1);
evas_object_show(bt);
bt = elm_button_add(win);
elm_button_label_set(bt, "How");
evas_object_smart_callback_add(bt, "clicked", my_show_it, it2);
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, 0.5, 0.9);
elm_table_pack(tb2, bt, 1, 0, 1, 1);
evas_object_show(bt);
bt = elm_button_add(win);
elm_button_label_set(bt, "doing");
evas_object_smart_callback_add(bt, "clicked", my_show_it, it3);
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, 0.5, 0.9);
elm_table_pack(tb2, bt, 2, 0, 1, 1);
evas_object_show(bt);
bt = elm_button_add(win);
elm_button_label_set(bt, "And");
evas_object_smart_callback_add(bt, "clicked", my_show_it, it4);
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, 0.5, 0.9);
elm_table_pack(tb2, bt, 3, 0, 1, 1);
evas_object_show(bt);
evas_object_show(tb2);
evas_object_resize(win, 320, 300);
evas_object_show(win);
}
/***********/
static void
@ -190,7 +317,7 @@ test_list2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
li = elm_list_add(win);
evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_list_horizontal_mode_set(li, ELM_LIST_LIMIT);
elm_list_mode_set(li, ELM_LIST_LIMIT);
// elm_list_multi_select_set(li, 1);
ic = elm_icon_add(win);
@ -307,7 +434,7 @@ test_list3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
li = elm_list_add(win);
elm_win_resize_object_add(win, li);
evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_list_horizontal_mode_set(li, ELM_LIST_COMPRESS);
elm_list_mode_set(li, ELM_LIST_COMPRESS);
ic = elm_icon_add(win);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
@ -469,7 +596,7 @@ test_list4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
li = elm_list_add(win);
evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_list_horizontal_mode_set(li, ELM_LIST_COMPRESS);
elm_list_mode_set(li, ELM_LIST_COMPRESS);
evas_object_smart_callback_add(li, "swipe", test_list4_swipe, &info);
elm_pager_content_push(pager, li);
@ -585,7 +712,7 @@ test_list5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
li = elm_list_add(win);
evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_list_horizontal_mode_set(li, ELM_LIST_COMPRESS);
elm_list_mode_set(li, ELM_LIST_COMPRESS);
evas_object_smart_callback_add(li, "swipe", test_list5_swipe, NULL);
elm_win_resize_object_add(win, li);
evas_object_show(li);

View File

@ -6,7 +6,7 @@ typedef struct _Elm_Params_List
{
const char *policy_h;
const char *policy_v;
const char *horizontal_mode;
const char *mode;
Eina_Bool multi : 1;
Eina_Bool multi_exists : 1;
Eina_Bool always_select : 1;
@ -20,8 +20,7 @@ typedef struct _Elm_Params_List
return i
static const char *scroller_policy_choices[] = {"auto", "on", "off", NULL};
static const char *list_horizontal_mode_choices[] = {"compress", "scroll",
"limit", NULL};
static const char *list_mode_choices[] = {"compress", "scroll", "limit", NULL};
static Elm_Scroller_Policy
_scroller_policy_choices_setting_get(const char *policy_str)
@ -33,11 +32,11 @@ _scroller_policy_choices_setting_get(const char *policy_str)
}
static Elm_List_Mode
_list_horizontal_mode_setting_get(const char *horizontal_mode_str)
_list_mode_setting_get(const char *mode_str)
{
assert(sizeof(list_horizontal_mode_choices)/
sizeof(list_horizontal_mode_choices[0]) == ELM_LIST_LAST + 1);
CHOICE_GET(list_horizontal_mode_choices, horizontal_mode_str);
assert(sizeof(list_mode_choices)/sizeof(list_mode_choices[0]) ==
ELM_LIST_LAST + 1);
CHOICE_GET(list_mode_choices, mode_str);
return ELM_LIST_LAST;
}
@ -52,13 +51,12 @@ external_list_state_set(void *data __UNUSED__, Evas_Object *obj, const void *fro
else if (from_params) p = from_params;
else return;
if (p->horizontal_mode)
if (p->mode)
{
Elm_List_Mode set = _list_horizontal_mode_setting_get(
p->horizontal_mode);
Elm_List_Mode set = _list_mode_setting_get(p->mode);
if (set != ELM_LIST_LAST)
elm_list_horizontal_mode_set(obj, set);
elm_list_mode_set(obj, set);
}
if ((p->policy_h) && (p->policy_v))
@ -95,9 +93,9 @@ external_list_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_Exte
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE)
{
Elm_List_Mode set = _list_horizontal_mode_setting_get(param->s);
Elm_List_Mode set = _list_mode_setting_get(param->s);
if (set == ELM_LIST_LAST) return EINA_FALSE;
elm_list_horizontal_mode_set(obj, set);
elm_list_mode_set(obj, set);
return EINA_TRUE;
}
}
@ -189,16 +187,16 @@ external_list_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_Exte
return EINA_TRUE;
}
}
else if (!strcmp(param->name, "horizontal mode"))
else if (!strcmp(param->name, "list mode"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE)
{
Elm_List_Mode m = elm_list_horizontal_mode_get(obj);
Elm_List_Mode m = elm_list_mode_get(obj);
if (m == ELM_LIST_LAST)
return EINA_FALSE;
param->s = list_horizontal_mode_choices[m];
param->s = list_mode_choices[m];
return EINA_TRUE;
}
}
@ -236,8 +234,8 @@ external_list_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, c
mem->policy_h = eina_stringshare_add(param->s);
else if (!strcmp(param->name, "scroll vertical"))
mem->policy_v = eina_stringshare_add(param->s);
else if (!strcmp(param->name, "horizontal mode"))
mem->horizontal_mode = eina_stringshare_add(param->s);
else if (!strcmp(param->name, "list mode"))
mem->mode = eina_stringshare_add(param->s);
}
return mem;
}
@ -254,8 +252,8 @@ external_list_params_free(void *params)
{
Elm_Params_List *mem = params;
if (mem->horizontal_mode)
eina_stringshare_del(mem->horizontal_mode);
if (mem->mode)
eina_stringshare_del(mem->mode);
if (mem->policy_h)
eina_stringshare_del(mem->policy_h);
if (mem->policy_v)
@ -265,8 +263,8 @@ external_list_params_free(void *params)
}
static Edje_External_Param_Info external_list_params[] = {
EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("horizontal mode", "scroll",
list_horizontal_mode_choices),
EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("list mode", "scroll",
list_mode_choices),
EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("scroll horizontal", "auto",
scroller_policy_choices),
EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("scroll vertical", "auto",

View File

@ -1252,6 +1252,7 @@ extern "C" {
ELM_LIST_COMPRESS = 0,
ELM_LIST_SCROLL,
ELM_LIST_LIMIT,
ELM_LIST_EXPAND,
ELM_LIST_LAST
} Elm_List_Mode;
typedef struct _Elm_List_Item Elm_List_Item; /**< Item of Elm_List. Sub-type of Elm_Widget_Item */
@ -1264,9 +1265,11 @@ extern "C" {
EAPI void elm_list_clear(Evas_Object *obj);
EAPI void elm_list_go(Evas_Object *obj);
EAPI void elm_list_multi_select_set(Evas_Object *obj, Eina_Bool multi);
EAPI Eina_Bool elm_list_multi_select_get(const Evas_Object *obj);
EAPI void elm_list_horizontal_mode_set(Evas_Object *obj, Elm_List_Mode mode);
EAPI Elm_List_Mode elm_list_horizontal_mode_get(const Evas_Object *obj);
EAPI Eina_Bool elm_list_multi_select_get(const Evas_Object *obj);
EAPI void elm_list_mode_set(Evas_Object *obj, Elm_List_Mode mode);
EAPI Elm_List_Mode elm_list_mode_get(const Evas_Object *obj);
EAPI void elm_list_horizontal_set(Evas_Object *obj, Eina_Bool horizontal);
EAPI Eina_Bool elm_list_horizontal_get(Evas_Object *obj);
EAPI void elm_list_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select);
EAPI Eina_Bool elm_list_always_select_mode_get(const Evas_Object *obj);
EAPI const Eina_List *elm_list_items_get(const Evas_Object *obj);

View File

@ -18,6 +18,7 @@ struct _Widget_Data
Eina_List *items, *selected, *to_delete;
Elm_List_Item *last_selected_item;
Elm_List_Mode mode;
Elm_List_Mode h_mode;
Evas_Coord minw[2], minh[2];
Eina_Bool scr_minw : 1;
Eina_Bool scr_minh : 1;
@ -75,18 +76,16 @@ static Eina_Bool _item_single_select_down(Widget_Data *wd);
static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src,
Evas_Callback_Type type, void *event_info);
#define ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, ...) \
if (!it) \
{ \
fprintf(stderr, "ERROR: %s:%d:%s() "#it" is NULL.\n", \
__FILE__, __LINE__, __FUNCTION__); \
return __VA_ARGS__; \
} \
else if (it->deleted) \
{ \
fprintf(stderr, "ERROR: %s:%d:%s() "#it" has been DELETED.\n",\
__FILE__, __LINE__, __FUNCTION__); \
return __VA_ARGS__; \
#define ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, ...) \
if (!it) \
{ \
ERR("ERROR: "#it" is NULL.\n"); \
return __VA_ARGS__; \
} \
else if (it->deleted) \
{ \
ERR("ERROR: "#it" has been DELETED.\n"); \
return __VA_ARGS__; \
}
static inline void
@ -144,6 +143,7 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type ty
elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
/* TODO: fix logic for horizontal mode */
if (!strcmp(ev->keyname, "Left") || !strcmp(ev->keyname, "KP_Left"))
{
x -= step_x;
@ -312,8 +312,8 @@ _elm_list_walk(Widget_Data *wd)
{
if (wd->walking < 0)
{
fprintf(stderr, "ERROR: walking was negative. fixed!\n");
wd->walking = 0;
ERR("ERROR: walking was negative. fixed!\n");
wd->walking = 0;
}
wd->walking++;
}
@ -324,8 +324,8 @@ _elm_list_unwalk(Widget_Data *wd)
wd->walking--;
if (wd->walking < 0)
{
fprintf(stderr, "ERROR: walking became negative. fixed!\n");
wd->walking = 0;
ERR("ERROR: walking became negative. fixed!\n");
wd->walking = 0;
}
if (wd->walking)
@ -351,12 +351,13 @@ _del_hook(Evas_Object *obj)
if (!wd) return;
if (wd->walking != 0)
fprintf(stderr, "ERROR: list deleted while walking.\n");
ERR("ERROR: list deleted while walking.\n");
_elm_list_walk(wd);
EINA_LIST_FOREACH(wd->items, n, it) elm_widget_item_pre_notify_del(it);
_elm_list_unwalk(wd);
if (wd->to_delete) fprintf(stderr, "ERROR: leaking nodes!\n");
if (wd->to_delete)
ERR("ERROR: leaking nodes!\n");
EINA_LIST_FREE(wd->items, it) _elm_list_item_free(it);
eina_list_free(wd->selected);
@ -405,6 +406,13 @@ _sizing_eval(Evas_Object *obj)
&vmw, &vmh);
if (wd->scr_minw) w = vmw + minw;
if (wd->scr_minh) h = vmh + minh;
evas_object_size_hint_max_get(obj, &maxw, &maxh);
if (maxw > 0 && w > maxw)
w = maxw;
if (maxh > 0 && h > maxh)
h = maxh;
evas_object_size_hint_min_set(obj, w, h);
}
@ -820,6 +828,39 @@ _item_new(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *e
return it;
}
static void
_elm_list_mode_set_internal(Widget_Data *wd)
{
if (!wd->scr)
return;
if (wd->mode == ELM_LIST_LIMIT)
{
if (!wd->h_mode)
{
wd->scr_minw = EINA_TRUE;
wd->scr_minh = EINA_FALSE;
}
else
{
wd->scr_minw = EINA_FALSE;
wd->scr_minh = EINA_TRUE;
}
}
else if (wd->mode == ELM_LIST_EXPAND)
{
wd->scr_minw = EINA_TRUE;
wd->scr_minh = EINA_TRUE;
}
else
{
wd->scr_minw = EINA_FALSE;
wd->scr_minh = EINA_FALSE;
}
_sizing_eval(wd->self);
}
static void
_fix_items(Evas_Object *obj)
{
@ -830,6 +871,10 @@ _fix_items(Evas_Object *obj)
Evas_Coord mw, mh;
int i, redo = 0;
const char *style = elm_widget_style_get(obj);
const char *it_plain = wd->h_mode ? "h_item" : "item";
const char *it_odd = wd->h_mode ? "h_item_odd" : "item_odd";
const char *it_compress = wd->h_mode ? "h_item_compress" : "item_compress";
const char *it_compress_odd = wd->h_mode ? "h_item_compress_odd" : "item_compress_odd";
if (!wd) return;
if (wd->walking)
@ -856,6 +901,7 @@ _fix_items(Evas_Object *obj)
if (mh > minh[1]) minh[1] = mh;
}
}
if ((minw[0] != wd->minw[0]) || (minw[1] != wd->minw[1]) ||
(minw[0] != wd->minh[0]) || (minh[1] != wd->minh[1]))
{
@ -868,115 +914,113 @@ _fix_items(Evas_Object *obj)
i = 0;
EINA_LIST_FOREACH(wd->items, l, it)
{
if (it->deleted) continue;
it->even = i & 0x1;
if ((it->even != it->is_even) || (!it->fixed) || (redo))
{
const char *stacking;
if (it->deleted)
continue;
if (it->is_separator)
_elm_theme_object_set(obj, it->base.view, "list", "separator", style);
else if (wd->mode == ELM_LIST_COMPRESS)
{
if (it->even)
_elm_theme_object_set(obj, it->base.view, "list", "item_compress", style);
else
_elm_theme_object_set(obj, it->base.view, "list", "item_compress_odd", style);
}
else
{
if (it->even)
_elm_theme_object_set(obj, it->base.view, "list", "item", style);
else
_elm_theme_object_set(obj, it->base.view, "list", "item_odd", style);
}
stacking = edje_object_data_get(it->base.view, "stacking");
if (stacking)
{
if (!strcmp(stacking, "below"))
evas_object_lower(it->base.view);
else if (!strcmp(stacking, "above"))
evas_object_raise(it->base.view);
}
edje_object_part_text_set(it->base.view, "elm.text", it->label);
if ((!it->icon) && (minh[0] > 0))
{
it->icon = evas_object_rectangle_add(evas_object_evas_get(it->base.view));
evas_object_color_set(it->icon, 0, 0, 0, 0);
it->dummy_icon = EINA_TRUE;
}
if ((!it->end) && (minh[1] > 0))
{
it->end = evas_object_rectangle_add(evas_object_evas_get(it->base.view));
evas_object_color_set(it->end, 0, 0, 0, 0);
it->dummy_end = EINA_TRUE;
}
if (it->icon)
{
evas_object_size_hint_min_set(it->icon, minw[0], minh[0]);
evas_object_size_hint_max_set(it->icon, 99999, 99999);
edje_object_part_swallow(it->base.view, "elm.swallow.icon", it->icon);
}
if (it->end)
{
evas_object_size_hint_min_set(it->end, minw[1], minh[1]);
evas_object_size_hint_max_set(it->end, 99999, 99999);
edje_object_part_swallow(it->base.view, "elm.swallow.end", it->end);
}
if (!it->fixed)
{
// this may call up user and it may modify the list item
// but we're safe as we're flagged as walking.
// just don't process further
edje_object_message_signal_process(it->base.view);
if (it->deleted)
continue;
mw = mh = -1;
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
edje_object_size_min_restricted_calc(it->base.view, &mw, &mh, mw, mh);
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
evas_object_size_hint_min_set(it->base.view, mw, mh);
evas_object_show(it->base.view);
}
if ((it->selected) || (it->hilighted))
{
const char *selectraise;
it->even = i & 0x1;
if ((it->even != it->is_even) || (!it->fixed) || (redo))
{
const char *stacking;
// this may call up user and it may modify the list item
// but we're safe as we're flagged as walking.
// just don't process further
edje_object_signal_emit(it->base.view, "elm,state,selected", "elm");
if (it->deleted)
continue;
/* FIXME: separators' themes seem to be b0rked */
if (it->is_separator)
_elm_theme_object_set(obj, it->base.view, "separator",
wd->h_mode ? "horizontal" : "vertical",
style);
else if (wd->mode == ELM_LIST_COMPRESS)
{
if (it->even)
_elm_theme_object_set(obj, it->base.view, "list",
it_compress, style);
else
_elm_theme_object_set(obj, it->base.view, "list",
it_compress_odd, style);
}
else
{
if (it->even)
_elm_theme_object_set(obj, it->base.view, "list", it_plain,
style);
else
_elm_theme_object_set(obj, it->base.view, "list", it_odd,
style);
}
stacking = edje_object_data_get(it->base.view, "stacking");
if (stacking)
{
if (!strcmp(stacking, "below"))
evas_object_lower(it->base.view);
else if (!strcmp(stacking, "above"))
evas_object_raise(it->base.view);
}
edje_object_part_text_set(it->base.view, "elm.text", it->label);
selectraise = edje_object_data_get(it->base.view, "selectraise");
if ((selectraise) && (!strcmp(selectraise, "on")))
evas_object_raise(it->base.view);
}
it->fixed = EINA_TRUE;
it->is_even = it->even;
}
i++;
if ((!it->icon) && (minh[0] > 0))
{
it->icon = evas_object_rectangle_add(evas_object_evas_get(it->base.view));
evas_object_color_set(it->icon, 0, 0, 0, 0);
it->dummy_icon = EINA_TRUE;
}
if ((!it->end) && (minh[1] > 0))
{
it->end = evas_object_rectangle_add(evas_object_evas_get(it->base.view));
evas_object_color_set(it->end, 0, 0, 0, 0);
it->dummy_end = EINA_TRUE;
}
if (it->icon)
{
evas_object_size_hint_min_set(it->icon, minw[0], minh[0]);
evas_object_size_hint_max_set(it->icon, 99999, 99999);
edje_object_part_swallow(it->base.view, "elm.swallow.icon", it->icon);
}
if (it->end)
{
evas_object_size_hint_min_set(it->end, minw[1], minh[1]);
evas_object_size_hint_max_set(it->end, 99999, 99999);
edje_object_part_swallow(it->base.view, "elm.swallow.end", it->end);
}
if (!it->fixed)
{
// this may call up user and it may modify the list item
// but we're safe as we're flagged as walking.
// just don't process further
edje_object_message_signal_process(it->base.view);
if (it->deleted)
continue;
mw = mh = -1;
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
edje_object_size_min_restricted_calc(it->base.view, &mw, &mh, mw, mh);
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
evas_object_size_hint_min_set(it->base.view, mw, mh);
evas_object_show(it->base.view);
}
if ((it->selected) || (it->hilighted))
{
const char *selectraise;
// this may call up user and it may modify the list item
// but we're safe as we're flagged as walking.
// just don't process further
edje_object_signal_emit(it->base.view, "elm,state,selected", "elm");
if (it->deleted)
continue;
selectraise = edje_object_data_get(it->base.view, "selectraise");
if ((selectraise) && (!strcmp(selectraise, "on")))
evas_object_raise(it->base.view);
}
it->fixed = EINA_TRUE;
it->is_even = it->even;
}
i++;
}
_elm_list_unwalk(wd);
mw = 0; mh = 0;
evas_object_size_hint_min_get(wd->box, &mw, &mh);
if (wd->scr)
{
if (wd->mode == ELM_LIST_LIMIT)
{
wd->scr_minw = 1;
wd->scr_minh = 0;
}
else
{
wd->scr_minw = 0;
wd->scr_minh = 0;
}
}
_sizing_eval(obj);
_elm_list_mode_set_internal(wd);
}
static void
@ -1349,54 +1393,141 @@ elm_list_multi_select_get(const Evas_Object *obj)
}
/**
* Enables/disables horizontal mode of the list
* Set which mode to use for the list with.
*
* @param obj The list object
* @param mode If true, horizontale mode is enabled
* @param mode One of @c ELM_LIST_COMPRESS, @c ELM_LIST_SCROLL or @c
* ELM_LIST_LIMIT.
*
* @note Default value is @c ELM_LIST_SCROLL. At this mode, the list
* object won't set any of its size hints to inform how a possible
* container should resize it. Then, if it's not created as a "resize
* object", it might end with zero dimensions. The list will respect
* the container's geometry and, if any of its items won't fit into
* its transverse axis, one will be able to scroll it in that
* direction. @c ELM_LIST_COMPRESS is the same as the previous, except
* that it <b>won't</b> let one scroll in the transverse axis, on
* those cases (large items will get cropped). @c ELM_LIST_LIMIT will
* actually set a minimun size hint on the list object, so that
* containers may respect it (and resize itself to fit the child
* properly). More specifically, a minimum size hint will be set for
* its transverse axis, so that the <b>largest</b> item in that
* direction fits well. @c ELM_LIST_EXPAND, besides setting a minimum
* size on the transverse axis, just like the previous mode, will set
* a minimum size on the longitudinal axis too, trying to reserve
* space to all its children to be visible at a time. The last two
* modes can always have effects bounded by setting the list object's
* maximum size hints, though.
*
* @ingroup List
*/
EAPI void
elm_list_horizontal_mode_set(Evas_Object *obj, Elm_List_Mode mode)
elm_list_mode_set(Evas_Object *obj, Elm_List_Mode mode)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (wd->mode == mode) return;
Widget_Data *wd;
wd = elm_widget_data_get(obj);
if (!wd)
return;
if (wd->mode == mode)
return;
wd->mode = mode;
if (wd->scr)
{
if (wd->mode == ELM_LIST_LIMIT)
{
wd->scr_minw = 1;
wd->scr_minh = 0;
}
else
{
wd->scr_minw = 0;
wd->scr_minh = 0;
}
_sizing_eval(obj);
}
_elm_list_mode_set_internal(wd);
}
/**
* Gets the state of horizontal mode of the list
* Get the mode the list is at.
*
* @param obj The list object
* @return If true, horizontale mode is enabled
* @return mode One of @c ELM_LIST_COMPRESS, @c ELM_LIST_SCROLL or @c
* ELM_LIST_LIMIT (@c ELM_LIST_LAST on errors).
*
* @note see elm_list_mode_set() for more information.
*
* @ingroup List
*/
EAPI Elm_List_Mode
elm_list_horizontal_mode_get(const Evas_Object *obj)
elm_list_mode_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_SCROLL;
ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return ELM_LIST_SCROLL;
if (!wd) return ELM_LIST_LAST;
return wd->mode;
}
/**
* Enables/disables horizontal mode of the list.
*
* @param obj The list object
* @param mode If true, horizontale mode is enabled
*
* @note Bounce options for the list will be reset to default values
* with this funcion. Re-call elm_list_bounce_set() once more after
* this one, if you had custom values.
*
* @ingroup List
*/
EAPI void
elm_list_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd;
wd = elm_widget_data_get(obj);
if (!wd)
return;
if (wd->h_mode == horizontal)
return;
wd->h_mode = horizontal;
elm_box_horizontal_set(wd->box, horizontal);
if (horizontal)
{
evas_object_size_hint_weight_set(wd->box, 0.0, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(wd->box, 0.0, EVAS_HINT_FILL);
elm_smart_scroller_bounce_allow_set(wd->scr, EINA_TRUE, EINA_FALSE);
}
else
{
evas_object_size_hint_weight_set(wd->box, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(wd->box, EVAS_HINT_FILL, 0.0);
elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE, EINA_TRUE);
}
_elm_list_mode_set_internal(wd);
}
/**
* Retrieve whether horizontal mode is enabled for a list.
*
* @param obj The list object
* @return @c EINA_TRUE, if horizontal mode is enabled and @c
* EINA_FALSE, otherwise.
*
* @note see elm_list_horizontal_set() for more information.
*
* @ingroup List
*/
EAPI Eina_Bool
elm_list_horizontal_get(Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd;
wd = elm_widget_data_get(obj);
if (!wd)
return EINA_FALSE;
return wd->h_mode;
}
/**
* Enables/disables the state of always_select, meaning that
* an item will always be selected.