diff --git a/legacy/elementary/data/themes/Makefile.am b/legacy/elementary/data/themes/Makefile.am index 7fbebbde49..59501da3d1 100644 --- a/legacy/elementary/data/themes/Makefile.am +++ b/legacy/elementary/data/themes/Makefile.am @@ -58,7 +58,9 @@ sb_runnerh.png \ sb_runnerv.png \ shelf_inset.png \ tog_base.png \ -shad_circ.png +shad_circ.png \ +bt_dis_base.png \ +bt_dis_hilight.png default.edj: Makefile $(EXTRA_DIST) $(EDJE_CC) $(EDJE_FLAGS) \ diff --git a/legacy/elementary/data/themes/bt_dis_base.png b/legacy/elementary/data/themes/bt_dis_base.png new file mode 100644 index 0000000000..06f3dd51af Binary files /dev/null and b/legacy/elementary/data/themes/bt_dis_base.png differ diff --git a/legacy/elementary/data/themes/bt_dis_hilight.png b/legacy/elementary/data/themes/bt_dis_hilight.png new file mode 100644 index 0000000000..e5cf7d3b02 Binary files /dev/null and b/legacy/elementary/data/themes/bt_dis_hilight.png differ diff --git a/legacy/elementary/data/themes/default.edc b/legacy/elementary/data/themes/default.edc index c6a6690769..c4577810c7 100644 --- a/legacy/elementary/data/themes/default.edc +++ b/legacy/elementary/data/themes/default.edc @@ -2194,6 +2194,406 @@ collections { } } +/////////////////////////////////////////////////////////////////////////////// + group { name: "elm/hover/base/popout"; + images { + image: "shad_circ.png" COMP; + image: "bt_dis_base.png" COMP; + image: "bt_dis_hilight.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: "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: "leftclip"; + type: RECT; + description { state: "default" 0.0; + rel2.to_x: "pop"; + rel2.relative: 0.0 1.0; + rel2.offset: 1 -1; + } + } + part { name: "left"; + clip_to: "leftclip"; + description { state: "default" 0.0; + visible: 0; + rel1.to: "elm.swallow.slot.left"; + rel1.offset: -5 -5; + rel2.to: "elm.swallow.slot.left"; + rel2.offset: 4 4; + image { + normal: "bt_dis_base.png"; + border: 4 4 4 4; + } + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } + part { name: "elm.swallow.slot.left"; + type: SWALLOW; + description { state: "default" 0.0; + align: 0.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; + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + rel1.offset: -7 0; + rel2.offset: -7 -1; + align: 1.0 0.5; + } + } + part { name: "leftover"; + clip_to: "leftclip"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "left"; + rel2.to: "left"; + rel2.relative: 1.0 0.5; + image { + normal: "bt_dis_hilight.png"; + border: 4 4 4 0; + } + } + } + part { name: "rightclip"; + type: RECT; + description { state: "default" 0.0; + rel1.to_x: "pop"; + rel1.relative: 1.0 0.0; + rel1.offset: -2 0; + } + } + part { name: "right"; + clip_to: "rightclip"; + description { state: "default" 0.0; + visible: 0; + rel1.to: "elm.swallow.slot.right"; + rel1.offset: -5 -5; + rel2.to: "elm.swallow.slot.right"; + rel2.offset: 4 4; + image { + normal: "bt_dis_base.png"; + border: 4 4 4 4; + } + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } + part { name: "elm.swallow.slot.right"; + type: SWALLOW; + description { state: "default" 0.0; + align: 1.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; + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + rel1.offset: 6 0; + rel2.offset: 6 -1; + align: 0.0 0.5; + } + } + part { name: "rightover"; + clip_to: "rightclip"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "right"; + rel2.to: "right"; + rel2.relative: 1.0 0.5; + image { + normal: "bt_dis_hilight.png"; + border: 4 4 4 0; + } + } + } + part { name: "topclip"; + type: RECT; + description { state: "default" 0.0; + rel2.to_y: "pop"; + rel2.relative: 1.0 0.0; + rel2.offset: -1 1; + } + } + part { name: "top"; + clip_to: "topclip"; + description { state: "default" 0.0; + visible: 0; + rel1.to: "elm.swallow.slot.top"; + rel1.offset: -5 -5; + rel2.to: "elm.swallow.slot.top"; + rel2.offset: 4 4; + image { + normal: "bt_dis_base.png"; + border: 4 4 4 4; + } + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } + part { name: "elm.swallow.slot.top"; + type: SWALLOW; + clip_to: "topclip"; + description { state: "default" 0.0; + visible: 1; + align: 0.5 0.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; + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + rel1.offset: 0 -7; + rel2.offset: -1 -7; + align: 0.5 1.0; + } + } + part { name: "topover"; + clip_to: "topclip"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "top"; + rel2.to: "top"; + rel2.relative: 1.0 0.5; + image { + normal: "bt_dis_hilight.png"; + border: 4 4 4 0; + } + } + } + part { name: "bottomclip"; + type: RECT; + description { state: "default" 0.0; + rel1.to_y: "pop"; + rel1.relative: 0.0 1.0; + rel1.offset: -1 -2; + } + } + part { name: "bottom"; + clip_to: "bottomclip"; + description { state: "default" 0.0; + visible: 0; + rel1.to: "elm.swallow.slot.bottom"; + rel1.offset: -5 -5; + rel2.to: "elm.swallow.slot.bottom"; + rel2.offset: 4 4; + image { + normal: "bt_dis_base.png"; + border: 4 4 4 4; + } + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } + part { name: "elm.swallow.slot.bottom"; + type: SWALLOW; + description { state: "default" 0.0; + align: 0.5 1.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; + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + rel1.offset: 0 6; + rel2.offset: -1 6; + align: 0.5 0.0; + } + } + part { name: "bottomover"; + clip_to: "bottomclip"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "bottom"; + rel2.to: "bottom"; + rel2.relative: 1.0 0.5; + image { + normal: "bt_dis_hilight.png"; + border: 4 4 4 0; + } + } + } + part { name: "shad"; + mouse_events: 0; + description { state: "default" 0.0; + image.normal: "shad_circ.png"; + rel1.to: "elm.swallow.size"; + rel1.offset: -64 -64; + rel2.to: "elm.swallow.size"; + rel2.offset: 63 63; + fill.smooth: 0; + } + } + part { name: "pop"; + mouse_events: 1; + description { state: "default" 0.0; + rel1.to: "elm.swallow.slot.middle"; + rel1.offset: -5 -5; + rel2.to: "elm.swallow.slot.middle"; + rel2.offset: 4 4; + image { + normal: "bt_dis_base.png"; + border: 4 4 4 4; + } + } + } + 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: "popover"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "pop"; + rel2.to: "pop"; + rel2.relative: 1.0 0.5; + image { + normal: "bt_dis_hilight.png"; + border: 4 4 4 0; + } + } + } + } + programs { + program { name: "end"; + signal: "mouse,down,1"; + source: "base"; + action: SIGNAL_EMIT "elm,action,dismiss" ""; + } + + program { name: "show"; + signal: "elm,action,show"; + source: "elm"; + action: STATE_SET "visible" 0.0; +// transition: DECELERATE 0.5; + target: "base"; + } + program { name: "hide"; + signal: "elm,action,hide"; + source: "elm"; + action: STATE_SET "default" 0.0; +// transition: DECELERATE 0.5; + target: "base"; + } + + program { name: "leftshow"; + signal: "elm,action,slot,left,show"; + source: "elm"; + action: STATE_SET "visible" 0.0; + transition: DECELERATE 0.5; + target: "left"; + target: "elm.swallow.slot.left"; + } + program { name: "lefthide"; + signal: "elm,action,slot,left,hide"; + source: "elm"; + action: STATE_SET "default" 0.0; + transition: DECELERATE 0.5; + target: "left"; + target: "elm.swallow.slot.left"; + } + program { name: "rightshow"; + signal: "elm,action,slot,right,show"; + source: "elm"; + action: STATE_SET "visible" 0.0; + transition: DECELERATE 0.5; + target: "right"; + target: "elm.swallow.slot.right"; + } + program { name: "righthide"; + signal: "elm,action,slot,right,hide"; + source: "elm"; + action: STATE_SET "default" 0.0; + transition: DECELERATE 0.5; + target: "right"; + target: "elm.swallow.slot.right"; + } + program { name: "topshow"; + signal: "elm,action,slot,top,show"; + source: "elm"; + action: STATE_SET "visible" 0.0; + transition: DECELERATE 0.5; + target: "top"; + target: "elm.swallow.slot.top"; + } + program { name: "tophide"; + signal: "elm,action,slot,top,hide"; + source: "elm"; + action: STATE_SET "default" 0.0; + transition: DECELERATE 0.5; + target: "top"; + target: "elm.swallow.slot.top"; + } + program { name: "bottomshow"; + signal: "elm,action,slot,bottom,show"; + source: "elm"; + action: STATE_SET "visible" 0.0; + transition: DECELERATE 0.5; + target: "bottom"; + target: "elm.swallow.slot.bottom"; + } + program { name: "bottomhide"; + signal: "elm,action,slot,bottom,hide"; + source: "elm"; + action: STATE_SET "default" 0.0; + transition: DECELERATE 0.5; + target: "bottom"; + target: "elm.swallow.slot.bottom"; + } + } + } + /////////////////////////////////////////////////////////////////////////////// group { name: "elm/icon/base/default"; min: 10 10; images.image: "bt_base1.png" COMP; parts { part { name: "base"; diff --git a/legacy/elementary/src/bin/test.c b/legacy/elementary/src/bin/test.c index 764171c386..ac0c670492 100644 --- a/legacy/elementary/src/bin/test.c +++ b/legacy/elementary/src/bin/test.c @@ -549,6 +549,86 @@ my_bt_11(void *data, Evas_Object *obj, void *event_info) evas_object_show(win); } +static void +my_bt_12(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *win, *bg, *bx, *bt, *hv, *ic; + char buf[PATH_MAX]; + + win = elm_win_add(NULL, "hover2", ELM_WIN_BASIC); + elm_win_title_set(win, "Hover 2"); + elm_win_autodel_set(win, 1); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, 1.0, 1.0); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, 1.0, 1.0); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + hv = elm_hover_add(win); + elm_hover_style_set(hv, "popout"); + + bt = elm_button_add(win); + elm_button_label_set(bt, "Button"); + evas_object_smart_callback_add(bt, "clicked", my_hover_bt_1, hv); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + elm_hover_parent_set(hv, win); + elm_hover_target_set(hv, bt); + + bt = elm_button_add(win); + elm_button_label_set(bt, "Popup"); + elm_hover_content_set(hv, "middle", bt); + evas_object_show(bt); + + bx = elm_box_add(win); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR); + elm_icon_file_set(ic, buf, NULL); + elm_icon_scale_set(ic, 0, 0); + elm_box_pack_end(bx, ic); + evas_object_show(ic); + bt = elm_button_add(win); + elm_button_label_set(bt, "Top 1"); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + bt = elm_button_add(win); + elm_button_label_set(bt, "Top 2"); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + bt = elm_button_add(win); + elm_button_label_set(bt, "Top 3"); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + evas_object_show(bx); + elm_hover_content_set(hv, "top", bx); + + bt = elm_button_add(win); + elm_button_label_set(bt, "Bot"); + elm_hover_content_set(hv, "bottom", bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_button_label_set(bt, "Left"); + elm_hover_content_set(hv, "left", bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_button_label_set(bt, "Right"); + elm_hover_content_set(hv, "right", bt); + evas_object_show(bt); + + evas_object_size_hint_min_set(bg, 160, 160); + evas_object_size_hint_max_set(bg, 640, 640); + evas_object_resize(win, 320, 320); + evas_object_show(win); +} + static void my_win_main(void) { @@ -719,6 +799,13 @@ my_win_main(void) elm_box_pack_end(bx, bt); evas_object_show(bt); + bt = elm_button_add(win); + elm_button_label_set(bt, "Hover 2"); + evas_object_smart_callback_add(bt, "clicked", my_bt_12, NULL); + evas_object_size_hint_align_set(bt, -1.0, 0.0); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + /* set an initial window size */ evas_object_resize(win, 320, 320); /* show the window */ diff --git a/legacy/elementary/src/lib/Elementary.h b/legacy/elementary/src/lib/Elementary.h index 188920b907..00bbdc480f 100644 --- a/legacy/elementary/src/lib/Elementary.h +++ b/legacy/elementary/src/lib/Elementary.h @@ -176,6 +176,7 @@ extern "C" { EAPI void elm_hover_target_set(Evas_Object *obj, Evas_Object *target); EAPI void elm_hover_parent_set(Evas_Object *obj, Evas_Object *parent); EAPI void elm_hover_content_set(Evas_Object *obj, const char *swallow, Evas_Object *content); + EAPI void elm_hover_style_set(Evas_Object *obj, const char *style); /* smart callbacks called: */ diff --git a/legacy/elementary/src/lib/elm_hover.c b/legacy/elementary/src/lib/elm_hover.c index 8fe230b5d3..3a63d6613e 100644 --- a/legacy/elementary/src/lib/elm_hover.c +++ b/legacy/elementary/src/lib/elm_hover.c @@ -110,14 +110,42 @@ static void _hov_show(void *data, Evas *e, Evas_Object *obj, void *event_info) { Widget_Data *wd = elm_widget_data_get(data); + Evas_List *l; + // FIXME: use signals for show for hov evas_object_show(wd->cov); + edje_object_signal_emit(wd->cov, "elm,action,show", "elm"); + for (l = wd->subs; l; l = l->next) + { + Subinfo *si = l->data; + char buf[1024]; + if (!strncmp(si->swallow, "elm.swallow.slot.", 17)) + { + snprintf(buf, sizeof(buf), "elm,action,slot,%s,show", + si->swallow + 17); + edje_object_signal_emit(wd->cov, buf, "elm"); + } + } } static void _hov_hide(void *data, Evas *e, Evas_Object *obj, void *event_info) { Widget_Data *wd = elm_widget_data_get(data); + Evas_List *l; + // FIXME: use signals for hide for hov + edje_object_signal_emit(wd->cov, "elm,action,hide", "elm"); evas_object_hide(wd->cov); + for (l = wd->subs; l; l = l->next) + { + Subinfo *si = l->data; + char buf[1024]; + if (!strncmp(si->swallow, "elm.swallow.slot.", 17)) + { + snprintf(buf, sizeof(buf), "elm,action,slot,%s,hide", + si->swallow + 17); + edje_object_signal_emit(wd->cov, buf, "elm"); + } + } } static void @@ -288,3 +316,11 @@ elm_hover_content_set(Evas_Object *obj, const char *swallow, Evas_Object *conten _sizing_eval(obj); } } + +EAPI void +elm_hover_style_set(Evas_Object *obj, const char *style) +{ + Widget_Data *wd = elm_widget_data_get(obj); + _elm_theme_set(wd->cov, "hover", "base", style); + _sizing_eval(obj); +}