[tab] Added dim hide.
authorDaniel Juyung Seo <juyung.seo@samsung.com>
Mon, 2 Aug 2010 07:09:43 +0000 (16:09 +0900)
committerDaniel Juyung Seo <juyung.seo@samsung.com>
Mon, 2 Aug 2010 07:09:43 +0000 (16:09 +0900)
[layout] Added show, hide hook.

src/lib/elm_layout.c
src/lib/elm_tab.c

index 6d6f09e..89b3c5a 100644 (file)
@@ -33,6 +33,8 @@ static void _del_hook(Evas_Object *obj);
 static void _theme_hook(Evas_Object *obj);
 static void _sizing_eval(Evas_Object *obj);
 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void _show_hook(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void _hide_hook(void *data, Evas *e, Evas_Object *obj, void *event_info);
 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
 
 static void
@@ -43,8 +45,8 @@ _del_hook(Evas_Object *obj)
    if (!wd) return;
    EINA_LIST_FREE(wd->subs, si)
      {
-       eina_stringshare_del(si->swallow);
-       free(si);
+   eina_stringshare_del(si->swallow);
+   free(si);
      }
    free(wd);
 }
@@ -68,8 +70,34 @@ _changed_hook(Evas_Object *obj)
    if (!wd) return;
    if (wd->needs_size_calc)
      {
-       _sizing_eval(obj);
-       wd->needs_size_calc = 0;
+   _sizing_eval(obj);
+   wd->needs_size_calc = 0;
+     }
+}
+
+static void
+_show_hook(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
+   Eina_List *l;
+   Subinfo *si;
+   if (!wd) return;
+   EINA_LIST_FOREACH(wd->subs, l, si)
+     {
+        evas_object_show(si->obj);
+     }
+}
+
+static void
+_hide_hook(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
+   Eina_List *l;
+   Subinfo *si;
+   if (!wd) return;
+   EINA_LIST_FOREACH(wd->subs, l, si)
+     {
+        evas_object_hide(si->obj);
      }
 }
 
@@ -110,17 +138,17 @@ _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
    if (!wd) return;
    EINA_LIST_FOREACH(wd->subs, l, si)
      {
-       if (si->obj == sub)
-         {
-            evas_object_event_callback_del_full(sub,
+   if (si->obj == sub)
+     {
+        evas_object_event_callback_del_full(sub,
                                             EVAS_CALLBACK_CHANGED_SIZE_HINTS,
                                             _changed_size_hints,
                                             obj);
-            wd->subs = eina_list_remove_list(wd->subs, l);
-            eina_stringshare_del(si->swallow);
-            free(si);
-            break;
-         }
+        wd->subs = eina_list_remove_list(wd->subs, l);
+        eina_stringshare_del(si->swallow);
+        free(si);
+        break;
+     }
      }
 }
 
@@ -160,8 +188,9 @@ elm_layout_add(Evas_Object *parent)
    elm_widget_resize_object_set(obj, wd->lay);
    edje_object_signal_callback_add(wd->lay, "size,eval", "elm",
                                    _signal_size_eval, obj);
-   
    evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
+   evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _hide_hook, obj);
+   evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _show_hook, obj);
 
    _request_sizing_eval(obj);
    return obj;
@@ -234,25 +263,25 @@ elm_layout_content_set(Evas_Object *obj, const char *swallow, Evas_Object *conte
    if (!wd) return;
    EINA_LIST_FOREACH(wd->subs, l, si)
      {
-       if (!strcmp(swallow, si->swallow))
-         {
-            if (content == si->obj) return;
-            elm_widget_sub_object_del(obj, si->obj);
-            break;
-         }
+   if (!strcmp(swallow, si->swallow))
+     {
+        if (content == si->obj) return;
+        elm_widget_sub_object_del(obj, si->obj);
+        break;
+     }
      }
    if (content)
      {
-       elm_widget_sub_object_add(obj, content);
-       evas_object_event_callback_add(content,
+   elm_widget_sub_object_add(obj, content);
+   evas_object_event_callback_add(content,
                                        EVAS_CALLBACK_CHANGED_SIZE_HINTS,
-                                      _changed_size_hints, obj);
-       edje_object_part_swallow(wd->lay, swallow, content);
-       si = ELM_NEW(Subinfo);
-       si->swallow = eina_stringshare_add(swallow);
-       si->obj = content;
-       wd->subs = eina_list_append(wd->subs, si);
-       _request_sizing_eval(obj);
+                   _changed_size_hints, obj);
+   edje_object_part_swallow(wd->lay, swallow, content);
+   si = ELM_NEW(Subinfo);
+   si->swallow = eina_stringshare_add(swallow);
+   si->obj = content;
+   wd->subs = eina_list_append(wd->subs, si);
+   _request_sizing_eval(obj);
      }
 }
 
@@ -277,15 +306,15 @@ elm_layout_content_unset(Evas_Object *obj, const char *swallow)
    if (!wd) return NULL;
    EINA_LIST_FOREACH(wd->subs, l, si)
      {
-       if (!strcmp(swallow, si->swallow))
-         {
-            Evas_Object *content;
-            if (!si->obj) return NULL;
-            content = si->obj; /* si will die in _sub_del due elm_widget_sub_object_del() */
-            elm_widget_sub_object_del(obj, content);
-            edje_object_part_unswallow(wd->lay, content);
-            return content;
-         }
+   if (!strcmp(swallow, si->swallow))
+     {
+        Evas_Object *content;
+        if (!si->obj) return NULL;
+        content = si->obj; /* si will die in _sub_del due elm_widget_sub_object_del() */
+        elm_widget_sub_object_del(obj, content);
+        edje_object_part_unswallow(wd->lay, content);
+        return content;
+     }
      }
    return NULL;
 }
index daf95bd..1197435 100644 (file)
@@ -1316,7 +1316,6 @@ static void _tab_object_show(void *data, Evas *e, Evas_Object *obj, void *event_
        if(!wd) return;\r
 \r
        evas_object_show(wd->edje);\r
-       evas_object_show(wd->ebx);\r
 }\r
 \r
 \r