diff --git a/legacy/elementary/data/themes/Makefile.am b/legacy/elementary/data/themes/Makefile.am index 55cf9f5d75..18f83a50f2 100644 --- a/legacy/elementary/data/themes/Makefile.am +++ b/legacy/elementary/data/themes/Makefile.am @@ -206,8 +206,11 @@ color_picker_alpha.png \ color_picker_alpha_bg.png \ color_picker_brightness.png \ color_picker_color.png \ -color_picker_opacity.png - +color_picker_opacity.png \ +icon_arrow_down_left.png \ +icon_arrow_down_right.png \ +icon_arrow_up_left.png \ +icon_arrow_up_right.png default.edj: Makefile $(EXTRA_DIST) $(EDJE_CC) $(EDJE_FLAGS) \ diff --git a/legacy/elementary/data/themes/default.edc b/legacy/elementary/data/themes/default.edc index 523fd373ff..9cf5ea406e 100644 --- a/legacy/elementary/data/themes/default.edc +++ b/legacy/elementary/data/themes/default.edc @@ -7002,6 +7002,1044 @@ collections { } } +/////////////////////////////////////////////////////////////////////////////// + group { name: "elm/hover/base/hoverlist/default"; + images { + image: "bt_base2.png" COMP; + image: "bt_hilight.png" COMP; + image: "bt_shine.png" COMP; + image: "icon_arrow_left.png" COMP; + image: "icon_arrow_up_left.png" COMP; + image: "icon_arrow_up.png" COMP; + image: "icon_arrow_up_right.png" COMP; + image: "icon_arrow_right.png" COMP; + image: "icon_arrow_down_right.png" COMP; + image: "icon_arrow_down.png" COMP; + image: "icon_arrow_down_left.png" COMP; + } + parts { + part { name: "elm.swallow.offset"; + type: SWALLOW; + description { state: "default" 0.0; + align: 0.0 0.0; + rel1.relative: 0.0 0.0; + rel2.relative: 0.0 0.0; + } + } + part { name: "elm.swallow.size"; + type: SWALLOW; + description { state: "default" 0.0; + align: 0.0 0.0; + rel1.to: "elm.swallow.offset"; + rel1.relative: 1.0 1.0; + rel2.to: "elm.swallow.offset"; + rel2.relative: 1.0 1.0; + } + } + part { name: "button_image"; + mouse_events: 1; + description { state: "default" 0.0; + image { + normal: "bt_base2.png"; + border: 7 7 7 7; + } + image.middle: SOLID; + } + description { state: "top-left" 0.0; + inherit: "default" 0.0; + visible: 1; + rel1.to: "elm.swallow.slot.top-left"; + rel1.offset: -2 -6; + rel2.to: "elm.swallow.slot.top-left"; + rel2.offset: 1 7; + } + description { state: "top" 0.0; + inherit: "default" 0.0; + visible: 1; + rel1.to: "elm.swallow.slot.top"; + rel1.offset: -2 -6; + rel2.to: "elm.swallow.slot.top"; + rel2.offset: 1 7; + } + description { state: "top-right" 0.0; + inherit: "default" 0.0; + visible: 1; + rel1.to: "elm.swallow.slot.top-right"; + rel1.offset: -2 -6; + rel2.to: "elm.swallow.slot.top-right"; + rel2.offset: 1 7; + } + description { state: "right" 0.0; + inherit: "default" 0.0; + visible: 1; + rel1.to: "elm.swallow.slot.right"; + rel1.offset: -2 -6; + rel2.to: "elm.swallow.slot.right"; + rel2.offset: 1 7; + } + description { state: "bottom-right" 0.0; + inherit: "default" 0.0; + visible: 1; + rel1.to: "elm.swallow.slot.bottom-right"; + rel1.offset: -2 -6; + rel2.to: "elm.swallow.slot.bottom-right"; + rel2.offset: 1 7; + } + description { state: "bottom" 0.0; + inherit: "default" 0.0; + visible: 1; + rel1.to: "elm.swallow.slot.bottom"; + rel1.offset: -2 -6; + rel2.to: "elm.swallow.slot.bottom"; + rel2.offset: 1 7; + } + description { state: "bottom-left" 0.0; + inherit: "default" 0.0; + visible: 1; + rel1.to: "elm.swallow.slot.bottom-left"; + rel1.offset: -2 -6; + rel2.to: "elm.swallow.slot.bottom-left"; + rel2.offset: 1 7; + } + description { state: "left" 0.0; + inherit: "default" 0.0; + visible: 1; + rel1.to: "elm.swallow.slot.left"; + rel1.offset: -2 -6; + rel2.to: "elm.swallow.slot.left"; + rel2.offset: 1 7; + } + } + part { name: "base"; + type: RECT; + mouse_events: 1; + description { state: "default" 0.0; + color: 0 0 0 0; + } + description { state: "visible" 0.0; + inherit: "default" 1.0; + color: 0 0 0 64; + } + } + part { name: "elm.swallow.slot.left"; + type: SWALLOW; + description { state: "default" 0.0; + align: 1.0 0.5; + rel1.to: "elm.swallow.slot.middle"; + rel1.relative: 0.0 0.0; + rel1.offset: -1 0; + rel2.to: "elm.swallow.slot.middle"; + rel2.relative: 0.0 1.0; + rel2.offset: -1 -1; + } + } + part { name: "elm.swallow.slot.top-left"; + type: SWALLOW; + description { state: "default" 0.0; + align: 1.0 1.0; + rel1.to: "elm.swallow.slot.middle"; + rel1.relative: 0.0 0.0; + rel1.offset: 0 0; + rel2.to: "elm.swallow.slot.middle"; + rel2.relative: 0.0 0.0; + rel2.offset: -1 -1; + } + } + part { name: "elm.swallow.slot.top"; + type: SWALLOW; + description { state: "default" 0.0; + align: 0.5 1.0; + rel1.to: "elm.swallow.slot.middle"; + rel1.relative: 0.0 0.0; + rel1.offset: 0 -1; + rel2.to: "elm.swallow.slot.middle"; + rel2.relative: 1.0 0.0; + rel2.offset: -1 -1; + } + } + part { name: "elm.swallow.slot.top-right"; + type: SWALLOW; + description { state: "default" 0.0; + align: 0.0 1.0; + rel1.to: "elm.swallow.slot.middle"; + rel1.relative: 1.0 0.0; + rel1.offset: 0 0; + rel2.to: "elm.swallow.slot.middle"; + rel2.relative: 1.0 0.0; + rel2.offset: -1 -1; + } + } + part { name: "elm.swallow.slot.right"; + type: SWALLOW; + description { state: "default" 0.0; + align: 0.0 0.5; + rel1.to: "elm.swallow.slot.middle"; + rel1.relative: 1.0 0.0; + rel1.offset: 0 0; + rel2.to: "elm.swallow.slot.middle"; + rel2.relative: 1.0 1.0; + rel2.offset: 0 -1; + } + } + part { name: "elm.swallow.slot.bottom-right"; + type: SWALLOW; + description { state: "default" 0.0; + align: 0.0 0.0; + rel1.to: "elm.swallow.slot.middle"; + rel1.relative: 1.0 1.0; + rel1.offset: 0 0; + rel2.to: "elm.swallow.slot.middle"; + rel2.relative: 1.0 1.0; + rel2.offset: -1 -1; + } + } + part { name: "elm.swallow.slot.bottom"; + type: SWALLOW; + description { state: "default" 0.0; + align: 0.5 0.0; + rel1.to: "elm.swallow.slot.middle"; + rel1.relative: 0.0 1.0; + rel1.offset: 0 0; + rel2.to: "elm.swallow.slot.middle"; + rel2.relative: 1.0 1.0; + rel2.offset: -1 0; + } + } + part { name: "elm.swallow.slot.bottom-left"; + type: SWALLOW; + description { state: "default" 0.0; + align: 1.0 0.0; + rel1.to: "elm.swallow.slot.middle"; + rel1.relative: 0.0 1.0; + rel1.offset: 0 0; + rel2.to: "elm.swallow.slot.middle"; + rel2.relative: 0.0 1.0; + rel2.offset: -1 0; + } + } + part { name: "over1"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "button_image"; + rel2.to: "button_image"; + rel2.relative: 1.0 0.5; + image { + normal: "bt_hilight.png"; + border: 7 7 7 0; + } + } + } + part { name: "over2"; + mouse_events: 1; + repeat_events: 1; + ignore_flags: ON_HOLD; + description { state: "default" 0.0; + rel1.to: "button_image"; + rel2.to: "button_image"; + image { + normal: "bt_shine.png"; + border: 7 7 7 7; + } + } + } + part { name: "elm.swallow.slot.middle"; + type: SWALLOW; + description { state: "default" 0.0; + rel1.to: "elm.swallow.size"; + rel2.to: "elm.swallow.size"; + } + } + part { name: "arrow"; + mouse_events: 0; + description { state: "default" 0.0; + visible: 0; + min: 40 40; + max: 40 40; + } + description { state: "left" 0.0; + inherit: "default" 0.0; + visible: 1; + align: 0.0 0.5; + rel1.to: "elm.swallow.slot.left"; + rel1.relative: 1.0 0.0; + rel1.offset: 0 0; + rel2.to: "elm.swallow.slot.left"; + rel2.relative: 1.0 1.0; + rel2.offset: 0 -1; + image.normal: "icon_arrow_right.png"; + } + description { state: "top-left" 0.0; + inherit: "default" 0.0; + visible: 1; + align: 0.0 0.0; + rel1.to: "elm.swallow.slot.top-left"; + rel1.relative: 1.0 1.0; + rel1.offset: -5 5; + rel2.to: "elm.swallow.slot.top-left"; + rel2.relative: 1.0 1.0; + rel2.offset: -4 4; + image.normal: "icon_arrow_down_right.png"; + } + description { state: "top" 0.0; + inherit: "default" 0.0; + visible: 1; + align: 0.5 0.0; + rel1.to: "elm.swallow.slot.top"; + rel1.relative: 0.0 1.0; + rel1.offset: 0 0; + rel2.to: "elm.swallow.slot.top"; + rel2.relative: 1.0 1.0; + rel2.offset: -1 0; + image.normal: "icon_arrow_down.png"; + } + description { state: "top-right" 0.0; + inherit: "default" 0.0; + visible: 1; + align: 1.0 0.0; + rel1.to: "elm.swallow.slot.top-right"; + rel1.relative: 0.0 1.0; + rel1.offset: 5 5; + rel2.to: "elm.swallow.slot.top-right"; + rel2.relative: 0.0 1.0; + rel2.offset: 4 4; + image.normal: "icon_arrow_down_left.png"; + } + description { state: "right" 0.0; + inherit: "default" 0.0; + visible: 1; + align: 1.0 0.5; + rel1.to: "elm.swallow.slot.right"; + rel1.relative: 0.0 0.0; + rel1.offset: 0 0; + rel2.to: "elm.swallow.slot.right"; + rel2.relative: 0.0 1.0; + rel2.offset: 0 -1; + image.normal: "icon_arrow_left.png"; + } + description { state: "bottom-right" 0.0; + inherit: "default" 0.0; + visible: 1; + align: 1.0 1.0; + rel1.to: "elm.swallow.slot.bottom-right"; + rel1.relative: 0.0 0.0; + rel1.offset: 5 5; + rel2.to: "elm.swallow.slot.bottom-right"; + rel2.relative: 0.0 0.0; + rel2.offset: 4 4; + image.normal: "icon_arrow_up_left.png"; + } + description { state: "bottom" 0.0; + inherit: "default" 0.0; + visible: 1; + align: 0.5 1.0; + rel1.to: "elm.swallow.slot.bottom"; + rel1.relative: 0.0 0.0; + rel1.offset: 0 -1; + rel2.to: "elm.swallow.slot.bottom"; + rel2.relative: 1.0 0.0; + rel2.offset: -1 -1; + image.normal: "icon_arrow_up.png"; + } + description { state: "bottom-left" 0.0; + inherit: "default" 0.0; + visible: 1; + align: 0.0 1.0; + rel1.to: "elm.swallow.slot.bottom-left"; + rel1.relative: 1.0 0.0; + rel1.offset: -5 5; + rel2.to: "elm.swallow.slot.bottom-left"; + rel2.relative: 1.0 0.0; + rel2.offset: -4 4; + image.normal: "icon_arrow_up_right.png"; + } + } + } + programs { + program { name: "end"; + signal: "mouse,up,1"; + source: "base"; + action: SIGNAL_EMIT "elm,action,dismiss" ""; + } + program { name: "show"; + signal: "elm,action,show"; + source: "elm"; + action: STATE_SET "visible" 0.0; + target: "base"; + } + program { name: "hide"; + signal: "elm,action,hide"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "base"; + } + program { name: "all-hide"; + action: STATE_SET "default" 0.0; + target: "button_image"; + } + program { name: "top-left-show"; + signal: "elm,action,slot,top-left,show"; + source: "elm"; + action: STATE_SET "top-left" 0.0; + target: "arrow"; + target: "button_image"; + } + program { name: "top-show"; + signal: "elm,action,slot,top,show"; + source: "elm"; + action: STATE_SET "top" 0.0; + target: "arrow"; + target: "button_image"; + } + program { name: "top-right-show"; + signal: "elm,action,slot,top-right,show"; + source: "elm"; + action: STATE_SET "top-right" 0.0; + target: "arrow"; + target: "button_image"; + } + program { name: "right-show"; + signal: "elm,action,slot,right,show"; + source: "elm"; + action: STATE_SET "right" 0.0; + target: "arrow"; + target: "button_image"; + } + program { name: "bottom-right-show"; + signal: "elm,action,slot,bottom-right,show"; + source: "elm"; + action: STATE_SET "bottom-right" 0.0; + target: "arrow"; + target: "button_image"; + } + program { name: "bottom-show"; + signal: "elm,action,slot,bottom,show"; + source: "elm"; + action: STATE_SET "bottom" 0.0; + target: "arrow"; + target: "button_image"; + } + program { name: "bottom-left-show"; + signal: "elm,action,slot,bottom-left,show"; + source: "elm"; + action: STATE_SET "bottom-left" 0.0; + target: "arrow"; + target: "button_image"; + after: "blah"; + } + program { name: "blah"; + action: SIGNAL_EMIT "elm,action,fuckyou" "blah"; + } + program { name: "left-show"; + signal: "elm,action,slot,left,show"; + source: "elm"; + action: STATE_SET "left" 0.0; + target: "arrow"; + target: "button_image"; + } + } + } + +/////////////////////////////////////////////////////////////////////////////// + group { name: "elm/list/item/hoverlist"; + alias: "elm/list/item_odd/hoverlist"; + alias: "elm/list/h_item/hoverlist"; + alias: "elm/list/h_item_odd/hoverlist"; + parts { + part { name: "button_image"; + mouse_events: 1; + clip_to: "disclip"; + description { state: "default" 0.0; + color: 255 255 255 0; + image.normal: "hoversel_entry_bg.png"; + image.border: 0 0 2 2; + fill.smooth: 0; + } + description { state: "selected" 0.0; + inherit: "default" 0.0; + color: 255 255 255 255; + } + } + part { name: "elm.swallow.icon"; + type: SWALLOW; + clip_to: "disclip"; + description { state: "default" 0.0; + fixed: 1 0; + align: 0.0 0.5; + rel1 { + relative: 0.0 0.0; + offset: 4 4; + } + rel2 { + relative: 0.0 1.0; + offset: 4 -5; + } + } + } + part { name: "elm.text"; + type: TEXT; + effect: SOFT_SHADOW; + mouse_events: 0; + scale: 1; + clip_to: "disclip"; + description { + state: "default" 0.0; + rel1 { + to_x: "elm.swallow.icon"; + relative: 1.0 0.0; + offset: 4 4; + } + rel2 { + offset: -5 -5; + } + color: 224 224 224 255; + color3: 0 0 0 64; + text { + font: "Sans,Edje-Vera"; + size: 10; + min: 1 1; + align: 0.0 0.5; + } + } + description { state: "selected" 0.0; + inherit: "default" 0.0; + text.min: 1 1; + color: 0 0 0 255; + color3: 0 0 0 0; + } + } + part { name: "event"; + type: RECT; + repeat_events: 1; + description { + state: "default" 0.0; + color: 0 0 0 0; + } + } + part { name: "disclip"; + type: RECT; + repeat_events: 1; + description { state: "default" 0.0; + rel1.to: "event"; + rel2.to: "event"; + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + color: 255 255 255 64; + } + } + } + programs { + program { + name: "go_active"; + signal: "elm,state,selected"; + source: "elm"; + action: STATE_SET "selected" 0.0; + target: "elm.text"; + target: "button_image"; + } + program { + name: "item_unclick"; + signal: "mouse,up,1"; + source: "event"; + action: STATE_SET "default" 0.0; + target: "button_image"; + target: "elm.text"; + } + program { + name: "go_passive"; + signal: "elm,state,unselected"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.text"; + target: "button_image"; + transition: LINEAR 0.1; + } + program { + name: "go_disabled"; + signal: "elm,state,disabled"; + source: "elm"; + action: STATE_SET "disabled" 0.0; + target: "disclip"; + } + program { + name: "go_enabled"; + signal: "elm,state,enabled"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "disclip"; + } + } + } + +/////////////////////////////////////////////////////////////////////////////// + group { name: "elm/list/base/hoverlist"; + data { + item: "focus_highlight" "on"; + } + script { + public sbvis_v, sbvis_h, sbalways_v, sbalways_h, sbvis_timer; + public timer0(val) { + new v; + v = get_int(sbvis_v); + if (v) { + v = get_int(sbalways_v); + if (!v) { + emit("do-hide-vbar", ""); + set_int(sbvis_v, 0); + } + } + v = get_int(sbvis_h); + if (v) { + v = get_int(sbalways_h); + if (!v) { + emit("do-hide-hbar", ""); + set_int(sbvis_h, 0); + } + } + set_int(sbvis_timer, 0); + return 0; + } + } + images { + image: "bt_sm_base2.png" COMP; + image: "bt_sm_shine.png" COMP; + image: "bt_sm_hilight.png" COMP; + image: "sl_bt2_2.png" COMP; + image: "sb_runnerh.png" COMP; + image: "sb_runnerv.png" COMP; + } + parts { + part { name: "bg"; + type: RECT; + description { state: "default" 0.0; + rel1.offset: 2 2; + rel2.offset: -3 -3; + color: 255 255 255 0; + } + } + part { name: "clipper"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "bg"; + rel2.to: "bg"; + rel1.offset: 2 2; + rel2.offset: -3 -3; + } + } + part { name: "elm.swallow.content"; + clip_to: "clipper"; + type: SWALLOW; + description { state: "default" 0.0; + rel1.to: "bg"; + rel2.to: "bg"; + rel1.offset: 2 2; + rel2.offset: -3 -3; + } + } + part { name: "focus_highlight"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.offset: -1 -1; + rel2.offset: 0 0; + image { + normal: "sl_bt2_2.png"; + border: 7 7 7 7; + middle: 0; + } + fill.smooth : 0; + color: 200 155 0 0; + } + description { state: "enabled" 0.0; + inherit: "default" 0.0; + color: 200 155 0 255; + } + } + part { name: "sb_vbar_clip_master"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + } + description { state: "hidden" 0.0; + visible: 0; + color: 255 255 255 0; + } + } + part { name: "sb_vbar_clip"; + clip_to: "sb_vbar_clip_master"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + } + description { state: "hidden" 0.0; + visible: 0; + color: 255 255 255 0; + } + } + part { name: "sb_vbar"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + fixed: 1 1; + visible: 0; + min: 17 17; + align: 1.0 0.0; + rel1 { + relative: 1.0 0.0; + offset: -2 2; + to_y: "elm.swallow.content"; + } + rel2 { + relative: 1.0 0.0; + offset: -2 -1; + to_y: "sb_hbar"; + } + } + } + part { name: "sb_vbar_runner"; + clip_to: "sb_vbar_clip"; + mouse_events: 0; + description { state: "default" 0.0; + min: 3 3; + max: 3 99999; + rel1.to: "sb_vbar"; + rel2.to: "sb_vbar"; + image { + normal: "sb_runnerv.png"; + border: 0 0 4 4; + } + fill.smooth: 0; + } + } + part { name: "elm.dragable.vbar"; + clip_to: "sb_vbar_clip"; + mouse_events: 0; + dragable { + x: 0 0 0; + y: 1 1 0; + confine: "sb_vbar"; + } + description { state: "default" 0.0; + fixed: 1 1; + min: 17 17; + rel1 { + relative: 0.5 0.5; + offset: 0 0; + to: "sb_vbar"; + } + rel2 { + relative: 0.5 0.5; + offset: 0 0; + to: "sb_vbar"; + } + image { + normal: "bt_sm_base2.png"; + border: 6 6 6 6; + } + image.middle: SOLID; + } + } + part { name: "sb_vbar_over1"; + clip_to: "sb_vbar_clip"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "elm.dragable.vbar"; + rel2.relative: 1.0 0.5; + rel2.to: "elm.dragable.vbar"; + image { + normal: "bt_sm_hilight.png"; + border: 6 6 6 0; + } + } + } + part { name: "sb_vbar_over2"; + clip_to: "sb_vbar_clip"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "elm.dragable.vbar"; + rel2.to: "elm.dragable.vbar"; + image { + normal: "bt_sm_shine.png"; + border: 6 6 6 0; + } + } + } + part { name: "sb_hbar_clip_master"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + } + description { state: "hidden" 0.0; + visible: 0; + color: 255 255 255 0; + } + } + part { name: "sb_hbar_clip"; + clip_to: "sb_hbar_clip_master"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + } + description { state: "hidden" 0.0; + visible: 0; + color: 255 255 255 0; + } + } + part { name: "sb_hbar"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + fixed: 1 1; + visible: 0; + min: 17 17; + align: 0.0 1.0; + rel1 { + relative: 0.0 1.0; + offset: 2 -2; + to_x: "elm.swallow.content"; + } + rel2 { + relative: 0.0 1.0; + offset: -1 -2; + to_x: "sb_vbar"; + } + } + } + part { name: "sb_hbar_runner"; + clip_to: "sb_hbar_clip"; + mouse_events: 0; + description { state: "default" 0.0; + min: 3 3; + max: 99999 3; + rel1.to: "sb_hbar"; + rel2.to: "sb_hbar"; + image { + normal: "sb_runnerh.png"; + border: 4 4 0 0; + } + fill.smooth: 0; + } + } + part { name: "elm.dragable.hbar"; + clip_to: "sb_hbar_clip"; + mouse_events: 0; + dragable { + x: 1 1 0; + y: 0 0 0; + confine: "sb_hbar"; + } + description { state: "default" 0.0; + fixed: 1 1; + min: 17 17; + rel1 { + relative: 0.5 0.5; + offset: 0 0; + to: "sb_hbar"; + } + rel2 { + relative: 0.5 0.5; + offset: 0 0; + to: "sb_hbar"; + } + image { + normal: "bt_sm_base2.png"; + border: 6 6 6 6; + } + image.middle: SOLID; + } + } + part { name: "sb_hbar_over1"; + clip_to: "sb_hbar_clip"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "elm.dragable.hbar"; + rel2.relative: 1.0 0.5; + rel2.to: "elm.dragable.hbar"; + image { + normal: "bt_sm_hilight.png"; + border: 6 6 6 0; + } + } + } + part { name: "sb_hbar_over2"; + clip_to: "sb_hbar_clip"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "elm.dragable.hbar"; + rel2.to: "elm.dragable.hbar"; + image { + normal: "bt_sm_shine.png"; + border: 6 6 6 0; + } + } + } + } + programs { + program { name: "load"; + signal: "load"; + source: ""; + script { + set_state(PART:"sb_hbar_clip", "hidden", 0.0); + set_state(PART:"sb_vbar_clip", "hidden", 0.0); + set_int(sbvis_h, 0); + set_int(sbvis_v, 0); + set_int(sbalways_v, 0); + set_int(sbalways_h, 0); + set_int(sbvis_timer, 0); + } + } + program { name: "vbar_show"; + signal: "elm,action,show,vbar"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "sb_vbar_clip_master"; + } + program { name: "vbar_hide"; + signal: "elm,action,hide,vbar"; + source: "elm"; + action: STATE_SET "hidden" 0.0; + target: "sb_vbar_clip_master"; + } + program { name: "vbar_show_always"; + signal: "elm,action,show_always,vbar"; + source: "elm"; + script { + new v; + v = get_int(sbvis_v); + v |= get_int(sbalways_v); + if (!v) { + set_int(sbalways_v, 1); + emit("do-show-vbar", ""); + set_int(sbvis_v, 1); + } + } + } + program { name: "vbar_show_notalways"; + signal: "elm,action,show_notalways,vbar"; + source: "elm"; + script { + new v; + v = get_int(sbalways_v); + if (v) { + set_int(sbalways_v, 0); + v = get_int(sbvis_v); + if (!v) { + emit("do-hide-vbar", ""); + set_int(sbvis_v, 0); + } + } + } + } + program { name: "sb_vbar_show"; + signal: "do-show-vbar"; + source: ""; + action: STATE_SET "default" 0.0; + transition: LINEAR 1.0; + target: "sb_vbar_clip"; + } + program { name: "sb_vbar_hide"; + signal: "do-hide-vbar"; + source: ""; + action: STATE_SET "hidden" 0.0; + transition: LINEAR 1.0; + target: "sb_vbar_clip"; + } + program { name: "hbar_show"; + signal: "elm,action,show,hbar"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "sb_hbar_clip_master"; + } + program { name: "hbar_hide"; + signal: "elm,action,hide,hbar"; + source: "elm"; + action: STATE_SET "hidden" 0.0; + target: "sb_hbar_clip_master"; + } + program { name: "hbar_show_always"; + signal: "elm,action,show_always,hbar"; + source: "elm"; + script { + new v; + v = get_int(sbvis_h); + v |= get_int(sbalways_h); + if (!v) { + set_int(sbalways_h, 1); + emit("do-show-hbar", ""); + set_int(sbvis_h, 1); + } + } + } + program { name: "hbar_show_notalways"; + signal: "elm,action,show_notalways,hbar"; + source: "elm"; + script { + new v; + v = get_int(sbalways_h); + if (v) { + set_int(sbalways_h, 0); + v = get_int(sbvis_h); + if (!v) { + emit("do-hide-hbar", ""); + set_int(sbvis_h, 0); + } + } + } + } + program { name: "sb_hbar_show"; + signal: "do-show-hbar"; + source: ""; + action: STATE_SET "default" 0.0; + transition: LINEAR 1.0; + target: "sb_hbar_clip"; + } + program { name: "sb_hbar_hide"; + signal: "do-hide-hbar"; + source: ""; + action: STATE_SET "hidden" 0.0; + transition: LINEAR 1.0; + target: "sb_hbar_clip"; + } + program { name: "scroll"; + signal: "elm,action,scroll"; + source: "elm"; + script { + new v; + v = get_int(sbvis_v); + v |= get_int(sbalways_v); + if (!v) { + emit("do-show-vbar", ""); + set_int(sbvis_v, 1); + } + v = get_int(sbvis_h); + v |= get_int(sbalways_h); + if (!v) { + emit("do-show-hbar", ""); + set_int(sbvis_h, 1); + } + v = get_int(sbvis_timer); + if (v > 0) cancel_timer(v); + v = timer(2.0, "timer0", 0); + set_int(sbvis_timer, v); + } + } + program { name: "highlight_show"; + signal: "elm,action,focus_highlight,show"; + source: "elm"; + action: STATE_SET "enabled" 0.0; + transition: ACCELERATE 0.3; + target: "focus_highlight"; + } + program { name: "highlight_hide"; + signal: "elm,action,focus_highlight,hide"; + source: "elm"; + action: STATE_SET "default" 0.0; + transition: DECELERATE 0.3; + target: "focus_highlight"; + } + } + } + /////////////////////////////////////////////////////////////////////////////// // emoticon images from: // Tanya - Latvia diff --git a/legacy/elementary/data/themes/icon_arrow_down_left.png b/legacy/elementary/data/themes/icon_arrow_down_left.png new file mode 100644 index 0000000000..2f1d2ed511 Binary files /dev/null and b/legacy/elementary/data/themes/icon_arrow_down_left.png differ diff --git a/legacy/elementary/data/themes/icon_arrow_down_right.png b/legacy/elementary/data/themes/icon_arrow_down_right.png new file mode 100644 index 0000000000..0439e887e8 Binary files /dev/null and b/legacy/elementary/data/themes/icon_arrow_down_right.png differ diff --git a/legacy/elementary/data/themes/icon_arrow_up_left.png b/legacy/elementary/data/themes/icon_arrow_up_left.png new file mode 100644 index 0000000000..711bef8760 Binary files /dev/null and b/legacy/elementary/data/themes/icon_arrow_up_left.png differ diff --git a/legacy/elementary/data/themes/icon_arrow_up_right.png b/legacy/elementary/data/themes/icon_arrow_up_right.png new file mode 100644 index 0000000000..7a9f495fc7 Binary files /dev/null and b/legacy/elementary/data/themes/icon_arrow_up_right.png differ diff --git a/legacy/elementary/src/bin/Makefile.am b/legacy/elementary/src/bin/Makefile.am index df6f133db5..b263ca7d3a 100644 --- a/legacy/elementary/src/bin/Makefile.am +++ b/legacy/elementary/src/bin/Makefile.am @@ -91,7 +91,8 @@ test_focus.c \ test_focus2.c \ test_flippicker.c \ test_diskpicker.c \ -test_colorpicker.c +test_colorpicker.c \ +test_hoverlist.c elementary_test_LDADD = $(top_builddir)/src/lib/libelementary.la @ELEMENTARY_EWEATHER_LIBS@ elementary_test_LDFLAGS = diff --git a/legacy/elementary/src/bin/test.c b/legacy/elementary/src/bin/test.c index b97aa53703..04ba223967 100644 --- a/legacy/elementary/src/bin/test.c +++ b/legacy/elementary/src/bin/test.c @@ -101,6 +101,7 @@ void test_focus2(void *data, Evas_Object *obj, void *event_info); void test_flippicker(void *data, Evas_Object *obj, void *event_info); void test_diskpicker(void *data, Evas_Object *obj, void *event_info); void test_colorpicker(void *data, Evas_Object *obj, void *event_info); +void test_hoverlist(void *data, Evas_Object *obj, void *event_info); struct elm_test { @@ -319,6 +320,7 @@ my_win_main(char *autorun) ADD_TEST("Flippicker", test_flippicker); ADD_TEST("Diskpicker", test_diskpicker); ADD_TEST("Colorpicker", test_colorpicker); + ADD_TEST("Hoverlist", test_hoverlist); #undef ADD_TEST if (autorun) diff --git a/legacy/elementary/src/bin/test_hoverlist.c b/legacy/elementary/src/bin/test_hoverlist.c new file mode 100644 index 0000000000..2f1a5907f4 --- /dev/null +++ b/legacy/elementary/src/bin/test_hoverlist.c @@ -0,0 +1,116 @@ +#include +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#ifndef ELM_LIB_QUICKLAUNCH + +static void +_list_item_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_show(data); +} + +static void +_hoverlist_item_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + printf("hoverlist item selected: %s\n", + elm_hoverlist_item_label_get(event_info)); +} + +static void _list_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + elm_list_item_selected_set(event_info, EINA_FALSE); +} + +void +test_hoverlist(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bg, *list, *hov1, *hov2, *hov3, *hov4, *ic; + Elm_Hoverlist_Item *it; + + win = elm_win_add(NULL, "Contexual Popup 2", ELM_WIN_BASIC); + elm_win_title_set(win, "Contextual Popup 2"); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + list = elm_list_add(win); + elm_win_resize_object_add(win, list); + elm_list_mode_set(list, ELM_LIST_COMPRESS); + evas_object_smart_callback_add(list, "selected", _list_clicked, NULL); + +#define ITEM_NEW(_hov, _icon, _label) \ + ic = elm_icon_add(win); \ + elm_icon_standard_set(ic, _icon); \ + elm_icon_scale_set(ic, EINA_FALSE, EINA_FALSE); \ + it = elm_hoverlist_item_append(_hov, _label, ic, _hoverlist_item_cb, NULL); + + hov1 = elm_hoverlist_add(win); + + ITEM_NEW(hov1, "home", "Go to home folder"); + ITEM_NEW(hov1, "file", "Save file"); + ITEM_NEW(hov1, "delete", "Delete file"); + ITEM_NEW(hov1, "folder", "Navigate to folder"); + elm_hoverlist_item_disabled_set(it, EINA_TRUE); + ITEM_NEW(hov1, "edit", "Edit entry"); + ITEM_NEW(hov1, "clock", "Set date and time"); + ITEM_NEW(hov1, "arrow_up", "Go up"); + ITEM_NEW(hov1, "arrow_down", "Go down"); + ITEM_NEW(hov1, "arrow_left", "Go left"); + elm_hoverlist_item_disabled_set(it, EINA_TRUE); + ITEM_NEW(hov1, "arrow_right", "Go right"); + + hov2 = elm_hoverlist_add(win); + + ITEM_NEW(hov2, "home", NULL); + ITEM_NEW(hov2, "file", NULL); + ITEM_NEW(hov2, "delete", NULL); + ITEM_NEW(hov2, "folder", NULL); + ITEM_NEW(hov2, "edit", NULL); + elm_hoverlist_item_disabled_set(it, EINA_TRUE); + ITEM_NEW(hov2, "clock", NULL); + ITEM_NEW(hov2, "arrow_up", NULL); + ITEM_NEW(hov2, "arrow_down", NULL); + ITEM_NEW(hov2, "arrow_left", NULL); + ITEM_NEW(hov2, "arrow_right", NULL); + + hov3 = elm_hoverlist_add(win); + elm_hoverlist_horizontal_set(hov3, EINA_TRUE); + + ITEM_NEW(hov3, "home", "Zero"); + ITEM_NEW(hov3, "file", "Um"); + ITEM_NEW(hov3, "delete", "Dos"); + ITEM_NEW(hov3, "folder", "Tri"); + ITEM_NEW(hov3, "edit", "Vier"); + ITEM_NEW(hov3, "clock", "δΊ”"); + + hov4 = elm_hoverlist_add(win); + + ITEM_NEW(hov4, NULL, "Eina"); + ITEM_NEW(hov4, NULL, "Eet"); + ITEM_NEW(hov4, NULL, "Evas"); + ITEM_NEW(hov4, NULL, "Ecore"); + elm_hoverlist_item_disabled_set(it, EINA_TRUE); + ITEM_NEW(hov4, NULL, "Embryo"); + ITEM_NEW(hov4, NULL, "Edje"); + +#undef ITEM_NEW + + elm_list_item_append(list, "Hoverlist with icons and labels", NULL, NULL, + _list_item_cb, hov1); + elm_list_item_append(list, "Hoverlist with icons only", NULL, NULL, + _list_item_cb, hov2); + elm_list_item_append(list, "Hoverlist at horizontal mode", NULL, NULL, + _list_item_cb, hov3); + elm_list_item_append(list, "Hoverlist with no icons", NULL, NULL, + _list_item_cb, hov4); + evas_object_show(list); + elm_list_go(list); + + evas_object_resize(win, 300, 300); + evas_object_show(win); +} +#endif diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in index 9a13b95c71..072e8ddb1e 100644 --- a/legacy/elementary/src/lib/Elementary.h.in +++ b/legacy/elementary/src/lib/Elementary.h.in @@ -2058,12 +2058,33 @@ extern "C" { * "changed" - when the color value changes */ + /* Hoverlist */ + typedef struct _Elm_Hoverlist_Item Elm_Hoverlist_Item; + + EAPI Evas_Object *elm_hoverlist_add(Evas_Object* parent); + EAPI void elm_hoverlist_hover_end(Evas_Object *obj); + EAPI Evas_Object *elm_hoverlist_item_icon_get(const Elm_Hoverlist_Item *item); + EAPI void elm_hoverlist_item_icon_set(Elm_Hoverlist_Item *item, Evas_Object *icon); + EAPI const char *elm_hoverlist_item_label_get(const Elm_Hoverlist_Item *item); + EAPI void elm_hoverlist_item_label_set(Elm_Hoverlist_Item *item, const char *label); + EAPI void elm_hoverlist_hover_parent_set(Evas_Object *obj, Evas_Object *parent); + EAPI Evas_Object *elm_hoverlist_hover_parent_get(const Evas_Object *obj); + EAPI void elm_hoverlist_clear(Evas_Object* obj); + EAPI void elm_hoverlist_horizontal_set(Evas_Object* obj, Eina_Bool horizontal); + EAPI Eina_Bool elm_hoverlist_horizontal_get(const Evas_Object *obj); + EAPI Elm_Hoverlist_Item *elm_hoverlist_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data); + EAPI void elm_hoverlist_item_del(Elm_Hoverlist_Item *item); + EAPI void elm_hoverlist_item_disabled_set(Elm_Hoverlist_Item *item, Eina_Bool disabled); + EAPI Eina_Bool elm_hoverlist_item_disabled_get(const Elm_Hoverlist_Item *item); + /* smart callbacks called: + * "dismissed" - the hoverlist was dismissed + */ + /* debug * don't use it unless you are sure */ EAPI void elm_object_tree_dump(const Evas_Object *top); EAPI void elm_object_tree_dot_dump(const Evas_Object *top, const char *file); - #ifdef __cplusplus } #endif diff --git a/legacy/elementary/src/lib/Makefile.am b/legacy/elementary/src/lib/Makefile.am index 3b58af55b1..1663d099da 100644 --- a/legacy/elementary/src/lib/Makefile.am +++ b/legacy/elementary/src/lib/Makefile.am @@ -93,6 +93,7 @@ elc_fileselector.c \ elc_fileselector_button.c \ elc_fileselector_entry.c \ elc_hoversel.c \ +elc_hoverlist.c \ elc_notepad.c \ elc_scrolled_entry.c \ \ diff --git a/legacy/elementary/src/lib/elc_hoverlist.c b/legacy/elementary/src/lib/elc_hoverlist.c new file mode 100644 index 0000000000..fe05dc3b0e --- /dev/null +++ b/legacy/elementary/src/lib/elc_hoverlist.c @@ -0,0 +1,709 @@ +#include +#include "elm_priv.h" + +/* TODO: steal focus when shown? */ +/* TODO: event hooks, then */ + +/** + * @addtogroup Hoverlist + * + * A hoverlist is a widget that, when show, pops up a list of items. + * It automatically chooses an area inside its parent object's view + * (set via elm_hoverlist_add() and elm_hoverlist_hover_parent_set()) + * to optimally fit into it. In the default theme, it will also point + * an arrow to the cursor position at the time one shows it. Hoverlist + * items have a label and/or an icon. It is intended for a small + * number of items (hence the use of list, not genlist). + * + * Signals that you can add callbacks for are: + * + * dismissed - the hover was dismissed + */ + +typedef struct _Widget_Data Widget_Data; + +struct _Elm_Hoverlist_Item +{ + Elm_Widget_Item base; + + Elm_List_Item *lptr; + + const char *label; + Evas_Object *icon; + + Evas_Smart_Cb func; + const void *data; + + Eina_Bool disabled : 1; +}; + +struct _Widget_Data +{ + Evas_Object *hover_parent; + Evas_Object *list; + Evas_Object *target; + Evas_Object *hover; + Evas *evas; + + Eina_List *items; + + Eina_Bool scroller_disabled : 1; + Eina_Bool horizontal : 1; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _del_pre_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _hover_clicked_cb(void *data, Evas_Object *obj, void *event_info); +static void _parent_resize_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info); +static void _hoverlist_show(void *data, Evas *evas, Evas_Object *obj, void *event_info); +static void _hoverlist_hide(void *data, Evas *evas, Evas_Object *obj, void *event_info); + +static const char SIG_DISMISSED[] = "dismissed"; +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_DISMISSED, ""}, + {NULL, NULL} +}; + +#define ELM_HOVERLIST_ITEM_CHECK_RETURN(it, ...) \ + ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \ + ELM_CHECK_WIDTYPE(item->base.widget, widtype) __VA_ARGS__; + +static Elm_Hoverlist_Item * +_item_new(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data) +{ + Elm_Hoverlist_Item *it; + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + it = elm_widget_item_new(obj, Elm_Hoverlist_Item); + if (!it) + return NULL; + + it->label = eina_stringshare_add(label); + it->icon = icon; + it->func = func; + it->base.data = data; + + return it; +} + +static inline void +_item_free(Elm_Hoverlist_Item *it) +{ + eina_stringshare_del(it->label); + elm_widget_item_del(it); +} + +static void +_del_pre_hook(Evas_Object* obj) +{ + Widget_Data * wd = elm_widget_data_get(obj); + if (!wd) + return; + evas_object_event_callback_del_full(wd->hover_parent, EVAS_CALLBACK_RESIZE, + _parent_resize_cb, obj); +} + +static void +_del_hook(Evas_Object* obj) +{ + Elm_Hoverlist_Item *it; + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) + return; + + EINA_LIST_FREE(wd->items, it) + _item_free(it); + + free(wd); +} + +static Eina_Bool +_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info) +{ + if (type != EVAS_CALLBACK_KEY_DOWN) + return EINA_FALSE; + + Evas_Event_Key_Down *ev = event_info; + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) + return EINA_FALSE; + + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) + return EINA_FALSE; + + if (strcmp(ev->keyname, "Escape")) + return EINA_FALSE; + + evas_object_hide(obj); + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) + return; + + if (elm_widget_focus_get(obj)) + { + edje_object_signal_emit(wd->list, "elm,action,focus", "elm"); + evas_object_focus_set(wd->list, EINA_TRUE); + } + else + { + edje_object_signal_emit(wd->list, "elm,action,unfocus", "elm"); + evas_object_focus_set(wd->list, EINA_FALSE); + } +} + +static void +_theme_hook(Evas_Object* obj) +{ + Widget_Data* wd; + char buf[1024]; + + wd = elm_widget_data_get(obj); + if (!wd) + return; + + elm_widget_style_set(wd->list, "hoverlist"); + + snprintf(buf, sizeof(buf), "hoverlist/%s", elm_widget_style_get(obj)); + elm_object_style_set(wd->hover, buf); +} + +static void +_item_func_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Hoverlist_Item *it; + + elm_list_item_selected_set(event_info, EINA_FALSE); + + it = data; + if (it->func) + it->func((void *)it->base.data, it->base.widget, it); +} + +static void +_hover_clicked_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_hide(data); +} + +void +_content_placement_changed_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info) +{ + const char *new_slot; + Widget_Data *wd; + char buf[1024]; + + wd = elm_widget_data_get(data); + new_slot = event_info; + + snprintf(buf, sizeof(buf), "elm,action,slot,%s,show", new_slot); + elm_widget_signal_emit(wd->hover, buf, "elm"); +} + +static void +_hoverlist_show(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data* wd; + int px, py; + int w, h; + + wd = elm_widget_data_get(obj); + if (eina_list_count(wd->items) < 1) + return; + + elm_widget_focus_steal(obj); + + evas_pointer_canvas_xy_get(wd->evas, &px, &py); + evas_object_geometry_get(wd->target, NULL, NULL, &w, &h); + evas_object_move(wd->target, px - (w / 2), py - (h / 2)); + + /* reset list */ + elm_list_item_show(eina_list_data_get(elm_list_items_get(wd->list))); + + evas_object_show(wd->hover); +} + +static void +_hoverlist_hide(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) + return; + + evas_object_hide(wd->hover); + evas_object_smart_callback_call(obj, SIG_DISMISSED, NULL); +} + +static void +_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) + return; + + wd->hover_parent = NULL; +} + +static void +_parent_resize_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd; + int w, h; + + wd = elm_widget_data_get(data); + if (!wd) + return; + + evas_object_geometry_get(wd->hover_parent, NULL, NULL, &w, &h); + evas_object_size_hint_max_set(wd->list, w * 0.666667, h/2); +} + +/** + * Add a new Hoverlist object to the parent. + * + * @param parent Parent object + * @return New object or @c NULL, if it cannot be created + * + * @ingroup Hoverlist + */ +EAPI Evas_Object* +elm_hoverlist_add(Evas_Object* parent) +{ + Evas_Object* obj; + Widget_Data* wd; + char buf[1024]; + + wd = ELM_NEW(Widget_Data); + wd->evas = evas_object_evas_get(parent); + obj = elm_widget_add(wd->evas); + ELM_SET_WIDTYPE(widtype, "hoverlist"); + elm_widget_type_set(obj, "hoverlist"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_can_focus_set(obj, EINA_TRUE); + 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_event_hook_set(obj, _event_hook); + + wd->list = elm_list_add(obj); + elm_widget_style_set(wd->list, "hoverlist"); + + elm_list_mode_set(wd->list, ELM_LIST_EXPAND); + evas_object_show(wd->list); + + wd->target = elm_icon_add(obj); /* has to be an elm_widget (dummy, + in this case) because we gotta + make it work with + elm_widget_hover_object_set() */ + evas_object_resize(wd->target, elm_finger_size_get(), + elm_finger_size_get()); + evas_object_show(wd->target); + + wd->hover = elm_hover_add(obj); + + snprintf(buf, sizeof(buf), "hoverlist/%s", elm_widget_style_get(obj)); + elm_object_style_set(wd->hover, buf); + + evas_object_smart_callback_add(wd->hover, "smart,changed", + _content_placement_changed_cb, obj); + + elm_hoverlist_hover_parent_set(obj, parent); + elm_hover_target_set(wd->hover, wd->target); + + evas_object_smart_callback_add(wd->hover, "clicked", _hover_clicked_cb, obj); + elm_hover_content_set(wd->hover, "smart", wd->list); + + evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _hoverlist_show, + NULL); + evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _hoverlist_hide, + NULL); + + elm_widget_sub_object_add(obj, wd->list); + elm_widget_sub_object_add(obj, wd->hover); + elm_widget_sub_object_add(obj, wd->target); + return obj; +} + +/** + * This ends the Hoverlist's popup as if the user had clicked + * outside the hover. + * + * @param obj The hoverlist object + * + * @ingroup Hoverlist + */ +EAPI void +elm_hoverlist_hover_end(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) + return; + + if (!wd->hover) + return; + + evas_object_hide(wd->hover); +} + +/** + * Get the icon object for the given hoverlist item. + * + * @param item Hoverlist item + * @return icon object or @c NULL, if the item does not have icon or + * an error occured + * + * @ingroup Hoverlist + */ +EAPI Evas_Object * +elm_hoverlist_item_icon_get(const Elm_Hoverlist_Item *item) +{ + ELM_HOVERLIST_ITEM_CHECK_RETURN(item, NULL); + return item->icon; +} + +/** + * Sets the side icon associated with the hoverlist item. + * + * Once the icon object is set, a previously set one will be deleted. + * You probably don't want, then, to have the same icon object + * set for more than one item of the list (when replacing one of its + * instances). + * + * @param item Hoverlist item + * @param icon Icon object to be set + * + * @ingroup Hoverlist + */ +EAPI void +elm_hoverlist_item_icon_set(Elm_Hoverlist_Item *item, Evas_Object *icon) +{ + ELM_HOVERLIST_ITEM_CHECK_RETURN(item); + + Widget_Data *wd; + + wd = elm_widget_data_get(item->base.widget); + if (!wd) + return; + + if (item->icon) + { + evas_object_del(item->icon); + item->icon = NULL; + } + + item->icon = icon; + elm_list_item_icon_set(item->lptr, icon); + elm_list_go(wd->list); +} + +/** + * Get the label object for the given hoverlist item. + * + * @param item Hoverlist item + * @return label object or @c NULL, if the item does not have label or + * an error occured + * + * @ingroup Hoverlist + */ +EAPI const char * +elm_hoverlist_item_label_get(const Elm_Hoverlist_Item *item) +{ + ELM_HOVERLIST_ITEM_CHECK_RETURN(item, NULL); + return item->label; +} + +/** + * (Re)set the label on the given hoverlist item. + * + * @param obj Hoverlist item + * @param label String to set as label + * + * @ingroup Hoverlist + */ +EAPI void +elm_hoverlist_item_label_set(Elm_Hoverlist_Item *item, const char *label) +{ + ELM_HOVERLIST_ITEM_CHECK_RETURN(item); + + Widget_Data *wd; + + wd = elm_widget_data_get(item->base.widget); + if (!wd) + return; + + if (!eina_stringshare_replace(&item->label, label)) + return; + + elm_list_item_label_set(item->lptr, label); + elm_list_go(wd->list); +} + +/** + * Set the Hoverlist's parent. + * + * Sets the hover's parent object (it would much probably be the + * window that the hoverlist is in). See Hover objects for more + * information. + * + * @param obj The hoverlist object + * @param parent The parent to use + * + * @note elm_hoverlist_add() will automatically call this function + * with its @c parent argument. + * + * @ingroup Hoverlist + */ +EAPI void +elm_hoverlist_hover_parent_set(Evas_Object *obj, Evas_Object *parent) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd || !parent) + return; + + elm_hover_parent_set(wd->hover, parent); + + if (wd->hover_parent) + { + evas_object_event_callback_del_full(wd->hover_parent, EVAS_CALLBACK_DEL, + _parent_del, obj); + evas_object_event_callback_del_full(wd->hover_parent, + EVAS_CALLBACK_RESIZE, + _parent_resize_cb, obj); + } + + wd->hover_parent = parent; + evas_object_event_callback_add(wd->hover_parent, EVAS_CALLBACK_DEL, + _parent_del, obj); + evas_object_event_callback_add(wd->hover_parent, EVAS_CALLBACK_RESIZE, + _parent_resize_cb, obj); + + _parent_resize_cb(obj, NULL, NULL, NULL); +} + +/** + * Get the Hoverlist's parent object. + * + * @param obj The hoverlist object + * @param parent The parent to use + * + * See elm_hoverlist_hover_parent_set() for more information. + * + * @ingroup Hoverlist + */ +EAPI Evas_Object * +elm_hoverlist_hover_parent_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) + return NULL; + + return wd->hover_parent; +} + +/** + * Clear all items in the given hoverlist object. + * + * @param obj Hoverlist object + * + * @ingroup Hoverlist + */ +EAPI void +elm_hoverlist_clear(Evas_Object* obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + + Elm_Hoverlist_Item *item; + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd || !wd->items) + return; + + EINA_LIST_FREE(wd->items, item) + { + elm_list_item_del(item->lptr); + _item_free(item); + } + + evas_object_hide(wd->hover); +} + +/** + * Change the hoverlist's orientation to horizontal or vertical. + * + * @param obj Hoverlist object + * @param horizontal @c EINA_TRUE for horizontal mode, @c EINA_FALSE + * for vertical + * + * @ingroup Hoverlist + */ +EAPI void +elm_hoverlist_horizontal_set(Evas_Object* obj, Eina_Bool horizontal) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) + return; + + if (wd->horizontal == horizontal) + return; + + wd->horizontal = horizontal; + elm_list_horizontal_set(wd->list, horizontal); +} + +/** + * Get the value of current hoverlist object's orientation. + * + * @param obj Hoverlist object + * @return @c EINA_TRUE for horizontal mode, @c EINA_FALSE for + * vertical mode (or errors) + * + * @ingroup Hoverlist + */ +EAPI Eina_Bool +elm_hoverlist_horizontal_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + + Widget_Data *wd; + + wd = elm_widget_data_get( obj ); + if (!wd) + return EINA_FALSE; + + return wd->horizontal; +} + +/** + * Append a new item to a hoverlist object. + * + * @param obj Hoverlist object + * @param label The label of the new item + * @param icon Icon to be set on new item + * @param func Convenience function called when item selected + * @param data Data passed to @p func above + * @return A handle to the item added or @c NULL, on errors + * + * @ingroup Hoverlist + */ +EAPI Elm_Hoverlist_Item * +elm_hoverlist_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + + Elm_Hoverlist_Item* item; + Widget_Data* wd; + + wd = elm_widget_data_get(obj); + if (!wd) + return NULL; + + item = _item_new(obj, label, icon, func, data); + if (!item) + return NULL; + + wd->items = eina_list_append(wd->items, item); + item->lptr = elm_list_item_append(wd->list, label, icon, NULL, + _item_func_cb, item); + elm_list_go(wd->list); + return item; +} + +/** + * Delete the given item in a hoverlist object. + * + * @param item Hoverlist item to be deleted + * + * @ingroup Hoverlist + */ +EAPI void +elm_hoverlist_item_del(Elm_Hoverlist_Item *item) +{ + ELM_HOVERLIST_ITEM_CHECK_RETURN(item); + + Widget_Data *wd; + + wd = elm_widget_data_get(item->base.widget); + if (!wd) + return; + + wd->items = eina_list_remove(wd->items, item); + + elm_list_item_del(item->lptr); + item->lptr = NULL; + + if (eina_list_count(wd->items) < 1) + evas_object_hide(wd->hover); + + _item_free(item); +} + +/** + * Set the hoverlist item's state as disabled or enabled + * + * @param item Hoverlist item to be enabled/disabled + * @param disabled @c EINA_TRUE to disable it, @c EINA_FALSE to enable + * + * @ingroup Hoverlist + */ +EAPI void +elm_hoverlist_item_disabled_set(Elm_Hoverlist_Item *item, Eina_Bool disabled) +{ + ELM_HOVERLIST_ITEM_CHECK_RETURN(item); + + Widget_Data *wd; + + wd = elm_widget_data_get(item->base.widget); + if (!wd) + return; + + if (disabled == item->disabled) + return; + + item->disabled = disabled; + elm_list_item_disabled_set(item->lptr, disabled); +} + +/** + * Get the hoverlist item's disabled/enabled state. + * + * @param item Hoverlist item to be enabled/disabled + * @return @c EINA_TRUE, if disabled, @c EINA_FALSE otherwise + * + * @ingroup Hoverlist + */ +EAPI Eina_Bool +elm_hoverlist_item_disabled_get(const Elm_Hoverlist_Item *item) +{ + ELM_HOVERLIST_ITEM_CHECK_RETURN(item, EINA_FALSE); + + return item->disabled; +}