From: tasn Date: Tue, 8 Feb 2011 12:08:28 +0000 (+0000) Subject: Elementary: Added ui-mirroring support for all the widgets. X-Git-Tag: REL_F_I9200_20110722_1~8^2~50^2~787 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1c9e3ebcecfb2ca477bd316707368340d0dce0f0;p=framework%2Fuifw%2Felementary.git Elementary: Added ui-mirroring support for all the widgets. git-svn-id: https://svn.enlightenment.org/svn/e/trunk/elementary@56803 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/data/themes/default.edc b/data/themes/default.edc index e888df6..3180d8b 100644 --- a/data/themes/default.edc +++ b/data/themes/default.edc @@ -14004,51 +14004,9 @@ collections { images { image: "sl_bg.png" COMP; image: "sl_bg_over.png" COMP; - image: "sl_bt_0.png" COMP; - image: "sl_bt_1.png" COMP; - image: "sl_bt_2.png" COMP; - image: "sl_bt_3.png" COMP; - image: "sl_bt2_0_0.png" COMP; - image: "sl_bt2_0_1.png" COMP; - image: "sl_bt2_0_2.png" COMP; - image: "sl_bt2_1.png" COMP; - image: "sl_bt2_2.png" COMP; + image: "sl_units.png" COMP; } - script { - public value_hide = 0; - public set_value_show() { - set_int(value_hide, 0); - } - public set_value_hide() { - set_int(value_hide, 1); - } - public thumb_down() { - if (get_int(value_hide) == 1) { - set_state(PART:"elm.indicator", "default", 0.0); - set_state(PART:"button3", "default", 0.0); - set_state(PART:"button4", "default", 0.0); - set_state(PART:"button5", "default", 0.0); - set_state(PART:"button6", "default", 0.0); - set_state(PART:"button7", "default", 0.0); - } else { - set_state(PART:"elm.indicator", "visible", 0.0); - set_state(PART:"button3", "visible", 0.0); - set_state(PART:"button4", "visible", 0.0); - set_state(PART:"button5", "visible", 0.0); - set_state(PART:"button6", "visible", 0.0); - set_state(PART:"button7", "visible", 0.0); - } - } - public thumb_up() { - set_state(PART:"elm.indicator", "default", 0.0); - set_state(PART:"button3", "default", 0.0); - set_state(PART:"button4", "default", 0.0); - set_state(PART:"button5", "default", 0.0); - set_state(PART:"button6", "default", 0.0); - set_state(PART:"button7", "default", 0.0); - } - } parts { part { name: "base"; mouse_events: 0; @@ -14320,8 +14278,10 @@ collections { } } part { name: "elm.dragable.slider"; - type: RECT; - mouse_events: 0; + type: GROUP; + source: "elm/slider/horizontal/indicator/default"; + mouse_events: 1; + repeat_events: 1; scale: 1; dragable { x: 1 1 0; @@ -14343,480 +14303,186 @@ collections { color: 255 0 0 100; } } - part { name: "button_events"; + part { name: "disabler"; type: RECT; - dragable { - events: "elm.dragable.slider"; - } - mouse_events: 1; description { state: "default" 0.0; - fixed: 1 1; - min: 16 16; - aspect: 1.0 1.0; - aspect_preference: VERTICAL; - rel1.to_x: "elm.dragable.slider"; - rel2.to_x: "elm.dragable.slider"; color: 0 0 0 0; + visible: 0; + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + visible: 1; } } - part { name: "button0"; - mouse_events: 0; - description { state: "default" 0.0; - fixed: 1 1; - max: 17 999; - min: 17 24; - rel1.to: "elm.dragable.slider"; - rel2.to: "elm.dragable.slider"; - image { - normal: "sl_bt_0.png"; - border: 5 5 5 10; + } + programs { + program { name: "text_show"; + signal: "elm,state,text,visible"; + source: "elm"; + action: STATE_SET "visible" 0.0; + target: "elm.text"; + } + program { name: "text_hide"; + signal: "elm,state,text,hidden"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.text"; + } + program { name: "icon_show"; + signal: "elm,state,icon,visible"; + source: "elm"; + action: STATE_SET "visible" 0.0; + target: "elm.swallow.icon"; + } + program { name: "icon_hide"; + signal: "elm,state,icon,hidden"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.swallow.icon"; + } + program { name: "end_show"; + signal: "elm,state,end,visible"; + source: "elm"; + action: STATE_SET "visible" 0.0; + target: "elm.swallow.end"; + } + program { name: "end_hide"; + signal: "elm,state,end,hidden"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.swallow.end"; + } + program { name: "units_show"; + signal: "elm,state,units,visible"; + source: "elm"; + action: STATE_SET "visible" 0.0; + target: "elm.units"; + target: "units"; + } + program { name: "units_hide"; + signal: "elm,state,units,hidden"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.units"; + target: "units"; + } + program { name: "invert_on"; + signal: "elm,state,inverted,on"; + source: "elm"; + action: STATE_SET "inverted" 0.0; + target: "level"; + target: "level2"; + } + program { name: "invert_off"; + signal: "elm,state,inverted,off"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "level"; + target: "level2"; + } + program { + name: "go_disabled"; + signal: "elm,state,disabled"; + source: "elm"; + action: STATE_SET "disabled" 0.0; +// target: "button0"; + target: "disabler"; + after: "disable_text"; + } + program { name: "disable_text"; + script { + new st[31]; + new Float:vl; + get_state(PART:"elm.text", st, 30, vl); + if (!strcmp(st, "visible")) + set_state(PART:"elm.text", "disabled_visible", 0.0); + else + set_state(PART:"elm.text", "disabled", 0.0); + + get_state(PART:"elm.units", st, 30, vl); + if (!strcmp(st, "visible")) + set_state(PART:"elm.units", "disabled_visible", 0.0); + else + set_state(PART:"elm.units", "disabled", 0.0); + + get_state(PART:"level2", st, 30, vl); + if (!strcmp(st, "inverted")) + { + set_state(PART:"level", "disabled_inverted", 0.0); + set_state(PART:"level2", "disabled_inverted", 0.0); } - fill.smooth: 0; - } - description { state: "disabled" 0.0; - inherit: "default" 0.0; - image { - normal: "sl_bt_3.png"; - border: 5 5 5 10; + else + { + set_state(PART:"level", "disabled", 0.0); + set_state(PART:"level2", "disabled", 0.0); } } } - part { name: "button1"; - mouse_events: 0; - description { state: "default" 0.0; - rel1.to: "button0"; - rel2 { - to: "button0"; - relative: 1.0 0.5; - offset: -1 -5; + program { name: "enable"; + signal: "elm,state,enabled"; + source: "elm"; + action: STATE_SET "default" 0.0; +// target: "button0"; + target: "disabler"; + after: "enable_text"; + } + program { name: "enable_text"; + script { + new st[31]; + new Float:vl; + get_state(PART:"elm.text", st, 30, vl); + if (!strcmp(st, "disabled_visible")) + set_state(PART:"elm.text", "visible", 0.0); + else + set_state(PART:"elm.text", "default", 0.0); + + get_state(PART:"elm.units", st, 30, vl); + if (!strcmp(st, "disabled_visible")) + set_state(PART:"elm.units", "visible", 0.0); + else + set_state(PART:"elm.units", "default", 0.0); + + get_state(PART:"level2", st, 30, vl); + if (!strcmp(st, "disabled_inverted")) + { + set_state(PART:"level", "inverted", 0.0); + set_state(PART:"level2", "inverted", 0.0); } - image { - normal: "sl_bt_1.png"; - border: 5 5 5 0; + else + { + set_state(PART:"level", "default", 0.0); + set_state(PART:"level2", "default", 0.0); } } } - part { name: "button2"; + } + } + + group { name: "elm/slider/vertical/default"; + images { + image: "slv_bg.png" COMP; + image: "slv_bg_over.png" COMP; + + image: "slv_units.png" COMP; + } + parts { + part { name: "base"; mouse_events: 0; description { state: "default" 0.0; - rel1.to: "button0"; - rel2.to: "button0"; - image { - normal: "sl_bt_2.png"; - border: 5 5 5 10; + max: 6 99999; + min: 6 0; + rel1 { to: "bg"; + offset: 1 0; + } + rel2 { to: "bg"; + offset: -2 -1; } + image.normal: "slv_bg.png"; fill.smooth: 0; } } - part { name: "button3"; - mouse_events: 0; - description { state: "default" 0.0; - fixed: 1 1; - visible: 0; - min: 8 32; - align: 1.0 0.5; - rel1 { - to_x: "elm.indicator"; - to_y: "button4"; - relative: 0.0 0.0; - offset: -7 0; - } - rel2 { - to: "button4"; - relative: 0.0 1.0; - offset: -1 -1; - } - image { - normal: "sl_bt2_0_0.png"; - border: 6 0 6 12; - } - fill.smooth: 0; - } - description { state: "visible" 0.0; - inherit: "default" 0.0; - visible: 1; - } - } - part { name: "button4"; - mouse_events: 0; - description { state: "default" 0.0; - visible: 0; - max: 15 999; - min: 15 32; - rel1 { - to_x: "button0"; - to_y: "elm.indicator"; - offset: 0 0; - } - rel2.to: "button0"; - image { - normal: "sl_bt2_0_1.png"; - border: 0 0 6 12; - } - fill.smooth: 0; - } - description { state: "visible" 0.0; - inherit: "default" 0.0; - visible: 1; - } - } - part { name: "button5"; - mouse_events: 0; - description { state: "default" 0.0; - fixed: 1 1; - visible: 0; - min: 8 32; - align: 0.0 0.5; - rel1 { - to: "button4"; - relative: 1.0 0.0; - offset: 0 0; - } - rel2 { - to_x: "elm.indicator"; - to_y: "button4"; - relative: 1.0 1.0; - offset: 6 -1; - } - image { - normal: "sl_bt2_0_2.png"; - border: 0 6 6 12; - } - fill.smooth: 0; - } - description { state: "visible" 0.0; - inherit: "default" 0.0; - visible: 1; - } - } - part { name: "elm.indicator"; - type: TEXT; - mouse_events: 0; - effect: SOFT_SHADOW; - scale: 1; - description { state: "default" 0.0; - visible: 0; - fixed: 1 1; - align: 0.5 1.0; - rel1 { - to: "button0"; - relative: 0.0 -0.25; - offset: 0 0; - } - rel2 { - to_x: "button0"; - relative: 1.0 -0.25; - offset: -1 0; - } - color: 224 224 224 255; - color3: 0 0 0 64; - text { - font: "Sans,Edje-Vera"; - size: 10; - min: 0 0; - align: 0.5 0.5; - } - } - description { state: "visible" 0.0; - inherit: "default" 0.0; - visible: 1; - text.min: 1 1; - rel1.offset: 0 -1; - rel2.offset: -1 -1; - } - } - part { name: "button6"; - mouse_events: 0; - description { state: "default" 0.0; - visible: 0; - rel1.to: "button3"; - rel2 { - to: "button5"; - relative: 1.0 0.3; - offset: -1 -1; - } - image { - normal: "sl_bt2_1.png"; - border: 5 5 5 0; - } - fill.smooth: 0; - } - description { state: "visible" 0.0; - inherit: "default" 0.0; - visible: 1; - } - } - part { name: "button7"; - mouse_events: 0; - description { state: "default" 0.0; - visible: 0; - rel1.to: "button3"; - rel2.to: "button5"; - image { - normal: "sl_bt2_2.png"; - border: 5 5 5 0; - middle: 0; - } - fill.smooth: 0; - } - description { state: "visible" 0.0; - inherit: "default" 0.0; - visible: 1; - } - } - part { name: "disabler"; - type: RECT; - description { state: "default" 0.0; - color: 0 0 0 0; - visible: 0; - } - description { state: "disabled" 0.0; - inherit: "default" 0.0; - visible: 1; - } - } - } - programs { - program { name: "text_show"; - signal: "elm,state,text,visible"; - source: "elm"; - action: STATE_SET "visible" 0.0; - target: "elm.text"; - } - program { name: "text_hide"; - signal: "elm,state,text,hidden"; - source: "elm"; - action: STATE_SET "default" 0.0; - target: "elm.text"; - } - program { name: "icon_show"; - signal: "elm,state,icon,visible"; - source: "elm"; - action: STATE_SET "visible" 0.0; - target: "elm.swallow.icon"; - } - program { name: "icon_hide"; - signal: "elm,state,icon,hidden"; - source: "elm"; - action: STATE_SET "default" 0.0; - target: "elm.swallow.icon"; - } - program { name: "end_show"; - signal: "elm,state,end,visible"; - source: "elm"; - action: STATE_SET "visible" 0.0; - target: "elm.swallow.end"; - } - program { name: "end_hide"; - signal: "elm,state,end,hidden"; - source: "elm"; - action: STATE_SET "default" 0.0; - target: "elm.swallow.end"; - } - program { name: "units_show"; - signal: "elm,state,units,visible"; - source: "elm"; - action: STATE_SET "visible" 0.0; - target: "elm.units"; - target: "units"; - } - program { name: "units_hide"; - signal: "elm,state,units,hidden"; - source: "elm"; - action: STATE_SET "default" 0.0; - target: "elm.units"; - target: "units"; - } - program { name: "invert_on"; - signal: "elm,state,inverted,on"; - source: "elm"; - action: STATE_SET "inverted" 0.0; - target: "level"; - target: "level2"; - } - program { name: "invert_off"; - signal: "elm,state,inverted,off"; - source: "elm"; - action: STATE_SET "default" 0.0; - target: "level"; - target: "level2"; - } - program { name: "set_val_show"; - signal: "elm,state,val,show"; - source: "elm"; - script { - set_value_show(); - } - } - program { name: "set_val_hide"; - signal: "elm,state,val,hide"; - source: "elm"; - script { - set_value_hide(); - } - } - program { name: "val_show"; - signal: "mouse,down,*"; - source: "elm.dragable.slider"; - script { - thumb_down(); - } - - } - program { name: "val_hide"; - signal: "mouse,up,*"; - source: "elm.dragable.slider"; - script { - thumb_up(); - } - } - program { - name: "go_disabled"; - signal: "elm,state,disabled"; - source: "elm"; - action: STATE_SET "disabled" 0.0; - target: "button0"; - target: "disabler"; - after: "disable_text"; - } - program { name: "disable_text"; - script { - new st[31]; - new Float:vl; - get_state(PART:"elm.text", st, 30, vl); - if (!strcmp(st, "visible")) - set_state(PART:"elm.text", "disabled_visible", 0.0); - else - set_state(PART:"elm.text", "disabled", 0.0); - - get_state(PART:"elm.units", st, 30, vl); - if (!strcmp(st, "visible")) - set_state(PART:"elm.units", "disabled_visible", 0.0); - else - set_state(PART:"elm.units", "disabled", 0.0); - - get_state(PART:"level2", st, 30, vl); - if (!strcmp(st, "inverted")) - { - set_state(PART:"level", "disabled_inverted", 0.0); - set_state(PART:"level2", "disabled_inverted", 0.0); - } - else - { - set_state(PART:"level", "disabled", 0.0); - set_state(PART:"level2", "disabled", 0.0); - } - } - } - program { name: "enable"; - signal: "elm,state,enabled"; - source: "elm"; - action: STATE_SET "default" 0.0; - target: "button0"; - target: "disabler"; - after: "enable_text"; - } - program { name: "enable_text"; - script { - new st[31]; - new Float:vl; - get_state(PART:"elm.text", st, 30, vl); - if (!strcmp(st, "disabled_visible")) - set_state(PART:"elm.text", "visible", 0.0); - else - set_state(PART:"elm.text", "default", 0.0); - - get_state(PART:"elm.units", st, 30, vl); - if (!strcmp(st, "disabled_visible")) - set_state(PART:"elm.units", "visible", 0.0); - else - set_state(PART:"elm.units", "default", 0.0); - - get_state(PART:"level2", st, 30, vl); - if (!strcmp(st, "disabled_inverted")) - { - set_state(PART:"level", "inverted", 0.0); - set_state(PART:"level2", "inverted", 0.0); - } - else - { - set_state(PART:"level", "default", 0.0); - set_state(PART:"level2", "default", 0.0); - } - } - } - } - } - - group { name: "elm/slider/vertical/default"; - images { - image: "slv_bg.png" COMP; - image: "slv_bg_over.png" COMP; - - image: "sl_bt_0.png" COMP; - image: "sl_bt_1.png" COMP; - image: "sl_bt_2.png" COMP; - image: "sl_bt_3.png" COMP; - image: "sl_bt2_0_0.png" COMP; - image: "sl_bt2_0_1.png" COMP; - image: "sl_bt2_0_2.png" COMP; - image: "sl_bt2_1.png" COMP; - image: "sl_bt2_2.png" COMP; - - image: "slv_units.png" COMP; - } - script { - public value_hide = 0; - public set_value_show() { - set_int(value_hide, 0); - } - public set_value_hide() { - set_int(value_hide, 1); - } - public thumb_down() { - if (get_int(value_hide) == 1) { - set_state(PART:"elm.indicator", "default", 0.0); - set_state(PART:"button3", "default", 0.0); - set_state(PART:"button4", "default", 0.0); - set_state(PART:"button5", "default", 0.0); - set_state(PART:"button6", "default", 0.0); - set_state(PART:"button7", "default", 0.0); - } else { - set_state(PART:"elm.indicator", "visible", 0.0); - set_state(PART:"button3", "visible", 0.0); - set_state(PART:"button4", "visible", 0.0); - set_state(PART:"button5", "visible", 0.0); - set_state(PART:"button6", "visible", 0.0); - set_state(PART:"button7", "visible", 0.0); - } - } - public thumb_up() { - set_state(PART:"elm.indicator", "default", 0.0); - set_state(PART:"button3", "default", 0.0); - set_state(PART:"button4", "default", 0.0); - set_state(PART:"button5", "default", 0.0); - set_state(PART:"button6", "default", 0.0); - set_state(PART:"button7", "default", 0.0); - } - } - parts { - part { name: "base"; - mouse_events: 0; - description { state: "default" 0.0; - max: 6 99999; - min: 6 0; - rel1 { to: "bg"; - offset: 1 0; - } - rel2 { to: "bg"; - offset: -2 -1; - } - image.normal: "slv_bg.png"; - fill.smooth: 0; - } - } - part { name: "level"; - type: RECT; + part { name: "level"; + type: RECT; mouse_events: 0; description { state: "default" 0.0; fixed: 1 1; @@ -15075,8 +14741,10 @@ collections { } } part { name: "elm.dragable.slider"; - type: RECT; - mouse_events: 0; + type: GROUP; + source: "elm/slider/vertical/indicator/default"; + mouse_events: 1; + repeat_events: 1; scale: 1; dragable { x: 0 0 0; @@ -15091,26 +14759,227 @@ collections { relative: 0.5 0.0; to_y: "bg"; } - rel2 { - relative: 0.5 1.0; - to_y: "bg"; + rel2 { + relative: 0.5 1.0; + to_y: "bg"; + } + color: 0 0 0 0; + } + } + part { name: "disabler"; + type: RECT; + description { state: "default" 0.0; + color: 0 0 0 0; + visible: 0; + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } + } + + programs { + program { name: "text_show"; + signal: "elm,state,text,visible"; + source: "elm"; + action: STATE_SET "visible" 0.0; + target: "elm.text"; + } + program { name: "text_hide"; + signal: "elm,state,text,hidden"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.text"; + } + program { name: "icon_show"; + signal: "elm,state,icon,visible"; + source: "elm"; + action: STATE_SET "visible" 0.0; + target: "elm.swallow.icon"; + } + program { name: "icon_hide"; + signal: "elm,state,icon,hidden"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.swallow.icon"; + } + program { name: "end_show"; + signal: "elm,state,end,visible"; + source: "elm"; + action: STATE_SET "visible" 0.0; + target: "elm.swallow.end"; + } + program { name: "end_hide"; + signal: "elm,state,end,hidden"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.swallow.end"; + } + program { name: "units_show"; + signal: "elm,state,units,visible"; + source: "elm"; + action: STATE_SET "visible" 0.0; + target: "elm.units"; + target: "units"; + } + program { name: "units_hide"; + signal: "elm,state,units,hidden"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.units"; + target: "units"; + } + program { name: "invert_on"; + signal: "elm,state,inverted,on"; + source: "elm"; + action: STATE_SET "inverted" 0.0; + target: "level"; + target: "level2"; + } + program { name: "invert_off"; + signal: "elm,state,inverted,off"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "level"; + target: "level2"; + } + program { + name: "go_disabled"; + signal: "elm,state,disabled"; + source: "elm"; + action: STATE_SET "disabled" 0.0; +// target: "button0"; + target: "disabler"; + after: "disable_text"; + } + program { name: "disable_text"; + script { + new st[31]; + new Float:vl; + get_state(PART:"elm.text", st, 30, vl); + if (!strcmp(st, "visible")) + set_state(PART:"elm.text", "disabled_visible", 0.0); + else + set_state(PART:"elm.text", "disabled", 0.0); + + get_state(PART:"elm.units", st, 30, vl); + if (!strcmp(st, "visible")) + set_state(PART:"elm.units", "disabled_visible", 0.0); + else + set_state(PART:"elm.units", "disabled", 0.0); + + get_state(PART:"level2", st, 30, vl); + if (!strcmp(st, "inverted")) + { + set_state(PART:"level", "disabled_inverted", 0.0); + set_state(PART:"level2", "disabled_inverted", 0.0); + } + else + { + set_state(PART:"level", "disabled", 0.0); + set_state(PART:"level2", "disabled", 0.0); + } + } + } + + program { name: "enable"; + signal: "elm,state,enabled"; + source: "elm"; + action: STATE_SET "default" 0.0; +// target: "button0"; + target: "disabler"; + after: "enable_text"; + } + program { name: "enable_text"; + script { + new st[31]; + new Float:vl; + get_state(PART:"elm.text", st, 30, vl); + if (!strcmp(st, "disabled_visible")) + set_state(PART:"elm.text", "visible", 0.0); + else + set_state(PART:"elm.text", "default", 0.0); + + get_state(PART:"elm.units", st, 30, vl); + if (!strcmp(st, "disabled_visible")) + set_state(PART:"elm.units", "visible", 0.0); + else + set_state(PART:"elm.units", "default", 0.0); + + get_state(PART:"level2", st, 30, vl); + if (!strcmp(st, "disabled_inverted")) + { + set_state(PART:"level", "inverted", 0.0); + set_state(PART:"level2", "inverted", 0.0); } - color: 0 0 0 0; + else + { + set_state(PART:"level", "default", 0.0); + set_state(PART:"level2", "default", 0.0); + } + } + } + } + } + group { name: "elm/slider/horizontal/indicator/default"; + alias: "elm/slider/horizontal/indicator/disabled"; + alias: "elm/slider/vertical/indicator/default"; + alias: "elm/slider/vertical/indicator/disabled"; + images { + image: "sl_bt_0.png" COMP; + image: "sl_bt_1.png" COMP; + image: "sl_bt_2.png" COMP; + image: "sl_bt_3.png" COMP; + image: "sl_bt2_0_0.png" COMP; + image: "sl_bt2_0_1.png" COMP; + image: "sl_bt2_0_2.png" COMP; + image: "sl_bt2_1.png" COMP; + image: "sl_bt2_2.png" COMP; + } + script { + public value_hide = 0; + public set_value_show() { + set_int(value_hide, 0); + } + public set_value_hide() { + set_int(value_hide, 1); + } + public thumb_down() { + if (get_int(value_hide) == 1) { + set_state(PART:"elm.indicator", "default", 0.0); + set_state(PART:"button3", "default", 0.0); + set_state(PART:"button4", "default", 0.0); + set_state(PART:"button5", "default", 0.0); + set_state(PART:"button6", "default", 0.0); + set_state(PART:"button7", "default", 0.0); + } else { + set_state(PART:"elm.indicator", "visible", 0.0); + set_state(PART:"button3", "visible", 0.0); + set_state(PART:"button4", "visible", 0.0); + set_state(PART:"button5", "visible", 0.0); + set_state(PART:"button6", "visible", 0.0); + set_state(PART:"button7", "visible", 0.0); } } + public thumb_up() { + set_state(PART:"elm.indicator", "default", 0.0); + set_state(PART:"button3", "default", 0.0); + set_state(PART:"button4", "default", 0.0); + set_state(PART:"button5", "default", 0.0); + set_state(PART:"button6", "default", 0.0); + set_state(PART:"button7", "default", 0.0); + } + } + parts { part { name: "button_events"; type: RECT; - dragable { - events: "elm.dragable.slider"; - } mouse_events: 1; description { state: "default" 0.0; fixed: 1 1; min: 16 16; aspect: 1.0 1.0; - aspect_preference: HORIZONTAL; - rel1.to_y: "elm.dragable.slider"; - rel2.to_y: "elm.dragable.slider"; + aspect_preference: VERTICAL; color: 0 0 0 0; } } @@ -15120,8 +14989,6 @@ collections { fixed: 1 1; max: 17 999; min: 17 24; - rel1.to: "elm.dragable.slider"; - rel2.to: "elm.dragable.slider"; image { normal: "sl_bt_0.png"; border: 5 5 5 10; @@ -15166,6 +15033,7 @@ collections { part { name: "button3"; mouse_events: 0; description { state: "default" 0.0; + fixed: 1 1; visible: 0; min: 8 32; align: 1.0 0.5; @@ -15197,11 +15065,10 @@ collections { visible: 0; max: 15 999; min: 15 32; - fixed: 1 1; rel1 { to_x: "button0"; to_y: "elm.indicator"; - offset: 0 -7; + offset: 0 0; } rel2.to: "button0"; image { @@ -15218,6 +15085,7 @@ collections { part { name: "button5"; mouse_events: 0; description { state: "default" 0.0; + fixed: 1 1; visible: 0; min: 8 32; align: 0.0 0.5; @@ -15254,12 +15122,12 @@ collections { align: 0.5 1.0; rel1 { to: "button0"; - relative: 0.0 -1.0; + relative: 0.0 -0.25; offset: 0 0; } rel2 { - to: "button0"; - relative: 1.0 -1.0; + to_x: "button0"; + relative: 1.0 -0.25; offset: -1 0; } color: 224 224 224 255; @@ -15318,84 +15186,8 @@ collections { visible: 1; } } - part { name: "disabler"; - type: RECT; - description { state: "default" 0.0; - color: 0 0 0 0; - visible: 0; - } - description { state: "disabled" 0.0; - inherit: "default" 0.0; - visible: 1; - } - } - } - + } programs { - program { name: "text_show"; - signal: "elm,state,text,visible"; - source: "elm"; - action: STATE_SET "visible" 0.0; - target: "elm.text"; - } - program { name: "text_hide"; - signal: "elm,state,text,hidden"; - source: "elm"; - action: STATE_SET "default" 0.0; - target: "elm.text"; - } - program { name: "icon_show"; - signal: "elm,state,icon,visible"; - source: "elm"; - action: STATE_SET "visible" 0.0; - target: "elm.swallow.icon"; - } - program { name: "icon_hide"; - signal: "elm,state,icon,hidden"; - source: "elm"; - action: STATE_SET "default" 0.0; - target: "elm.swallow.icon"; - } - program { name: "end_show"; - signal: "elm,state,end,visible"; - source: "elm"; - action: STATE_SET "visible" 0.0; - target: "elm.swallow.end"; - } - program { name: "end_hide"; - signal: "elm,state,end,hidden"; - source: "elm"; - action: STATE_SET "default" 0.0; - target: "elm.swallow.end"; - } - program { name: "units_show"; - signal: "elm,state,units,visible"; - source: "elm"; - action: STATE_SET "visible" 0.0; - target: "elm.units"; - target: "units"; - } - program { name: "units_hide"; - signal: "elm,state,units,hidden"; - source: "elm"; - action: STATE_SET "default" 0.0; - target: "elm.units"; - target: "units"; - } - program { name: "invert_on"; - signal: "elm,state,inverted,on"; - source: "elm"; - action: STATE_SET "inverted" 0.0; - target: "level"; - target: "level2"; - } - program { name: "invert_off"; - signal: "elm,state,inverted,off"; - source: "elm"; - action: STATE_SET "default" 0.0; - target: "level"; - target: "level2"; - } program { name: "set_val_show"; signal: "elm,state,val,show"; source: "elm"; @@ -15412,97 +15204,23 @@ collections { } program { name: "val_show"; signal: "mouse,down,*"; - source: "elm.dragable.slider"; + source: "button_events"; script { thumb_down(); } + } program { name: "val_hide"; signal: "mouse,up,*"; - source: "elm.dragable.slider"; + source: "button_events"; script { thumb_up(); } } - program { - name: "go_disabled"; - signal: "elm,state,disabled"; - source: "elm"; - action: STATE_SET "disabled" 0.0; - target: "button0"; - target: "disabler"; - after: "disable_text"; - } - program { name: "disable_text"; - script { - new st[31]; - new Float:vl; - get_state(PART:"elm.text", st, 30, vl); - if (!strcmp(st, "visible")) - set_state(PART:"elm.text", "disabled_visible", 0.0); - else - set_state(PART:"elm.text", "disabled", 0.0); - - get_state(PART:"elm.units", st, 30, vl); - if (!strcmp(st, "visible")) - set_state(PART:"elm.units", "disabled_visible", 0.0); - else - set_state(PART:"elm.units", "disabled", 0.0); - - get_state(PART:"level2", st, 30, vl); - if (!strcmp(st, "inverted")) - { - set_state(PART:"level", "disabled_inverted", 0.0); - set_state(PART:"level2", "disabled_inverted", 0.0); - } - else - { - set_state(PART:"level", "disabled", 0.0); - set_state(PART:"level2", "disabled", 0.0); - } - } - } - - program { name: "enable"; - signal: "elm,state,enabled"; - source: "elm"; - action: STATE_SET "default" 0.0; - target: "button0"; - target: "disabler"; - after: "enable_text"; - } - program { name: "enable_text"; - script { - new st[31]; - new Float:vl; - get_state(PART:"elm.text", st, 30, vl); - if (!strcmp(st, "disabled_visible")) - set_state(PART:"elm.text", "visible", 0.0); - else - set_state(PART:"elm.text", "default", 0.0); - - get_state(PART:"elm.units", st, 30, vl); - if (!strcmp(st, "disabled_visible")) - set_state(PART:"elm.units", "visible", 0.0); - else - set_state(PART:"elm.units", "default", 0.0); - - get_state(PART:"level2", st, 30, vl); - if (!strcmp(st, "disabled_inverted")) - { - set_state(PART:"level", "inverted", 0.0); - set_state(PART:"level2", "inverted", 0.0); - } - else - { - set_state(PART:"level", "default", 0.0); - set_state(PART:"level2", "default", 0.0); - } - } - } } } + //////////////////////////////////////////////////////////////////////////////// // actionslider //////////////////////////////////////////////////////////////////////////////// diff --git a/src/lib/elc_anchorblock.c b/src/lib/elc_anchorblock.c index 7c75062..3671f5e 100644 --- a/src/lib/elc_anchorblock.c +++ b/src/lib/elc_anchorblock.c @@ -48,6 +48,7 @@ static void _del_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _del_pre_hook(Evas_Object *obj) @@ -75,6 +76,22 @@ _del_hook(Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_widget_mirrored_set(wd->hover, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); +} + +static void _sizing_eval(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); @@ -110,6 +127,7 @@ _anchor_clicked(void *data, Evas_Object *obj, void *event_info) evas_object_move(wd->pop, info->x, info->y); evas_object_resize(wd->pop, info->w, info->h); wd->hover = elm_hover_add(obj); + elm_widget_mirrored_set(wd->hover, elm_widget_mirrored_get((Evas_Object *) data)); if (wd->hover_style) elm_object_style_set(wd->hover, wd->hover_style); hover_parent = wd->hover_parent; @@ -138,6 +156,14 @@ _anchor_clicked(void *data, Evas_Object *obj, void *event_info) if (py < (y + (h / 3))) ei.hover_top = 0; ei.hover_bottom = 1; if (py > (y + ((h * 2) / 3))) ei.hover_bottom = 0; + + if (elm_widget_mirrored_get(wd->hover)) + { /* Swap right and left because they switch sides in RTL */ + Eina_Bool tmp = ei.hover_left; + ei.hover_left = ei.hover_right; + ei.hover_right = tmp; + } + evas_object_smart_callback_call(data, SIG_ANCHOR_CLICKED, &ei); evas_object_smart_callback_add(wd->hover, "clicked", _hover_clicked, data); evas_object_show(wd->hover); @@ -195,6 +221,7 @@ elm_anchorblock_add(Evas_Object *parent) elm_widget_data_set(obj, wd); elm_widget_del_pre_hook_set(obj, _del_pre_hook); elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); elm_widget_can_focus_set(obj, EINA_TRUE); wd->entry = elm_entry_add(parent); @@ -212,6 +239,7 @@ elm_anchorblock_add(Evas_Object *parent) evas_object_smart_callback_add(wd->entry, "anchor,clicked", _anchor_clicked, obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _sizing_eval(obj); // TODO: convert Elementary to subclassing of Evas_Smart_Class diff --git a/src/lib/elc_anchorview.c b/src/lib/elc_anchorview.c index df61e53..1be7b21 100644 --- a/src/lib/elc_anchorview.c +++ b/src/lib/elc_anchorview.c @@ -45,6 +45,7 @@ static void _del_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _del_pre_hook(Evas_Object *obj) @@ -68,6 +69,22 @@ _del_hook(Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_widget_mirrored_set(wd->hover, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); +} + +static void _sizing_eval(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); @@ -102,6 +119,7 @@ _anchor_clicked(void *data, Evas_Object *obj, void *event_info) evas_object_move(wd->pop, info->x, info->y); evas_object_resize(wd->pop, info->w, info->h); wd->hover = elm_hover_add(obj); + elm_widget_mirrored_set(wd->hover, elm_widget_mirrored_get((Evas_Object *) data)); if (wd->hover_style) elm_object_style_set(wd->hover, wd->hover_style); hover_parent = wd->hover_parent; if (!hover_parent) hover_parent = obj; @@ -129,6 +147,14 @@ _anchor_clicked(void *data, Evas_Object *obj, void *event_info) if (py < (y + (h / 3))) ei.hover_top = 0; ei.hover_bottom = 1; if (py > (y + ((h * 2) / 3))) ei.hover_bottom = 0; + + if (elm_widget_mirrored_get(wd->hover)) + { /* Swap right and left because they switch sides in RTL */ + Eina_Bool tmp = ei.hover_left; + ei.hover_left = ei.hover_right; + ei.hover_right = tmp; + } + evas_object_smart_callback_call(data, SIG_ANCHOR_CLICKED, &ei); evas_object_smart_callback_add(wd->hover, "clicked", _hover_clicked, data); evas_object_show(wd->hover); @@ -186,6 +212,7 @@ elm_anchorview_add(Evas_Object *parent) elm_widget_data_set(obj, wd); elm_widget_del_pre_hook_set(obj, _del_pre_hook); elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); elm_widget_can_focus_set(obj, EINA_TRUE); wd->scroller = elm_scroller_add(parent); @@ -206,6 +233,7 @@ elm_anchorview_add(Evas_Object *parent) evas_object_smart_callback_add(wd->entry, "anchor,clicked", _anchor_clicked, obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _sizing_eval(obj); // TODO: convert Elementary to subclassing of Evas_Smart_Class diff --git a/src/lib/elc_fileselector.c b/src/lib/elc_fileselector.c index 2cf3010..de3c073 100644 --- a/src/lib/elc_fileselector.c +++ b/src/lib/elc_fileselector.c @@ -113,6 +113,19 @@ _sizing_eval(Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_widget_mirrored_set(wd->cancel_button, rtl); + elm_widget_mirrored_set(wd->ok_button, rtl); + elm_widget_mirrored_set(wd->files_list, rtl); + elm_widget_mirrored_set(wd->up_button, rtl); + elm_widget_mirrored_set(wd->home_button, rtl); + edje_object_mirrored_set(wd->edje, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); @@ -179,6 +192,7 @@ _theme_hook(Evas_Object *obj) #undef SWALLOW edje_object_message_signal_process(wd->edje); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); edje_object_scale_set (wd->edje, elm_widget_scale_get(obj) * _elm_config->scale); _sizing_eval(obj); diff --git a/src/lib/elc_fileselector_button.c b/src/lib/elc_fileselector_button.c index dbdeeb2..fef1935 100644 --- a/src/lib/elc_fileselector_button.c +++ b/src/lib/elc_fileselector_button.c @@ -82,11 +82,21 @@ _on_focus_hook(void *data __UNUSED__, } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_widget_mirrored_set(wd->btn, rtl); + elm_widget_mirrored_set(wd->fs, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); char buf[4096]; if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); snprintf(buf, sizeof(buf), "fileselector_button/%s", elm_widget_style_get(obj)); elm_object_style_set(wd->btn, buf); @@ -191,6 +201,7 @@ _activate(Widget_Data *wd) wd->fsw = _new_window_add(wd); wd->fs = elm_fileselector_add(wd->fsw); + elm_widget_mirrored_set(wd->fs, elm_widget_mirrored_get(wd->self)); elm_fileselector_expandable_set(wd->fs, wd->fsd.expandable); elm_fileselector_folder_only_set(wd->fs, wd->fsd.folder_only); elm_fileselector_is_save_set(wd->fs, wd->fsd.is_save); diff --git a/src/lib/elc_fileselector_entry.c b/src/lib/elc_fileselector_entry.c index 7b0ad6d..e759377 100644 --- a/src/lib/elc_fileselector_entry.c +++ b/src/lib/elc_fileselector_entry.c @@ -74,6 +74,8 @@ SIG_FWD(SELECTION_CUT) SIG_FWD(UNPRESSED) #undef SIG_FWD +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); + static void _FILE_CHOSEN_fwd(void *data, Evas_Object *obj __UNUSED__, void *event_info) { @@ -152,6 +154,15 @@ _elm_fileselector_entry_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direct } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_widget_mirrored_set(wd->button, rtl); + edje_object_mirrored_set(wd->edje, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); @@ -159,6 +170,7 @@ _theme_hook(Evas_Object *obj) char buf[1024]; if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _elm_theme_object_set(obj, wd->edje, "fileselector_entry", "base", style); if (elm_object_disabled_get(obj)) edje_object_signal_emit(wd->edje, "elm,state,disabled", "elm"); @@ -273,6 +285,7 @@ elm_fileselector_entry_add(Evas_Object *parent) SIG_FWD(SELECTION_CUT); #undef SIG_FWD + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _sizing_eval(obj); // TODO: convert Elementary to subclassing of Evas_Smart_Class diff --git a/src/lib/elc_hoversel.c b/src/lib/elc_hoversel.c index 0ee816e..a6cd8af 100644 --- a/src/lib/elc_hoversel.c +++ b/src/lib/elc_hoversel.c @@ -77,6 +77,15 @@ _del_hook(Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_widget_mirrored_set(wd->btn, rtl); + elm_widget_mirrored_set(wd->hover, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); @@ -89,6 +98,7 @@ _theme_hook(Evas_Object *obj) snprintf(buf, sizeof(buf), "hoversel_vertical/%s", elm_widget_style_get(obj)); elm_object_style_set(wd->btn, buf); elm_object_disabled_set(wd->btn, elm_widget_disabled_get(obj)); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); } static void @@ -185,6 +195,7 @@ _activate(Evas_Object *obj) EINA_LIST_FOREACH(wd->items, l, item) { bt = elm_button_add(wd->hover); + elm_widget_mirrored_set(bt, elm_widget_mirrored_get(obj)); elm_object_style_set(bt, buf); elm_button_label_set(bt, item->label); if (item->icon_file) diff --git a/src/lib/elm_actionslider.c b/src/lib/elm_actionslider.c index 2aafd7c..31297fc 100644 --- a/src/lib/elm_actionslider.c +++ b/src/lib/elm_actionslider.c @@ -60,6 +60,51 @@ _del_hook(Evas_Object *obj) free(wd); } +static Elm_Actionslider_Pos +_get_pos_by_orientation(const Evas_Object *obj, Elm_Actionslider_Pos pos) +{ + if (elm_widget_mirrored_get(obj)) + { + switch (pos) + { + case ELM_ACTIONSLIDER_LEFT: + pos = ELM_ACTIONSLIDER_RIGHT; + break; + case ELM_ACTIONSLIDER_RIGHT: + pos = ELM_ACTIONSLIDER_LEFT; + break; + default: + break; + } + } + return pos; +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + double pos; + + if (!wd) return; + if (edje_object_mirrored_get(wd->as) == rtl) + return; + + edje_object_mirrored_set(wd->as, rtl); + if (!elm_widget_mirrored_get(obj)) + { + edje_object_part_text_set(wd->as, "elm.text.left", wd->text_left); + edje_object_part_text_set(wd->as, "elm.text.right", wd->text_right); + } + else + { + edje_object_part_text_set(wd->as, "elm.text.left", wd->text_right); + edje_object_part_text_set(wd->as, "elm.text.right", wd->text_left); + } + edje_object_part_drag_value_get(wd->as, "elm.drag_button_base", &pos, NULL); + edje_object_part_drag_value_set(wd->as, "elm.drag_button_base", 1.0 - pos, 0.5); +} + static void _sizing_eval(Evas_Object *obj) { @@ -92,8 +137,8 @@ _theme_hook(Evas_Object *obj) _elm_theme_object_set(obj, wd->drag_button_base, "actionslider", "drag_button", elm_widget_style_get(obj)); edje_object_part_swallow(wd->as, "elm.drag_button_base", wd->drag_button_base); - edje_object_part_text_set(wd->as, "elm.text.left", wd->text_left); - edje_object_part_text_set(wd->as, "elm.text.right", wd->text_right); + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); edje_object_part_text_set(wd->as, "elm.text.center", wd->text_center); edje_object_part_text_set(wd->as, "elm.text.indicator", wd->indicator_label); edje_object_message_signal_process(wd->as); @@ -111,25 +156,30 @@ _drag_button_down_cb(void *data, Evas_Object *o __UNUSED__, const char *emission static void _drag_button_move_cb(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) { - Evas_Object *as = (Evas_Object *) data; - Widget_Data *wd = elm_widget_data_get(as); + Evas_Object *obj = (Evas_Object *) data; + Widget_Data *wd = elm_widget_data_get(obj); double pos = 0.0; if (!wd) return; if (!wd->mouse_down) return; edje_object_part_drag_value_get(wd->as, "elm.drag_button_base", &pos, NULL); if (pos == 0.0) - evas_object_smart_callback_call(as, SIG_CHANGED, "left"); + evas_object_smart_callback_call(obj, SIG_CHANGED, + (void *) ((!elm_widget_mirrored_get(obj)) ? + "left" : "right")); else if (pos == 1.0) - evas_object_smart_callback_call(as, SIG_CHANGED, "right"); + evas_object_smart_callback_call(obj, SIG_CHANGED, + (void *) ((!elm_widget_mirrored_get(obj)) ? + "right" : "left")); else if (pos >= 0.45 && pos <= 0.55) - evas_object_smart_callback_call(as, SIG_CHANGED, "center"); + evas_object_smart_callback_call(obj, SIG_CHANGED, (void *)"center"); } static Eina_Bool _button_animation(void *data) { - Widget_Data *wd = elm_widget_data_get(data); + Evas_Object *obj = data; + Widget_Data *wd = elm_widget_data_get(obj); double cur_position = 0.0, new_position = 0.0; double move_amount = 0.05; Eina_Bool flag_finish_animation = EINA_FALSE; @@ -137,28 +187,34 @@ _button_animation(void *data) edje_object_part_drag_value_get(wd->as, "elm.drag_button_base", &cur_position, NULL); - if ((wd->final_position == 0.0) || - (wd->final_position == 0.5 && cur_position >= wd->final_position)) { - new_position = cur_position - move_amount; - if (new_position <= wd->final_position) + double adjusted_final; + adjusted_final = (!elm_widget_mirrored_get(obj)) ? + wd->final_position : 1.0 - wd->final_position; + if ((adjusted_final == 0.0) || + (adjusted_final == 0.5 && cur_position >= adjusted_final)) { - new_position = wd->final_position; - flag_finish_animation = EINA_TRUE; + new_position = cur_position - move_amount; + if (new_position <= adjusted_final) + { + new_position = adjusted_final; + flag_finish_animation = EINA_TRUE; + } } - } - else if ((wd->final_position == 1.0) || - (wd->final_position == 0.5 && cur_position < wd->final_position)) - { - new_position = cur_position + move_amount; - if (new_position >= wd->final_position) + else if ((adjusted_final == 1.0) || + (adjusted_final == 0.5 && cur_position < adjusted_final)) { - new_position = wd->final_position; - flag_finish_animation = EINA_TRUE; + new_position = cur_position + move_amount; + if (new_position >= adjusted_final) + { + new_position = adjusted_final; + flag_finish_animation = EINA_TRUE; + } } + edje_object_part_drag_value_set(wd->as, + "elm.drag_button_base", new_position, 0.5); } - edje_object_part_drag_value_set(wd->as, - "elm.drag_button_base", new_position, 0.5); + if (flag_finish_animation) { if ((!wd->final_position) && @@ -181,7 +237,8 @@ _button_animation(void *data) static void _drag_button_up_cb(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) { - Widget_Data *wd = elm_widget_data_get(data); + Evas_Object *obj = (Evas_Object *) data; + Widget_Data *wd = elm_widget_data_get(obj); double position = 0.0; if (!wd) return; @@ -190,11 +247,13 @@ _drag_button_up_cb(void *data, Evas_Object *o __UNUSED__, const char *emission _ edje_object_part_drag_value_get(wd->as, "elm.drag_button_base", &position, NULL); - if (position == 0.0 && (wd->enabled_position & ELM_ACTIONSLIDER_LEFT)) + if ((wd->enabled_position & ELM_ACTIONSLIDER_LEFT) && + ((!elm_widget_mirrored_get(obj) && position == 0.0) || + (elm_widget_mirrored_get(obj) && position == 1.0))) { wd->final_position = 0; evas_object_smart_callback_call(data, SIG_SELECTED, - (void *)wd->text_left); + (void *) wd->text_left); return; } if (position >= 0.45 && position <= 0.55 && @@ -205,24 +264,33 @@ _drag_button_up_cb(void *data, Evas_Object *o __UNUSED__, const char *emission _ (void *)wd->text_center); return; } - if (position == 1.0 && (wd->enabled_position & ELM_ACTIONSLIDER_RIGHT)) + if ((wd->enabled_position & ELM_ACTIONSLIDER_RIGHT) && + ((!elm_widget_mirrored_get(obj) && position == 1.0) || + (elm_widget_mirrored_get(obj) && position == 0.0))) { wd->final_position = 1; evas_object_smart_callback_call(data, SIG_SELECTED, - (void *)wd->text_right); + (void *) wd->text_right); return; } if (wd->magnet_position == ELM_ACTIONSLIDER_NONE) return; +#define _FINAL_POS_BY_ORIENTATION(x) (x) +#define _POS_BY_ORIENTATION(x) \ + ((!elm_widget_mirrored_get(obj)) ? \ + x : 1.0 - x) + + position = _POS_BY_ORIENTATION(position); + if (position < 0.3) { if (wd->magnet_position & ELM_ACTIONSLIDER_LEFT) - wd->final_position = 0; + wd->final_position = _FINAL_POS_BY_ORIENTATION(0); else if (wd->magnet_position & ELM_ACTIONSLIDER_CENTER) wd->final_position = 0.5; else if (wd->magnet_position & ELM_ACTIONSLIDER_RIGHT) - wd->final_position = 1; + wd->final_position = _FINAL_POS_BY_ORIENTATION(1); } else if ((position >= 0.3) && (position <= 0.7)) { @@ -231,28 +299,30 @@ _drag_button_up_cb(void *data, Evas_Object *o __UNUSED__, const char *emission _ else if (position < 0.5) { if (wd->magnet_position & ELM_ACTIONSLIDER_LEFT) - wd->final_position = 0; + wd->final_position = _FINAL_POS_BY_ORIENTATION(0); else - wd->final_position = 1; + wd->final_position = _FINAL_POS_BY_ORIENTATION(1); } else { if (wd->magnet_position & ELM_ACTIONSLIDER_RIGHT) - wd->final_position = 1; + wd->final_position = _FINAL_POS_BY_ORIENTATION(1); else - wd->final_position = 0; + wd->final_position = _FINAL_POS_BY_ORIENTATION(0); } } else { if (wd->magnet_position & ELM_ACTIONSLIDER_RIGHT) - wd->final_position = 1; + wd->final_position = _FINAL_POS_BY_ORIENTATION(1); else if (wd->magnet_position & ELM_ACTIONSLIDER_CENTER) wd->final_position = 0.5; else - wd->final_position = 0; + wd->final_position = _FINAL_POS_BY_ORIENTATION(0); } wd->button_animator = ecore_animator_add(_button_animation, data); + +#undef _FINAL_POS_BY_ORIENTATION } /** @@ -305,6 +375,7 @@ elm_actionslider_add(Evas_Object *parent) _drag_button_move_cb, obj); evas_object_smart_callbacks_descriptions_set(obj, _signals); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _sizing_eval(obj); return obj; } @@ -324,6 +395,7 @@ elm_actionslider_indicator_pos_set(Evas_Object *obj, Elm_Actionslider_Pos pos) Widget_Data *wd = elm_widget_data_get(obj); double position = 0.0; if (!wd) return; + pos = _get_pos_by_orientation(obj, pos); if (pos == ELM_ACTIONSLIDER_CENTER) position = 0.5; else if (pos == ELM_ACTIONSLIDER_RIGHT) position = 1.0; edje_object_part_drag_value_set(wd->as, "elm.drag_button_base", position, 0.5); @@ -347,11 +419,11 @@ elm_actionslider_indicator_pos_get(const Evas_Object *obj) edje_object_part_drag_value_get(wd->as, "elm.drag_button_base", &position, NULL); if (position < 0.3) - return ELM_ACTIONSLIDER_LEFT; + return _get_pos_by_orientation(obj, ELM_ACTIONSLIDER_LEFT); else if (position < 0.7) return ELM_ACTIONSLIDER_CENTER; else - return ELM_ACTIONSLIDER_RIGHT; + return _get_pos_by_orientation(obj, ELM_ACTIONSLIDER_RIGHT); } /** @@ -448,11 +520,19 @@ elm_actionslider_labels_set(Evas_Object *obj, const char *left_label, const char if (!wd) return; eina_stringshare_replace(&wd->text_left, left_label); - edje_object_part_text_set(wd->as, "elm.text.left", left_label); eina_stringshare_replace(&wd->text_center, center_label); - edje_object_part_text_set(wd->as, "elm.text.center", center_label); eina_stringshare_replace(&wd->text_right, right_label); - edje_object_part_text_set(wd->as, "elm.text.right", right_label); + if (!elm_widget_mirrored_get(obj)) + { + edje_object_part_text_set(wd->as, "elm.text.left", wd->text_left); + edje_object_part_text_set(wd->as, "elm.text.right", wd->text_right); + } + else + { + edje_object_part_text_set(wd->as, "elm.text.left", wd->text_right); + edje_object_part_text_set(wd->as, "elm.text.right", wd->text_left); + } + edje_object_part_text_set(wd->as, "elm.text.center", center_label); } /** diff --git a/src/lib/elm_box.c b/src/lib/elm_box.c index 0d6449d..6c4b697 100644 --- a/src/lib/elm_box.c +++ b/src/lib/elm_box.c @@ -120,6 +120,14 @@ _elm_box_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_O } static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_smart_calculate(wd->box); +} + +static void _sizing_eval(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); @@ -153,9 +161,11 @@ _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) static void _layout(Evas_Object *o, Evas_Object_Box_Data *priv, void *data) { - Widget_Data *wd = data; + Evas_Object *obj = (Evas_Object *) data; + Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - _els_box_layout(o, priv, wd->horizontal, wd->homogeneous); + _els_box_layout(o, priv, wd->horizontal, wd->homogeneous, + elm_widget_mirrored_get(obj)); } static Eina_Bool @@ -355,11 +365,12 @@ elm_box_add(Evas_Object *parent) elm_widget_focus_next_hook_set(obj, _elm_box_focus_next_hook); elm_widget_can_focus_set(obj, EINA_FALSE); elm_widget_highlight_ignore_set(obj, EINA_TRUE); + elm_widget_theme_hook_set(obj, _theme_hook); wd->box = evas_object_box_add(e); /*evas_object_box_layout_set(wd->box, evas_object_box_layout_vertical, NULL, NULL);*/ - evas_object_box_layout_set(wd->box, _layout, wd, NULL); + evas_object_box_layout_set(wd->box, _layout, obj, NULL); evas_object_event_callback_add(wd->box, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj); @@ -661,7 +672,7 @@ elm_box_layout_set(Evas_Object *obj, Evas_Object_Box_Layout cb, const void *data if (cb) evas_object_box_layout_set(wd->box, cb, data, free_data); else - evas_object_box_layout_set(wd->box, _layout, wd, NULL); + evas_object_box_layout_set(wd->box, _layout, obj, NULL); } /** diff --git a/src/lib/elm_bubble.c b/src/lib/elm_bubble.c index 2be1dcd..9265c2e 100644 --- a/src/lib/elm_bubble.c +++ b/src/lib/elm_bubble.c @@ -23,6 +23,7 @@ struct _Widget_Data static const char *widtype = NULL; static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _theme_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); @@ -47,10 +48,19 @@ _del_hook(Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->bbl, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _elm_theme_object_set(obj, wd->bbl, "bubble", wd->corner, elm_widget_style_get(obj)); edje_object_part_text_set(wd->bbl, "elm.text", wd->label); @@ -170,7 +180,6 @@ elm_bubble_add(Evas_Object *parent) wd->corner = eina_stringshare_add("base"); wd->bbl = edje_object_add(e); - _elm_theme_object_set(obj, wd->bbl, "bubble", "base", "default"); elm_widget_resize_object_set(obj, wd->bbl); evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); @@ -178,6 +187,9 @@ elm_bubble_add(Evas_Object *parent) _mouse_up, obj); evas_object_smart_callbacks_descriptions_set(obj, _signals); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _elm_theme_object_set(obj, wd->bbl, "bubble", wd->corner, + elm_widget_style_get(obj)); _sizing_eval(obj); return obj; } diff --git a/src/lib/elm_button.c b/src/lib/elm_button.c index 6ebd759..14e5a6a 100644 --- a/src/lib/elm_button.c +++ b/src/lib/elm_button.c @@ -93,11 +93,20 @@ _on_focus_hook(void *data __UNUSED__, Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->btn, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); const char *str; if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _elm_theme_object_set(obj, wd->btn, "button", "base", elm_widget_style_get(obj)); if (wd->icon) edje_object_part_swallow(wd->btn, "elm.swallow.content", wd->icon); diff --git a/src/lib/elm_calendar.c b/src/lib/elm_calendar.c index 3c2ff39..e0a0b12 100644 --- a/src/lib/elm_calendar.c +++ b/src/lib/elm_calendar.c @@ -60,6 +60,7 @@ struct _Elm_Calendar_Mark static const char *widtype = NULL; static void _on_focus_hook(void *data, Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static const char *_days_abbrev[] = { @@ -435,12 +436,21 @@ _on_focus_hook(void *data __UNUSED__, Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->calendar, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; _elm_theme_object_set(obj, wd->calendar, "calendar", "base", elm_widget_style_get(obj)); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _set_headers(obj); _populate(obj); edje_object_message_signal_process(wd->calendar); @@ -767,6 +777,7 @@ elm_calendar_add(Evas_Object *parent) _set_headers(obj); _populate(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _sizing_eval(obj); return obj; } diff --git a/src/lib/elm_check.c b/src/lib/elm_check.c index 00badfa..fb86519 100644 --- a/src/lib/elm_check.c +++ b/src/lib/elm_check.c @@ -31,6 +31,7 @@ struct _Widget_Data static const char *widtype = NULL; static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _theme_hook(Evas_Object *obj); static void _disable_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); @@ -95,10 +96,19 @@ _on_focus_hook(void *data __UNUSED__, Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->chk, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _elm_theme_object_set(obj, wd->chk, "check", "base", elm_widget_style_get(obj)); if (wd->icon) edje_object_signal_emit(wd->chk, "elm,state,icon,visible", "elm"); @@ -265,6 +275,7 @@ elm_check_add(Evas_Object *parent) evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _sizing_eval(obj); // TODO: convert Elementary to subclassing of Evas_Smart_Class diff --git a/src/lib/elm_conform.c b/src/lib/elm_conform.c index 34e2e39..42df1ed 100644 --- a/src/lib/elm_conform.c +++ b/src/lib/elm_conform.c @@ -27,6 +27,7 @@ struct _Widget_Data /* local function prototypes */ static const char *widtype = NULL; static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _theme_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); static Eina_Bool _prop_change(void *data, int type, void *event); @@ -42,10 +43,19 @@ _del_hook(Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->base, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _elm_theme_object_set(obj, wd->base, "conformant", "base", elm_widget_style_get(obj)); if (wd->content) edje_object_part_swallow(wd->base, "elm.swallow.content", wd->content); @@ -266,6 +276,7 @@ elm_conformant_add(Evas_Object *parent) evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _sizing_eval(obj); return obj; } diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c index c715199..14a5ba5 100644 --- a/src/lib/elm_entry.c +++ b/src/lib/elm_entry.c @@ -167,6 +167,7 @@ static const char *widtype = NULL; static Eina_Bool _drag_drop_cb(void *data, Evas_Object *obj, Elm_Selection_Data *); #endif static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _theme_hook(Evas_Object *obj); static void _disable_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); @@ -448,10 +449,18 @@ _del_hook(Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + edje_object_mirrored_set(wd->ent, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); const char *t; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); t = eina_stringshare_add(elm_entry_entry_get(obj)); _elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj), elm_widget_style_get(obj)); @@ -1493,6 +1502,7 @@ elm_entry_add(Evas_Object *parent) // if found - hook in if ((wd->api) && (wd->api->obj_hook)) wd->api->obj_hook(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); // TODO: convert Elementary to subclassing of Evas_Smart_Class // TODO: and save some bytes, making descriptions per-class and not instance! evas_object_smart_callbacks_descriptions_set(obj, _signals); diff --git a/src/lib/elm_frame.c b/src/lib/elm_frame.c index 0e00a12..cc5028f 100644 --- a/src/lib/elm_frame.c +++ b/src/lib/elm_frame.c @@ -19,6 +19,7 @@ struct _Widget_Data static const char *widtype = NULL; static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _theme_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); @@ -34,10 +35,19 @@ _del_hook(Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->frm, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _elm_theme_object_set(obj, wd->frm, "frame", "base", elm_widget_style_get(obj)); edje_object_part_text_set(wd->frm, "elm.text", wd->label); if (wd->content) @@ -134,6 +144,7 @@ elm_frame_add(Evas_Object *parent) evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _sizing_eval(obj); return obj; } diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c index 0060898..66a7c7a 100644 --- a/src/lib/elm_gengrid.c +++ b/src/lib/elm_gengrid.c @@ -260,6 +260,7 @@ static Eina_Bool _event_hook(Evas_Object *obj, static Eina_Bool _deselect_all_items(Widget_Data *wd); static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION; +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static Eina_Bool _event_hook(Evas_Object *obj, @@ -649,10 +650,29 @@ _on_focus_hook(void *data __UNUSED__, } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Gengrid_Item *item; + if (!wd) return; + elm_smart_scroller_mirrored_set(wd->scr, rtl); + if (!wd->items) return; + item = ELM_GENGRID_ITEM_FROM_INLIST(wd->items); + + while (item) + { + edje_object_mirrored_set(item->base.view, rtl); + elm_gengrid_item_update(item); + item = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(item)->next); + } +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); elm_smart_scroller_object_theme_set(obj, wd->scr, "gengrid", "base", elm_widget_style_get(obj)); } @@ -738,6 +758,18 @@ _mouse_move(void *data, minh /= 2; if ((adx > minw) || (ady > minh)) { + const char *left_drag, *right_drag; + if (!elm_widget_mirrored_get(item->wd->self)) + { + left_drag = "drag,start,left"; + right_drag = "drag,start,right"; + } + else + { + left_drag = "drag,start,right"; + right_drag = "drag,start,left"; + } + item->dragging = 1; if (item->long_timer) { @@ -755,7 +787,7 @@ _mouse_move(void *data, { if (dx < 0) evas_object_smart_callback_call(item->wd->self, - "drag,start,left", item); + left_drag, item); } } else @@ -767,10 +799,10 @@ _mouse_move(void *data, { if (dx < 0) evas_object_smart_callback_call(item->wd->self, - "drag,start,left", item); + left_drag, item); else evas_object_smart_callback_call(item->wd->self, - "drag,start,right", item); + right_drag, item); } } } @@ -909,6 +941,7 @@ _item_realize(Elm_Gengrid_Item *item) item->base.view = edje_object_add(evas_object_evas_get(item->wd->self)); edje_object_scale_set(item->base.view, elm_widget_scale_get(item->wd->self) * _elm_config->scale); + edje_object_mirrored_set(item->base.view, elm_widget_mirrored_get(item->base.widget)); evas_object_smart_member_add(item->base.view, item->wd->pan_smart); elm_widget_sub_object_add(item->wd->self, item->base.view); snprintf(style, sizeof(style), "item/%s", @@ -1060,7 +1093,6 @@ _item_place(Elm_Gengrid_Item *item, { Evas_Coord x, y, ox, oy, cvx, cvy, cvw, cvh; Evas_Coord tch, tcw, alignw = 0, alignh = 0, vw, vh; - item->x = cx; item->y = cy; evas_object_geometry_get(item->wd->pan_smart, &ox, &oy, &vw, &vh); @@ -1120,6 +1152,13 @@ _item_place(Elm_Gengrid_Item *item, } x = cx * item->wd->item_width - item->wd->pan_x + ox + alignw; + if (elm_widget_mirrored_get(item->wd->self)) + { /* Switch items side and componsate for pan_x when in RTL mode */ + Evas_Coord ww; + evas_object_geometry_get(item->wd->self, NULL, NULL, &ww, NULL); + x = ww - x - item->wd->item_width - item->wd->pan_x - item->wd->pan_x; + } + y = cy * item->wd->item_height - item->wd->pan_y + oy + alignh; Eina_Bool was_realized = item->realized; @@ -1560,6 +1599,7 @@ elm_gengrid_add(Evas_Object *parent) _pan_set, _pan_get, _pan_max_get, _pan_min_get, _pan_child_size_get); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); return obj; } diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index d572b64..04f296f 100644 --- a/src/lib/elm_genlist.c +++ b/src/lib/elm_genlist.c @@ -445,6 +445,7 @@ struct _Pan static const char *widtype = NULL; static void _item_cache_zero(Widget_Data *wd); static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _theme_hook(Evas_Object *obj); //static void _show_region_hook(void *data, Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); @@ -724,12 +725,22 @@ _del_pre_hook(Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _item_cache_zero(wd); + elm_smart_scroller_mirrored_set(wd->scr, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); Item_Block *itb; if (!wd) return; _item_cache_zero(wd); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base", elm_widget_style_get(obj)); // edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale); @@ -1648,6 +1659,8 @@ _item_realize(Elm_Genlist_Item *it, _elm_theme_object_set(it->base.widget, it->base.view, "genlist", buf, elm_widget_style_get(it->base.widget)); + edje_object_mirrored_set(it->base.view, + elm_widget_mirrored_get(it->base.widget)); it->spacer = evas_object_rectangle_add(evas_object_evas_get(it->base.widget)); evas_object_color_set(it->spacer, 0, 0, 0, 0); @@ -1871,7 +1884,10 @@ _item_unrealize(Elm_Genlist_Item *it) it->spacer = NULL; } else - _item_cache_add(it); + { + edje_object_mirrored_set(it->base.view, elm_widget_mirrored_get(it->base.widget)); + _item_cache_add(it); + } elm_widget_stringlist_free(it->labels); it->labels = NULL; elm_widget_stringlist_free(it->icons); @@ -2638,6 +2654,7 @@ elm_genlist_add(Evas_Object *parent) &minw, &minh); evas_object_size_hint_min_set(obj, minw, minh); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _sizing_eval(obj); return obj; } diff --git a/src/lib/elm_hover.c b/src/lib/elm_hover.c index 45d5447..5b613d6 100644 --- a/src/lib/elm_hover.c +++ b/src/lib/elm_hover.c @@ -63,6 +63,7 @@ struct _Widget_Data static const char *widtype = NULL; static void _del_pre_hook(Evas_Object *obj); static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _theme_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); static void _reval_content(Evas_Object *obj); @@ -127,10 +128,19 @@ _on_focus_hook(void *data __UNUSED__, Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->cov, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); // FIXME: hover contents doesn't seem to propagate resizes properly _elm_theme_object_set(obj, wd->cov, "hover", "base", elm_widget_style_get(obj)); edje_object_scale_set(wd->cov, elm_widget_scale_get(obj) * @@ -208,13 +218,19 @@ static void _sizing_eval(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); - Evas_Coord x = 0, y = 0, w = 0, h = 0, x2 = 0, y2 = 0, w2 = 0, h2 = 0; + Evas_Coord ofs_x, x = 0, y = 0, w = 0, h = 0, x2 = 0, y2 = 0, w2 = 0, h2 = 0; if (!wd) return; if (wd->parent) evas_object_geometry_get(wd->parent, &x, &y, &w, &h); if (wd->hov) evas_object_geometry_get(wd->hov, &x2, &y2, &w2, &h2); + + if (elm_widget_mirrored_get(obj)) + ofs_x = w - (x2 - x) - w2; + else + ofs_x = x2 - x; + evas_object_move(wd->cov, x, y); evas_object_resize(wd->cov, w, h); - evas_object_size_hint_min_set(wd->offset, x2 - x, y2 - y); + evas_object_size_hint_min_set(wd->offset, ofs_x, y2 - y); evas_object_size_hint_min_set(wd->size, w2, h2); edje_object_part_swallow(wd->cov, "elm.swallow.offset", wd->offset); edje_object_part_swallow(wd->cov, "elm.swallow.size", wd->size); @@ -532,6 +548,7 @@ elm_hover_add(Evas_Object *parent) elm_hover_parent_set(obj, parent); evas_object_smart_callbacks_descriptions_set(obj, _signals); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _sizing_eval(obj); return obj; } @@ -686,6 +703,21 @@ _elm_hover_sub_obj_placement_eval(Evas_Object *obj) evas_object_smart_callback_call(obj, SIG_SMART_LOCATION_CHANGED, (void *)smart_dir); + if (elm_widget_mirrored_get(obj)) + { + if (smart_dir == _HOV_BOTTOM_LEFT) + smart_dir = _HOV_BOTTOM_RIGHT; + else if (smart_dir == _HOV_BOTTOM_RIGHT) + smart_dir = _HOV_BOTTOM_LEFT; + else if (smart_dir == _HOV_RIGHT) + smart_dir = _HOV_LEFT; + else if (smart_dir == _HOV_LEFT) + smart_dir = _HOV_RIGHT; + else if (smart_dir == _HOV_TOP_RIGHT) + smart_dir = _HOV_TOP_LEFT; + else if (smart_dir == _HOV_TOP_LEFT) + smart_dir = _HOV_TOP_RIGHT; + } snprintf(buf, sizeof(buf), "elm.swallow.slot.%s", smart_dir); edje_object_part_swallow(wd->cov, buf, wd->smt_sub); } diff --git a/src/lib/elm_index.c b/src/lib/elm_index.c index c63a2a4..5e2a277 100644 --- a/src/lib/elm_index.c +++ b/src/lib/elm_index.c @@ -34,6 +34,7 @@ struct _Elm_Index_Item }; static const char *widtype = NULL; +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _theme_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); static void _index_box_auto_fill(Evas_Object *obj, Evas_Object *box, int level); @@ -63,7 +64,7 @@ _layout(Evas_Object *o, Evas_Object_Box_Data *priv, void *data) { Widget_Data *wd = data; if (!wd) return; - _els_box_layout(o, priv, wd->horizontal, 1); + _els_box_layout(o, priv, wd->horizontal, 1, 0); } static void @@ -91,17 +92,30 @@ _signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *so } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (!wd->horizontal) + edje_object_mirrored_set(wd->base, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Evas_Coord minw = 0, minh = 0; Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; + _index_box_clear(obj, wd->bx[0], 0); _index_box_clear(obj, wd->bx[1], 1); if (wd->horizontal) _elm_theme_object_set(obj, wd->base, "index", "base/horizontal", elm_widget_style_get(obj)); else - _elm_theme_object_set(obj, wd->base, "index", "base/vertical", elm_widget_style_get(obj)); + { + _elm_theme_object_set(obj, wd->base, "index", "base/vertical", elm_widget_style_get(obj)); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + } edje_object_part_swallow(wd->base, "elm.swallow.event.0", wd->event[0]); elm_coords_finger_size_adjust(1, &minw, 1, &minh); evas_object_size_hint_min_set(wd->event[0], minw, minh); @@ -200,12 +214,14 @@ static void _index_box_auto_fill(Evas_Object *obj, Evas_Object *box, int level) { Widget_Data *wd = elm_widget_data_get(obj); + Eina_Bool rtl; Eina_List *l; Elm_Index_Item *it; Evas_Coord mw, mh, w, h; int i = 0; if (!wd) return; if (wd->level_active[level]) return; + rtl = elm_widget_mirrored_get(obj); evas_object_geometry_get(box, NULL, NULL, &w, &h); EINA_LIST_FOREACH(wd->items, l, it) { @@ -215,6 +231,7 @@ _index_box_auto_fill(Evas_Object *obj, Evas_Object *box, int level) if (it->level != level) continue; o = edje_object_add(evas_object_evas_get(obj)); it->base.view = o; + edje_object_mirrored_set(it->base.view, rtl); if (i & 0x1) _elm_theme_object_set(obj, o, "index", "item_odd/vertical", elm_widget_style_get(obj)); else @@ -405,17 +422,17 @@ _mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *eve { Widget_Data *wd = elm_widget_data_get(data); Evas_Event_Mouse_Down *ev = event_info; - Evas_Coord x, y; + Evas_Coord x, y, w; if (!wd) return; if (ev->button != 1) return; wd->down = 1; - evas_object_geometry_get(wd->base, &x, &y, NULL, NULL); + evas_object_geometry_get(wd->base, &x, &y, &w, NULL); wd->dx = ev->canvas.x - x; wd->dy = ev->canvas.y - y; elm_index_active_set(data, 1); _sel_eval(data, ev->canvas.x, ev->canvas.y); edje_object_part_drag_value_set(wd->base, "elm.dragable.pointer", - wd->dx, wd->dy); + (!edje_object_mirrored_get(wd->base)) ? wd->dx : (wd->dx - w), wd->dy); } static void @@ -438,18 +455,19 @@ _mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *eve { Widget_Data *wd = elm_widget_data_get(data); Evas_Event_Mouse_Move *ev = event_info; - Evas_Coord minw = 0, minh = 0, x, y, dx, adx; + Evas_Coord minw = 0, minh = 0, x, y, dx, adx, w; char buf[1024]; if (!wd) return; if (!wd->down) return; elm_coords_finger_size_adjust(1, &minw, 1, &minh); - evas_object_geometry_get(wd->base, &x, &y, NULL, NULL); + evas_object_geometry_get(wd->base, &x, &y, &w, NULL); x = ev->cur.canvas.x - x; y = ev->cur.canvas.y - y; dx = x - wd->dx; adx = dx; if (adx < 0) adx = -dx; - edje_object_part_drag_value_set(wd->base, "elm.dragable.pointer", x, y); + edje_object_part_drag_value_set(wd->base, "elm.dragable.pointer" + , (!edje_object_mirrored_get(wd->base)) ? x : (x - w), y); if (!wd->horizontal) { if (adx > minw) @@ -555,6 +573,7 @@ elm_index_add(Evas_Object *parent) evas_object_show(wd->bx[1]); } + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _sizing_eval(obj); return obj; } diff --git a/src/lib/elm_label.c b/src/lib/elm_label.c index 5240cec..d340afd 100644 --- a/src/lib/elm_label.c +++ b/src/lib/elm_label.c @@ -30,6 +30,7 @@ struct _Widget_Data static const char *widtype = NULL; static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _theme_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); static int _get_value_in_key_string(const char *oldstring, const char *key, char **value); @@ -104,10 +105,19 @@ _theme_change(Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->lbl, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _theme_change(obj); edje_object_part_text_set(wd->lbl, "elm.text", wd->label); edje_object_scale_set(wd->lbl, elm_widget_scale_get(obj) * @@ -664,9 +674,10 @@ elm_label_add(Evas_Object *parent) wd->label = eina_stringshare_add("
"); edje_object_part_text_set(wd->lbl, "elm.text", "
"); elm_widget_resize_object_set(obj, wd->lbl); - + evas_object_event_callback_add(wd->lbl, EVAS_CALLBACK_RESIZE, _resize, obj); - + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); wd->changed = 1; _sizing_eval(obj); return obj; diff --git a/src/lib/elm_layout.c b/src/lib/elm_layout.c index a398af4..c55e2b7 100644 --- a/src/lib/elm_layout.c +++ b/src/lib/elm_layout.c @@ -61,6 +61,7 @@ struct _Part_Cursor static const char *widtype = NULL; static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _theme_hook(Evas_Object *obj); static void _sizing_eval(Widget_Data *wd); static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); @@ -87,10 +88,19 @@ _del_hook(Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->lay, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); edje_object_scale_set(wd->lay, elm_widget_scale_get(obj) * _elm_config->scale); _sizing_eval(wd); @@ -336,6 +346,7 @@ elm_layout_add(Evas_Object *parent) evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _request_sizing_eval(wd); return obj; } diff --git a/src/lib/elm_list.c b/src/lib/elm_list.c index 73906bc..aed9be0 100644 --- a/src/lib/elm_list.c +++ b/src/lib/elm_list.c @@ -61,6 +61,7 @@ struct _Elm_List_Item static const char *widtype = NULL; static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _theme_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); static void _disable_hook(Evas_Object *obj); @@ -536,6 +537,21 @@ _signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *so } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Elm_List_Item *it; + Eina_List *n; + + if (!wd) return; + if (wd->scr) + elm_smart_scroller_mirrored_set(wd->scr, rtl); + + EINA_LIST_FOREACH(wd->items, n, it) + edje_object_mirrored_set(it->base.view, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); @@ -543,6 +559,8 @@ _theme_hook(Evas_Object *obj) Eina_List *n; if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + if (wd->scr) { Evas_Object *edj; @@ -943,6 +961,7 @@ _item_new(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *e it->func = func; it->base.data = data; it->base.view = edje_object_add(evas_object_evas_get(obj)); + edje_object_mirrored_set(it->base.view, elm_widget_mirrored_get(obj)); evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, it); evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_UP, @@ -1281,6 +1300,7 @@ elm_list_add(Evas_Object *parent) evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj); evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _sizing_eval(obj); return obj; } diff --git a/src/lib/elm_menu.c b/src/lib/elm_menu.c index 06606ab..4fed8a6 100644 --- a/src/lib/elm_menu.c +++ b/src/lib/elm_menu.c @@ -103,6 +103,7 @@ _theme_hook(Evas_Object *obj) { EINA_LIST_FOREACH(l, _l, item) { + edje_object_mirrored_set(item->base.view, elm_widget_mirrored_get(obj)); ll = eina_list_append(ll, item->submenu.items); if (item->separator) _elm_theme_object_set(obj, item->base.view, "menu", "separator", @@ -152,12 +153,16 @@ _sizing_eval(Evas_Object *obj) x_p = wd->xloc; y_p = wd->yloc; + if (elm_widget_mirrored_get(obj)) + x_p -= w_p; + if (x_p+bw > x2+w2) x_p -= x_p+bw - (x2+w2); if (x_p < x2) x_p += x2 - x_p; if (y_p+h_p+bh > y2+h2) y_p -= y_p+h_p+bh - (y2+h2); if (y_p < y2) y_p += y2 - y_p; + evas_object_move(wd->location, x_p, y_p); evas_object_resize(wd->location, bw, h_p); evas_object_size_hint_min_set(wd->location, bw, h_p); @@ -187,6 +192,16 @@ _submenu_sizing_eval(Elm_Menu_Item *parent) x_p = x2+w2; y_p = y2; + /* If it overflows on the right, adjust the x */ + if ((x_p + bw > px + pw) || elm_widget_mirrored_get(parent->base.widget)) + x_p = x2-bw; + + /* If it overflows on the left, adjust the x - usually only happens + * with an RTL interface */ + if (x_p < px) + x_p = x2 + w2; + + /* If after all the adjustments it still overflows, fix it */ if (x_p + bw > px + pw) x_p = x2-bw; @@ -345,6 +360,7 @@ _item_obj_create(Elm_Menu_Item *item) Widget_Data *wd = elm_widget_data_get(item->base.widget); if (!wd) return; item->base.view = edje_object_add(evas_object_evas_get(wd->bx)); + edje_object_mirrored_set(item->base.view, elm_widget_mirrored_get(item->base.widget)); evas_object_size_hint_weight_set(item->base.view, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_fill_set(item->base.view, EVAS_HINT_FILL, EVAS_HINT_FILL); _elm_theme_object_set(item->base.widget, item->base.view, "menu", "item", elm_widget_style_get(item->base.widget)); @@ -376,15 +392,18 @@ _item_submenu_obj_create(Elm_Menu_Item *item) if (!wd) return; item->submenu.location = elm_icon_add(wd->bx); item->submenu.hv = elm_hover_add(wd->bx); + elm_widget_mirrored_set(item->submenu.hv, EINA_FALSE); elm_hover_target_set(item->submenu.hv, item->submenu.location); elm_hover_parent_set(item->submenu.hv, wd->parent); elm_object_style_set(item->submenu.hv, "submenu"); item->submenu.bx = elm_box_add(wd->bx); + elm_widget_mirrored_set(item->submenu.bx, EINA_FALSE); evas_object_size_hint_weight_set(item->submenu.bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(item->submenu.bx); elm_hover_content_set(item->submenu.hv, elm_hover_best_content_location_get(item->submenu.hv, ELM_HOVER_AXIS_VERTICAL), item->submenu.bx); + edje_object_mirrored_set(item->base.view, elm_widget_mirrored_get(item->base.widget)); _elm_theme_object_set(item->base.widget, item->base.view, "menu", "item_with_submenu", elm_widget_style_get(item->base.widget)); elm_menu_item_label_set(item, item->label); elm_menu_item_icon_set(item, item->icon_str); @@ -432,12 +451,14 @@ elm_menu_add(Evas_Object *parent) wd->obj = obj; wd->hv = elm_hover_add(obj); + elm_widget_mirrored_set(wd->hv, EINA_FALSE); elm_hover_parent_set(wd->hv, parent); elm_hover_target_set(wd->hv, wd->location); elm_object_style_set(wd->hv, "menu"); evas_object_smart_callback_add(wd->hv, "clicked", _hover_clicked_cb, obj); wd->bx = elm_box_add(obj); + elm_widget_mirrored_set(wd->bx, EINA_FALSE); evas_object_size_hint_weight_set(wd->bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(wd->bx); elm_hover_content_set(wd->hv, elm_hover_best_content_location_get(wd->hv, ELM_HOVER_AXIS_VERTICAL), wd->bx); diff --git a/src/lib/elm_notify.c b/src/lib/elm_notify.c index 18c407d..53873fa 100644 --- a/src/lib/elm_notify.c +++ b/src/lib/elm_notify.c @@ -29,6 +29,7 @@ struct _Widget_Data static const char *widtype = NULL; static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _theme_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); @@ -72,6 +73,53 @@ _del_hook(Evas_Object *obj) free(wd); } +/** + * Return Notification orientation with RTL + * + * This function switches-sides of notification area when in RTL mode. + * + * @param obj notification object. + * + * @param orient Original notification orientation. + * + * @return notification orientation with respect to the object RTL mode. + * + * @internal + **/ +static Elm_Notify_Orient +_notify_orientation_with_rtl(Evas_Object *obj, Elm_Notify_Orient orient) +{ + if (elm_widget_mirrored_get(obj)) + { + switch (orient) + { + case ELM_NOTIFY_ORIENT_LEFT: + orient = ELM_NOTIFY_ORIENT_RIGHT; + break; + case ELM_NOTIFY_ORIENT_RIGHT: + orient = ELM_NOTIFY_ORIENT_LEFT; + break; + case ELM_NOTIFY_ORIENT_TOP_LEFT: + orient = ELM_NOTIFY_ORIENT_TOP_RIGHT; + break; + case ELM_NOTIFY_ORIENT_TOP_RIGHT: + orient = ELM_NOTIFY_ORIENT_TOP_LEFT; + break; + case ELM_NOTIFY_ORIENT_BOTTOM_LEFT: + orient = ELM_NOTIFY_ORIENT_BOTTOM_RIGHT; + break; + case ELM_NOTIFY_ORIENT_BOTTOM_RIGHT: + orient = ELM_NOTIFY_ORIENT_BOTTOM_LEFT; + break; + default: + break; + } + } + + return orient; +} + + static void _notify_theme_apply(Evas_Object *obj) { @@ -112,6 +160,68 @@ _notify_theme_apply(Evas_Object *obj) } } +/** + * Moves notification to orientation. + * + * This fucntion moves notification to orientation + * according to object RTL orientation. + * + * @param obj notification object. + * + * @param orient notification orientation. + * + * @internal + **/ +static void +_notify_move_to_orientation(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + int offx; + int offy; + Evas_Coord minw = -1, minh = -1; + Evas_Coord x, y, w, h; + + if (!wd) return; + evas_object_geometry_get(obj, &x, &y, &w, &h); + edje_object_size_min_get(wd->notify, &minw, &minh); + edje_object_size_min_restricted_calc(wd->notify, &minw, &minh, minw, minh); + offx = (w - minw) / 2; + offy = (h - minh) / 2; + + switch (_notify_orientation_with_rtl(obj, wd->orient)) + { + case ELM_NOTIFY_ORIENT_TOP: + evas_object_move(wd->notify, x + offx, y); + break; + case ELM_NOTIFY_ORIENT_CENTER: + evas_object_move(wd->notify, x + offx, y + offy); + break; + case ELM_NOTIFY_ORIENT_BOTTOM: + evas_object_move(wd->notify, x + offx, y + h - minh); + break; + case ELM_NOTIFY_ORIENT_LEFT: + evas_object_move(wd->notify, x, y + offy); + break; + case ELM_NOTIFY_ORIENT_RIGHT: + evas_object_move(wd->notify, x + w - minw, y + offy); + break; + case ELM_NOTIFY_ORIENT_TOP_LEFT: + evas_object_move(wd->notify, x, y); + break; + case ELM_NOTIFY_ORIENT_TOP_RIGHT: + evas_object_move(wd->notify, x + w - minw, y); + break; + case ELM_NOTIFY_ORIENT_BOTTOM_LEFT: + evas_object_move(wd->notify, x, y + h - minh); + break; + case ELM_NOTIFY_ORIENT_BOTTOM_RIGHT: + evas_object_move(wd->notify, x + w - minw, y + h - minh); + break; + case ELM_NOTIFY_ORIENT_LAST: + break; + } +} + static void _block_events_theme_apply(Evas_Object *obj) { @@ -121,10 +231,20 @@ _block_events_theme_apply(Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->notify, rtl); + _notify_move_to_orientation(obj); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _notify_theme_apply(obj); if (wd->block_events) _block_events_theme_apply(obj); edje_object_scale_set(wd->notify, elm_widget_scale_get(obj) * @@ -201,41 +321,7 @@ _calc(Evas_Object *obj) if (wd->content) { - int offx = (w - minw) / 2; - int offy = (h - minh) / 2; - - switch (wd->orient) - { - case ELM_NOTIFY_ORIENT_TOP: - evas_object_move(wd->notify, x + offx, y); - break; - case ELM_NOTIFY_ORIENT_CENTER: - evas_object_move(wd->notify, x + offx, y + offy); - break; - case ELM_NOTIFY_ORIENT_BOTTOM: - evas_object_move(wd->notify, x + offx, y + h - minh); - break; - case ELM_NOTIFY_ORIENT_LEFT: - evas_object_move(wd->notify, x, y + offy); - break; - case ELM_NOTIFY_ORIENT_RIGHT: - evas_object_move(wd->notify, x + w - minw, y + offy); - break; - case ELM_NOTIFY_ORIENT_TOP_LEFT: - evas_object_move(wd->notify, x, y); - break; - case ELM_NOTIFY_ORIENT_TOP_RIGHT: - evas_object_move(wd->notify, x + w - minw, y); - break; - case ELM_NOTIFY_ORIENT_BOTTOM_LEFT: - evas_object_move(wd->notify, x, y + h - minh); - break; - case ELM_NOTIFY_ORIENT_BOTTOM_RIGHT: - evas_object_move(wd->notify, x + w - minw, y + h - minh); - break; - case ELM_NOTIFY_ORIENT_LAST: - break; - } + _notify_move_to_orientation(obj); evas_object_resize(wd->notify, minw, minh); } _sizing_eval(obj); @@ -353,6 +439,7 @@ elm_notify_add(Evas_Object *parent) evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _show, obj); evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _hide, obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _sizing_eval(obj); evas_object_smart_callbacks_descriptions_set(obj, _signals); diff --git a/src/lib/elm_pager.c b/src/lib/elm_pager.c index 0c6c67e..fb72092 100644 --- a/src/lib/elm_pager.c +++ b/src/lib/elm_pager.c @@ -39,6 +39,7 @@ struct _Item static const char *widtype = NULL; static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _theme_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); @@ -53,12 +54,24 @@ _del_hook(Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Eina_List *l; + Item *it; + if (!wd) return; + EINA_LIST_FOREACH(wd->stack, l, it) + edje_object_mirrored_set(it->base, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); Eina_List *l; Item *it; if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); EINA_LIST_FOREACH(wd->stack, l, it) { _elm_theme_object_set(obj, it->base, "pager", "base", @@ -271,6 +284,7 @@ elm_pager_add(Evas_Object *parent) evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _sizing_eval(obj); return obj; } diff --git a/src/lib/elm_panel.c b/src/lib/elm_panel.c index c6b7a9f..be50fbb 100644 --- a/src/lib/elm_panel.c +++ b/src/lib/elm_panel.c @@ -42,6 +42,19 @@ _del_hook(Evas_Object *obj) free(wd); } +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (wd->scr) + { + elm_widget_mirrored_set(wd->bx, rtl); + elm_panel_orient_set(obj, elm_panel_orient_get(obj)); + } +} + static void _theme_hook(Evas_Object *obj) { @@ -52,6 +65,7 @@ _theme_hook(Evas_Object *obj) Evas_Object *edj; const char *str; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); elm_smart_scroller_object_theme_set(obj, wd->scr, "panel", "base", elm_widget_style_get(obj)); // scale = (elm_widget_scale_get(obj) * _elm_config->scale); @@ -63,6 +77,7 @@ _theme_hook(Evas_Object *obj) else elm_widget_highlight_in_theme_set(obj, EINA_FALSE); } + _sizing_eval(obj); } @@ -172,7 +187,7 @@ _layout(Evas_Object *o, Evas_Object_Box_Data *priv, void *data) { Widget_Data *wd = data; if (!wd) return; - _els_box_layout(o, priv, EINA_TRUE, EINA_FALSE); + _els_box_layout(o, priv, EINA_TRUE, EINA_FALSE, EINA_FALSE); } static void @@ -283,6 +298,7 @@ elm_panel_add(Evas_Object *parent) evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_RESIZE, _resize, obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _sizing_eval(obj); return obj; } @@ -317,12 +333,19 @@ elm_panel_orient_set(Evas_Object *obj, Elm_Panel_Orient orient) elm_smart_scroller_object_theme_set(obj, wd->scr, "panel", "base", "bottom"); break; case ELM_PANEL_ORIENT_LEFT: - elm_smart_scroller_object_theme_set(obj, wd->scr, "panel", "base", "left"); + if (!elm_widget_mirrored_get(obj)) + elm_smart_scroller_object_theme_set(obj, wd->scr, "panel", "base", "left"); + else + elm_smart_scroller_object_theme_set(obj, wd->scr, "panel", "base", "right"); break; case ELM_PANEL_ORIENT_RIGHT: - elm_smart_scroller_object_theme_set(obj, wd->scr, "panel", "base", "right"); + if (!elm_widget_mirrored_get(obj)) + elm_smart_scroller_object_theme_set(obj, wd->scr, "panel", "base", "right"); + else + elm_smart_scroller_object_theme_set(obj, wd->scr, "panel", "base", "left"); break; } + _sizing_eval(obj); } diff --git a/src/lib/elm_panes.c b/src/lib/elm_panes.c index be82d21..937fa9b 100644 --- a/src/lib/elm_panes.c +++ b/src/lib/elm_panes.c @@ -31,6 +31,7 @@ struct _Widget_Data static const char *widtype = NULL; static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _theme_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); @@ -44,6 +45,14 @@ _del_hook(Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->panes, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); @@ -51,6 +60,7 @@ _theme_hook(Evas_Object *obj) double size; if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); size = elm_panes_content_left_size_get(obj); if (wd->horizontal) @@ -234,6 +244,7 @@ elm_panes_add(Evas_Object *parent) evas_object_event_callback_add(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _sizing_eval(obj); return obj; } diff --git a/src/lib/elm_photo.c b/src/lib/elm_photo.c index c69ed79..4496e53 100644 --- a/src/lib/elm_photo.c +++ b/src/lib/elm_photo.c @@ -28,6 +28,7 @@ struct _Widget_Data static const char *widtype = NULL; static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _theme_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); static void _mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); @@ -42,10 +43,19 @@ _del_hook(Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->frm, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; + _mirrored_set(wd->frm, elm_widget_mirrored_get(obj)); _elm_theme_object_set(obj, wd->frm, "photo", "base", elm_widget_style_get(obj)); edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->img); @@ -249,6 +259,8 @@ elm_photo_add(Evas_Object *parent) _icon_move_resize, obj); evas_object_event_callback_add(icon, EVAS_CALLBACK_RESIZE, _icon_move_resize, obj); + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _sizing_eval(obj); return obj; } diff --git a/src/lib/elm_progressbar.c b/src/lib/elm_progressbar.c index b7e112f..17775dd 100644 --- a/src/lib/elm_progressbar.c +++ b/src/lib/elm_progressbar.c @@ -45,6 +45,7 @@ struct _Widget_Data static const char *widtype = NULL; static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _theme_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); @@ -63,10 +64,19 @@ _del_hook(Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->progressbar, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); if (wd->horizontal) _elm_theme_object_set(obj, wd->progressbar, "progressbar", "horizontal", elm_widget_style_get(obj)); else @@ -150,10 +160,14 @@ static void _val_set(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); + Eina_Bool rtl; double pos; if (!wd) return; pos = wd->val; - if (wd->inverted) pos = MAX_RATIO_LVL - pos; + rtl = elm_widget_mirrored_get(obj); + if ((!rtl && wd->inverted) || (rtl && + ((!wd->horizontal && wd->inverted) || + (wd->horizontal && !wd->inverted)))) pos = MAX_RATIO_LVL - pos; edje_object_part_drag_value_set(wd->progressbar, "elm.cur.progressbar", pos, pos); } @@ -221,6 +235,7 @@ elm_progressbar_add(Evas_Object *parent) evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); _units_set(obj); _val_set(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _sizing_eval(obj); return obj; } diff --git a/src/lib/elm_radio.c b/src/lib/elm_radio.c index c01572f..e1407db 100644 --- a/src/lib/elm_radio.c +++ b/src/lib/elm_radio.c @@ -53,6 +53,7 @@ struct _Widget_Data static const char *widtype = NULL; static void _state_set(Evas_Object *obj, Eina_Bool state); static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _theme_hook(Evas_Object *obj); static void _disable_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); @@ -118,10 +119,19 @@ _on_focus_hook(void *data __UNUSED__, Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->radio, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _elm_theme_object_set(obj, wd->radio, "radio", "base", elm_widget_style_get(obj)); if (wd->icon) edje_object_signal_emit(wd->radio, "elm,state,icon,visible", "elm"); @@ -302,6 +312,7 @@ elm_radio_add(Evas_Object *parent) wd->group->radios = eina_list_append(wd->group->radios, obj); wd->state = 0; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _sizing_eval(obj); // TODO: convert Elementary to subclassing of Evas_Smart_Class diff --git a/src/lib/elm_scroller.c b/src/lib/elm_scroller.c index 1bd94a0..b1e6648 100644 --- a/src/lib/elm_scroller.c +++ b/src/lib/elm_scroller.c @@ -174,6 +174,15 @@ _del_hook(Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool mirrored) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->scr) + elm_smart_scroller_mirrored_set(wd->scr, mirrored); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); @@ -183,6 +192,7 @@ _theme_hook(Evas_Object *obj) Evas_Object *edj; const char *str; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); elm_smart_scroller_object_theme_set(obj, wd->scr, wd->widget_name, wd->widget_base, elm_widget_style_get(obj)); @@ -499,6 +509,7 @@ elm_scroller_add(Evas_Object *parent) // TODO: convert Elementary to subclassing of Evas_Smart_Class // TODO: and save some bytes, making descriptions per-class and not instance! evas_object_smart_callbacks_descriptions_set(obj, _signals); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); return obj; } diff --git a/src/lib/elm_separator.c b/src/lib/elm_separator.c index 6580bd3..e8f4750 100644 --- a/src/lib/elm_separator.c +++ b/src/lib/elm_separator.c @@ -18,6 +18,7 @@ struct _Widget_Data static const char *widtype = NULL; static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _theme_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); @@ -30,10 +31,19 @@ _del_hook(Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->sep, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); if (wd->horizontal) _elm_theme_object_set(obj, wd->sep, "separator", "horizontal", elm_widget_style_get(obj)); else @@ -88,6 +98,7 @@ elm_separator_add(Evas_Object *parent) wd->sep = edje_object_add(e); _elm_theme_object_set(obj, wd->sep, "separator", "vertical", "default"); elm_widget_resize_object_set(obj, wd->sep); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _sizing_eval(obj); return obj; } diff --git a/src/lib/elm_slider.c b/src/lib/elm_slider.c index 681298b..381ff82 100644 --- a/src/lib/elm_slider.c +++ b/src/lib/elm_slider.c @@ -63,6 +63,7 @@ struct _Widget_Data static const char *widtype = NULL; static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _theme_hook(Evas_Object *obj); static void _disable_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); @@ -184,10 +185,19 @@ _on_focus_hook(void *data __UNUSED__, Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->slider, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); if (wd->horizontal) _elm_theme_object_set(obj, wd->slider, "slider", "horizontal", elm_widget_style_get(obj)); else @@ -300,6 +310,7 @@ _delay_change(void *data) static void _val_fetch(Evas_Object *obj) { + Eina_Bool rtl; Widget_Data *wd = elm_widget_data_get(obj); double posx = 0.0, posy = 0.0, pos = 0.0, val; if (!wd) return; @@ -307,7 +318,11 @@ _val_fetch(Evas_Object *obj) &posx, &posy); if (wd->horizontal) pos = posx; else pos = posy; - if (wd->inverted) pos = 1.0 - pos; + + rtl = elm_widget_mirrored_get(obj); + if ((!rtl && wd->inverted) || (rtl && + ((!wd->horizontal && wd->inverted) || + (wd->horizontal && !wd->inverted)))) pos = 1.0 - pos; val = (pos * (wd->val_max - wd->val_min)) + wd->val_min; if (val != wd->val) { @@ -321,6 +336,7 @@ _val_fetch(Evas_Object *obj) static void _val_set(Evas_Object *obj) { + Eina_Bool rtl; Widget_Data *wd = elm_widget_data_get(obj); double pos; if (!wd) return; @@ -330,7 +346,11 @@ _val_set(Evas_Object *obj) pos = 0.0; if (pos < 0.0) pos = 0.0; else if (pos > 1.0) pos = 1.0; - if (wd->inverted) pos = 1.0 - pos; + + rtl = elm_widget_mirrored_get(obj); + if ((!rtl && wd->inverted) || (rtl && + ((!wd->horizontal && wd->inverted) || + (wd->horizontal && !wd->inverted)))) pos = 1.0 - pos; edje_object_part_drag_value_set(wd->slider, "elm.dragable.slider", pos, pos); } @@ -359,16 +379,16 @@ _indicator_set(Evas_Object *obj) { const char *buf; buf = wd->indicator_format_func(wd->val); - edje_object_part_text_set(wd->slider, "elm.indicator", buf); + edje_object_part_text_set(wd->slider, "elm.dragable.slider:elm.indicator", buf); } else if (wd->indicator) { char buf[1024]; snprintf(buf, sizeof(buf), wd->indicator, wd->val); - edje_object_part_text_set(wd->slider, "elm.indicator", buf); + edje_object_part_text_set(wd->slider, "elm.dragable.slider:elm.indicator", buf); } else - edje_object_part_text_set(wd->slider, "elm.indicator", NULL); + edje_object_part_text_set(wd->slider, "elm.dragable.slider:elm.indicator", NULL); } static void @@ -519,6 +539,7 @@ elm_slider_add(Evas_Object *parent) evas_object_event_callback_add(wd->spacer, EVAS_CALLBACK_MOUSE_DOWN, _spacer_cb, obj); evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _sizing_eval(obj); // TODO: convert Elementary to subclassing of Evas_Smart_Class diff --git a/src/lib/elm_slideshow.c b/src/lib/elm_slideshow.c index 79a2b80..19037d0 100644 --- a/src/lib/elm_slideshow.c +++ b/src/lib/elm_slideshow.c @@ -52,6 +52,7 @@ struct _Widget_Data static const char *widtype = NULL; static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _theme_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); @@ -133,10 +134,19 @@ _on_focus_hook(void *data __UNUSED__, Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->slideshow, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _elm_theme_object_set(obj, wd->slideshow, "slideshow", "base", elm_widget_style_get(obj)); edje_object_scale_set(wd->slideshow, elm_widget_scale_get(obj) * _elm_config->scale); @@ -335,6 +345,7 @@ elm_slideshow_add(Evas_Object *parent) evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); evas_object_event_callback_add(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _sizing_eval(obj); return obj; } diff --git a/src/lib/elm_spinner.c b/src/lib/elm_spinner.c index 3ce2ea3..4711e1a 100644 --- a/src/lib/elm_spinner.c +++ b/src/lib/elm_spinner.c @@ -56,6 +56,8 @@ static void _on_focus_hook(void *data, Evas_Object *obj); static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src, Evas_Callback_Type type, void *event_info); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); + static void _del_hook(Evas_Object *obj) { @@ -113,10 +115,19 @@ _signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *so } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->spinner, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _elm_theme_object_set(obj, wd->spinner, "spinner", "base", elm_widget_style_get(obj)); edje_object_part_swallow(wd->spinner, "elm.swallow.entry", wd->ent); _write_label(obj); @@ -296,9 +307,10 @@ _val_set(Evas_Object *obj) } static void -_drag(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +_drag(void *data, Evas_Object *_obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) { - Widget_Data *wd = elm_widget_data_get(data); + Evas_Object *obj = data; + Widget_Data *wd = elm_widget_data_get(obj); double pos = 0.0, offset, delta; if (!wd) return; if (wd->entry_visible) return; @@ -306,6 +318,9 @@ _drag(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, &pos, NULL); offset = wd->step; delta = (pos - wd->drag_start_pos) * offset; + /* If we are on rtl mode, change the delta to be negative on such changes */ + if (elm_widget_mirrored_get(obj)) + delta *= -1; if (_value_set(data, delta)) _write_label(data); wd->drag_start_pos = pos; wd->dragging = 1; @@ -620,6 +635,7 @@ elm_spinner_add(Evas_Object *parent) edje_object_signal_callback_add(wd->spinner, "elm,action,entry,toggle", "*", _toggle_entry, obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _write_label(obj); _sizing_eval(obj); return obj; diff --git a/src/lib/elm_table.c b/src/lib/elm_table.c index 8e296bc..1c80b22 100644 --- a/src/lib/elm_table.c +++ b/src/lib/elm_table.c @@ -21,6 +21,7 @@ static void _del_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _sub_del(void *data, Evas_Object *obj, void *event_info); +static void _theme_hook(Evas_Object *obj); static void _del_pre_hook(Evas_Object *obj) @@ -77,6 +78,22 @@ _elm_table_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (!wd->tbl)) + return; + + evas_object_table_mirrored_set(wd->tbl, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + _mirrored_set(obj, elm_widget_mirrored_get(obj)); +} + +static void _sizing_eval(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); @@ -137,6 +154,7 @@ elm_table_add(Evas_Object *parent) elm_widget_focus_next_hook_set(obj, _elm_table_focus_next_hook); elm_widget_can_focus_set(obj, EINA_FALSE); elm_widget_highlight_ignore_set(obj, EINA_FALSE); + elm_widget_theme_hook_set(obj, _theme_hook); wd->tbl = evas_object_table_add(e); evas_object_event_callback_add(wd->tbl, EVAS_CALLBACK_CHANGED_SIZE_HINTS, @@ -145,6 +163,7 @@ elm_table_add(Evas_Object *parent) evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); return obj; } diff --git a/src/lib/elm_toggle.c b/src/lib/elm_toggle.c index bfd2857..5024fdd 100644 --- a/src/lib/elm_toggle.c +++ b/src/lib/elm_toggle.c @@ -104,10 +104,19 @@ _on_focus_hook(void *data __UNUSED__, Evas_Object *obj) } static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->tgl, rtl); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _elm_theme_object_set(obj, wd->tgl, "toggle", "base", elm_widget_style_get(obj)); if (wd->icon) edje_object_signal_emit(wd->tgl, "elm,state,icon,visible", "elm"); @@ -225,6 +234,7 @@ elm_toggle_add(Evas_Object *parent) elm_widget_event_hook_set(obj, _event_hook); wd->tgl = edje_object_add(e); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); _elm_theme_object_set(obj, wd->tgl, "toggle", "base", "default"); wd->ontext = eina_stringshare_add("ON"); wd->offtext = eina_stringshare_add("OFF"); @@ -237,6 +247,7 @@ elm_toggle_add(Evas_Object *parent) edje_object_part_text_set(wd->tgl, "elm.offtext", wd->offtext); evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + edje_object_signal_emit(wd->tgl, "elm,state,toggle,off", "elm"); _sizing_eval(obj); diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c index 3031216..8923416 100644 --- a/src/lib/elm_toolbar.c +++ b/src/lib/elm_toolbar.c @@ -65,6 +65,8 @@ static void _item_unselect(Elm_Toolbar_Item *it); static void _item_disable(Elm_Toolbar_Item *it, Eina_Bool disabled); static void _del_pre_hook(Evas_Object *obj); static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool mirrored); +static void _mirrored_set_item(Evas_Object *obj, Elm_Toolbar_Item *it, Eina_Bool mirrored); static void _theme_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); static void _resize(void *data, Evas *e, Evas_Object *obj, void *event_info); @@ -263,12 +265,20 @@ _del_hook(Evas_Object *obj) static void +_mirrored_set_item(Evas_Object *obj __UNUSED__, Elm_Toolbar_Item *it, Eina_Bool mirrored) +{ + edje_object_mirrored_set(it->base.view, mirrored); + elm_widget_mirrored_set(it->o_menu, mirrored); +} + +static void _theme_hook_item(Evas_Object *obj, Elm_Toolbar_Item *it, double scale, int icon_size) { Evas_Object *view = it->base.view; Evas_Coord mw, mh; const char *style = elm_widget_style_get(obj); + _mirrored_set_item(obj, it, elm_widget_mirrored_get(obj)); edje_object_scale_set(view, scale); if (!it->separator) { @@ -308,6 +318,18 @@ _theme_hook_item(Evas_Object *obj, Elm_Toolbar_Item *it, double scale, int icon_ } static void +_mirrored_set(Evas_Object *obj, Eina_Bool mirrored) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Toolbar_Item *it; + + EINA_INLIST_FOREACH(wd->items, it) + _mirrored_set_item(obj, it, mirrored); + if (wd->more_item) + _mirrored_set_item(obj, wd->more_item, mirrored); +} + +static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); @@ -316,6 +338,7 @@ _theme_hook(Evas_Object *obj) if (!wd) return; elm_smart_scroller_object_theme_set(obj, wd->scr, "toolbar", "base", elm_widget_style_get(obj)); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); scale = (elm_widget_scale_get(obj) * _elm_config->scale); edje_object_scale_set(wd->scr, scale); wd->icon_size = _elm_toolbar_icon_size_get(wd); @@ -434,6 +457,7 @@ _resize_job(void *data) Widget_Data *wd = elm_widget_data_get(data); Evas_Coord mw, mh, vw, vh, w, h; Elm_Toolbar_Item *it; + Evas_Object *obj = (Evas_Object *) data; if (!wd) return; wd->resize_job = NULL; @@ -541,6 +565,8 @@ _resize_job(void *data) } } } + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); } static void @@ -583,9 +609,10 @@ _mouse_out(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSE static void _layout(Evas_Object *o, Evas_Object_Box_Data *priv, void *data) { - Widget_Data *wd = data; + Evas_Object *obj = (Evas_Object *) data; + Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - _els_box_layout(o, priv, 1, wd->homogeneous); + _els_box_layout(o, priv, 1, wd->homogeneous, elm_widget_mirrored_get(obj)); } static Elm_Toolbar_Item * @@ -710,7 +737,7 @@ elm_toolbar_add(Evas_Object *parent) wd->bx = evas_object_box_add(e); evas_object_size_hint_align_set(wd->bx, wd->align, 0.5); - evas_object_box_layout_set(wd->bx, _layout, wd, NULL); + evas_object_box_layout_set(wd->bx, _layout, obj, NULL); elm_widget_sub_object_add(obj, wd->bx); elm_smart_scroller_child_set(wd->scr, wd->bx); evas_object_show(wd->bx); diff --git a/src/lib/els_box.c b/src/lib/els_box.c index 46b47aa..7cb07ef 100644 --- a/src/lib/els_box.c +++ b/src/lib/els_box.c @@ -45,7 +45,7 @@ _smart_extents_calculate(Evas_Object *box, Evas_Object_Box_Data *priv, int horiz } void -_els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, int horizontal, int homogeneous) +_els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, int horizontal, int homogeneous, int rtl) { Evas_Coord x, y, w, h, xx, yy; const Eina_List *l; @@ -123,30 +123,14 @@ _els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, int horizontal, int if (wy > 0.0) xh = 1; if (horizontal) { + Evas_Coord ww, hh, ow, oh; + if (homogeneous) { - Evas_Coord ww, hh, ow, oh; - ww = (w / (Evas_Coord)count); - hh = h; - ow = mnw; - if (fw) ow = ww; - if ((mxw >= 0) && (mxw < ow)) - ow = mxw; - oh = mnh; - if (fh) oh = hh; - if ((mxh >= 0) && (mxh < oh)) - oh = mxh; - evas_object_move(obj, - xx + (Evas_Coord)(((double)(ww - ow)) * ax), - yy + (Evas_Coord)(((double)(hh - oh)) * ay)); - evas_object_resize(obj, ow, oh); - xx += ww; } else { - Evas_Coord ww, hh, ow, oh; - ww = mnw; if ((expand > 0) && (xw)) { @@ -155,45 +139,31 @@ _els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, int horizontal, int wdif -= ow; ww += ow; } - hh = h; - ow = mnw; - if (fw) ow = ww; - if ((mxw >= 0) && (mxw < ow)) ow = mxw; - oh = mnh; - if (fh) oh = hh; - if ((mxh >= 0) && (mxh < oh)) oh = mxh; - evas_object_move(obj, - xx + (Evas_Coord)(((double)(ww - ow)) * ax), - yy + (Evas_Coord)(((double)(hh - oh)) * ay)); - evas_object_resize(obj, ow, oh); - xx += ww; } + hh = h; + ow = mnw; + if (fw) ow = ww; + if ((mxw >= 0) && (mxw < ow)) ow = mxw; + oh = mnh; + if (fh) oh = hh; + if ((mxh >= 0) && (mxh < oh)) oh = mxh; + evas_object_move(obj, + ((!rtl) ? (xx) : (x + (w - (xx - x) - ww))) + + (Evas_Coord)(((double)(ww - ow)) * ax), + yy + (Evas_Coord)(((double)(hh - oh)) * ay)); + evas_object_resize(obj, ow, oh); + xx += ww; } else { + Evas_Coord ww, hh, ow, oh; + if (homogeneous) { - Evas_Coord ww, hh, ow, oh; - - ww = w; hh = (h / (Evas_Coord)count); - ow = mnw; - if (fw) ow = ww; - if ((mxw >= 0) && (mxw < ow)) ow = mxw; - oh = mnh; - if (fh) oh = hh; - if ((mxh >= 0) && (mxh < oh)) oh = mxh; - evas_object_move(obj, - xx + (Evas_Coord)(((double)(ww - ow)) * ax), - yy + (Evas_Coord)(((double)(hh - oh)) * ay)); - evas_object_resize(obj, ow, oh); - yy += hh; } else { - Evas_Coord ww, hh, ow, oh; - - ww = w; hh = mnh; if ((expand > 0) && (xh)) { @@ -202,18 +172,19 @@ _els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, int horizontal, int hdif -= oh; hh += oh; } - ow = mnw; - if (fw) ow = ww; - if ((mxw >= 0) && (mxw < ow)) ow = mxw; - oh = mnh; - if (fh) oh = hh; - if ((mxh >= 0) && (mxh < oh)) oh = mxh; - evas_object_move(obj, - xx + (Evas_Coord)(((double)(ww - ow)) * ax), - yy + (Evas_Coord)(((double)(hh - oh)) * ay)); - evas_object_resize(obj, ow, oh); - yy += hh; } + ww = w; + ow = mnw; + if (fw) ow = ww; + if ((mxw >= 0) && (mxw < ow)) ow = mxw; + oh = mnh; + if (fh) oh = hh; + if ((mxh >= 0) && (mxh < oh)) oh = mxh; + evas_object_move(obj, + xx + (Evas_Coord)(((double)(ww - ow)) * ax), + yy + (Evas_Coord)(((double)(hh - oh)) * ay)); + evas_object_resize(obj, ow, oh); + yy += hh; } } } diff --git a/src/lib/els_box.h b/src/lib/els_box.h index e394884..026f3af 100644 --- a/src/lib/els_box.h +++ b/src/lib/els_box.h @@ -1 +1 @@ -void _els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, int horizontal, int homogeneous); +void _els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, int horizontal, int homogeneous, int rtl); diff --git a/src/lib/els_scroller.c b/src/lib/els_scroller.c index bf173c1..f6b2079 100644 --- a/src/lib/els_scroller.c +++ b/src/lib/els_scroller.c @@ -168,7 +168,7 @@ void elm_smart_scroller_mirrored_set(Evas_Object *obj, Eina_Bool mirrored) { API_ENTRY return; - Evas_Coord px, py, wx; + Evas_Coord wx; if (sd->is_mirrored == mirrored) return;