From: Prince Kr Dubey Date: Wed, 3 Aug 2011 14:54:09 +0000 (+0530) Subject: [TickerNoti] API added to support for alignment of notification window. review X-Git-Tag: REL_F_I9200_20110812_1~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8d287f6983cdebad26981503ba652b130410281b;p=framework%2Fuifw%2Felementary.git [TickerNoti] API added to support for alignment of notification window. review comment fixed. Change-Id: I14d6ce82dc6d27203a7fab829575024fe9e0978c --- diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index 3741f55..6d73c09 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -8087,29 +8087,42 @@ extern "C" { EAPI void elm_nocontents_custom_set(const Evas_Object *obj, Evas_Object *custom); EAPI Evas_Object *elm_nocontents_custom_get(const Evas_Object *obj); - /* TickerNoti */ - typedef enum - { - ELM_TICKERNOTI_DEFAULT, - ELM_TICKERNOTI_DETAILVIEW - } Elm_Tickernoti_Mode; - - EAPI Evas_Object *elm_tickernoti_add (Evas_Object *parent); - EAPI void elm_tickernoti_icon_set (const Evas_Object *obj, Evas_Object *icon); - EAPI Evas_Object *elm_tickernoti_icon_get (const Evas_Object *obj); - EAPI void elm_tickernoti_label_set (Evas_Object *obj, const char *label); - EAPI const char *elm_tickernoti_label_get (const Evas_Object *obj); - EAPI void elm_tickernoti_detailview_label_set (Evas_Object *obj, const char *label); - EAPI const char *elm_tickernoti_detailview_label_get (const Evas_Object *obj); - EAPI void elm_tickernoti_detailview_button_set (const Evas_Object *obj, Evas_Object *button); - EAPI Evas_Object *elm_tickernoti_detailview_button_get (const Evas_Object *obj); - EAPI void elm_tickernoti_detailview_icon_set (const Evas_Object *obj, Evas_Object *icon); - EAPI Evas_Object *elm_tickernoti_detailview_icon_get (const Evas_Object *obj); - EAPI Evas_Object *elm_tickernoti_detailview_get (const Evas_Object *obj); - EAPI int elm_tickernoti_rotation_get (const Evas_Object *obj); - EAPI void elm_tickernoti_rotation_set (const Evas_Object *obj, int angle); - EAPI void elm_tickernoti_mode_set (const Evas_Object *obj, Elm_Tickernoti_Mode mode); - EAPI Elm_Tickernoti_Mode elm_tickernoti_mode_get (const Evas_Object *obj); +/* TickerNoti */ +typedef enum + { + ELM_TICKERNOTI_DEFAULT, + ELM_TICKERNOTI_DETAILVIEW + } Elm_Tickernoti_Mode; + +typedef enum + { + ELM_TICKERNOTI_ORIENT_TOP, + ELM_TICKERNOTI_ORIENT_BOTTOM + } Elm_Tickernoti_Orient; + + EAPI Evas_Object *elm_tickernoti_add (Evas_Object *parent); + EAPI void elm_tickernoti_icon_set (Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1); + EAPI Evas_Object *elm_tickernoti_icon_get (const Evas_Object *obj) EINA_ARG_NONNULL(1); + EAPI void elm_tickernoti_label_set (Evas_Object *obj, const char *label) EINA_ARG_NONNULL(1); + EAPI const char *elm_tickernoti_label_get (const Evas_Object *obj) EINA_ARG_NONNULL(1); + EAPI void elm_tickernoti_button_set (Evas_Object *obj, Evas_Object *button) EINA_ARG_NONNULL(1); + EAPI Evas_Object *elm_tickernoti_button_get (const Evas_Object *obj) EINA_ARG_NONNULL(1); + EAPI void elm_tickernoti_orientation_set (Evas_Object *obj, Elm_Tickernoti_Orient orient) EINA_ARG_NONNULL(1); + EAPI Elm_Tickernoti_Orient elm_tickernoti_orientation_get (const Evas_Object *obj) EINA_ARG_NONNULL(1); + EAPI int elm_tickernoti_rotation_get (const Evas_Object *obj) EINA_ARG_NONNULL(1); + EAPI void elm_tickernoti_rotation_set (Evas_Object *obj, int angle) EINA_ARG_NONNULL(1); + /* #### Below APIs are going to be deprecated, announcment will be made soon ####*/ + EAPI Evas_Object *elm_tickernoti_win_get (const Evas_Object *obj) EINA_ARG_NONNULL(1); + EAPI void elm_tickernoti_detailview_label_set (Evas_Object *obj, const char *label) EINA_ARG_NONNULL(1); + EAPI const char *elm_tickernoti_detailview_label_get (const Evas_Object *obj)EINA_ARG_NONNULL(1); + EAPI void elm_tickernoti_detailview_button_set (Evas_Object *obj, Evas_Object *button) EINA_ARG_NONNULL(2); + EAPI Evas_Object *elm_tickernoti_detailview_button_get (const Evas_Object *obj) EINA_ARG_NONNULL(1); + EAPI void elm_tickernoti_detailview_icon_set (Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1); + EAPI Evas_Object *elm_tickernoti_detailview_icon_get (const Evas_Object *obj) EINA_ARG_NONNULL(1); + EAPI Evas_Object *elm_tickernoti_detailview_get (const Evas_Object *obj) EINA_ARG_NONNULL(1); + EAPI void elm_tickernoti_mode_set (Evas_Object *obj, Elm_Tickernoti_Mode mode) EINA_ARG_NONNULL(1); + EAPI Elm_Tickernoti_Mode elm_tickernoti_mode_get (const Evas_Object *obj) EINA_ARG_NONNULL(1); + /* ############################################################################### */ /* colorpalette */ typedef struct _Colorpalette_Color Elm_Colorpalette_Color; diff --git a/src/lib/elm_tickernoti.c b/src/lib/elm_tickernoti.c index a07748f..4476c2b 100644 --- a/src/lib/elm_tickernoti.c +++ b/src/lib/elm_tickernoti.c @@ -5,28 +5,25 @@ * @defgroup TickerNoti TickerNoti * @ingroup Elementary * + * This is a notification widget which can be used to display some short information. */ typedef struct _Widget_Data Widget_Data; struct _Widget_Data { - Evas_Object *win_indi; - Evas_Object *win_detail; - Evas_Object *edje_indi; - Evas_Object *edje_detail; - Evas_Object *icon_indi; - Evas_Object *icon_detail; - Evas_Object *button_detail; + Evas_Object *win; + Evas_Object *edje_obj; + Evas_Object *icon; + Evas_Object *button; - const char *label_indi; - const char *label_detail; + const char *label; - int indicator_height; - int detail_view_height; + int noti_height; int angle; Elm_Tickernoti_Mode mode; + Elm_Tickernoti_Orient orient; }; static const char *widtype = NULL; @@ -37,67 +34,67 @@ static void _sizing_eval(Evas_Object *obj); static void _del_job(void *data) { - Evas_Object *obj = data; - evas_object_del(obj); + evas_object_del(data); } static void _del_hook(Evas_Object *obj) { + Evas_Object *p; Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; - Evas_Object *p = elm_widget_parent_get(obj); - if (p == wd->win_indi) ecore_job_add (_del_job, p); + p = elm_widget_parent_get(obj); + if (wd->win) ecore_job_add (_del_job, p); - evas_object_del (wd->edje_indi); - wd->edje_indi = NULL; - evas_object_del (wd->edje_detail); - wd->edje_detail = NULL; - evas_object_del (wd->win_detail); - wd->win_detail = NULL; + evas_object_del (wd->edje_obj); + wd->edje_obj = NULL; free(wd); } static void -_theme_hook(Evas_Object *obj) +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) { Widget_Data *wd = elm_widget_data_get(obj); - char *data_win_height = NULL; if (!wd) return; + edje_object_mirrored_set(wd->edje_obj, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + char *data_win_height = NULL; + Evas_Coord w; + Widget_Data *wd = elm_widget_data_get(obj); - _elm_theme_object_set (wd->win_indi, wd->edje_indi, "tickernoti", "1line", - elm_widget_style_get(obj)); - _elm_theme_object_set (wd->win_detail, wd->edje_detail, "tickernoti", "2line", - elm_widget_style_get(obj)); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); - edje_object_scale_set (wd->edje_indi, elm_widget_scale_get(obj) * _elm_config->scale); - edje_object_scale_set (wd->edje_detail, elm_widget_scale_get(obj) * _elm_config->scale); + _elm_theme_object_set (wd->win, wd->edje_obj, "tickernoti", + "base", elm_widget_style_get(obj)); - /* tickernoti indicator height set */ - data_win_height = (char *)edje_object_data_get (wd->edje_indi, "height"); - if (data_win_height != NULL && elm_scale_get() > 0.0) - wd->indicator_height = (int)(elm_scale_get() * atoi(data_win_height)); + edje_object_scale_set (wd->edje_obj, elm_widget_scale_get(obj) * _elm_config->scale); /* tickernoti detail height set */ - data_win_height = (char *)edje_object_data_get (wd->edje_detail, "height"); + data_win_height = (char *)edje_object_data_get (wd->edje_obj, "height"); if (data_win_height != NULL && elm_scale_get() > 0.0) - wd->detail_view_height = (int)(elm_scale_get() * atoi(data_win_height)); + wd->noti_height = (int)(elm_scale_get() * atoi(data_win_height)); -#ifdef HAVE_ELEMENTARY_X - Evas_Coord w; - - ecore_x_window_size_get (ecore_x_window_root_first_get(), &w, NULL); - evas_object_resize (wd->win_indi, w, wd->indicator_height); - evas_object_resize (wd->win_detail, w, wd->detail_view_height); -#endif + evas_object_geometry_get(wd->win, NULL, NULL, &w, NULL); + evas_object_resize (wd->win, w, wd->noti_height); - if (wd->label_indi) - edje_object_part_text_set(wd->edje_indi, "elm.text", wd->label_indi); - if (wd->label_detail) - edje_object_part_text_set(wd->edje_detail, "elm.text", wd->label_detail); + if (wd->label) + edje_object_part_text_set(wd->edje_obj, "elm.text", wd->label); + if (wd->icon) + edje_object_part_swallow (wd->edje_obj, "icon", wd->icon); + if (wd->button) + edje_object_part_swallow (wd->edje_obj, "button", wd->button); + edje_object_signal_emit (wd->edje_obj, "effect,show", "elm"); + edje_object_message_signal_process(wd->edje_obj); _sizing_eval(obj); } @@ -106,31 +103,26 @@ static void _sizing_eval(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); -// Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; - if (!wd) return; + Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; -/* - edje_object_size_min_calc(wd->win_detail, &minw, &minh); - evas_object_size_hint_min_set(obj, minw, minh); - evas_object_size_hint_max_set(obj, maxw, maxh); - evas_object_size_hint_align_set(obj, maxw, maxh); -*/ + if (!wd) return; + edje_object_size_min_calc(wd->win, &minw, &minh); +//TODO: } + #ifdef HAVE_ELEMENTARY_X static void -_make_notification_window (Evas_Object *obj) +_update_window_hints (Evas_Object *obj) { - Widget_Data *wd = elm_widget_data_get(obj); - if (!wd) return; - Ecore_X_Window xwin; Ecore_X_Atom _notification_level_atom; int level; /* elm_win_xwindow_get() must call after elm_win_alpha_set() */ xwin = elm_win_xwindow_get (obj); - ecore_x_netwm_window_type_set (xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION); - ecore_x_icccm_hints_set(xwin, 0, ECORE_X_WINDOW_STATE_HINT_NONE, 0, 0, 0, 0, 0); + ecore_x_icccm_hints_set(xwin, 0, ECORE_X_WINDOW_STATE_HINT_NONE, 0, 0, 0, 0, 0); + ecore_x_netwm_window_type_set (xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION); + ecore_x_netwm_opacity_set(xwin, 0); /* Create atom for notification level */ _notification_level_atom = ecore_x_atom_get ("_E_ILLUME_NOTIFICATION_LEVEL"); @@ -142,18 +134,15 @@ _make_notification_window (Evas_Object *obj) } #endif -static void _detail_show_cb (void *data, Evas_Object *obj __UNUSED__, +static void _hide_cb (void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) { - evas_object_smart_callback_call ((Evas_Object *)data, "detail,show", NULL); -} + Widget_Data *wd = elm_widget_data_get(data); -static void _detail_hide_cb (void *data, Evas_Object *obj __UNUSED__, - const char *emission __UNUSED__, - const char *source __UNUSED__) -{ - evas_object_smart_callback_call ((Evas_Object *)data, "detail,hide", NULL); + if (!wd) return; + evas_object_hide (wd->win); + evas_object_smart_callback_call (data, "hide", NULL); } static Evas_Object @@ -162,84 +151,58 @@ static Evas_Object Evas_Object *win; win = elm_win_add (parent, name, ELM_WIN_BASIC); -/* Property */ elm_win_title_set (win, name); elm_win_borderless_set (win, EINA_TRUE); elm_win_autodel_set (win, EINA_TRUE); - elm_win_alpha_set (win, EINA_TRUE); - elm_win_transparent_set(win, EINA_TRUE); + elm_win_alpha_set(win, EINA_TRUE); #ifdef HAVE_ELEMENTARY_X /* set top window */ - _make_notification_window (win); + _update_window_hints (win); #endif return win; } static void -_create_tickernoti_indi (Evas_Object *obj) +_create_tickernoti (Evas_Object *obj) { #ifdef HAVE_ELEMENTARY_X Evas_Coord w; #endif Widget_Data *wd = elm_widget_data_get(obj); - Evas *e; char *data_win_height = NULL; + Evas *e; if (!wd) return; - evas_object_move (wd->win_indi, 0, 0); - e = evas_object_evas_get (wd->win_indi); + evas_object_move (wd->win, 0, 0); + e = evas_object_evas_get (wd->win); - wd->edje_indi = edje_object_add (e); - _elm_theme_object_set (wd->win_indi, wd->edje_indi, "tickernoti", "1line", "default"); - elm_win_resize_object_add (wd->win_indi, wd->edje_indi); + wd->edje_obj = edje_object_add (e); + _elm_theme_object_set (wd->win, wd->edje_obj, "tickernoti", "base", "default"); + elm_win_resize_object_add (wd->win, wd->edje_obj); - /* tickernoti indicator height set */ - data_win_height = (char *)edje_object_data_get (wd->edje_indi, "height"); + /* tickernoti detail height set */ + data_win_height = (char *)edje_object_data_get (wd->edje_obj, "height"); if (data_win_height != NULL && elm_scale_get() > 0.0) - wd->indicator_height = (int)(elm_scale_get() * atoi(data_win_height)); + wd->noti_height = (int)(elm_scale_get() * atoi(data_win_height)); #ifdef HAVE_ELEMENTARY_X ecore_x_window_size_get (ecore_x_window_root_first_get(), &w, NULL); - evas_object_resize (wd->win_indi, w, wd->indicator_height); + evas_object_resize (wd->win, w, wd->noti_height); #endif - edje_object_signal_callback_add (wd->edje_indi, "request,detail,show", "", _detail_show_cb, obj); - evas_object_show (wd->edje_indi); + edje_object_signal_callback_add(wd->edje_obj, "request,hide", "", _hide_cb, obj); + evas_object_show (wd->edje_obj); } static void -_create_tickernoti_detail (Evas_Object *obj) +_disable_hook(Evas_Object *obj) { -#ifdef HAVE_ELEMENTARY_X - Evas_Coord w; -#endif Widget_Data *wd = elm_widget_data_get(obj); - char *data_win_height = NULL; - Evas *e; if (!wd) return; - - evas_object_move (wd->win_detail, 0, 0); - e = evas_object_evas_get (wd->win_detail); - - wd->edje_detail = edje_object_add (e); - _elm_theme_object_set (wd->win_detail, wd->edje_detail, "tickernoti", "2line", "default"); - elm_win_resize_object_add (wd->win_detail, wd->edje_detail); - - /* tickernoti detail height set */ - data_win_height = (char *)edje_object_data_get (wd->edje_detail, "height"); - if (data_win_height != NULL && elm_scale_get() > 0.0) - wd->detail_view_height = (int)(elm_scale_get() * atoi(data_win_height)); - -#ifdef HAVE_ELEMENTARY_X - ecore_x_window_size_get (ecore_x_window_root_first_get(), &w, NULL); - evas_object_resize (wd->win_detail, w, wd->detail_view_height); -#endif - - edje_object_signal_callback_add(wd->edje_detail, "request,detail,hide", "", _detail_hide_cb, obj); - evas_object_show (wd->edje_detail); +//TODO: } static void @@ -249,24 +212,12 @@ _show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - if (wd->mode == ELM_TICKERNOTI_DEFAULT) - { - evas_object_hide (wd->win_detail); -#ifdef HAVE_ELEMENTARY_X - _make_notification_window (wd->win_indi); -#endif - evas_object_show (wd->win_indi); - edje_object_signal_emit (wd->edje_indi, "effect,show", "bg_1line"); - } - else if (wd->mode == ELM_TICKERNOTI_DETAILVIEW) - { - evas_object_hide (wd->win_indi); #ifdef HAVE_ELEMENTARY_X - _make_notification_window (wd->win_detail); + _update_window_hints (wd->win); #endif - evas_object_show (wd->win_detail); - edje_object_signal_emit (wd->edje_detail, "effect,show", "bg_2line"); - } + evas_object_show (wd->win); + edje_object_signal_emit (wd->edje_obj, "effect,show", "elm"); + edje_object_message_signal_process(wd->edje_obj); } static void @@ -277,8 +228,18 @@ _hide(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, if (!wd) return; evas_object_hide (obj); - evas_object_hide (wd->win_indi); - evas_object_hide (wd->win_detail); + evas_object_hide (wd->win); +} + +static void _tickernoti_hide_cb (void *data, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Widget_Data *wd = data; + + if (!wd) return; + + edje_object_signal_emit (wd->edje_obj, "effect,hide", "elm"); + edje_object_message_signal_process(wd->edje_obj); } /** @@ -298,25 +259,22 @@ elm_tickernoti_add(Evas_Object *parent) Widget_Data *wd; wd = ELM_NEW(Widget_Data); - wd->win_indi = _create_window (parent, "indi"); - wd->win_detail = _create_window (parent, "detail"); - - if (!parent) parent = wd->win_indi; + wd->win = _create_window (parent, "noti-window"); - e = evas_object_evas_get(parent); + e = evas_object_evas_get(wd->win); obj = elm_widget_add(e); ELM_SET_WIDTYPE(widtype, "tickernoti"); elm_widget_type_set(obj, "tickernoti"); - elm_widget_sub_object_add(parent, obj); + elm_widget_sub_object_add(wd->win, obj); elm_widget_data_set(obj, wd); elm_widget_del_hook_set(obj, _del_hook); elm_widget_theme_hook_set(obj, _theme_hook); elm_widget_can_focus_set(obj, 0); + elm_widget_disable_hook_set(obj, _disable_hook); - wd->mode = ELM_TICKERNOTI_DEFAULT; + wd->orient = ELM_TICKERNOTI_ORIENT_TOP; - _create_tickernoti_indi (obj); - _create_tickernoti_detail (obj); + _create_tickernoti (obj); evas_object_event_callback_add (obj, EVAS_CALLBACK_SHOW, _show, NULL); evas_object_event_callback_add (obj, EVAS_CALLBACK_HIDE, _hide, NULL); @@ -324,41 +282,6 @@ elm_tickernoti_add(Evas_Object *parent) return obj; } - -/** - * Set the icon object used on the tickernoti object - * - * @param obj The tickernotil object - * @param icon The icon object will be used on the tickernoti object - * @ingroup TickerNoti - */ -EAPI void -elm_tickernoti_icon_set (const Evas_Object *obj, Evas_Object *icon) -{ - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - if (!wd) return; - if (!icon) return; - edje_object_part_swallow (wd->edje_indi, "icon", icon); - wd->icon_indi = icon; -} - -/** - * Get the icon object used on the tickernoti object - * - * @param obj The tickernotil object - * @return The icon object inside the tickernoti - * @ingroup TickerNoti - */ -EAPI Evas_Object * -elm_tickernoti_icon_get (const Evas_Object *obj) -{ - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - Widget_Data *wd = elm_widget_data_get(obj); - if (!wd) return NULL; - return wd->icon_indi; -} - /** * Set the label on the tickernoti object * @@ -374,8 +297,8 @@ elm_tickernoti_label_set (Evas_Object *obj, const char *label) Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - eina_stringshare_replace(&wd->label_indi, label); - edje_object_part_text_set(wd->edje_indi, "elm.text", wd->label_indi); + eina_stringshare_replace(&wd->label, label); + edje_object_part_text_set(wd->edje_obj, "elm.text", wd->label); _sizing_eval(obj); } @@ -392,115 +315,82 @@ elm_tickernoti_label_get (const Evas_Object *obj) ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return NULL; - return wd->label_indi; -} -/** - * Set the detail label on the tickernoti object - * - * @param obj The tickernoti object - * @param label The label will be used on the tickernoti object - * - * @ingroup TickerNoti - */ -EAPI void -elm_tickernoti_detailview_label_set (Evas_Object *obj, const char *label) -{ - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return; - eina_stringshare_replace(&wd->label_detail, label); - edje_object_part_text_set(wd->edje_detail, "elm.text", wd->label_detail); - _sizing_eval(obj); + return wd->label; } /** - * Get the detail label used on the tickernoti object - * - * @param obj The tickernotil object - * @return The string inside the label - * @ingroup TickerNoti - */ -EAPI const char * -elm_tickernoti_detailview_label_get (const Evas_Object *obj) -{ - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - Widget_Data *wd = elm_widget_data_get(obj); - if (!wd) return NULL; - return wd->label_detail; -} - -/** - * Set the button object used on the tickernoti object + * Set the action button object used on the tickernoti object * * @param obj The tickernotil object * @param button The button object will be used on the tickernoti object * @ingroup TickerNoti */ EAPI void -elm_tickernoti_detailview_button_set (const Evas_Object *obj, Evas_Object *button) +elm_tickernoti_button_set (Evas_Object *obj, Evas_Object *button) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; if (!button) return; - edje_object_part_swallow (wd->edje_detail, "button", button); - wd->button_detail = button; + edje_object_part_swallow (wd->edje_obj, "button", button); + wd->button = button; + evas_object_smart_callback_add (wd->button, "clicked", _tickernoti_hide_cb, wd); } /** - * Get the button object used on the tickernoti object + * Get the action button object used on the tickernoti object * * @param obj The tickernotil object * @return The button object inside the tickernoti * @ingroup TickerNoti */ EAPI Evas_Object * -elm_tickernoti_detailview_button_get (const Evas_Object *obj) +elm_tickernoti_button_get (const Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return NULL; - return wd->button_detail; + return wd->button; } /** - * Set the detail icon object used on the tickernoti object + * Set the icon object of the tickernoti object * * @param obj The tickernotil object * @param icon The icon object will be used on the tickernoti object * @ingroup TickerNoti */ EAPI void -elm_tickernoti_detailview_icon_set (const Evas_Object *obj, Evas_Object *icon) +elm_tickernoti_icon_set (Evas_Object *obj, Evas_Object *icon) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; if (!icon) return; - edje_object_part_swallow (wd->edje_detail, "icon", icon); - wd->icon_detail = icon; + edje_object_part_swallow (wd->edje_obj, "icon", icon); + wd->icon = icon; } /** - * Get the detail icon object used on the tickernoti object + * Get the icon object of the tickernoti object * * @param obj The tickernotil object * @return The icon object inside the tickernoti * @ingroup TickerNoti */ EAPI Evas_Object * -elm_tickernoti_detailview_icon_get (const Evas_Object *obj) +elm_tickernoti_icon_get (const Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return NULL; - return wd->icon_detail; + return wd->icon; } /** - * Get the rotation used on the tickernoti object + * Get the rotation of tickernoti object * * @param obj The tickernotil object * @return The rotation angle @@ -516,99 +406,209 @@ elm_tickernoti_rotation_get (const Evas_Object *obj) } /** - * Set the rotation used on the tickernoti object + * Set the rotation angle for the tickernoti object * - * @param obj The tickernotil object + * @param obj The tickernoti object * @param angle The rotation angle(in degree) will be used on the tickernoti object * @ingroup TickerNoti */ EAPI void -elm_tickernoti_rotation_set (const Evas_Object *obj, int angle) +elm_tickernoti_rotation_set (Evas_Object *obj, int angle) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); - Evas_Coord x, y, w, h; + Evas_Coord w, x = 0, y = 0; if (!wd) return; if (angle%90 != 0) return; - if (angle >= 0) - angle = angle%360; - else - angle = angle - (angle/360 - 1)*360; + wd->angle = angle%360; + if (wd->angle < 0) + wd->angle = 360 + wd->angle; - wd->angle = angle; #ifdef HAVE_ELEMENTARY_X Evas_Coord root_w, root_h; + /* * manual calculate win_tickernoti_indi window position & size * - win_indi is not full size window (480 x 27) */ ecore_x_window_size_get (ecore_x_window_root_first_get(), &root_w, &root_h); -#endif - evas_object_geometry_get (wd->win_indi, &x, &y, &w, &h); - - if (evas_object_visible_get (wd->win_detail)) - evas_object_geometry_get (wd->win_detail, &x, &y, &w, &h); /* rotate win */ - switch (angle) + switch (wd->angle) { case 90: -#ifdef HAVE_ELEMENTARY_X w = root_h; -#endif - x = 0; - y = 0; + if (wd->orient == ELM_TICKERNOTI_ORIENT_BOTTOM) + x = root_w-wd->noti_height; break; case 270: -#ifdef HAVE_ELEMENTARY_X w = root_h; -#endif -#ifdef HAVE_ELEMENTARY_X - x = root_w-h; -#endif - y = 0; + if (!(wd->orient == ELM_TICKERNOTI_ORIENT_BOTTOM)) + x = root_w-wd->noti_height; break; case 180: -#ifdef HAVE_ELEMENTARY_X w = root_w; -#endif - x = 0; -#ifdef HAVE_ELEMENTARY_X - y = root_h-h; -#endif + if (!wd->orient == ELM_TICKERNOTI_ORIENT_BOTTOM) + y = root_h - wd->noti_height; break; + case 0: default: - case 0: -#ifdef HAVE_ELEMENTARY_X w = root_w; -#endif - x = 0; - y = 0; + if (wd->orient == ELM_TICKERNOTI_ORIENT_BOTTOM) + y = root_h - wd->noti_height; break; } +#endif +/* detail */ + elm_win_rotation_with_resize_set (wd->win, wd->angle); + evas_object_move (wd->win, x, y); -/* indicator */ - elm_win_rotation_with_resize_set (wd->win_indi, angle); - evas_object_move (wd->win_indi, x, y); - evas_object_resize (wd->win_indi, w, wd->indicator_height); - if (evas_object_visible_get (wd->win_indi)) - { + evas_object_resize (wd->win, w, wd->noti_height); #ifdef HAVE_ELEMENTARY_X - _make_notification_window (wd->win_indi); + _update_window_hints (wd->win); #endif - } -/* detail */ - elm_win_rotation_with_resize_set (wd->win_detail, angle); - evas_object_move (wd->win_detail, x, y); - evas_object_resize (wd->win_detail, w, wd->detail_view_height); - if (evas_object_visible_get (wd->win_detail)) - { +} + +/** + * Set the orientation of the tickernoti object + * + * @param obj The tickernoti object + * @param orient The orientation of tickernoti object + * @ingroup TickerNoti + */ +EAPI void +elm_tickernoti_orientation_set (Evas_Object *obj, Elm_Tickernoti_Orient orient) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + #ifdef HAVE_ELEMENTARY_X - _make_notification_window (wd->win_detail); + Evas_Coord root_w, root_h; #endif - } + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + +#ifdef HAVE_ELEMENTARY_X + ecore_x_window_size_get (ecore_x_window_root_first_get(), &root_w, &root_h); +#endif + + switch (orient) { + case ELM_TICKERNOTI_ORIENT_BOTTOM: +#ifdef HAVE_ELEMENTARY_X + evas_object_move (wd->win, 0, root_h - wd->noti_height); +#endif + wd->orient = ELM_TICKERNOTI_ORIENT_BOTTOM; + break; + case ELM_TICKERNOTI_ORIENT_TOP: + default: +#ifdef HAVE_ELEMENTARY_X + evas_object_move (wd->win, 0, 0); +#endif + wd->orient = ELM_TICKERNOTI_ORIENT_TOP; + break; + } +} + +/** + * Get the orientation of the tickernoti object + * + * @param obj The tickernotil object + * @return The orientation of tickernotil object + * @ingroup TickerNoti + */ +EAPI Elm_Tickernoti_Orient +elm_tickernoti_orientation_get (const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) -1; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return -1; + return wd->orient; +} + +// ################### Below APIs are going to be removed. ########################### +/** + * Set the detail label on the tickernoti object + * + * @param obj The tickernoti object + * @param label The label will be used on the tickernoti object + * + * @ingroup TickerNoti + */ +EAPI void +elm_tickernoti_detailview_label_set (Evas_Object *obj, const char *label) +{ + elm_tickernoti_label_set (obj, label); +} + +/** + * Get the detail label used on the tickernoti object + * + * @param obj The tickernotil object + * @return The string inside the label + * @ingroup TickerNoti + */ +EAPI const char * +elm_tickernoti_detailview_label_get (const Evas_Object *obj) +{ + return elm_tickernoti_label_get (obj); +} + +/** + * Set the button object used on the tickernoti object + * + * @param obj The tickernotil object + * @param button The button object will be used on the tickernoti object + * @ingroup TickerNoti + */ +EAPI void +elm_tickernoti_detailview_button_set (Evas_Object *obj, Evas_Object *button) +{ + elm_tickernoti_button_set (obj, button); +} + + +/** + * Get the button object used on the tickernoti object + * + * @param obj The tickernotil object + * @return The button object inside the tickernoti + * @ingroup TickerNoti + */ +EAPI Evas_Object * +elm_tickernoti_detailview_button_get (const Evas_Object *obj) +{ + return elm_tickernoti_button_get (obj); +} + + + +/** + * Set the detail icon object used on the tickernoti object + * + * @param obj The tickernotil object + * @param icon The icon object will be used on the tickernoti object + * @ingroup TickerNoti + */ +EAPI void +elm_tickernoti_detailview_icon_set (Evas_Object *obj, Evas_Object *icon) +{ + elm_tickernoti_icon_set (obj, icon); +} + +/** + * Get the detail icon object used on the tickernoti object + * + * @param obj The tickernotil object + * @return The icon object inside the tickernoti + * @ingroup TickerNoti + */ +EAPI Evas_Object * +elm_tickernoti_detailview_icon_get (const Evas_Object *obj) +{ + return elm_tickernoti_icon_get (obj); } /** @@ -635,7 +635,7 @@ elm_tickernoti_mode_get (const Evas_Object *obj) * @ingroup TickerNoti */ EAPI void -elm_tickernoti_mode_set (const Evas_Object *obj, Elm_Tickernoti_Mode mode) +elm_tickernoti_mode_set (Evas_Object *obj, Elm_Tickernoti_Mode mode) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -659,11 +659,24 @@ elm_tickernoti_mode_set (const Evas_Object *obj, Elm_Tickernoti_Mode mode) * @ingroup TickerNoti */ EAPI Evas_Object * -elm_tickernoti_detailview_get (const Evas_Object *obj) +elm_tickernoti_win_get (const Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return NULL; - return wd->win_detail; + return wd->win; +} + +/** + * Get the detail view window(elm_win) on the tickernoti object + * + * @param obj The tickernotil object + * @return detail view window(elm_win) object + * @ingroup TickerNoti + */ +EAPI Evas_Object * +elm_tickernoti_detailview_get (const Evas_Object *obj) +{ + return elm_tickernoti_win_get (obj); }