naviframe - new APIS for prev button auto created mode.
authorChunEon Park <chuneon.park@samsung.com>
Wed, 12 Oct 2011 09:30:00 +0000 (18:30 +0900)
committerChunEon Park <chuneon.park@samsung.com>
Wed, 12 Oct 2011 09:31:37 +0000 (18:31 +0900)
Change-Id: I0821d84f60f02baca6b7722cf311286db4108c7d

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

index de7dc67..c3321cf 100644 (file)
@@ -8465,6 +8465,28 @@ extern "C" {
     * @see also elm_naviframe_item_title_visible_set()
     */
    EAPI Eina_Bool           elm_naviframe_item_title_visible_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
+   /**
+    * @brief Set creating prev button automatically or not
+    *
+    * @param obj The naviframe object
+    * @param auto_pushed If @c EINA_TRUE, the previous button(back button) will
+    *        be created internally when you pass the @c NULL to the prev_btn
+    *        parameter in elm_naviframe_item_push
+    *
+    * @see also elm_naviframe_item_push()
+    */
+   EAPI void                elm_naviframe_prev_btn_auto_pushed_set(Evas_Object *obj, Eina_Bool auto_pushed) EINA_ARG_NONNULL(1);
+   /**
+    * @brief Get a value whether prev button(back button) will be auto pushed or
+    *        not.
+    *
+    * @param obj The naviframe object
+    * @return If @c EINA_TRUE, prev button will be auto pushed.
+    *
+    * @see also elm_naviframe_item_push()
+    *           elm_naviframe_prev_btn_auto_pushed_set()
+    */
+   EAPI Eina_Bool           elm_naviframe_prev_btn_auto_pushed_get(const Evas_Object *obj); EINA_ARG_NONNULL(1);
 
    /* Control Bar */
    #define CONTROLBAR_SYSTEM_ICON_ALBUMS "controlbar_albums"
index b666622..4e55ac9 100644 (file)
@@ -12,6 +12,7 @@ struct _Widget_Data
    Evas_Object  *base;
    Evas_Object  *rect;
    Eina_Bool     preserve: 1;
+   Eina_Bool     auto_pushed: 1;
    Eina_Bool     pass_events: 1;
 };
 
@@ -745,7 +746,7 @@ elm_naviframe_add(Evas_Object *parent)
    elm_widget_resize_object_set(obj, wd->base);
    _elm_theme_object_set(obj, wd->base, "naviframe", "base", "default");
 
-   //rect:
+   //rect
    wd->rect = evas_object_rectangle_add(e);
    evas_object_color_set(wd->rect, 0, 0, 0, 0);
    elm_widget_sub_object_add(obj, wd->rect);
@@ -755,6 +756,7 @@ elm_naviframe_add(Evas_Object *parent)
    evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _hide, obj);
    evas_object_smart_callbacks_descriptions_set(obj, _signals);
 
+   wd->auto_pushed = EINA_TRUE;
    wd->pass_events = EINA_TRUE;
 
    return obj;
@@ -816,7 +818,7 @@ elm_naviframe_item_push(Evas_Object *obj,
    _item_text_set_hook(ELM_CAST(it), "elm.text.title", title_label);
 
    //title buttons
-   if ((!prev_btn) && (eina_list_count(wd->stack)))
+   if ((!prev_btn) && wd->auto_pushed && eina_list_count(wd->stack))
      {
         prev_btn = _back_btn_new(obj);
         _title_prev_btn_set(it, prev_btn, EINA_TRUE);
@@ -1058,3 +1060,21 @@ elm_naviframe_item_title_visible_get(const Elm_Object_Item *it)
    return navi_it->title_visible;
 }
 
+EAPI void
+elm_naviframe_prev_btn_auto_pushed_set(Evas_Object *obj, Eina_Bool auto_pushed)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return NULL;
+   wd->auto_pushed = !!auto_pushed;
+}
+
+EAPI Eina_Bool
+elm_naviframe_prev_btn_auto_pushed_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->auto_pushed;
+}
+