diff --git a/legacy/elementary/data/themes/default.edc b/legacy/elementary/data/themes/default.edc index cf20ecaf1f..b11ab3c9d5 100644 --- a/legacy/elementary/data/themes/default.edc +++ b/legacy/elementary/data/themes/default.edc @@ -23427,6 +23427,337 @@ collections { } } + group { + name: "elm/panes/horizontal/default"; + images { + image: "bt_base1.png" COMP; + image: "bt_base2.png" COMP; + image: "bt_hilight.png" COMP; + image: "bt_shine.png" COMP; + image: "bt_glow.png" COMP; + image: "bt_dis_base.png" COMP; + image: "bt_dis_hilight.png" COMP; + image: "arrow_up.png" COMP; + image: "arrow_down.png" COMP; + } + parts + { + part + { + name: "whole"; + type: RECT; + mouse_events: 0; + description + { + state: "default" 0.0; + visible: 0; + } + } + + //2 contents + part + { + name: "whole_left"; + type: RECT; + mouse_events: 0; + description + { + state: "default" 0.0; + rel2.to_y: "elm.bar"; + rel2.relative: 1.0 0.0; + visible: 1; + } + } + part + { + name: "elm.swallow.left"; + type: SWALLOW; + clip_to: "whole_left"; + description + { + state: "default" 0.0; + rel1.to: "whole_left"; + rel2.to: "whole_left"; + } + } + + part + { + name: "whole_right"; + type: RECT; + mouse_events: 0; + description + { + state: "default" 0.0; + rel1.to_y: "elm.bar"; + rel1.relative: 0.0 1.0; + visible: 1; + } + } + part + { + name: "elm.swallow.right"; + type: SWALLOW; + clip_to: "whole_right"; + description + { + state: "default" 0.0; + rel1.to: "whole_right"; + rel2.to: "whole_right"; + } + } + //BAR + part { name: "elm.bar"; + mouse_events: 1; + dragable { + confine: "whole"; + x: 0 0 0; + y: 1 1 1; + } + description { state: "default" 0.0; + max: 999 15; + min: 100 15; + rel1.relative: 0.5 0.0; + rel2.relative: 0.5 1.0; + image { + normal: "bt_base2.png"; + border: 7 7 7 7; + } + image.middle: SOLID; + } + description { state: "clicked" 0.0; + inherit: "default" 0.0; + image.normal: "bt_base1.png"; + image.middle: SOLID; + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + image { + normal: "bt_dis_base.png"; + border: 4 4 4 4; + } + } + } + part { name: "over1"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "elm.bar"; + rel2.to: "elm.bar"; + rel2.relative: 1.0 0.5; + image { + normal: "bt_hilight.png"; + border: 7 7 7 0; + } + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + image { + normal: "bt_dis_hilight.png"; + border: 4 4 4 0; + } + } + } + part { name: "over2"; + mouse_events: 1; + repeat_events: 1; + ignore_flags: ON_HOLD; + description { state: "default" 0.0; + rel1.to: "elm.bar"; + rel2.to: "elm.bar"; + image { + normal: "bt_shine.png"; + border: 7 7 7 7; + } + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + visible: 0; + } + } + part { name: "over3"; + mouse_events: 1; + repeat_events: 1; + description { state: "default" 0.0; + color: 255 255 255 0; + rel1.to: "elm.bar"; + rel2.to: "elm.bar"; + image { + normal: "bt_glow.png"; + border: 12 12 12 12; + } + fill.smooth : 0; + } + description { state: "clicked" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 255; + } + } + + //Arrow + part { + name: "arrow_right"; + description { state: "default" 0.0; + min: 45 45; + max: 45 45; + color: 255 255 255 0; + + rel1.relative: 0.5 1.0; + rel1.to_y: "elm.bar"; + rel1.offset: -45/2 45/2; + + rel2.relative: 0.5 1.0; + rel2.to_y: "elm.bar"; + rel2.offset: 45/2 45/2; + + image.normal: "arrow_down.png"; + + fixed: 1 1; + } + description { state: "anim_1" 0.0; + inherit: "default" 0.0; + color: 255 255 255 200; + rel1.offset: -45/2 (45/2 +10); + rel2.offset: 45/2 (45/2 +10); + } + description { state: "anim_2" 0.0; + inherit: "default" 0.0; + color: 255 255 255 0; + rel1.offset: -45/2 (45/2 + 20); + rel2.offset: 45/2 (45/2 + 20); + } + } + part { + name: "arrow_left"; + description { state: "default" 0.0; + min: 45 45; + max: 45 45; + color: 255 255 255 0; + + rel1.relative: 0.5 0.0; + rel1.to_y: "elm.bar"; + rel1.offset: -45/2 -45/2; + + rel2.relative: 0.5 0.0; + rel2.to_y: "elm.bar"; + rel2.offset: 45/2 -45/2; + + image.normal: "arrow_up.png"; + + fixed: 1 1; + } + description { state: "anim_1" 0.0; + inherit: "default" 0.0; + color: 255 255 255 200; + rel1.offset: -45/2 (-45/2 - 10); + rel2.offset: 45/2 (-45/2 - 10); + } + description { state: "anim_2" 0.0; + inherit: "default" 0.0; + color: 255 255 255 0; + rel1.offset: -45/2 (-45/2 - 20); + rel2.offset: 45/2 (-45/2 - 20); + } + } + + } + programs { + program { + name: "button_click"; + signal: "mouse,down,1"; + source: "over2"; + action: SIGNAL_EMIT "elm,action,press" ""; + after: "button_click_anim"; + after: "arrow_anim_start"; + } + program { + name: "button_click_anim"; + action: STATE_SET "clicked" 0.0; + target: "elm.bar"; + } + program { + name: "button_unclick"; + signal: "mouse,up,1"; + source: "over2"; + action: SIGNAL_EMIT "elm,action,unpress" ""; + after: "button_unclick_anim"; + after: "arrow_anim_stop"; + } + program { + name: "button_unclick_anim"; + action: STATE_SET "default" 0.0; + target: "elm.bar"; + } + program { + name: "button_click2"; + signal: "mouse,down,1"; + source: "over3"; + action: STATE_SET "clicked" 0.0; + target: "over3"; + } + program { + name: "button_unclick2"; + signal: "mouse,up,1"; + source: "over3"; + action: STATE_SET "default" 0.0; + transition: DECELERATE 0.5; + target: "over3"; + } + program { + name: "button_unclick3"; + signal: "mouse,up,1"; + source: "over2"; + action: SIGNAL_EMIT "elm,action,click" ""; + } + program { + name: "button_down_double"; + signal: "mouse,down,1,double"; + source: "over3"; + action: SIGNAL_EMIT "elm,action,click,double" ""; + } + + //arrows animation + program { + name: "arrow_anim_start"; + action: STATE_SET "anim_1" 0.0; + target: "arrow_right"; + target: "arrow_left"; + transition: LINEAR 0.6; + after: "arrow_anim_1"; + } + program { + name: "arrow_anim_1"; + action: STATE_SET "anim_2" 0.0; + target: "arrow_right"; + target: "arrow_left"; + transition: LINEAR 0.6; + after: "arrow_anim_2"; + } + program { + name: "arrow_anim_2"; + action: STATE_SET "default" 0.0; + target: "arrow_right"; + target: "arrow_left"; + after: "arrow_anim_start"; + } + program { + name: "arrow_anim_stop"; + action: ACTION_STOP; + target: "arrow_anim_start"; + target: "arrow_anim_1"; + target: "arrow_anim_2"; + after: "arrow_anim_stop_1"; + } + program { + name: "arrow_anim_stop_1"; + action: STATE_SET "default" 0.0; + target: "arrow_right"; + target: "arrow_left"; + transition: DECELERATE 0.4; + } + } + } + ///////////////////////////////////////////////////////////////////////////// diff --git a/legacy/elementary/src/bin/test_panes.c b/legacy/elementary/src/bin/test_panes.c index bb4da5f355..e236946717 100644 --- a/legacy/elementary/src/bin/test_panes.c +++ b/legacy/elementary/src/bin/test_panes.c @@ -39,7 +39,7 @@ _clicked_double(void *data, Evas_Object *obj, void *event_info) void test_panes(void *data, Evas_Object *obj, void *event_info) { - Evas_Object *win, *bg, *panes, *bt; + Evas_Object *win, *bg, *panes, *panes_h, *bt; char buf[PATH_MAX]; Evas_Object *list; @@ -65,19 +65,47 @@ test_panes(void *data, Evas_Object *obj, void *event_info) evas_object_smart_callback_add(panes, "unpress", _unpress, panes); + // bt = elm_button_add(win); elm_button_label_set(bt, "Left"); evas_object_size_hint_weight_set(bt, 1.0, 1.0); evas_object_size_hint_align_set(bt, -1.0, -1.0); evas_object_show(bt); elm_panes_content_left_set(panes, bt); + // + // + panes_h = elm_panes_add(win); + elm_panes_horizontal_set(panes_h, EINA_TRUE); + evas_object_size_hint_weight_set(panes_h, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(panes_h, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(panes_h); + + evas_object_smart_callback_add(panes_h, "clicked", _clicked, panes_h); + evas_object_smart_callback_add(panes_h, "clicked,double", _clicked_double, panes_h); + + evas_object_smart_callback_add(panes_h, "press", _press, panes_h); + evas_object_smart_callback_add(panes_h, "unpress", _unpress, panes_h); + elm_panes_content_right_set(panes, panes_h); + // + + // bt = elm_button_add(win); - elm_button_label_set(bt, "Right"); + elm_button_label_set(bt, "Up"); evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(bt); - elm_panes_content_right_set(panes, bt); + elm_panes_content_left_set(panes_h, bt); + // + + // + bt = elm_button_add(win); + elm_button_label_set(bt, "Down"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bt); + elm_panes_content_right_set(panes_h, bt); + // evas_object_resize(win, 320, 400); diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in index 1ad3e78c5a..63c7b11f13 100644 --- a/legacy/elementary/src/lib/Elementary.h.in +++ b/legacy/elementary/src/lib/Elementary.h.in @@ -1480,6 +1480,8 @@ extern "C" { EAPI void elm_panes_content_right_set(Evas_Object *obj, Evas_Object *content); EAPI double elm_panes_content_left_size_get(Evas_Object *obj); EAPI void elm_panes_content_left_size_set(Evas_Object *obj, double size); + EAPI void elm_panes_horizontal_set(Evas_Object *obj, Eina_Bool horizontal); + typedef enum _Elm_Flip_Mode { diff --git a/legacy/elementary/src/lib/elm_panes.c b/legacy/elementary/src/lib/elm_panes.c index 7fe93e77b5..83494682ec 100644 --- a/legacy/elementary/src/lib/elm_panes.c +++ b/legacy/elementary/src/lib/elm_panes.c @@ -29,6 +29,7 @@ struct _Widget_Data } move; Eina_Bool clicked_double; + Eina_Bool horizontal; }; static const char *widtype = NULL; @@ -50,7 +51,17 @@ _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - _elm_theme_object_set(obj, wd->panes, "panes", "vertical", "default"); + + if(wd->horizontal) + _elm_theme_object_set(obj, wd->panes, "panes", "horizontal", "default"); + else + _elm_theme_object_set(obj, wd->panes, "panes", "vertical", "default"); + + if(wd->contents.left) + edje_object_part_swallow(wd->panes, "elm.swallow.left", wd->contents.right); + if(wd->contents.right) + edje_object_part_swallow(wd->panes, "elm.swallow.right", wd->contents.right); + edje_object_scale_set(wd->panes, elm_widget_scale_get(obj) * _elm_config->scale); _sizing_eval(obj); @@ -215,14 +226,29 @@ EAPI double elm_panes_content_left_size_get(Evas_Object *obj) edje_object_part_drag_value_get(wd->panes, "elm.bar", &w, &h); - return w; + if(wd->horizontal) + return h; + else + return w; } EAPI void elm_panes_content_left_size_set(Evas_Object *obj, double size) { Widget_Data *wd = elm_widget_data_get(obj); - edje_object_part_drag_value_set(wd->panes, "elm.bar", size, 0.0); + if(wd->horizontal) + edje_object_part_drag_value_set(wd->panes, "elm.bar", 0.0, size); + else + edje_object_part_drag_value_set(wd->panes, "elm.bar", size, 0.0); +} + +EAPI void elm_panes_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + wd->horizontal = horizontal; + _theme_hook(obj); + elm_panes_content_left_size_set(obj, 0.5); }