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;
}
static void
-_content_set_hook(Evas_Object *obj, const char *part __UNUSED__, Evas_Object *content)
+_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
{
ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
+ 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);
}
}
static Evas_Object *
-_content_get_hook(const Evas_Object *obj, const char *part __UNUSED__)
+_content_get_hook(const Evas_Object *obj, const char *part)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
+ Widget_Data *wd;
+ if (part && strcmp(part, "overlay")) return NULL;
+ wd = elm_widget_data_get(obj);
if (!wd) return NULL;
return wd->overlay;
}
static Evas_Object *
-_content_unset_hook(Evas_Object *obj, const char *part __UNUSED__)
+_content_unset_hook(Evas_Object *obj, const char *part)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
+ Widget_Data *wd;
Evas_Object *overlay;
- if (!wd) return NULL;
- if (!wd->overlay) return NULL;
+ if (part && strcmp(part, "overlay")) return NULL;
+ wd = elm_widget_data_get(obj);
+ if (!wd || !wd->overlay) return NULL;
overlay = wd->overlay;
elm_widget_sub_object_del(obj, wd->overlay);
edje_object_part_unswallow(wd->base, wd->overlay);
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;
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);
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
Widget_Data *wd = elm_widget_data_get(obj);
if (file) *file = wd->file;
if (group) *group = wd->group;
+
+ return;
}
EAPI void
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);
_custom_resize(wd, NULL, NULL, NULL);
}
evas_object_color_set(wd->rect, r, g, b, 255);
+
+ return;
}
EAPI void
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, NULL, overlay);
-}
-
-EAPI Evas_Object *
-elm_bg_overlay_get(const Evas_Object *obj)
-{
- return _content_get_hook(obj, NULL);
-}
-
-EAPI Evas_Object *
-elm_bg_overlay_unset(Evas_Object *obj)
-{
- return _content_unset_hook(obj, NULL);
+ return;
}
EAPI void
if (!wd->img) return;
if (!(((p = strrchr(wd->file, '.'))) && (!strcasecmp(p, ".edj"))))
evas_object_image_load_size_set(wd->img, w, h);
+
+ return;
}