[elm_tickernoti] Implementation of elm_object_text_set/get, elm_object_content_set...
authorRajeev Ranjan <rajeev.r@samsung.com>
Mon, 26 Sep 2011 11:14:30 +0000 (20:14 +0900)
committerRajeev Ranjan <rajeev.r@samsung.com>
Mon, 26 Sep 2011 11:19:23 +0000 (20:19 +0900)
Change-Id: Ic8edb228100563603f08c965d6a5122630e272cd

src/lib/Elementary.h.in
src/lib/elm_tickernoti.c

index 8ae8d2f..6408cf8 100644 (file)
@@ -8534,32 +8534,26 @@ 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;
-
-typedef enum
-  {
-     ELM_TICKERNOTI_ORIENT_TOP,
-     ELM_TICKERNOTI_ORIENT_BOTTOM
-  } Elm_Tickernoti_Orient;
+   /* TickerNoti */
+   typedef enum
+     {
+        ELM_TICKERNOTI_ORIENT_TOP = 0,
+        ELM_TICKERNOTI_ORIENT_BOTTOM,
+        ELM_TICKERNOTI_ORIENT_LAST
+     }  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 void                      elm_tickernoti_orient_set (Evas_Object *obj, Elm_Tickernoti_Orient orient) EINA_ARG_NONNULL(1);
+   EAPI Elm_Tickernoti_Orient     elm_tickernoti_orient_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);
+   /* #### Below APIs and data structures are going to be deprecated, announcment will be made soon ####*/
+   typedef enum
+    {
+       ELM_TICKERNOTI_DEFAULT,
+       ELM_TICKERNOTI_DETAILVIEW
+    } Elm_Tickernoti_Mode;
    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);
@@ -8569,12 +8563,32 @@ typedef enum
    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);
+   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 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_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_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);
    /* ############################################################################### */
-   /* smart callbacks called:
+   /*
+    * Parts which can be used with elm_object_text_part_set() and
+    * elm_object_text_part_get():
+    *
+    * @li NULL/"default" - Operates on tickernoti content-text
+    *
+    * Parts which can be used with elm_object_content_part_set() and
+    * elm_object_content_part_get():
+    *
+    * @li "icon" - Operates on tickernoti's icon
+    * @li "button" - Operates on tickernoti's button
+    *
+    * smart callbacks called:
     * @li "clicked" - emitted when tickernoti is clicked, except at the
     * swallow/button region, if any.
-    * @li "hide" - emitted when the tickernoti is completelyhidden. In case of
-    * any hide animation, this signal is raised after the animation.
+    * @li "hide" - emitted when the tickernoti is completely hidden. In case of
+    * any hide animation, this signal is emitted after the animation.
     */
 
    /* colorpalette */
index a69995b..b37e494 100644 (file)
@@ -16,12 +16,10 @@ struct _Widget_Data
    Evas_Object *edje_obj;
    Evas_Object *icon;
    Evas_Object *button;
-
+   Ecore_Event_Handler *rotation_event_handler;
    const char *label;
-
    int noti_height;
    int angle;
-
    Elm_Tickernoti_Mode mode;
    Elm_Tickernoti_Orient orient;
 };
@@ -30,6 +28,7 @@ static const char *widtype = NULL;
 static void _del_hook(Evas_Object *obj);
 static void _theme_hook(Evas_Object *obj);
 static void _sizing_eval(Evas_Object *obj);
+static void _update_geometry_on_rotation(Evas_Object *obj, int angle, int *x, int *y, int *w);
 
 static const char SIG_CLICKED[] = "clicked";
 static const char SIG_HIDDEN[] = "hide";
@@ -38,6 +37,7 @@ static const Evas_Smart_Cb_Description _signals[] = {
        {SIG_HIDDEN, ""},
        {NULL, NULL}
 };
+
 static void
 _del_job(void *data)
 {
@@ -47,17 +47,16 @@ _del_job(void *data)
 static void
 _del_hook(Evas_Object *obj)
 {
-   Evas_Object *p;
+   Evas_Object *parent;
    Widget_Data *wd = elm_widget_data_get(obj);
 
    if (!wd) return;
-
-   p = elm_widget_parent_get(obj);
-   if (wd->win) ecore_job_add (_del_job, p);
-
-   evas_object_del (wd->edje_obj);
+   parent = elm_widget_parent_get(obj);
+   if (wd->rotation_event_handler)
+     ecore_event_handler_del(wd->rotation_event_handler);
+   if (wd->win) ecore_job_add(_del_job, parent);
+   evas_object_del(wd->edje_obj);
    wd->edje_obj = NULL;
-
    free(wd);
 }
 
@@ -81,26 +80,26 @@ _theme_hook(Evas_Object *obj)
    _elm_widget_mirrored_reload(obj);
    _mirrored_set(obj, elm_widget_mirrored_get(obj));
 
-   _elm_theme_object_set (wd->win, wd->edje_obj, "tickernoti",
+   _elm_theme_object_set(wd->win, wd->edje_obj, "tickernoti",
                           "base", elm_widget_style_get(obj));
 
-   edje_object_scale_set (wd->edje_obj, elm_widget_scale_get(obj) * _elm_config->scale);
+   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_obj, "height");
+   data_win_height = (char *)edje_object_data_get(wd->edje_obj, "height");
    if (data_win_height != NULL && elm_scale_get() > 0.0)
      wd->noti_height = (int)(elm_scale_get() * atoi(data_win_height));
 
    evas_object_geometry_get(wd->win, NULL, NULL, &w, NULL);
-   evas_object_resize (wd->win, w, wd->noti_height);
+   evas_object_resize(wd->win, w, wd->noti_height);
 
    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);
+     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_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);
@@ -120,69 +119,111 @@ _sizing_eval(Evas_Object *obj)
 
 #ifdef HAVE_ELEMENTARY_X
 static void
-_update_window_hints (Evas_Object *obj)
+_update_window_hints(Evas_Object *obj)
 {
    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);
+   // elm_win_xwindow_get() must call after elm_win_alpha_set()
+   xwin = elm_win_xwindow_get(obj);
 
    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_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");
+   // Create atom for notification level
+   _notification_level_atom = ecore_x_atom_get("_E_ILLUME_NOTIFICATION_LEVEL");
 
-   /* HIGH:150, NORMAL:100, LOW:50 */
+   // HIGH:150, NORMAL:100, LOW:50
    level = 100;
 
-   /* Set notification level of the window */
-   ecore_x_window_prop_property_set (xwin, _notification_level_atom, ECORE_X_ATOM_CARDINAL, 32, &level, 1);
+   // Set notification level of the window
+   ecore_x_window_prop_property_set(xwin, _notification_level_atom, ECORE_X_ATOM_CARDINAL, 32, &level, 1);
 }
 #endif
 
-static void _hide_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__)
 {
    Widget_Data *wd = elm_widget_data_get(data);
 
    if (!wd) return;
-   evas_object_hide (wd->win);
-   evas_object_smart_callback_call (data, SIG_HIDDEN, NULL);
+   evas_object_hide(wd->win);
+   evas_object_smart_callback_call(data, SIG_HIDDEN, NULL);
 }
 
-static void _clicked_cb (void *data, Evas_Object *obj __UNUSED__,
+static void _clicked_cb(void *data, Evas_Object *obj __UNUSED__,
                              const char *emission __UNUSED__,
                              const char *source __UNUSED__)
 {
    Widget_Data *wd = elm_widget_data_get(data);
 
    if (!wd) return;
-   evas_object_smart_callback_call (data, SIG_CLICKED, NULL);
+   evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
 }
 
 static Evas_Object
-*_create_window (Evas_Object *parent, const char *name)
+*_create_window(Evas_Object *parent, const char *name)
 {
    Evas_Object *win;
 
-   win = elm_win_add (parent, name, ELM_WIN_BASIC);
-   elm_win_title_set (win, name);
-   elm_win_borderless_set (win, EINA_TRUE);
-   elm_win_autodel_set (win, EINA_TRUE);
+   win = elm_win_add(parent, name, ELM_WIN_BASIC);
+   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);
+   evas_object_size_hint_weight_set(win, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   evas_object_size_hint_align_set(win, EVAS_HINT_FILL, EVAS_HINT_FILL);
 
 #ifdef HAVE_ELEMENTARY_X
-/* set top window */
-   _update_window_hints (win);
+   // set top window
+   _update_window_hints(win);
 #endif
    return win;
 }
 
 static void
-_create_tickernoti (Evas_Object *obj)
+_win_rotated(Evas_Object *obj)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
+   int x = 0, y = 0, w = 0, angle = 0;
+
+   if (!wd) return;
+   angle = elm_win_rotation_get(wd->win);
+   while (angle < 0) angle += 360;
+   while (angle >= 360) angle -= 360;
+   if (angle%90 != 0) return;
+   wd->angle = angle;
+   _update_geometry_on_rotation(obj, wd->angle, &x, &y, &w);
+   evas_object_move(wd->win, x, y);
+   evas_object_resize(wd->win, w, wd->noti_height);
+#ifdef HAVE_ELEMENTARY_X
+   _update_window_hints(wd->win);
+#endif
+}
+
+static Eina_Bool
+_prop_change(void *data, int type __UNUSED__, void *event)
+{
+#ifdef HAVE_ELEMENTARY_X
+   Ecore_X_Event_Window_Property *ev;
+   Widget_Data *wd = elm_widget_data_get(data);
+
+   if (!wd) return ECORE_CALLBACK_PASS_ON;
+   ev = event;
+   if (ev->atom == ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE)
+     {
+        if (ev->win == elm_win_xwindow_get(wd->win))
+          {
+             _win_rotated(data);
+          }
+     }
+   return ECORE_CALLBACK_PASS_ON;
+#endif
+}
+
+static void
+_create_tickernoti(Evas_Object *obj)
 {
 #ifdef HAVE_ELEMENTARY_X
    Evas_Coord w;
@@ -193,26 +234,28 @@ _create_tickernoti (Evas_Object *obj)
 
    if (!wd) return;
 
-   evas_object_move (wd->win, 0, 0);
-   e = evas_object_evas_get (wd->win);
+   evas_object_move(wd->win, 0, 0);
+   e = evas_object_evas_get(wd->win);
 
-   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);
+   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 detail height set */
-   data_win_height = (char *)edje_object_data_get (wd->edje_obj, "height");
+   // tickernoti height setting
+   data_win_height = (char *)edje_object_data_get(wd->edje_obj, "height");
    if (data_win_height != NULL && elm_scale_get() > 0.0)
      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, w, wd->noti_height);
+   ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, NULL);
+   evas_object_resize(wd->win, w, wd->noti_height);
+   wd->rotation_event_handler = ecore_event_handler_add(
+            ECORE_X_EVENT_WINDOW_PROPERTY, _prop_change, obj);
 #endif
 
    edje_object_signal_callback_add(wd->edje_obj, "request,hide", "", _hide_cb, obj);
    edje_object_signal_callback_add(wd->edje_obj, "clicked", "", _clicked_cb, obj);
-   evas_object_show (wd->edje_obj);
+   evas_object_show(wd->edje_obj);
 }
 
 static void
@@ -221,7 +264,7 @@ _disable_hook(Evas_Object *obj)
    Widget_Data *wd = elm_widget_data_get(obj);
 
    if (!wd) return;
-//TODO:
+//TODO: To stop the event in case of being disabled
 }
 
 static void
@@ -232,10 +275,10 @@ _show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
    if (!wd) return;
 
 #ifdef HAVE_ELEMENTARY_X
-   _update_window_hints (wd->win);
+   _update_window_hints(wd->win);
 #endif
-   evas_object_show (wd->win);
-   edje_object_signal_emit (wd->edje_obj, "effect,show", "elm");
+   evas_object_show(wd->win);
+   edje_object_signal_emit(wd->edje_obj, "effect,show", "elm");
    edje_object_message_signal_process(wd->edje_obj);
 }
 
@@ -246,126 +289,142 @@ _hide(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
    Widget_Data *wd = elm_widget_data_get(obj);
 
    if (!wd) return;
-   evas_object_hide (obj);
-   evas_object_hide (wd->win);
+   evas_object_hide(wd->win);
 }
 
-static void _tickernoti_hide_cb (void *data, Evas_Object *obj __UNUSED__,
+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_signal_emit(wd->edje_obj, "effect,hide", "elm");
    edje_object_message_signal_process(wd->edje_obj);
 }
 
-/**
- * Add a tickernoti object to @p parent
- *
- * @param parent The parent object
- *
- * @return The tickernoti object, or NULL upon failure
- *
- * @ingroup TickerNoti
- */
-EAPI Evas_Object *
-elm_tickernoti_add(Evas_Object *parent)
+static void
+_update_geometry_on_rotation(Evas_Object *obj, int angle, int *x, int *y, int *w)
 {
-   Evas_Object *obj;
-   Evas *e;
-   Widget_Data *wd;
-
-   wd = ELM_NEW(Widget_Data);
-   wd->win = _create_window (parent, "noti-window");
-
-   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(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);
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
 
-   wd->orient = ELM_TICKERNOTI_ORIENT_TOP;
+   if (!wd) return;
 
-   _create_tickernoti (obj);
+#ifdef HAVE_ELEMENTARY_X
+   Evas_Coord root_w, root_h;
 
-   evas_object_event_callback_add (obj, EVAS_CALLBACK_SHOW, _show, NULL);
-   evas_object_event_callback_add (obj, EVAS_CALLBACK_HIDE, _hide, NULL);
-   evas_object_smart_callbacks_descriptions_set(obj, _signals);
-   return obj;
+   /*
+   * manual calculate win_tickernoti_indi window position & size
+   *  - win_indi is not full size window
+   */
+   ecore_x_window_size_get(ecore_x_window_root_first_get(), &root_w, &root_h);
+   // rotate win
+   switch(angle)
+     {
+      case 90:
+         *w = root_h;
+         if (wd->orient == ELM_TICKERNOTI_ORIENT_BOTTOM)
+           *x = root_w-wd->noti_height;
+         break;
+      case 270:
+         *w = root_h;
+         if (!(wd->orient == ELM_TICKERNOTI_ORIENT_BOTTOM))
+           *x = root_w-wd->noti_height;
+         break;
+      case 180:
+         *w = root_w;
+         if (!wd->orient == ELM_TICKERNOTI_ORIENT_BOTTOM)
+           *y = root_h - wd->noti_height;
+         break;
+       case 0:
+      default:
+         *w = root_w;
+         if (wd->orient == ELM_TICKERNOTI_ORIENT_BOTTOM)
+           *y = root_h - wd->noti_height;
+         break;
+     }
+#endif
 }
 
-/**
- * Set the 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_label_set (Evas_Object *obj, const char *label)
+static void
+_elm_tickernoti_label_set(Evas_Object *obj, const char *part, const char *label)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
 
    if (!wd) return;
+   if (part && strcmp(part, "default")) return;
    eina_stringshare_replace(&wd->label, label);
    edje_object_part_text_set(wd->edje_obj, "elm.text", wd->label);
    _sizing_eval(obj);
 }
 
-/**
- * Get the label used on the tickernoti object
- *
- * @param obj The tickernotil object
- * @return The string inside the label
- * @ingroup TickerNoti
- */
-EAPI const char *
-elm_tickernoti_label_get (const Evas_Object *obj)
+const char *
+_elm_tickernoti_label_get(const Evas_Object *obj, const char *part)
 {
    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
    Widget_Data *wd = elm_widget_data_get(obj);
-   if (!wd) return NULL;
 
+   if (part && strcmp(part, "default")) return NULL;
+   if (!wd) return NULL;
    return wd->label;
 }
 
-/**
- * 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_button_set (Evas_Object *obj, Evas_Object *button)
+static void
+_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_obj, "icon", icon);
+   wd->icon = icon;
+}
+
+static void
+_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_obj, "button", 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);
+   evas_object_smart_callback_add(wd->button, "clicked", _tickernoti_hide_cb, wd);
 }
 
-/**
- * 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_button_get (const Evas_Object *obj)
+static void
+_elm_tickernoti_content_part_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+
+   if (!wd || !part) return;
+   if (!part || !strcmp(part, "icon"))
+     {
+        _elm_tickernoti_icon_set(obj, content);
+        return;
+     }
+   else if (!strcmp(part, "button"))
+     {
+        _elm_tickernoti_button_set(obj, content);
+        return;
+     }
+}
+
+static 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;
+}
+
+static Evas_Object *
+_elm_tickernoti_button_get(const Evas_Object *obj)
 {
    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -373,39 +432,62 @@ elm_tickernoti_button_get (const Evas_Object *obj)
    return wd->button;
 }
 
-/**
- * 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_icon_set (Evas_Object *obj, Evas_Object *icon)
+static Evas_Object *
+_elm_tickernoti_content_part_get_hook(Evas_Object *obj, const char *part)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype);
+   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
    Widget_Data *wd = elm_widget_data_get(obj);
 
-   if (!wd) return;
-   if (!icon) return;
-   edje_object_part_swallow (wd->edje_obj, "icon", icon);
-   wd->icon = icon;
+   if (!wd || !part) return NULL;
+   if (!part || !strcmp(part, "icon"))
+     return _elm_tickernoti_icon_get(obj);
+   else if (!strcmp(part, "button"))
+     return _elm_tickernoti_button_get(obj);
+   return NULL;
 }
 
 /**
- * Get the icon object of the tickernoti object
+ * Add a tickernoti object to @p parent
+ *
+ * @param parent The parent object
+ *
+ * @return The tickernoti object, or NULL upon failure
  *
- * @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_tickernoti_add(Evas_Object *parent)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
-   Widget_Data *wd = elm_widget_data_get(obj);
-   if (!wd) return NULL;
-   return wd->icon;
+   Evas_Object *obj;
+   Evas *e;
+   Widget_Data *wd;
+
+   wd = ELM_NEW(Widget_Data);
+   wd->win = _create_window(parent, "noti-window");
+
+   e = evas_object_evas_get(wd->win);
+   obj = elm_widget_add(e);
+   ELM_SET_WIDTYPE(widtype, "tickernoti");
+   elm_widget_type_set(obj, widtype);
+   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->orient = ELM_TICKERNOTI_ORIENT_TOP;
+
+   _create_tickernoti(obj);
+   elm_widget_text_set_hook_set(obj, _elm_tickernoti_label_set);
+   elm_widget_text_get_hook_set(obj, _elm_tickernoti_label_get);
+   elm_widget_content_set_hook_set(obj, _elm_tickernoti_content_part_set_hook);
+   elm_widget_content_get_hook_set(obj, _elm_tickernoti_content_part_get_hook);
+
+   evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _show, NULL);
+   evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _hide, NULL);
+   evas_object_smart_callbacks_descriptions_set(obj, _signals);
+   return obj;
 }
 
 /**
@@ -416,7 +498,7 @@ elm_tickernoti_icon_get (const Evas_Object *obj)
  * @ingroup TickerNoti
  */
 EAPI int
-elm_tickernoti_rotation_get (const Evas_Object *obj)
+elm_tickernoti_rotation_get(const Evas_Object *obj)
 {
    ELM_CHECK_WIDTYPE(obj, widtype) -1;
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -432,62 +514,17 @@ elm_tickernoti_rotation_get (const Evas_Object *obj)
  * @ingroup TickerNoti
  */
 EAPI void
-elm_tickernoti_rotation_set (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 w, x = 0, y = 0;
 
    if (!wd) return;
    if (angle%90 != 0) return;
 
-   wd->angle = angle%360;
-   if (wd->angle < 0)
-     wd->angle = 360 + wd->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
-   */
-   ecore_x_window_size_get (ecore_x_window_root_first_get(), &root_w, &root_h);
-
-   /* rotate win */
-   switch (wd->angle)
-     {
-      case 90:
-         w = root_h;
-         if (wd->orient == ELM_TICKERNOTI_ORIENT_BOTTOM)
-           x = root_w-wd->noti_height;
-         break;
-      case 270:
-         w = root_h;
-         if (!(wd->orient == ELM_TICKERNOTI_ORIENT_BOTTOM))
-           x = root_w-wd->noti_height;
-         break;
-      case 180:
-         w = root_w;
-         if (!wd->orient == ELM_TICKERNOTI_ORIENT_BOTTOM)
-           y = root_h - wd->noti_height;
-         break;
-       case 0:
-      default:
-         w = root_w;
-         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);
-
-   evas_object_resize (wd->win, w, wd->noti_height);
-#ifdef HAVE_ELEMENTARY_X
-   _update_window_hints (wd->win);
-#endif
+   while (angle < 0) angle += 360;
+   while (angle >= 360) angle -= 360;
+   elm_win_rotation_with_resize_set (wd->win, angle);
 }
 
 /**
@@ -498,7 +535,7 @@ elm_tickernoti_rotation_set (Evas_Object *obj, int angle)
  * @ingroup TickerNoti
  */
 EAPI void
-elm_tickernoti_orientation_set (Evas_Object *obj, Elm_Tickernoti_Orient orient)
+elm_tickernoti_orient_set(Evas_Object *obj, Elm_Tickernoti_Orient orient)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
 
@@ -508,26 +545,30 @@ elm_tickernoti_orientation_set (Evas_Object *obj, Elm_Tickernoti_Orient orient)
    Widget_Data *wd = elm_widget_data_get(obj);
 
    if (!wd) return;
+   if (orient >= ELM_TICKERNOTI_ORIENT_LAST) return;
 
 #ifdef HAVE_ELEMENTARY_X
-   ecore_x_window_size_get (ecore_x_window_root_first_get(), &root_w, &root_h);
+   ecore_x_window_size_get(ecore_x_window_root_first_get(), &root_w, &root_h);
 #endif
 
-   switch (orient) {
+   switch(orient) {
       case ELM_TICKERNOTI_ORIENT_BOTTOM:
 #ifdef HAVE_ELEMENTARY_X
-         evas_object_move (wd->win, 0, root_h - wd->noti_height);
+         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);
+         evas_object_move(wd->win, 0, 0);
 #endif
          wd->orient = ELM_TICKERNOTI_ORIENT_TOP;
          break;
    }
+#ifdef HAVE_ELEMENTARY_X
+   _update_window_hints(wd->win);
+#endif
 }
 
 /**
@@ -535,31 +576,50 @@ elm_tickernoti_orientation_set (Evas_Object *obj, Elm_Tickernoti_Orient orient)
  *
  * @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_tickernoti_orient_get(const Evas_Object *obj)
 {
    ELM_CHECK_WIDTYPE(obj, widtype) -1;
    Widget_Data *wd = elm_widget_data_get(obj);
 
-   if (!wd) return -1;
+   if (!wd) return ELM_TICKERNOTI_ORIENT_LAST;
    return wd->orient;
 }
 
+/**
+ * Get the view window(elm_win) on the tickernoti object
+ *
+ * @param obj The tickernotil object
+ * @return internal view window(elm_win) object
+ *
+ * @ingroup TickerNoti
+ */
+EAPI Evas_Object *
+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;
+}
+
 // ################### 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
+ * @deprecated use elm_object_text_set() instead
  *
  * @ingroup TickerNoti
  */
 EAPI void
-elm_tickernoti_detailview_label_set (Evas_Object *obj, const char *label)
+elm_tickernoti_detailview_label_set(Evas_Object *obj, const char *label)
 {
-   elm_tickernoti_label_set (obj, label);
+   _elm_tickernoti_label_set(obj, NULL, label);
 }
 
 /**
@@ -567,12 +627,14 @@ elm_tickernoti_detailview_label_set (Evas_Object *obj, const char *label)
  *
  * @param obj The tickernotil object
  * @return The string inside the label
+ * @deprecated use elm_object_text_get() instead
+ *
  * @ingroup TickerNoti
  */
 EAPI const char *
-elm_tickernoti_detailview_label_get (const Evas_Object *obj)
+elm_tickernoti_detailview_label_get(const Evas_Object *obj)
 {
-   return elm_tickernoti_label_get (obj);
+   return _elm_tickernoti_label_get(obj, NULL);
 }
 
 /**
@@ -580,12 +642,14 @@ elm_tickernoti_detailview_label_get (const Evas_Object *obj)
  *
  * @param obj The tickernotil object
  * @param button The button object will be used on the tickernoti object
+ * @deprecated use elm_object_content_part_set() instead with "icon" as part name
+ *
  * @ingroup TickerNoti
  */
 EAPI void
-elm_tickernoti_detailview_button_set (Evas_Object *obj, Evas_Object *button)
+elm_tickernoti_detailview_button_set(Evas_Object *obj, Evas_Object *button)
 {
-   elm_tickernoti_button_set (obj, button);
+   _elm_tickernoti_button_set(obj, button);
 }
 
 
@@ -594,27 +658,29 @@ elm_tickernoti_detailview_button_set (Evas_Object *obj, Evas_Object *button)
  *
  * @param obj The tickernotil object
  * @return The button object inside the tickernoti
+ * @deprecated use elm_object_content_part_get() instead with "button" as part name
+ *
  * @ingroup TickerNoti
  */
 EAPI Evas_Object *
-elm_tickernoti_detailview_button_get (const Evas_Object *obj)
+elm_tickernoti_detailview_button_get(const Evas_Object *obj)
 {
-   return elm_tickernoti_button_get (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
+ * @deprecated use elm_object_content_part_set() instead with "icon" as part name
+ *
  * @ingroup TickerNoti
  */
 EAPI void
-elm_tickernoti_detailview_icon_set (Evas_Object *obj, Evas_Object *icon)
+elm_tickernoti_detailview_icon_set(Evas_Object *obj, Evas_Object *icon)
 {
-   elm_tickernoti_icon_set (obj, icon);
+   _elm_tickernoti_icon_set(obj, icon);
 }
 
 /**
@@ -622,12 +688,14 @@ elm_tickernoti_detailview_icon_set (Evas_Object *obj, Evas_Object *icon)
  *
  * @param obj The tickernotil object
  * @return The icon object inside the tickernoti
+ * @deprecated use elm_object_content_part_get() instead with "icon" as part name
+ *
  * @ingroup TickerNoti
  */
 EAPI Evas_Object *
-elm_tickernoti_detailview_icon_get (const Evas_Object *obj)
+elm_tickernoti_detailview_icon_get(const Evas_Object *obj)
 {
-   return elm_tickernoti_icon_get (obj);
+   return _elm_tickernoti_icon_get(obj);
 }
 
 /**
@@ -635,10 +703,12 @@ elm_tickernoti_detailview_icon_get (const Evas_Object *obj)
  *
  * @param obj The tickernotil object
  * @return The view mode
+ * @deprecated removed as now styles are used instead
+ *
  * @ingroup TickerNoti
  */
 EAPI Elm_Tickernoti_Mode
-elm_tickernoti_mode_get (const Evas_Object *obj)
+elm_tickernoti_mode_get(const Evas_Object *obj)
 {
    ELM_CHECK_WIDTYPE(obj, widtype) -1;
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -651,10 +721,12 @@ elm_tickernoti_mode_get (const Evas_Object *obj)
  *
  * @param obj The tickernotil object
  * @param mode The view mode will be used on the tickernoti object
+ * @deprecated removed as now styles are used instead
+ *
  * @ingroup TickerNoti
  */
 EAPI void
-elm_tickernoti_mode_set (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);
@@ -678,24 +750,127 @@ elm_tickernoti_mode_set (Evas_Object *obj, Elm_Tickernoti_Mode mode)
  * @ingroup TickerNoti
  */
 EAPI Evas_Object *
-elm_tickernoti_win_get (const Evas_Object *obj)
+elm_tickernoti_detailview_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;
+   return elm_tickernoti_win_get(obj);
 }
 
 /**
- * Get the detail view window(elm_win) on the tickernoti object
+ * Set the orientation of the tickernoti object
+ *
+ * @param obj The tickernoti object
+ * @param orient The orientation of tickernoti object
+ * @deprecated use elm_tickernoti_orient_set() instead
+ *
+ * @ingroup TickerNoti
+ */
+EAPI void
+elm_tickernoti_orientation_set(Evas_Object *obj, Elm_Tickernoti_Orient orient)
+{
+   elm_tickernoti_orient_set(obj, orient);
+}
+
+/**
+ * Get the orientation of the tickernoti object
  *
  * @param obj The tickernotil object
- * @return detail view window(elm_win) object
+ * @return The orientation of tickernotil object
+ * @deprecated use elm_tickernoti_orient_get() instead
+ *
+ * @ingroup TickerNoti
+ */
+EAPI Elm_Tickernoti_Orient
+elm_tickernoti_orientation_get(const Evas_Object *obj)
+{
+   return elm_tickernoti_orient_get(obj);
+}
+
+/**
+ * Set the label on the tickernoti object
+ *
+ * @param obj The tickernoti object
+ * @param label The label will be used on the tickernoti object
+ * @deprecated use elm_object_text_get()
+ *
+ * @ingroup TickerNoti
+ */
+EAPI void
+elm_tickernoti_label_set(Evas_Object *obj, const char *label)
+{
+   _elm_tickernoti_label_set(obj, NULL, label);
+}
+
+/**
+ * Get the label used on the tickernoti object
+ *
+ * @param obj The tickernotil object
+ * @return The string inside the label
+ * @deprecated use elm_object_text_get() instead
+ *
+ * @ingroup TickerNoti
+ */
+EAPI const char *
+elm_tickernoti_label_get(const Evas_Object *obj)
+{
+   return _elm_tickernoti_label_get(obj, NULL);
+}
+
+/**
+ * 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
+ * @deprecated use elm_object_content_part_set() instead with "button" as part name
+ *
+ * @ingroup TickerNoti
+ */
+EAPI void
+elm_tickernoti_button_set(Evas_Object *obj, Evas_Object *button)
+{
+   _elm_tickernoti_button_set(obj, button);
+}
+
+/**
+ * Get the action button object used on the tickernoti object
+ *
+ * @param obj The tickernotil object
+ * @return The button object inside the tickernoti
+ * @deprecated use elm_object_content_part_get() instead with "button" as part name
+ *
  * @ingroup TickerNoti
  */
 EAPI Evas_Object *
-elm_tickernoti_detailview_get (const Evas_Object *obj)
+elm_tickernoti_button_get(const Evas_Object *obj)
+{
+   return _elm_tickernoti_button_get(obj);
+}
+
+/**
+ * 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
+ * @deprecated use elm_object_content_part_set() instead with "icon" as part name
+ *
+ * @ingroup TickerNoti
+ */
+EAPI void
+elm_tickernoti_icon_set(Evas_Object *obj, Evas_Object *icon)
 {
-   return elm_tickernoti_win_get (obj);
+   _elm_tickernoti_icon_set(obj, icon);
 }
 
+/**
+ * Get the icon object of the tickernoti object
+ *
+ * @param obj The tickernotil object
+ * @return The icon object inside the tickernoti
+ * @deprecated use elm_object_content_part_get() instead with "icon" as part name
+ *
+ * @ingroup TickerNoti
+ */
+EAPI Evas_Object *
+elm_tickernoti_icon_get(const Evas_Object *obj)
+{
+   return _elm_tickernoti_icon_get(obj);
+}