elementary/naviframe - modified content unfocusable.
authorhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 27 Mar 2012 05:48:41 +0000 (05:48 +0000)
committerhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 27 Mar 2012 05:48:41 +0000 (05:48 +0000)
The contents will be unfocusable only when they are being pushed or popped.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@69651 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/elc_naviframe.c

index ff2c345..28e788e 100644 (file)
@@ -43,6 +43,7 @@ struct _Elm_Naviframe_Item
    Evas_Coord         minh;
    Eina_Bool          back_btn: 1;
    Eina_Bool          title_visible: 1;
+   Eina_Bool          content_unfocusable : 1;
 };
 
 static const char *widtype = NULL;
@@ -870,6 +871,10 @@ _pushed_finished(void *data,
    if (!wd) return;
 
    evas_object_hide(VIEW(it));
+
+   if (it->content)
+     elm_widget_tree_unfocusable_set(it->content, it->content_unfocusable);
+
    if (wd->freeze_events)
      evas_object_freeze_events_set(VIEW(it), EINA_FALSE);
 }
@@ -880,9 +885,18 @@ _popped_finished(void *data,
                  const char *emission __UNUSED__,
                  const char *source __UNUSED__)
 {
+   Widget_Data *wd;
    Elm_Naviframe_Item *it = data;
    if (!it) return;
+
+   wd = elm_widget_data_get(WIDGET(it));
+   if (!wd) return;
+
+   if (wd->preserve && it->content)
+     elm_widget_tree_unfocusable_set(it->content, it->content_unfocusable);
+
    _item_del(data);
+
    elm_widget_item_free(data);
 }
 
@@ -900,10 +914,7 @@ _show_finished(void *data,
    wd =  elm_widget_data_get(WIDGET(it));
    if (!wd) return;
 
-   // FIXME : If current top's content is unfocusable, it should be restored as focusable.
-   // Similar cases are should be checked and should call following function.
-   if (elm_widget_tree_unfocusable_get(it->content))
-     elm_widget_tree_unfocusable_set(it->content, EINA_FALSE);
+   elm_widget_tree_unfocusable_set(it->content, it->content_unfocusable);
 
    evas_object_smart_callback_call(WIDGET(it),
                                    SIG_TRANSITION_FINISHED,
@@ -1171,7 +1182,11 @@ elm_naviframe_item_push(Evas_Object *obj,
         elm_object_signal_emit(VIEW(prev_it), "elm,state,cur,pushed", "elm");
         elm_object_signal_emit(VIEW(it), "elm,state,new,pushed", "elm");
         edje_object_message_signal_process(elm_layout_edje_get(VIEW(prev_it)));
-        elm_widget_tree_unfocusable_set(prev_it->content, EINA_TRUE);
+        if (prev_it->content)
+          {
+             prev_it->content_unfocusable = elm_widget_tree_unfocusable_get(prev_it->content);
+             elm_widget_tree_unfocusable_set(prev_it->content, EINA_TRUE);
+          }
         edje_object_message_signal_process(elm_layout_edje_get(VIEW(it)));
      }
    wd->stack = eina_inlist_append(wd->stack, EINA_INLIST_GET(it));
@@ -1196,15 +1211,14 @@ elm_naviframe_item_insert_before(Evas_Object *obj,
    wd = elm_widget_data_get(obj);
    if (!wd) return NULL;
 
-   it = _item_new(WIDGET(before), title_label, prev_btn, next_btn, content,
-                  item_style);
+   it = _item_new(obj, title_label, prev_btn, next_btn, content, item_style);
    if (!it) return NULL;
 
    wd->stack =
       eina_inlist_prepend_relative(wd->stack,
                                    EINA_INLIST_GET(it),
                                    EINA_INLIST_GET(((Elm_Naviframe_Item *) before)));
-   _sizing_eval(WIDGET(before));
+   _sizing_eval(obj);
    return (Elm_Object_Item *)it;
 }
 
@@ -1225,20 +1239,19 @@ elm_naviframe_item_insert_after(Evas_Object *obj,
    wd = elm_widget_data_get(obj);
    if (!wd) return NULL;
 
-   it = _item_new(WIDGET(after), title_label, prev_btn, next_btn, content,
-                  item_style);
+   it = _item_new(obj, title_label, prev_btn, next_btn, content, item_style);
    if (!it) return NULL;
 
-   if (elm_naviframe_top_item_get(WIDGET(after)) == after)
+   if (elm_naviframe_top_item_get(obj) == after)
      {
-        evas_object_hide(VIEW(after));
         evas_object_show(VIEW(it));
+        evas_object_hide(VIEW(after));
      }
    wd->stack =
       eina_inlist_append_relative(wd->stack,
                                   EINA_INLIST_GET(it),
                                   EINA_INLIST_GET(((Elm_Naviframe_Item *) after)));
-   _sizing_eval(WIDGET(after));
+   _sizing_eval(obj);
    return (Elm_Object_Item *)it;
 }
 
@@ -1257,8 +1270,12 @@ elm_naviframe_item_pop(Evas_Object *obj)
    if (!it) return NULL;
    if (wd->preserve)
      content = it->content;
-   else
-     elm_widget_tree_unfocusable_set(it->content, EINA_TRUE);
+
+   if (it->content)
+     {
+        it->content_unfocusable = elm_widget_tree_unfocusable_get(it->content);
+        elm_widget_tree_unfocusable_set(it->content, EINA_TRUE);
+     }
 
    if (wd->stack->last->prev)
      prev_it = EINA_INLIST_CONTAINER_GET(wd->stack->last->prev,
@@ -1332,11 +1349,15 @@ elm_naviframe_item_promote(Elm_Object_Item *it)
    if (!wd) return;
 
    if (it == elm_naviframe_top_item_get(navi_it->base.widget)) return;
-   elm_widget_tree_unfocusable_set(navi_it->content, EINA_FALSE);
    wd->stack = eina_inlist_demote(wd->stack, EINA_INLIST_GET(navi_it));
    prev_it = EINA_INLIST_CONTAINER_GET(wd->stack->last->prev,
                                          Elm_Naviframe_Item);
-   elm_widget_tree_unfocusable_set(prev_it->content, EINA_FALSE);
+   if (prev_it->content)
+     {
+        prev_it->content_unfocusable = elm_widget_tree_unfocusable_get(prev_it->content);
+        elm_widget_tree_unfocusable_set(prev_it->content, EINA_TRUE);
+     }
+
    if (wd->freeze_events)
      {
         evas_object_freeze_events_set(VIEW(it), EINA_TRUE);