naviframe - merged with opensource
authorChunEon Park <chuneon.park@samsung.com>
Mon, 26 Dec 2011 07:59:56 +0000 (16:59 +0900)
committerChunEon Park <chuneon.park@samsung.com>
Mon, 26 Dec 2011 09:11:36 +0000 (18:11 +0900)
added two apis.
prevent accessing null pointers

Change-Id: If83abfda1023342d172c50c51aaa3ff8f9360677

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

index 762c009..0061309 100644 (file)
@@ -28847,6 +28847,22 @@ extern "C" {
     * @li "default" - Title label in the title area
     * @li "subtitle" - Sub-title label in the title area
     *
+    * Supported elm_object common APIs.
+    * @li elm_object_signal_emit
+    *
+    * Supported elm_object_item common APIs.
+    * @li elm_object_item_text_set
+    * @li elm_object_item_part_text_set
+    * @li elm_object_item_text_get
+    * @li elm_object_item_part_text_get
+    * @li elm_object_item_content_set
+    * @li elm_object_item_part_content_set
+    * @li elm_object_item_content_get
+    * @li elm_object_item_part_content_get
+    * @li elm_object_item_content_unset
+    * @li elm_object_item_part_content_unset
+    * @li elm_object_item_signal_emit
+    *
     * @ref tutorial_naviframe gives a good overview of the usage of the API.
     */
 
@@ -29175,6 +29191,39 @@ extern "C" {
    EAPI Eina_Inlist        *elm_naviframe_items_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
 
    /**
+    * @brief Set the event enabled when pushing/popping items
+    *
+    * If @c enabled is EINA_TRUE, the contents of the naviframe item will
+    * receives events from mouse and keyboard during view changing such as
+    * item push/pop.
+    *
+    * @param obj The naviframe object
+    * @param enabled Events are received when enabled is @c EINA_TRUE, and
+    * ignored otherwise.
+    *
+    * @warning Events will be blocked by calling evas_object_freeze_events_set()
+    * internally. So don't call the API whiling pushing/popping items.
+    *
+    * @see elm_naviframe_event_enabled_get()
+    * @see evas_object_freeze_events_set()
+    *
+    * @ingroup Naviframe
+    */
+   EAPI void                elm_naviframe_event_enabled_set(Evas_Object *obj, Eina_Bool enabled) EINA_ARG_NONNULL(1);
+
+   /**
+    * @brief Get the value of event enabled status.
+    *
+    * @param obj The naviframe object
+    * @return EINA_TRUE, when event is enabled
+    *
+    * @see elm_naviframe_event_enabled_set()
+    *
+    * @ingroup Naviframe
+    */
+   EAPI Eina_Bool           elm_naviframe_event_enabled_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
+
+   /**
     * @}
     */
 
index c5b41c2..cbdd6e6 100644 (file)
@@ -802,6 +802,8 @@ _title_content_unset(Elm_Naviframe_Item *it, const char *part)
           }
      }
 
+   if (!content) return NULL;
+
    elm_widget_sub_object_del(WIDGET(it), content);
    edje_object_part_unswallow(VIEW(it), content);
    snprintf(buf, sizeof(buf), "elm,state,%s,hide", part);
@@ -1361,6 +1363,8 @@ elm_naviframe_item_del(Elm_Object_Item *it)
      {
         wd->stack = eina_inlist_remove(wd->stack, EINA_INLIST_GET(navi_it));
         _item_del(navi_it);
+        //If the item is only one, the stack will be empty
+        if (!wd->stack) return;
         navi_it = EINA_INLIST_CONTAINER_GET(wd->stack->last,
                                             Elm_Naviframe_Item);
         evas_object_show(VIEW(navi_it));
@@ -1483,3 +1487,23 @@ elm_naviframe_items_get(const Evas_Object *obj)
    if (!wd) return NULL;
    return wd->stack;
 }
+
+EAPI void
+elm_naviframe_event_enabled_set(Evas_Object *obj, Eina_Bool enabled)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   enabled = !!enabled;
+   if (wd->freeze_events == !enabled) return;
+   wd->freeze_events = !enabled;
+}
+
+EAPI Eina_Bool
+elm_naviframe_event_enabled_get(const Evas_Object *obj)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return EINA_FALSE;
+   return !wd->freeze_events;
+}