[genlist] apply r71140 with local enhancement
[framework/uifw/elementary.git] / src / lib / elm_bg.c
index 99d4157..df29d5b 100644 (file)
@@ -8,9 +8,10 @@ struct _Widget_Data
    Evas_Object *base, *rect, *img, *overlay;
    const char  *file, *group;
    Elm_Bg_Option option;
-   struct {
-      Evas_Coord w, h;
-   } load_opts;
+   struct
+     {
+        Evas_Coord w, h;
+     } load_opts;
 };
 
 static const char *widtype = NULL;
@@ -121,19 +122,16 @@ _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd;
-
    if (part && strcmp(part, "overlay")) return;
-
    wd = elm_widget_data_get(obj);
    if (!wd) return;
-   if (wd->overlay)
-     {
-        evas_object_del(wd->overlay);
-        wd->overlay = NULL;
-     }
+
+   if (content == wd->overlay) return;
+   if (wd->overlay) evas_object_del(wd->overlay);
+
+   wd->overlay = content;
    if (content)
      {
-        wd->overlay = content;
         edje_object_part_swallow(wd->base, "elm.swallow.content", content);
         elm_widget_sub_object_add(obj, content);
      }
@@ -201,10 +199,10 @@ elm_bg_add(Evas_Object *parent)
    return obj;
 }
 
-EAPI void
+EAPI Eina_Bool
 elm_bg_file_set(Evas_Object *obj, const char *file, const char *group)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype);
+   ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
    Widget_Data *wd = elm_widget_data_get(obj);
    const char *p;
 
@@ -219,7 +217,7 @@ elm_bg_file_set(Evas_Object *obj, const char *file, const char *group)
         wd->file = NULL;
         eina_stringshare_del(wd->group);
         wd->group = NULL;
-        return;
+        return EINA_TRUE;
      }
    eina_stringshare_replace(&wd->file, file);
    eina_stringshare_replace(&wd->group, group);
@@ -239,6 +237,8 @@ elm_bg_file_set(Evas_Object *obj, const char *file, const char *group)
    edje_object_part_swallow(wd->base, "elm.swallow.background", wd->img);
    elm_widget_sub_object_add(obj, wd->img);
    _custom_resize(wd, NULL, NULL, NULL);
+
+   return EINA_TRUE;
 }
 
 EAPI void
@@ -248,6 +248,8 @@ elm_bg_file_get(const Evas_Object *obj, const char **file, const char **group)
    Widget_Data *wd = elm_widget_data_get(obj);
    if (file) *file = wd->file;
    if (group) *group = wd->group;
+
+   return;
 }
 
 EAPI void
@@ -259,12 +261,14 @@ elm_bg_option_set(Evas_Object *obj, Elm_Bg_Option option)
    wd = elm_widget_data_get(obj);
    wd->option = option;
    _custom_resize(wd, NULL, NULL, NULL);
+
+   return;
 }
 
 EAPI Elm_Bg_Option
 elm_bg_option_get(const Evas_Object *obj)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype) 0;
+   ELM_CHECK_WIDTYPE(obj, widtype) ELM_BG_OPTION_LAST;
    Widget_Data *wd;
 
    wd = elm_widget_data_get(obj);
@@ -286,6 +290,8 @@ elm_bg_color_set(Evas_Object *obj, int r, int g, int b)
         _custom_resize(wd, NULL, NULL, NULL);
      }
    evas_object_color_set(wd->rect, r, g, b, 255);
+
+   return;
 }
 
 EAPI void
@@ -296,24 +302,8 @@ elm_bg_color_get(const Evas_Object *obj, int *r, int *g, int *b)
 
    wd = elm_widget_data_get(obj);
    evas_object_color_get(wd->rect, r, g, b, NULL);
-}
 
-EAPI void
-elm_bg_overlay_set(Evas_Object *obj, Evas_Object *overlay)
-{
-   _content_set_hook(obj, "overlay", overlay);
-}
-
-EAPI Evas_Object *
-elm_bg_overlay_get(const Evas_Object *obj)
-{
-   return _content_get_hook(obj, "overlay");
-}
-
-EAPI Evas_Object *
-elm_bg_overlay_unset(Evas_Object *obj)
-{
-   return _content_unset_hook(obj, "overlay");
+   return;
 }
 
 EAPI void
@@ -328,5 +318,7 @@ elm_bg_load_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
    if (!wd->img) return;
    if (!(((p = strrchr(wd->file, '.'))) && (!strcasecmp(p, ".edj"))))
      evas_object_image_load_size_set(wd->img, w, h);
+
+   return;
 }