From 6e0c99e69f739f3cc464e02d257b2cc1f6d2dc81 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Fri, 13 Mar 2009 05:50:38 +0000 Subject: [PATCH] fixes for some bugs i found, tree ability in genlist (basic not fully done visually yet), and some win util calls added. SVN revision: 39456 --- legacy/elementary/data/themes/default.edc | 598 +++++++++++++++++++++- legacy/elementary/src/bin/test.c | 164 ++++++ legacy/elementary/src/lib/Elementary.h.in | 39 +- legacy/elementary/src/lib/elm_bg.c | 1 - legacy/elementary/src/lib/elm_entry.c | 2 + legacy/elementary/src/lib/elm_genlist.c | 376 +++++++++----- legacy/elementary/src/lib/elm_icon.c | 8 + legacy/elementary/src/lib/elm_main.c | 52 +- legacy/elementary/src/lib/elm_pager.c | 1 + legacy/elementary/src/lib/elm_scroller.c | 2 + legacy/elementary/src/lib/elm_win.c | 40 +- legacy/elementary/src/lib/els_scroller.c | 1 + 12 files changed, 1106 insertions(+), 178 deletions(-) diff --git a/legacy/elementary/data/themes/default.edc b/legacy/elementary/data/themes/default.edc index 81326f8b8a..e7ba949886 100644 --- a/legacy/elementary/data/themes/default.edc +++ b/legacy/elementary/data/themes/default.edc @@ -2568,17 +2568,6 @@ collections { fill.smooth : 0; } } - part { name: "elm.swallow.content"; - type: SWALLOW; - description { state: "default" 0.0; - rel1 { - to_y: "elm.text"; - relative: 0.0 1.0; - offset: 8 2; - } - rel2.offset: -9 -9; - } - } part { name: "elm.text"; type: TEXT; mouse_events: 0; @@ -2617,6 +2606,17 @@ collections { fill.smooth : 0; } } + part { name: "elm.swallow.content"; + type: SWALLOW; + description { state: "default" 0.0; + rel1 { + to_y: "elm.text"; + relative: 0.0 1.0; + offset: 8 2; + } + rel2.offset: -9 -9; + } + } } } @@ -7538,6 +7538,544 @@ collections { } } + group { name: "elm/genlist/tree/default/default"; + alias: "elm/genlist/tree_odd/default/default"; + data.item: "stacking" "above"; + data.item: "selectraise" "on"; + data.item: "labels" "elm.text"; + data.item: "icons" "elm.swallow.icon elm.swallow.end"; +// data.item: "states" ""; + 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; + image: "icon_arrow_right.png" COMP; + image: "icon_arrow_down.png" COMP; + } + parts { + part { + name: "base_sh"; + mouse_events: 0; + description { + state: "default" 0.0; + align: 0.0 0.0; + min: 0 10; + fixed: 1 1; + 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"; + clip_to: "disclip"; + 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: "arrow"; + clip_to: "disclip"; + ignore_flags: ON_HOLD; + description { state: "default" 0.0; + fixed: 1 0; + align: 0.0 0.5; + aspect: 1.0 1.0; + rel1 { + relative: 0.0 0.0; + offset: 4 4; + } + rel2 { + relative: 0.0 1.0; + offset: 4 -5; + } + image.normal: "icon_arrow_right.png"; + } + description { state: "active" 0.0; + inherit: "default" 0.0; + image.normal: "icon_arrow_down.png"; + } + } + part { name: "elm.swallow.icon"; + clip_to: "disclip"; + type: SWALLOW; + description { state: "default" 0.0; + fixed: 1 0; + align: 0.0 0.5; + rel1 { + to_x: "arrow"; + relative: 1.0 0.0; + offset: 4 4; + } + rel2 { + to_x: "arrow"; + relative: 1.0 1.0; + offset: 4 -5; + } + } + } + part { name: "elm.swallow.end"; + clip_to: "disclip"; + type: SWALLOW; + description { state: "default" 0.0; + fixed: 1 0; + align: 1.0 0.5; + aspect: 1.0 1.0; + aspect_preference: VERTICAL; + rel1 { + relative: 1.0 0.0; + offset: -5 4; + } + rel2 { + relative: 1.0 1.0; + offset: -5 -5; + } + } + } + part { name: "elm.text"; + clip_to: "disclip"; + 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"; + clip_to: "disclip"; + 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"; + clip_to: "disclip"; + 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: "disclip"; + type: RECT; + description { state: "default" 0.0; + rel1.to: "bg"; + rel2.to: "bg"; + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + color: 255 255 255 64; + } + } + part { + name: "event"; + type: RECT; + repeat_events: 1; + description { + state: "default" 0.0; + color: 0 0 0 0; + } + } + } + programs { + // signal: elm,state,%s,active + // a "check" item named %s went active + // signal: elm,state,%s,passive + // a "check" item named %s went passive + // default is passive + 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; + } + program { + name: "go_disabled"; + signal: "elm,state,disabled"; + source: "elm"; + action: STATE_SET "disabled" 0.0; + target: "disclip"; + } + program { + name: "go_enabled"; + signal: "elm,state,enabled"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "disclip"; + } + program { + name: "expand"; + signal: "mouse,up,1"; + source: "arrow"; + action: SIGNAL_EMIT "elm,action,expand,toggle" "elm"; + } + program { + name: "go_expanded"; + signal: "elm,state,expanded"; + source: "elm"; + action: STATE_SET "active" 0.0; + target: "arrow"; + } + program { + name: "go_contracted"; + signal: "elm,state,contracted"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "arrow"; + } + } + } +/* + group { name: "elm/genlist/tree_odd/default/default"; + data.item: "stacking" "below"; + data.item: "selectraise" "on"; + data.item: "labels" "elm.text"; + data.item: "icons" "elm.swallow.icon elm.swallow.end"; +// data.item: "states" ""; + 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"; + clip_to: "disclip"; + 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"; + clip_to: "disclip"; + type: SWALLOW; + description { state: "default" 0.0; + fixed: 1 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"; + clip_to: "disclip"; + type: SWALLOW; + description { state: "default" 0.0; + fixed: 1 0; + align: 1.0 0.5; + aspect: 1.0 1.0; + aspect_preference: VERTICAL; + rel1 { + relative: 1.0 0.0; + offset: -5 4; + } + rel2 { + relative: 1.0 1.0; + offset: -5 -5; + } + } + } + part { name: "elm.text"; + clip_to: "disclip"; + 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"; + clip_to: "disclip"; + 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"; + clip_to: "disclip"; + 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: "disclip"; + type: RECT; + description { state: "default" 0.0; + rel1.to: "bg"; + rel2.to: "bg"; + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + color: 255 255 255 64; + } + } + part { name: "event"; + type: RECT; + repeat_events: 1; + description { + state: "default" 0.0; + color: 0 0 0 0; + } + } + } + programs { + // signal: elm,state,%s,active + // a "check" item named %s went active + // signal: elm,state,%s,passive + // a "check" item named %s went passive + // default is passive + 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; + } + program { + name: "go_disabled"; + signal: "elm,state,disabled"; + source: "elm"; + action: STATE_SET "disabled" 0.0; + target: "disclip"; + } + program { + name: "go_enabled"; + signal: "elm,state,enabled"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "disclip"; + } + } + } +*/ + /////////////////////////////////////////////////////////////////////////////// group { name: "elm/check/base/default"; images { @@ -7837,8 +8375,14 @@ collections { type: RECT; mouse_events: 0; description { state: "default" 0.0; - rel1.to: "base"; - rel2.to: "base"; + rel1 { + to: "base"; + offset: -9999 -9999; + } + rel2 { + to: "base"; + offset: 9999 9999; + } color: 255 255 255 255; } description { state: "visible" 0.0; @@ -7888,20 +8432,6 @@ collections { rel2.relative: 1.0 1.0; } } - part { name: "elm.swallow.content"; - type: SWALLOW; - clip_to: "clip"; - description { state: "default" 0.0; - rel1 { - to: "base"; - offset: 8 8; - } - rel2 { - to: "base"; - offset: -9 -9; - } - } - } part { name: "over"; mouse_events: 0; clip_to: "clip"; @@ -7922,6 +8452,20 @@ collections { fill.smooth : 0; } } + part { name: "elm.swallow.content"; + type: SWALLOW; + clip_to: "clip"; + description { state: "default" 0.0; + rel1 { + to: "base"; + offset: 8 8; + } + rel2 { + to: "base"; + offset: -9 -9; + } + } + } } programs { program { name: "show_start"; diff --git a/legacy/elementary/src/bin/test.c b/legacy/elementary/src/bin/test.c index 9480b05710..eb9f4c848f 100644 --- a/legacy/elementary/src/bin/test.c +++ b/legacy/elementary/src/bin/test.c @@ -2910,6 +2910,169 @@ my_bt_35(void *data, Evas_Object *obj, void *event_info) evas_object_show(win); } +static Elm_Genlist_Item_Class itc4; + +static void +gl4_sel(void *data, Evas_Object *obj, void *event_info) +{ +} +static void +gl4_exp(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Genlist_Item *it = event_info; + Evas_Object *gl = elm_genlist_item_genlist_get(it); + int val = (int)elm_genlist_item_data_get(it); + val *= 10; + elm_genlist_item_append(gl, &itc4, + (void *)(val + 1)/* item data */, it/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */, + NULL/* func data */); + elm_genlist_item_append(gl, &itc4, + (void *)(val + 2)/* item data */, it/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */, + NULL/* func data */); + elm_genlist_item_append(gl, &itc4, + (void *)(val + 3)/* item data */, it/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */, + NULL/* func data */); +} +static void +gl4_con(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Genlist_Item *it = event_info; + elm_genlist_item_subitems_clear(it); +} + +static void +gl4_exp_req(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Genlist_Item *it = event_info; + elm_genlist_item_expanded_set(it, 1); +} +static void +gl4_con_req(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Genlist_Item *it = event_info; + elm_genlist_item_expanded_set(it, 0); +} + +char *gl4_label_get(const void *data, Evas_Object *obj, const char *part) +{ + char buf[256]; + snprintf(buf, sizeof(buf), "Item mode %i", (int)data); + return strdup(buf); +} +Evas_Object *gl4_icon_get(const void *data, Evas_Object *obj, const char *part) +{ + char buf[PATH_MAX]; + if (!strcmp(part, "elm.swallow.icon")) + { + Evas_Object *ic = elm_icon_add(obj); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + evas_object_show(ic); + return ic; + } + else if (!strcmp(part, "elm.swallow.end")) + { + Evas_Object *ck; + ck = elm_check_add(obj); + evas_object_show(ck); + return ck; + } + return NULL; +} +Evas_Bool gl4_state_get(const void *data, Evas_Object *obj, const char *part) +{ + return 0; +} +void gl4_del(const void *data, Evas_Object *obj) +{ +} + +static void +my_bt_36(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *win, *bg, *gl, *bx, *bx2, *bt; + + win = elm_win_add(NULL, "genlist-tree", ELM_WIN_BASIC); + elm_win_title_set(win, "Genlist Tree"); + 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); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, 1.0, 1.0); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + gl = elm_genlist_add(win); + evas_object_size_hint_align_set(gl, -1.0, -1.0); + evas_object_size_hint_weight_set(gl, 1.0, 1.0); + evas_object_show(gl); + + itc4.item_style = "default"; + itc4.func.label_get = gl4_label_get; + itc4.func.icon_get = gl4_icon_get; + itc4.func.state_get = gl4_state_get; + itc4.func.del = gl4_del; + + elm_genlist_item_append(gl, &itc4, + (void *)1/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */, + NULL/* func data */); + elm_genlist_item_append(gl, &itc4, + (void *)2/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */, + NULL/* func data */); + elm_genlist_item_append(gl, &itc4, + (void *)3/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */, + NULL/* func data */); + + evas_object_smart_callback_add(gl, "expand,request", gl4_exp_req, gl); + evas_object_smart_callback_add(gl, "contract,request", gl4_con_req, gl); + evas_object_smart_callback_add(gl, "expanded", gl4_exp, gl); + evas_object_smart_callback_add(gl, "contracted", gl4_con, gl); + + elm_box_pack_end(bx, gl); + evas_object_show(bx2); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, 1); + elm_box_homogenous_set(bx2, 1); + evas_object_size_hint_weight_set(bx2, 1.0, 0.0); + evas_object_size_hint_align_set(bx2, -1.0, -1.0); + + bt = elm_button_add(win); + elm_button_label_set(bt, "[1]"); +// evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0])); + evas_object_size_hint_align_set(bt, -1.0, -1.0); + evas_object_size_hint_weight_set(bt, 1.0, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_button_label_set(bt, "[2]"); +// evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1])); + evas_object_size_hint_align_set(bt, -1.0, -1.0); + evas_object_size_hint_weight_set(bt, 1.0, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_button_label_set(bt, "[3]"); +// evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2])); + evas_object_size_hint_align_set(bt, -1.0, -1.0); + evas_object_size_hint_weight_set(bt, 1.0, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} + static void my_win_main(void) { @@ -3020,6 +3183,7 @@ my_win_main(void) elm_list_item_append(li, "Checks", NULL, NULL, my_bt_33, NULL); elm_list_item_append(li, "Radios", NULL, NULL, my_bt_34, NULL); elm_list_item_append(li, "Pager", NULL, NULL, my_bt_35, NULL); + elm_list_item_append(li, "Genlist Tree", NULL, NULL, my_bt_36, NULL); elm_list_go(li); diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in index 822c02b5b4..77082eaae4 100644 --- a/legacy/elementary/src/lib/Elementary.h.in +++ b/legacy/elementary/src/lib/Elementary.h.in @@ -185,6 +185,11 @@ extern "C" { EAPI void elm_object_scale_set(Evas_Object *obj, double scale); EAPI double elm_object_scale_get(const Evas_Object *obj); + EAPI double elm_scale_get(void); + EAPI void elm_scale_set(double scale); + EAPI Evas_Coord elm_finger_size_get(void); + EAPI void elm_finger_size_set(Evas_Coord size); + EAPI void elm_object_focus(Evas_Object *obj); EAPI void elm_coords_finger_size_adjust(int times_w, Evas_Coord *w, int times_h, Evas_Coord *h); @@ -202,6 +207,23 @@ extern "C" { EAPI void elm_win_shaped_set(Evas_Object *obj, Evas_Bool shaped); EAPI void elm_win_alpha_set(Evas_Object *obj, Evas_Bool alpha); EAPI void elm_win_override_set(Evas_Object *obj, Evas_Bool override); + EAPI void elm_win_fullscreen_set(Evas_Object *obj, Evas_Bool fullscreen); + EAPI void elm_win_maximized_set(Evas_Object *obj, Evas_Bool maximized); + EAPI void elm_win_iconified_set(Evas_Object *obj, Evas_Bool iconified); + EAPI void elm_win_layer_set(Evas_Object *obj, int layer); + /*... + * ecore_x_icccm_hints_set -> accepts_focus (add to ecore_evas) + * ecore_x_icccm_hints_set -> window_group (add to ecore_evas) + * ecore_x_icccm_size_pos_hints_set -> request_pos (add to ecore_evas) + * ecore_x_icccm_client_leader_set -> l (add to ecore_evas) + * ecore_x_icccm_window_role_set -> role (add to ecore_evas) + * ecore_x_icccm_transient_for_set -> forwin (add to ecore_evas) + * ecore_x_netwm_window_type_set -> type (add to ecore_evas) + * + * (add to ecore_x) set netwm argb icon! (add to ecore_evas) + * (blank mouse, private mouse obj, defaultmouse) + * + */ EAPI void elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode); EAPI void elm_win_keyboard_win_set(Evas_Object *obj, Evas_Bool is_keyboard); @@ -234,6 +256,7 @@ extern "C" { EAPI void elm_icon_no_scale_set(Evas_Object *obj, Evas_Bool no_scale); EAPI void elm_icon_scale_set(Evas_Object *obj, Evas_Bool scale_up, Evas_Bool scale_down); EAPI void elm_icon_fill_outside_set(Evas_Object *obj, Evas_Bool fill_outside); + EAPI void elm_icon_prescale_set(Evas_Object *obj, int size); /* smart callbacks called: * "clicked" - the user clicked the icon */ @@ -570,18 +593,28 @@ extern "C" { EAPI Elm_Genlist_Item *elm_genlist_last_item_get(const Evas_Object *obj); EAPI Elm_Genlist_Item *elm_genlist_item_next_get(const Elm_Genlist_Item *item); EAPI Elm_Genlist_Item *elm_genlist_item_prev_get(const Elm_Genlist_Item *item); + EAPI Evas_Object *elm_genlist_item_genlist_get(const Elm_Genlist_Item *item); + EAPI Elm_Genlist_Item *elm_genlist_item_parent_get(const Elm_Genlist_Item *it); + EAPI void elm_genlist_item_subitems_clear(Elm_Genlist_Item *item); EAPI void elm_genlist_item_selected_set(Elm_Genlist_Item *item, Evas_Bool selected); EAPI Evas_Bool elm_genlist_item_selected_get(const Elm_Genlist_Item *item); + EAPI void elm_genlist_item_expanded_set(Elm_Genlist_Item *item, Evas_Bool expanded); + EAPI Evas_Bool elm_genlist_item_expanded_get(const Elm_Genlist_Item *item); EAPI void elm_genlist_item_disabled_set(Elm_Genlist_Item *item, Evas_Bool disabled); EAPI Evas_Bool elm_genlist_item_disabled_get(const Elm_Genlist_Item *item); EAPI void elm_genlist_item_show(Elm_Genlist_Item *item); EAPI void elm_genlist_item_del(Elm_Genlist_Item *item); EAPI const void *elm_genlist_item_data_get(const Elm_Genlist_Item *item); EAPI void elm_genlist_item_update(Elm_Genlist_Item *item); + EAPI void elm_genlist_horizontal_mode_set(Evas_Object *obj, Elementary_List_Mode mode); /* smart callbacks called: - * "clicked" - the user clicked the hoversel button and popped up the sel - * "selected" - an item in the hoversel list is selected - * "dismissed" - the hover is dismissed + * "clicked" - when the user double-clicked an item + * "selected" - when the user selected an item + * "unselected" - when the user selected an item + * "expanded" - when the user expanded an item + * "contracted" - when the user contracted an item + * "expand,request" - when the user requested to expand an item + * "contract,request" - when the user requested to expand an item */ EAPI Evas_Object *elm_check_add(Evas_Object *parent); diff --git a/legacy/elementary/src/lib/elm_bg.c b/legacy/elementary/src/lib/elm_bg.c index 54e00c9b14..5996d34043 100644 --- a/legacy/elementary/src/lib/elm_bg.c +++ b/legacy/elementary/src/lib/elm_bg.c @@ -26,7 +26,6 @@ _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); _elm_theme_set(wd->img, "bg", "base", "default"); - _els_smart_icon_scale_set(wd->img, elm_widget_scale_get(obj) * _elm_config->scale); } static void diff --git a/legacy/elementary/src/lib/elm_entry.c b/legacy/elementary/src/lib/elm_entry.c index 2269c33777..3fa3dd3086 100644 --- a/legacy/elementary/src/lib/elm_entry.c +++ b/legacy/elementary/src/lib/elm_entry.c @@ -333,6 +333,8 @@ _text_to_mkup(const char *text) if (ch <= 0) break; if (ch == '\n') str = _str_append(str, "
", &str_len, &str_alloc); else if (ch == '\t') str = _str_append(str, "<\t>", &str_len, &str_alloc); + else if (ch == '<') str = _str_append(str, "<", &str_len, &str_alloc); + else if (ch == '>') str = _str_append(str, ">", &str_len, &str_alloc); else { char tstr[16]; diff --git a/legacy/elementary/src/lib/elm_genlist.c b/legacy/elementary/src/lib/elm_genlist.c index 4cce384376..b9a09b58f2 100644 --- a/legacy/elementary/src/lib/elm_genlist.c +++ b/legacy/elementary/src/lib/elm_genlist.c @@ -19,6 +19,7 @@ struct _Widget_Data Eina_List *queue; Eina_List *selected; Elm_Genlist_Item *show_item; + Elementary_List_Mode mode; Evas_Bool on_hold : 1; Evas_Bool multi : 1; Evas_Bool min_w : 1; @@ -41,8 +42,7 @@ struct _Elm_Genlist_Item EINA_INLIST; Widget_Data *wd; Item_Block *block; - Eina_Inlist *subblocks; // FIXME: not done yet - Eina_Inlist *subitems; // FIXME: not done yet + Eina_List *items; // FIXME: not done yet Evas_Coord x, y, w, h, minw, minh; const Elm_Genlist_Item_Class *itc; const void *data; @@ -71,7 +71,8 @@ struct _Elm_Genlist_Item Evas_Bool delete_me : 1; }; -struct _Pan { +struct _Pan +{ Evas_Object_Smart_Clipped_Data __clipped_data; Widget_Data *wd; }; @@ -112,7 +113,9 @@ _theme_hook(Evas_Object *obj) Eina_List *l; Elm_Genlist_Item *it; EINA_LIST_FOREACH(itb->items, l, it) - it->mincalcd = 0; + { + it->mincalcd = 0; + } itb->changed = 1; } @@ -134,47 +137,14 @@ static void _sizing_eval(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); - Evas_Coord vw, vh, minw, minh, maxw, maxh, w, h, vmw, vmh; - double xw, xy; + Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; - // fixme - now handle scroll hinting etc. - /* - evas_object_size_hint_min_get(wd->content, &minw, &minh); - evas_object_size_hint_max_get(wd->content, &maxw, &maxh); - evas_object_size_hint_weight_get(wd->content, &xw, &xy); - elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh); - if (xw > 0.0) - { - if ((minw > 0) && (vw < minw)) vw = minw; - else if ((maxw > 0) && (vw > maxw)) vw = maxw; - } - else if (minw > 0) vw = minw; - if (xy > 0.0) - { - if ((minh > 0) && (vh < minh)) vh = minh; - else if ((maxh > 0) && (vh > maxh)) vh = maxh; - } - else if (minh > 0) vh = minh; - evas_object_resize(wd->content, vw, vh); - w = -1; - h = -1; - 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; - evas_object_size_hint_min_set(obj, w, h); - */ -} - -static void -_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - _sizing_eval(data); -} - -static void -_resize(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - _sizing_eval(data); + evas_object_size_hint_min_get(wd->scr, &minw, &minh); + evas_object_size_hint_max_get(wd->scr, &maxw, &maxh); + minh = -1; + if (wd->mode != ELM_LIST_LIMIT) minw = -1; + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, maxw, maxh); } static Eina_List * @@ -294,6 +264,32 @@ _mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info) } } +static void +_signal_expand_toggle(void *data, Evas_Object *obj, const char *emission, const char *source) +{ + Elm_Genlist_Item *it = data; + if (it->expanded) + evas_object_smart_callback_call(it->wd->obj, "contract,request", it); + else + evas_object_smart_callback_call(it->wd->obj, "expand,request", it); +} + +static void +_signal_expand(void *data, Evas_Object *obj, const char *emission, const char *source) +{ + Elm_Genlist_Item *it = data; + if (!it->expanded) + evas_object_smart_callback_call(it->wd->obj, "expand,request", it); +} + +static void +_signal_contract(void *data, Evas_Object *obj, const char *emission, const char *source) +{ + Elm_Genlist_Item *it = data; + if (it->expanded) + evas_object_smart_callback_call(it->wd->obj, "contract,request", it); +} + static void _item_realize(Elm_Genlist_Item *it, int in, int calc) { @@ -306,13 +302,26 @@ _item_realize(Elm_Genlist_Item *it, int in, int calc) edje_object_scale_set(it->base, elm_widget_scale_get(it->wd->obj) * _elm_config->scale); evas_object_smart_member_add(it->base, it->wd->pan_smart); elm_widget_sub_object_add(it->wd->obj, it->base); - if (in & 0x1) - snprintf(buf, sizeof(buf), "%s/%s", "item_odd", it->itc->item_style); + if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) + { + if (in & 0x1) + snprintf(buf, sizeof(buf), "%s/%s", "tree_odd", it->itc->item_style); + else + snprintf(buf, sizeof(buf), "%s/%s", "tree", it->itc->item_style); + } else - snprintf(buf, sizeof(buf), "%s/%s", "item", it->itc->item_style); + { + if (in & 0x1) + snprintf(buf, sizeof(buf), "%s/%s", "item_odd", it->itc->item_style); + else + snprintf(buf, sizeof(buf), "%s/%s", "item", it->itc->item_style); + } _elm_theme_set(it->base, "genlist", buf, "default"); if (!calc) { + edje_object_signal_callback_add(it->base, "elm,action,expand,toggle", "elm", _signal_expand_toggle, it); + edje_object_signal_callback_add(it->base, "elm,action,expand", "elm", _signal_expand, it); + edje_object_signal_callback_add(it->base, "elm,action,contract", "elm", _signal_contract, it); stacking = edje_object_data_get(it->base, "stacking"); if (stacking) { @@ -327,6 +336,8 @@ _item_realize(Elm_Genlist_Item *it, int in, int calc) edje_object_signal_emit(it->base, "elm,state,selected", "elm"); if (it->disabled) edje_object_signal_emit(it->base, "elm,state,disabled", "elm"); + if (it->expanded) + edje_object_signal_emit(it->base, "elm,state,expanded", "elm"); } if (it->itc->func.label_get) @@ -571,7 +582,9 @@ _calc_job(void *data) { wd->minw = minw; wd->minh = minh; + evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh); evas_object_smart_callback_call(wd->pan_smart, "changed", NULL); + _sizing_eval(wd->obj); } wd->calc_job = NULL; evas_object_smart_changed(wd->pan_smart); @@ -702,7 +715,7 @@ elm_genlist_add(Evas_Object *parent) Evas_Object *obj; Evas *e; Widget_Data *wd; - Evas_Coord vw, vh, minw, minh; + Evas_Coord minw, minh; static Evas_Smart *smart = NULL; wd = ELM_NEW(Widget_Data); @@ -716,7 +729,8 @@ elm_genlist_add(Evas_Object *parent) elm_widget_resize_object_set(obj, wd->scr); wd->obj = obj; - + wd->mode = ELM_LIST_SCROLL; + if (!smart) { static Evas_Smart_Class sc; @@ -743,7 +757,6 @@ elm_genlist_add(Evas_Object *parent) edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &minw, &minh); evas_object_size_hint_min_set(obj, minw, minh); - evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj); _sizing_eval(obj); return obj; @@ -784,7 +797,10 @@ _item_block_del(Elm_Genlist_Item *it) { il = EINA_INLIST_GET(itb); Item_Block *itbn = (Item_Block *)(il->next); - it->wd->blocks = eina_inlist_remove(it->wd->blocks, il); + if (it->parent) + it->parent->items = eina_list_remove(it->parent->items, it); + else + it->wd->blocks = eina_inlist_remove(it->wd->blocks, il); free(itb); if (itbn) itbn->changed = 1; } @@ -830,108 +846,100 @@ _item_block_del(Elm_Genlist_Item *it) static void _item_del(Elm_Genlist_Item *it) { - it->delete_me = 1; + elm_genlist_item_subitems_clear(it); if (it->wd->show_item == it) it->wd->show_item = NULL; if (it->selected) it->wd->selected = eina_list_remove(it->wd->selected, it); - if ((!it->delete_me) && (it->itc->func.del)) it->itc->func.del(it->data, it->wd->obj); if (it->realized) _item_unrealize(it); if (it->block) _item_block_del(it); - // FIXME: tree. del it->subblocks - // FIXME: tree. del it->subitems + if ((!it->delete_me) && (it->itc->func.del)) it->itc->func.del(it->data, it->wd->obj); + it->delete_me = 1; if (it->queued) - { - it->wd->queue = eina_list_remove(it->wd->queue, it); - } + it->wd->queue = eina_list_remove(it->wd->queue, it); it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it)); + if (it->parent) + it->parent->items = eina_list_remove(it->parent->items, it); free(it); } static void -_item_block_add(Widget_Data *wd, Elm_Genlist_Item *it, Elm_Genlist_Item *itpar) +_item_block_add(Widget_Data *wd, Elm_Genlist_Item *it) { Item_Block *itb = NULL; if (!it->rel) { newblock: - if (!it->parent) + if (it->rel) { - if (it->rel) + itb = calloc(1, sizeof(Item_Block)); + if (!itb) return; + itb->wd = wd; + if (!it->rel->block) { - itb = calloc(1, sizeof(Item_Block)); - if (!itb) return; - itb->wd = wd; - if (!it->rel->block) - { - wd->blocks = eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb)); - itb->items = eina_list_append(itb->items, it); - } - else - { - if (it->before) - { - wd->blocks = eina_inlist_prepend_relative(wd->blocks, EINA_INLIST_GET(itb), EINA_INLIST_GET(it->rel->block)); - itb->items = eina_list_prepend_relative(itb->items, it, it->rel); - } - else - { - wd->blocks = eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb), EINA_INLIST_GET(it->rel->block)); - itb->items = eina_list_append_relative(itb->items, it, it->rel); - } - } + wd->blocks = eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb)); + itb->items = eina_list_append(itb->items, it); } else { if (it->before) { - if (wd->blocks) - { - itb = (Item_Block *)(wd->blocks); - if (itb->count >= 32) - { - itb = calloc(1, sizeof(Item_Block)); - if (!itb) return; - itb->wd = wd; - wd->blocks = eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb)); - } - } - else + wd->blocks = eina_inlist_prepend_relative(wd->blocks, EINA_INLIST_GET(itb), EINA_INLIST_GET(it->rel->block)); + itb->items = eina_list_prepend_relative(itb->items, it, it->rel); + } + else + { + wd->blocks = eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb), EINA_INLIST_GET(it->rel->block)); + itb->items = eina_list_append_relative(itb->items, it, it->rel); + } + } + } + else + { + if (it->before) + { + if (wd->blocks) + { + itb = (Item_Block *)(wd->blocks); + if (itb->count >= 32) { itb = calloc(1, sizeof(Item_Block)); if (!itb) return; itb->wd = wd; wd->blocks = eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb)); } - itb->items = eina_list_prepend(itb->items, it); } else { - if (wd->blocks) - { - itb = (Item_Block *)(wd->blocks->last); - if (itb->count >= 32) - { - itb = calloc(1, sizeof(Item_Block)); - if (!itb) return; - itb->wd = wd; - wd->blocks = eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb)); - } - } - else + itb = calloc(1, sizeof(Item_Block)); + if (!itb) return; + itb->wd = wd; + wd->blocks = eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb)); + } + itb->items = eina_list_prepend(itb->items, it); + } + else + { + if (wd->blocks) + { + itb = (Item_Block *)(wd->blocks->last); + if (itb->count >= 32) { itb = calloc(1, sizeof(Item_Block)); if (!itb) return; itb->wd = wd; wd->blocks = eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb)); } - itb->items = eina_list_append(itb->items, it); } + else + { + itb = calloc(1, sizeof(Item_Block)); + if (!itb) return; + itb->wd = wd; + wd->blocks = eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb)); + } + itb->items = eina_list_append(itb->items, it); } } - else - { - // FIXME: tree not handled. - } } else { @@ -972,14 +980,7 @@ _item_idler(void *data) it = wd->queue->data; wd->queue = eina_list_remove_list(wd->queue, wd->queue); it->queued = 0; - if (!it->parent) - { - _item_block_add(wd, it, NULL); - } - else - { - // FIXME: tree. not done yet - } + _item_block_add(wd, it); } if (n > 0) { @@ -1013,13 +1014,23 @@ elm_genlist_item_append(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func, func_data); if (!it) return NULL; if (!it->parent) - wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it)); + { + wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it)); + it->rel = NULL; + it->before = 0; + } else { - // FIXME: tree. not done yet + Elm_Genlist_Item *it2 = NULL; + Eina_List *ll = eina_list_last(it->parent->items); + if (ll) it2 = ll->data; + it->parent->items = eina_list_append(it->parent->items, it); + if (!it2) it2 = it->parent; + wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(it2)); + it->rel = it2; + it->rel->relcount++; + it->before = 0; } - it->rel = NULL; - it->before = 0; _item_queue(wd, it); return it; } @@ -1037,7 +1048,7 @@ elm_genlist_item_prepend(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it)); else { - // FIXME: tree. not done yet + printf("FIXME: 12 tree not handled yet\n"); } it->rel = NULL; it->before = 1; @@ -1058,7 +1069,7 @@ elm_genlist_item_insert_before(Evas_Object *obj, const Elm_Genlist_Item_Class *i wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before)); else { - // FIXME: tree. not done yet + printf("FIXME: 13 tree not handled yet\n"); } it->rel = before; it->rel->relcount++; @@ -1080,7 +1091,7 @@ elm_genlist_item_insert_after(Evas_Object *obj, const Elm_Genlist_Item_Class *it wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after)); else { - // FIXME: tree. not done yet + printf("FIXME: 14 tree not handled yet\n"); } it->rel = after; it->rel->relcount++; @@ -1133,7 +1144,9 @@ elm_genlist_clear(Evas_Object *obj) wd->pan_y = 0; wd->minw = 0; wd->minh = 0; + evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh); evas_object_smart_callback_call(wd->pan_smart, "changed", NULL); + _sizing_eval(obj); } EAPI void @@ -1201,11 +1214,39 @@ elm_genlist_item_prev_get(const Elm_Genlist_Item *it) return (Elm_Genlist_Item *)it; } +EAPI Evas_Object * +elm_genlist_item_genlist_get(const Elm_Genlist_Item *it) +{ + if (!it) return NULL; + return it->wd->obj; +} + +EAPI Elm_Genlist_Item * +elm_genlist_item_parent_get(const Elm_Genlist_Item *it) +{ + if (!it) return NULL; + return it->parent; +} + +EAPI void +elm_genlist_item_subitems_clear(Elm_Genlist_Item *it) +{ + Eina_List *tl = NULL, *l; + Elm_Genlist_Item *it2; + + if (!it) return; + EINA_LIST_FOREACH(it->items, l, it2) + tl = eina_list_append(tl, it2); + EINA_LIST_FREE(tl, it2) + elm_genlist_item_del(it2); +} + EAPI void elm_genlist_item_selected_set(Elm_Genlist_Item *it, Evas_Bool selected) { Widget_Data *wd = elm_widget_data_get(it->wd->obj); + if (!it) return; if (it->delete_me) return; selected = !!selected; if (it->selected == selected) return; @@ -1226,24 +1267,41 @@ elm_genlist_item_selected_set(Elm_Genlist_Item *it, Evas_Bool selected) EAPI Evas_Bool elm_genlist_item_selected_get(const Elm_Genlist_Item *it) { + if (!it) return 0; return it->selected; } EAPI void -elm_genlist_item_expanded_set(Elm_Genlist_Item *item, Evas_Bool expanded) +elm_genlist_item_expanded_set(Elm_Genlist_Item *it, Evas_Bool expanded) { - // FIXME: tree. not done yet + if (!it) return; + if (it->expanded == expanded) return; + it->expanded = expanded; + if (it->expanded) + { + if (it->realized) + edje_object_signal_emit(it->base, "elm,state,expanded", "elm"); + evas_object_smart_callback_call(it->wd->obj, "expanded", it); + } + else + { + if (it->realized) + edje_object_signal_emit(it->base, "elm,state,contracted", "elm"); + evas_object_smart_callback_call(it->wd->obj, "contracted", it); + } } EAPI Evas_Bool -elm_genlist_item_expanded_get(const Elm_Genlist_Item *item) +elm_genlist_item_expanded_get(const Elm_Genlist_Item *it) { - // FIXME: tree. not done yet + if (!it) return 0; + return it->expanded; } EAPI void elm_genlist_item_disabled_set(Elm_Genlist_Item *it, Evas_Bool disabled) { + if (!it) return; if (it->disabled == disabled) return; if (it->delete_me) return; it->disabled = disabled; @@ -1259,6 +1317,7 @@ elm_genlist_item_disabled_set(Elm_Genlist_Item *it, Evas_Bool disabled) EAPI Evas_Bool elm_genlist_item_disabled_get(const Elm_Genlist_Item *it) { + if (!it) return 0; if (it->delete_me) return 0; return it->disabled; } @@ -1266,6 +1325,7 @@ elm_genlist_item_disabled_get(const Elm_Genlist_Item *it) EAPI void elm_genlist_item_show(Elm_Genlist_Item *it) { + if (!it) return; if (it->delete_me) return; if ((it->queued) || (!it->mincalcd)) { @@ -1290,10 +1350,10 @@ elm_genlist_item_del(Elm_Genlist_Item *it) if (!it) return; if (it->relcount > 0) { + elm_genlist_item_subitems_clear(it); it->delete_me = 1; if (it->wd->show_item == it) it->wd->show_item = NULL; if (it->selected) it->wd->selected = eina_list_remove(it->wd->selected, it); - if (it->itc->func.del) it->itc->func.del(it->data, it->wd->obj); if (it->block) { if (it->realized) _item_unrealize(it); @@ -1301,6 +1361,7 @@ elm_genlist_item_del(Elm_Genlist_Item *it) if (it->wd->calc_job) ecore_job_del(it->wd->calc_job); it->wd->calc_job = ecore_job_add(_calc_job, it->wd); } + if (it->itc->func.del) it->itc->func.del(it->data, it->wd->obj); return; } _item_del(it); @@ -1315,10 +1376,55 @@ elm_genlist_item_data_get(const Elm_Genlist_Item *it) EAPI void elm_genlist_item_update(Elm_Genlist_Item *it) { + Evas_Coord minw, minh; + Eina_List *l; + Elm_Genlist_Item *it2; + Item_Block *itb; + int num, numb; if (!it->block) return; if (it->delete_me) return; + minw = it->wd->minw; + minh = it->minh; it->mincalcd = 0; - it->block->changed = 1; - if (it->wd->calc_job) ecore_job_del(it->wd->calc_job); - it->wd->calc_job = ecore_job_add(_calc_job, it->wd); + EINA_INLIST_FOREACH(it->wd->blocks, itb) + { + if (itb == it->block) break; + num += itb->count; + } + numb = num; + EINA_LIST_FOREACH(it->block->items, l, it2) + { + if (it2 == it) break; + num++; + } + if (it->realized) + { + _item_unrealize(it); + _item_realize(it, num, 0); + _item_block_recalc(it->block, numb); + _item_block_position(it->block); + } + else + { + _item_realize(it, num, 1); + _item_unrealize(it); + } + if ((it->minw > minw) || (it->minh != minh)) + { + it->block->changed = 1; + if (it->wd->calc_job) ecore_job_del(it->wd->calc_job); + it->wd->calc_job = ecore_job_add(_calc_job, it->wd); + } +} + +EAPI void +elm_genlist_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->scr, 1, 0); + else + elm_scroller_content_min_limit(wd->scr, 0, 0); } diff --git a/legacy/elementary/src/lib/elm_icon.c b/legacy/elementary/src/lib/elm_icon.c index c0188a185d..d776102cc4 100644 --- a/legacy/elementary/src/lib/elm_icon.c +++ b/legacy/elementary/src/lib/elm_icon.c @@ -172,3 +172,11 @@ elm_icon_fill_outside_set(Evas_Object *obj, Evas_Bool fill_outside) wd->fill_outside = fill_outside; _sizing_eval(obj); } + +EAPI void +elm_icon_prescale_set(Evas_Object *obj, int size) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _els_smart_icon_scale_size_set(wd->img, size); +} diff --git a/legacy/elementary/src/lib/elm_main.c b/legacy/elementary/src/lib/elm_main.c index 625652c417..20657ef0cb 100644 --- a/legacy/elementary/src/lib/elm_main.c +++ b/legacy/elementary/src/lib/elm_main.c @@ -314,18 +314,21 @@ elm_quicklaunch_sub_init(int argc, char **argv) ECORE_X_EVENT_MASK_WINDOW_PROPERTY); _elm_event_property_change = ecore_event_handler_add (ECORE_X_EVENT_WINDOW_PROPERTY, _elm_window_property_change, NULL); - if (ecore_x_window_prop_card32_get(ecore_x_window_root_first_get(), - _elm_atom_enlightenment_scale, - &val, 1) > 0) - { - if (val > 0) + if (!elm_scale) + { + if (ecore_x_window_prop_card32_get(ecore_x_window_root_first_get(), + _elm_atom_enlightenment_scale, + &val, 1) > 0) { - _elm_config->scale = (double)val / 1000.0; - // FIXME: hack until e export finger size too - if (!elm_finger_size) - _elm_config->finger_size = 40.0 * _elm_config->scale; + if (val > 0) + { + _elm_config->scale = (double)val / 1000.0; + // FIXME: hack until e export finger size too + if (!elm_finger_size) + _elm_config->finger_size = 40.0 * _elm_config->scale; + } } - } + } #endif } @@ -643,6 +646,35 @@ elm_object_scale_get(const Evas_Object *obj) return elm_widget_scale_get(obj); } +EAPI double +elm_scale_get(void) +{ + return _elm_config->scale; +} + +EAPI void +elm_scale_set(double scale) +{ + if (_elm_config->scale == scale) return; + _elm_config->scale = scale; + _elm_rescale(); +} + +EAPI Evas_Coord +elm_finger_size_get(void) +{ + return _elm_config->finger_size; +} + +EAPI void +elm_finger_size_set(Evas_Coord size) +{ + elm_finger_size = NULL; + if (_elm_config->finger_size == size) return; + _elm_config->finger_size = size; + _elm_rescale(); +} + EAPI void elm_object_focus(Evas_Object *obj) { diff --git a/legacy/elementary/src/lib/elm_pager.c b/legacy/elementary/src/lib/elm_pager.c index 46f004f586..b80645cdfc 100644 --- a/legacy/elementary/src/lib/elm_pager.c +++ b/legacy/elementary/src/lib/elm_pager.c @@ -62,6 +62,7 @@ _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info) { Item *it = data; edje_object_part_swallow(it->base, "elm.swallow.content", it->content); + edje_object_size_min_calc(it->base, &it->minw, &it->minh); _sizing_eval(it->obj); } diff --git a/legacy/elementary/src/lib/elm_scroller.c b/legacy/elementary/src/lib/elm_scroller.c index 145cd3fc07..097e5351dc 100644 --- a/legacy/elementary/src/lib/elm_scroller.c +++ b/legacy/elementary/src/lib/elm_scroller.c @@ -122,6 +122,8 @@ elm_scroller_add(Evas_Object *parent) wd->scr = elm_smart_scroller_add(e); elm_widget_resize_object_set(obj, wd->scr); + evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &minw, &minh); evas_object_size_hint_min_set(obj, minw, minh); diff --git a/legacy/elementary/src/lib/elm_win.c b/legacy/elementary/src/lib/elm_win.c index ddfc52c4cf..9d52a9ef98 100644 --- a/legacy/elementary/src/lib/elm_win.c +++ b/legacy/elementary/src/lib/elm_win.c @@ -202,9 +202,9 @@ _elm_win_eval_subobjs(Evas_Object *obj) if (w < 1) w = -1; if (h < 1) h = -1; if (maxw == -1) maxw = w; - else if (w < maxw) maxw = w; + else if ((w > 0) && (w < maxw)) maxw = w; if (maxh == -1) maxh = h; - else if (h < maxh) maxh = h; + else if ((h > 0) && (h < maxh)) maxh = h; } if ((maxw >= 0) && (maxw < minw)) maxw = minw; if ((maxh >= 0) && (maxh < minh)) maxh = minh; @@ -453,6 +453,42 @@ elm_win_override_set(Evas_Object *obj, Evas_Bool override) _elm_win_xwin_update(win); } +EAPI void +elm_win_fullscreen_set(Evas_Object *obj, Evas_Bool fullscreen) +{ + Elm_Win *win = elm_widget_data_get(obj); + if (!win) return; + ecore_evas_fullscreen_set(win->ee, fullscreen); + _elm_win_xwin_update(win); +} + +EAPI void +elm_win_maximized_set(Evas_Object *obj, Evas_Bool maximized) +{ + Elm_Win *win = elm_widget_data_get(obj); + if (!win) return; + ecore_evas_maximized_set(win->ee, maximized); + _elm_win_xwin_update(win); +} + +EAPI void +elm_win_iconified_set(Evas_Object *obj, Evas_Bool iconified) +{ + Elm_Win *win = elm_widget_data_get(obj); + if (!win) return; + ecore_evas_iconified_set(win->ee, iconified); + _elm_win_xwin_update(win); +} + +EAPI void +elm_win_layer_set(Evas_Object *obj, int layer) +{ + Elm_Win *win = elm_widget_data_get(obj); + if (!win) return; + ecore_evas_layer_set(win->ee, layer); + _elm_win_xwin_update(win); +} + EAPI void elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode) { diff --git a/legacy/elementary/src/lib/els_scroller.c b/legacy/elementary/src/lib/els_scroller.c index 339a30ec26..f4a615b106 100644 --- a/legacy/elementary/src/lib/els_scroller.c +++ b/legacy/elementary/src/lib/els_scroller.c @@ -395,6 +395,7 @@ _smart_pan_changed_hook(void *data, Evas_Object *obj, void *event_info) sd->child.w = w; sd->child.h = h; _smart_scrollbar_size_adjust(sd); + evas_object_size_hint_min_set(sd->smart_obj, sd->child.w, sd->child.h); } }