diff --git a/legacy/elementary/src/bin/test_notify.c b/legacy/elementary/src/bin/test_notify.c
index b8ea9acd01..c3cb8bfe93 100644
--- a/legacy/elementary/src/bin/test_notify.c
+++ b/legacy/elementary/src/bin/test_notify.c
@@ -50,8 +50,10 @@ test_notify(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(tb);
+ // Notify top
notify = elm_notify_add(win);
evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_notify_align_set(notify, 0.5, 0.0);
bx = elm_box_add(win);
elm_object_content_set(notify, bx);
@@ -70,15 +72,18 @@ test_notify(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
evas_object_show(bt);
bt = elm_button_add(win);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(bt, "Top");
evas_object_smart_callback_add(bt, "clicked", _bt, notify);
- elm_table_pack(tb, bt, 1, 0, 1, 1);
+ elm_table_pack(tb, bt, 2, 1, 1, 1);
evas_object_show(bt);
+ // Notify bottom
notify = elm_notify_add(win);
elm_notify_allow_events_set(notify, EINA_FALSE);
evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM);
+ elm_notify_align_set(notify, 0.5, 1.0);
+
elm_notify_timeout_set(notify, 5.0);
evas_object_smart_callback_add(notify, "timeout", _notify_timeout, NULL);
evas_object_smart_callback_add(notify, "block,clicked", _notify_block, NULL);
@@ -101,14 +106,16 @@ test_notify(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
evas_object_show(bt);
bt = elm_button_add(win);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(bt, "Bottom");
evas_object_smart_callback_add(bt, "clicked", _bt, notify);
- elm_table_pack(tb, bt, 1, 2, 1, 1);
+ elm_table_pack(tb, bt, 2, 3, 1, 1);
evas_object_show(bt);
+ // Notify left
notify = elm_notify_add(win);
evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_LEFT);
+ elm_notify_align_set(notify, 0.0, 0.5);
elm_notify_timeout_set(notify, 10.0);
evas_object_smart_callback_add(notify, "timeout", _notify_timeout, NULL);
@@ -129,14 +136,16 @@ test_notify(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
evas_object_show(bt);
bt = elm_button_add(win);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(bt, "Left");
evas_object_smart_callback_add(bt, "clicked", _bt, notify);
- elm_table_pack(tb, bt, 0, 1, 1, 1);
+ elm_table_pack(tb, bt, 1, 2, 1, 1);
evas_object_show(bt);
+ // Notify center
notify = elm_notify_add(win);
evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_CENTER);
+ elm_notify_align_set(notify, 0.5, 0.5);
elm_notify_timeout_set(notify, 10.0);
evas_object_smart_callback_add(notify, "timeout", _notify_timeout, NULL);
@@ -157,14 +166,16 @@ test_notify(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
evas_object_show(bt);
bt = elm_button_add(win);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(bt, "Center");
evas_object_smart_callback_add(bt, "clicked", _bt, notify);
- elm_table_pack(tb, bt, 1, 1, 1, 1);
+ elm_table_pack(tb, bt, 2, 2, 1, 1);
evas_object_show(bt);
+ // Notify right
notify = elm_notify_add(win);
evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_RIGHT);
+ elm_notify_align_set(notify, 1.0, 0.5);
bx = elm_box_add(win);
elm_object_content_set(notify, bx);
@@ -183,14 +194,16 @@ test_notify(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
evas_object_show(bt);
bt = elm_button_add(win);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(bt, "Right");
evas_object_smart_callback_add(bt, "clicked", _bt, notify);
- elm_table_pack(tb, bt, 2, 1, 1, 1);
+ elm_table_pack(tb, bt, 3, 2, 1, 1);
evas_object_show(bt);
+ // Notify top left
notify = elm_notify_add(win);
evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_TOP_LEFT);
+ elm_notify_align_set(notify, 0.0, 0.0);
bx = elm_box_add(win);
elm_object_content_set(notify, bx);
@@ -209,14 +222,16 @@ test_notify(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
evas_object_show(bt);
bt = elm_button_add(win);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(bt, "Top Left");
evas_object_smart_callback_add(bt, "clicked", _bt, notify);
- elm_table_pack(tb, bt, 0, 0, 1, 1);
+ elm_table_pack(tb, bt, 1, 1, 1, 1);
evas_object_show(bt);
+ // Notify top right
notify = elm_notify_add(win);
evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_TOP_RIGHT);
+ elm_notify_align_set(notify, 1.0, 0.0);
bx = elm_box_add(win);
elm_object_content_set(notify, bx);
@@ -235,14 +250,16 @@ test_notify(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
evas_object_show(bt);
bt = elm_button_add(win);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(bt, "Top Right");
evas_object_smart_callback_add(bt, "clicked", _bt, notify);
- elm_table_pack(tb, bt, 2, 0, 1, 1);
+ elm_table_pack(tb, bt, 3, 1, 1, 1);
evas_object_show(bt);
+ // Notify bottom left
notify = elm_notify_add(win);
evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM_LEFT);
+ elm_notify_align_set(notify, 0.0, 1.0);
bx = elm_box_add(win);
elm_object_content_set(notify, bx);
@@ -261,14 +278,16 @@ test_notify(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
evas_object_show(bt);
bt = elm_button_add(win);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(bt, "Bottom Left");
evas_object_smart_callback_add(bt, "clicked", _bt, notify);
- elm_table_pack(tb, bt, 0, 2, 1, 1);
+ elm_table_pack(tb, bt, 1, 3, 1, 1);
evas_object_show(bt);
+ // Notify bottom right
notify = elm_notify_add(win);
evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM_RIGHT);
+ elm_notify_align_set(notify, 1.0, 1.0);
bx = elm_box_add(win);
elm_object_content_set(notify, bx);
@@ -287,14 +306,132 @@ test_notify(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
evas_object_show(bt);
bt = elm_button_add(win);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(bt, "Bottom Right");
evas_object_smart_callback_add(bt, "clicked", _bt, notify);
- elm_table_pack(tb, bt, 2, 2, 1, 1);
+ elm_table_pack(tb, bt, 3, 3, 1, 1);
+ evas_object_show(bt);
+
+ // Notify top fill
+ notify = elm_notify_add(win);
+ evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_notify_align_set(notify, ELM_NOTIFY_ALIGN_FILL, 0.0);
+ elm_notify_timeout_set(notify, 5.0);
+
+ bx = elm_box_add(win);
+ elm_object_content_set(notify, bx);
+ elm_box_horizontal_set(bx, EINA_TRUE);
+ evas_object_show(bx);
+
+ lb = elm_label_add(win);
+ elm_object_text_set(lb, "Fill top. This notify fills horizontal area.
"
+ "elm_notify_align_set(notify, ELM_NOTIFY_ALIGN_FILL, 0.0); ");
+ elm_box_pack_end(bx, lb);
+ evas_object_show(lb);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Close");
+ evas_object_smart_callback_add(bt, "clicked", _bt_close, notify);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
+ elm_object_text_set(bt, "Top fill");
+ evas_object_smart_callback_add(bt, "clicked", _bt, notify);
+ elm_table_pack(tb, bt, 1, 0, 3, 1);
+ evas_object_show(bt);
+
+ // Notify bottom fill
+ notify = elm_notify_add(win);
+ evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_notify_align_set(notify, ELM_NOTIFY_ALIGN_FILL, 1.0);
+ elm_notify_timeout_set(notify, 5.0);
+
+ bx = elm_box_add(win);
+ elm_object_content_set(notify, bx);
+ elm_box_horizontal_set(bx, EINA_TRUE);
+ evas_object_show(bx);
+
+ lb = elm_label_add(win);
+ evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(lb, 0.0, 0.5);
+ elm_object_text_set(lb, "Fill Bottom. This notify fills horizontal area.
"
+ "elm_notify_align_set(notify, ELM_NOTIFY_ALIGN_FILL, 1.0); ");
+ elm_box_pack_end(bx, lb);
+ evas_object_show(lb);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Close");
+ evas_object_smart_callback_add(bt, "clicked", _bt_close, notify);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
+ elm_object_text_set(bt, "Bottom fill");
+ evas_object_smart_callback_add(bt, "clicked", _bt, notify);
+ elm_table_pack(tb, bt, 1, 4, 3, 1);
+ evas_object_show(bt);
+
+ // Notify left fill
+ notify = elm_notify_add(win);
+ evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_notify_align_set(notify, 0.0, EVAS_HINT_FILL);
+ elm_notify_timeout_set(notify, 5.0);
+
+ bx = elm_box_add(win);
+ elm_object_content_set(notify, bx);
+ evas_object_show(bx);
+
+ lb = elm_label_add(win);
+ elm_object_text_set(lb, "Left fill.");
+ elm_box_pack_end(bx, lb);
+ evas_object_show(lb);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Close");
+ evas_object_smart_callback_add(bt, "clicked", _bt_close, notify);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
+ evas_object_size_hint_align_set(bt, 0.5, EVAS_HINT_FILL);
+ elm_object_text_set(bt, "Left fill");
+ evas_object_smart_callback_add(bt, "clicked", _bt, notify);
+ elm_table_pack(tb, bt, 0, 1, 1, 3);
+ evas_object_show(bt);
+
+ // Notify right fill
+ notify = elm_notify_add(win);
+ evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_notify_align_set(notify, 1.0, EVAS_HINT_FILL);
+ elm_notify_timeout_set(notify, 5.0);
+
+ bx = elm_box_add(win);
+ elm_object_content_set(notify, bx);
+ evas_object_show(bx);
+
+ lb = elm_label_add(win);
+ elm_object_text_set(lb, "Right fill.");
+ elm_box_pack_end(bx, lb);
+ evas_object_show(lb);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Close");
+ evas_object_smart_callback_add(bt, "clicked", _bt_close, notify);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
+ evas_object_size_hint_align_set(bt, 0.5, EVAS_HINT_FILL);
+ elm_object_text_set(bt, "Right fill");
+ evas_object_smart_callback_add(bt, "clicked", _bt, notify);
+ elm_table_pack(tb, bt, 4, 1, 1, 3);
evas_object_show(bt);
evas_object_show(win);
- evas_object_resize(win, 300, 350);
+ evas_object_resize(win, 400, 400);
}
#endif
-
diff --git a/legacy/elementary/src/lib/elm_deprecated.h b/legacy/elementary/src/lib/elm_deprecated.h
index 49f88c2a78..cc3ea346da 100644
--- a/legacy/elementary/src/lib/elm_deprecated.h
+++ b/legacy/elementary/src/lib/elm_deprecated.h
@@ -421,3 +421,35 @@ EINA_DEPRECATED EAPI void elm_calendar_day_selection_disabled_se
*/
EINA_DEPRECATED EAPI Eina_Bool elm_calendar_day_selection_disabled_get(const Evas_Object *obj);
+/**
+ * @deprecated Possible orient values for notify.
+ *
+ * This values should be used in conjunction to elm_notify_orient_set() to
+ * set the position in which the notify should appear(relative to its parent)
+ * and in conjunction with elm_notify_orient_get() to know where the notify
+ * is appearing.
+ */
+typedef enum
+{
+ ELM_NOTIFY_ORIENT_TOP, /**< Notify should appear in the top of parent, default */
+ ELM_NOTIFY_ORIENT_CENTER, /**< Notify should appear in the center of parent */
+ ELM_NOTIFY_ORIENT_BOTTOM, /**< Notify should appear in the bottom of parent */
+ ELM_NOTIFY_ORIENT_LEFT, /**< Notify should appear in the left of parent */
+ ELM_NOTIFY_ORIENT_RIGHT, /**< Notify should appear in the right of parent */
+ ELM_NOTIFY_ORIENT_TOP_LEFT, /**< Notify should appear in the top left of parent */
+ ELM_NOTIFY_ORIENT_TOP_RIGHT, /**< Notify should appear in the top right of parent */
+ ELM_NOTIFY_ORIENT_BOTTOM_LEFT, /**< Notify should appear in the bottom left of parent */
+ ELM_NOTIFY_ORIENT_BOTTOM_RIGHT, /**< Notify should appear in the bottom right of parent */
+ ELM_NOTIFY_ORIENT_LAST /**< Sentinel value, @b don't use */
+} Elm_Notify_Orient;
+
+
+/**
+ * @deprecated Use elm_notify_align_set instead.
+ */
+EINA_DEPRECATED EAPI void elm_notify_orient_set(Evas_Object *obj, Elm_Notify_Orient orient);
+
+/**
+ * @deprecated Use elm_notify_align_get instead.
+ */
+EINA_DEPRECATED EAPI Elm_Notify_Orient elm_notify_orient_get(const Evas_Object *obj);
diff --git a/legacy/elementary/src/lib/elm_notify.c b/legacy/elementary/src/lib/elm_notify.c
index 25866e9ed9..16ec68b8ef 100644
--- a/legacy/elementary/src/lib/elm_notify.c
+++ b/legacy/elementary/src/lib/elm_notify.c
@@ -73,56 +73,24 @@ static void
_notify_theme_apply(Evas_Object *obj)
{
const char *style = elm_widget_style_get(obj);
+ double ax, ay;
ELM_NOTIFY_DATA_GET(obj, sd);
- switch (sd->orient)
- {
- case ELM_NOTIFY_ORIENT_TOP:
- elm_widget_theme_object_set(obj, sd->notify, "notify", "top", style);
- break;
+ ax = sd->horizontal_align;
+ ay = sd->vertical_align;
+ if ((elm_widget_mirrored_get(obj)) && (ax != ELM_NOTIFY_ALIGN_FILL)) ax = 1.0 - ax;
- case ELM_NOTIFY_ORIENT_CENTER:
- elm_widget_theme_object_set
- (obj, sd->notify, "notify", "center", style);
- break;
-
- case ELM_NOTIFY_ORIENT_BOTTOM:
- elm_widget_theme_object_set
- (obj, sd->notify, "notify", "bottom", style);
- break;
-
- case ELM_NOTIFY_ORIENT_LEFT:
- elm_widget_theme_object_set(obj, sd->notify, "notify", "left", style);
- break;
-
- case ELM_NOTIFY_ORIENT_RIGHT:
- elm_widget_theme_object_set(obj, sd->notify, "notify", "right", style);
- break;
-
- case ELM_NOTIFY_ORIENT_TOP_LEFT:
- elm_widget_theme_object_set
- (obj, sd->notify, "notify", "top_left", style);
- break;
-
- case ELM_NOTIFY_ORIENT_TOP_RIGHT:
- elm_widget_theme_object_set
- (obj, sd->notify, "notify", "top_right", style);
- break;
-
- case ELM_NOTIFY_ORIENT_BOTTOM_LEFT:
- elm_widget_theme_object_set
- (obj, sd->notify, "notify", "bottom_left", style);
- break;
-
- case ELM_NOTIFY_ORIENT_BOTTOM_RIGHT:
- elm_widget_theme_object_set
- (obj, sd->notify, "notify", "bottom_right", style);
- break;
-
- case ELM_NOTIFY_ORIENT_LAST:
- break;
- }
+ if (ay == 0.0)
+ elm_widget_theme_object_set(obj, sd->notify, "notify", "top", style);
+ else if (ay == 1.0)
+ elm_widget_theme_object_set(obj, sd->notify, "notify", "bottom", style);
+ else if (ax == 0.0)
+ elm_widget_theme_object_set(obj, sd->notify, "notify", "left", style);
+ else if (ax == 1.0)
+ elm_widget_theme_object_set(obj, sd->notify, "notify", "right", style);
+ else
+ elm_widget_theme_object_set(obj, sd->notify, "notify", "center", style);
}
/**
@@ -140,60 +108,27 @@ _notify_theme_apply(Evas_Object *obj)
static void
_notify_move_to_orientation(Evas_Object *obj)
{
- int offx;
- int offy;
Evas_Coord minw = -1, minh = -1;
Evas_Coord x, y, w, h;
+ double ax, ay;
ELM_NOTIFY_DATA_GET(obj, sd);
evas_object_geometry_get(obj, &x, &y, &w, &h);
edje_object_size_min_get(sd->notify, &minw, &minh);
edje_object_size_min_restricted_calc(sd->notify, &minw, &minh, minw, minh);
- offx = (w - minw) / 2;
- offy = (h - minh) / 2;
- switch (_notify_orientation_rtl_fix(obj, sd->orient))
- {
- case ELM_NOTIFY_ORIENT_TOP:
- evas_object_move(sd->notify, x + offx, y);
- break;
+ ax = sd->horizontal_align;
+ ay = sd->vertical_align;
+ if ((elm_widget_mirrored_get(obj)) && (ax != ELM_NOTIFY_ALIGN_FILL)) ax = 1.0 - ax;
- case ELM_NOTIFY_ORIENT_CENTER:
- evas_object_move(sd->notify, x + offx, y + offy);
- break;
+ if (ax == ELM_NOTIFY_ALIGN_FILL) minw = w;
+ if (ay == ELM_NOTIFY_ALIGN_FILL) minh = h;
- case ELM_NOTIFY_ORIENT_BOTTOM:
- evas_object_move(sd->notify, x + offx, y + h - minh);
- break;
+ x = x + ((w - minw) * ax);
+ y = y + ((h - minh) * ay);
- case ELM_NOTIFY_ORIENT_LEFT:
- evas_object_move(sd->notify, x, y + offy);
- break;
-
- case ELM_NOTIFY_ORIENT_RIGHT:
- evas_object_move(sd->notify, x + w - minw, y + offy);
- break;
-
- case ELM_NOTIFY_ORIENT_TOP_LEFT:
- evas_object_move(sd->notify, x, y);
- break;
-
- case ELM_NOTIFY_ORIENT_TOP_RIGHT:
- evas_object_move(sd->notify, x + w - minw, y);
- break;
-
- case ELM_NOTIFY_ORIENT_BOTTOM_LEFT:
- evas_object_move(sd->notify, x, y + h - minh);
- break;
-
- case ELM_NOTIFY_ORIENT_BOTTOM_RIGHT:
- evas_object_move(sd->notify, x + w - minw, y + h - minh);
- break;
-
- case ELM_NOTIFY_ORIENT_LAST:
- break;
- }
+ evas_object_move(sd->notify, x, y);
}
static void
@@ -262,6 +197,9 @@ _calc(Evas_Object *obj)
edje_object_size_min_get(sd->notify, &minw, &minh);
edje_object_size_min_restricted_calc(sd->notify, &minw, &minh, minw, minh);
+ if (sd->horizontal_align == ELM_NOTIFY_ALIGN_FILL) minw = w;
+ if (sd->vertical_align == ELM_NOTIFY_ALIGN_FILL) minh = h;
+
if (sd->content)
{
_notify_move_to_orientation(obj);
@@ -278,15 +216,6 @@ _changed_size_hints_cb(void *data,
_calc(data);
}
-static void
-_content_resize_cb(void *data,
- Evas *e __UNUSED__,
- Evas_Object *obj __UNUSED__,
- void *event_info __UNUSED__)
-{
- _calc(data);
-}
-
static Eina_Bool
_elm_notify_smart_sub_object_del(Evas_Object *obj,
Evas_Object *sobj)
@@ -301,8 +230,6 @@ _elm_notify_smart_sub_object_del(Evas_Object *obj,
evas_object_event_callback_del_full
(sobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_changed_size_hints_cb, obj);
- evas_object_event_callback_del_full
- (sobj, EVAS_CALLBACK_RESIZE, _content_resize_cb, obj);
sd->content = NULL;
}
@@ -482,8 +409,6 @@ _elm_notify_smart_content_set(Evas_Object *obj,
evas_object_event_callback_add
(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_changed_size_hints_cb, obj);
- evas_object_event_callback_add
- (content, EVAS_CALLBACK_RESIZE, _content_resize_cb, obj);
edje_object_part_swallow(sd->notify, "elm.swallow.content", content);
}
@@ -533,12 +458,14 @@ _elm_notify_smart_add(Evas_Object *obj)
priv->notify = edje_object_add(evas_object_evas_get(obj));
priv->orient = -1;
+ priv->horizontal_align = 0.5;
+ priv->vertical_align = 0.0;
evas_object_event_callback_add
(obj, EVAS_CALLBACK_RESTACK, _restack_cb, obj);
elm_widget_can_focus_set(obj, EINA_FALSE);
- elm_notify_orient_set(obj, ELM_NOTIFY_ORIENT_TOP);
+ elm_notify_align_set(obj, 0.5, 0.0);
}
static void
@@ -674,7 +601,7 @@ elm_notify_parent_get(const Evas_Object *obj)
return sd->parent;
}
-EAPI void
+EINA_DEPRECATED EAPI void
elm_notify_orient_set(Evas_Object *obj,
Elm_Notify_Orient orient)
{
@@ -684,11 +611,50 @@ elm_notify_orient_set(Evas_Object *obj,
if (sd->orient == orient) return;
sd->orient = orient;
- _notify_theme_apply(obj);
- _calc(obj);
+ switch (_notify_orientation_rtl_fix(obj, sd->orient))
+ {
+ case ELM_NOTIFY_ORIENT_TOP:
+ elm_notify_align_set(obj, 0.5, 0.0);
+ break;
+
+ case ELM_NOTIFY_ORIENT_CENTER:
+ elm_notify_align_set(obj, 0.5, 0.5);
+ break;
+
+ case ELM_NOTIFY_ORIENT_BOTTOM:
+ elm_notify_align_set(obj, 0.5, 1.0);
+ break;
+
+ case ELM_NOTIFY_ORIENT_LEFT:
+ elm_notify_align_set(obj, 0.0, 0.5);
+ break;
+
+ case ELM_NOTIFY_ORIENT_RIGHT:
+ elm_notify_align_set(obj, 1.0, 0.5);
+ break;
+
+ case ELM_NOTIFY_ORIENT_TOP_LEFT:
+ elm_notify_align_set(obj, 0.0, 0.0);
+ break;
+
+ case ELM_NOTIFY_ORIENT_TOP_RIGHT:
+ elm_notify_align_set(obj, 1.0, 0.0);
+ break;
+
+ case ELM_NOTIFY_ORIENT_BOTTOM_LEFT:
+ elm_notify_align_set(obj, 0.0, 1.0);
+ break;
+
+ case ELM_NOTIFY_ORIENT_BOTTOM_RIGHT:
+ elm_notify_align_set(obj, 1.0, 1.0);
+ break;
+
+ case ELM_NOTIFY_ORIENT_LAST:
+ break;
+ }
}
-EAPI Elm_Notify_Orient
+EINA_DEPRECATED EAPI Elm_Notify_Orient
elm_notify_orient_get(const Evas_Object *obj)
{
ELM_NOTIFY_CHECK(obj) - 1;
@@ -747,3 +713,26 @@ elm_notify_allow_events_get(const Evas_Object *obj)
return sd->allow_events;
}
+
+EAPI void
+elm_notify_align_set(Evas_Object *obj, double horizontal, double vertical)
+{
+ ELM_NOTIFY_CHECK(obj);
+ ELM_NOTIFY_DATA_GET(obj, sd);
+
+ sd->horizontal_align = horizontal;
+ sd->vertical_align = vertical;
+
+ _notify_theme_apply(obj);
+ _calc(obj);
+}
+
+EAPI void
+elm_notify_align_get(const Evas_Object *obj, double *horizontal, double *vertical)
+{
+ ELM_NOTIFY_CHECK(obj);
+ ELM_NOTIFY_DATA_GET(obj, sd);
+
+ *horizontal = sd->horizontal_align;
+ *vertical = sd->vertical_align;
+}
diff --git a/legacy/elementary/src/lib/elm_notify.h b/legacy/elementary/src/lib/elm_notify.h
index 945dc11402..9a1bc22bed 100644
--- a/legacy/elementary/src/lib/elm_notify.h
+++ b/legacy/elementary/src/lib/elm_notify.h
@@ -32,27 +32,7 @@
* @{
*/
-/**
- * @brief Possible orient values for notify.
- *
- * This values should be used in conjunction to elm_notify_orient_set() to
- * set the position in which the notify should appear(relative to its parent)
- * and in conjunction with elm_notify_orient_get() to know where the notify
- * is appearing.
- */
-typedef enum
-{
- ELM_NOTIFY_ORIENT_TOP, /**< Notify should appear in the top of parent, default */
- ELM_NOTIFY_ORIENT_CENTER, /**< Notify should appear in the center of parent */
- ELM_NOTIFY_ORIENT_BOTTOM, /**< Notify should appear in the bottom of parent */
- ELM_NOTIFY_ORIENT_LEFT, /**< Notify should appear in the left of parent */
- ELM_NOTIFY_ORIENT_RIGHT, /**< Notify should appear in the right of parent */
- ELM_NOTIFY_ORIENT_TOP_LEFT, /**< Notify should appear in the top left of parent */
- ELM_NOTIFY_ORIENT_TOP_RIGHT, /**< Notify should appear in the top right of parent */
- ELM_NOTIFY_ORIENT_BOTTOM_LEFT, /**< Notify should appear in the bottom left of parent */
- ELM_NOTIFY_ORIENT_BOTTOM_RIGHT, /**< Notify should appear in the bottom right of parent */
- ELM_NOTIFY_ORIENT_LAST /**< Sentinel value, @b don't use */
-} Elm_Notify_Orient;
+#define ELM_NOTIFY_ALIGN_FILL -1.0 /**< Use with elm_notify_align_set() */
/**
* @brief Add a new notify to the parent
@@ -89,32 +69,6 @@ EAPI void elm_notify_parent_set(Evas_Object *obj, Evas_O
*/
EAPI Evas_Object *elm_notify_parent_get(const Evas_Object *obj);
-/**
- * @brief Set the orientation
- *
- * @param obj The notify object
- * @param orient The new orientation
- *
- * Sets the position in which the notify will appear in its parent.
- *
- * @see @ref Elm_Notify_Orient for possible values.
- *
- * @ingroup Notify
- */
-EAPI void elm_notify_orient_set(Evas_Object *obj, Elm_Notify_Orient orient);
-
-/**
- * @brief Return the orientation
- * @param obj The notify object
- * @return The orientation of the notification
- *
- * @see elm_notify_orient_set()
- * @see Elm_Notify_Orient
- *
- * @ingroup Notify
- */
-EAPI Elm_Notify_Orient elm_notify_orient_get(const Evas_Object *obj);
-
/**
* @brief Set the time interval after which the notify window is going to be
* hidden.
@@ -173,6 +127,31 @@ EAPI void elm_notify_allow_events_set(Evas_Object *obj,
*/
EAPI Eina_Bool elm_notify_allow_events_get(const Evas_Object *obj);
+/**
+ * @brief Set the alignment of the notify object
+ *
+ * @param obj The notify object
+ * @param horizontal The horizontal alignment of the notification
+ * @param vertical The vertical alignment of the notification
+ *
+ * Sets the alignment in which the notify will appear in its parent.
+ *
+ * @ingroup Notify
+ */
+EAPI void elm_notify_align_set(Evas_Object *obj, double horizontal, double vertical);
+
+/**
+ * @brief Get the alignment of the notify object
+ * @param obj The notify object
+ * @param horizontal The horizontal alignment of the notification
+ * @param vertical The vertical alignment of the notification
+ *
+ * @see elm_notify_align_set()
+ *
+ * @ingroup Notify
+ */
+EAPI void elm_notify_align_get(const Evas_Object *obj, double *horizontal, double *vertical);
+
/**
* @}
*/
diff --git a/legacy/elementary/src/lib/elm_widget_notify.h b/legacy/elementary/src/lib/elm_widget_notify.h
index 7fc3dc710e..bdc5aef394 100644
--- a/legacy/elementary/src/lib/elm_widget_notify.h
+++ b/legacy/elementary/src/lib/elm_widget_notify.h
@@ -128,6 +128,7 @@ struct _Elm_Notify_Smart_Data
Elm_Notify_Orient orient;
double timeout;
+ double horizontal_align, vertical_align;
Ecore_Timer *timer;
Eina_Bool allow_events : 1;