EAPI void elm_object_scale_set(Evas_Object *obj, double scale);
EAPI double elm_object_scale_get(const Evas_Object *obj);
+ EAPI void elm_object_style_set(Evas_Object *obj, const char *style);
+ EAPI const char *elm_object_style_get(const Evas_Object *obj);
+
EAPI double elm_scale_get(void);
EAPI void elm_scale_set(double scale);
EAPI Evas_Coord elm_finger_size_get(void);
_theme_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
- _elm_theme_set(wd->img, "bg", "base", "default");
+ _elm_theme_set(wd->img, "bg", "base", elm_widget_style_get(obj));
}
static void
_theme_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
- _elm_theme_set(wd->bbl, "bubble", "base", "default");
+ _elm_theme_set(wd->bbl, "bubble", "base", elm_widget_style_get(obj));
edje_object_part_text_set(wd->bbl, "elm.text", wd->label);
edje_object_part_text_set(wd->bbl, "elm.info", wd->info);
edje_object_scale_set(wd->bbl, elm_widget_scale_get(obj) * _elm_config->scale);
{
Widget_Data *wd = elm_widget_data_get(obj);
- _elm_theme_set(wd->bbl, "bubble", corner, "default");
+ _elm_theme_set(wd->bbl, "bubble", corner, elm_widget_style_get(obj));
if (wd->icon)
edje_object_part_swallow(wd->bbl, "elm.swallow.icon", wd->icon);
if (wd->content)
Evas_Object *btn;
Evas_Object *icon;
const char *label;
- const char *style;
};
static void _del_hook(Evas_Object *obj);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (wd->label) eina_stringshare_del(wd->label);
- if (wd->style) eina_stringshare_del(wd->style);
free(wd);
}
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (wd->style) _elm_theme_set(wd->btn, "button", "base", wd->style);
- else _elm_theme_set(wd->btn, "button", "base", "default");
+ _elm_theme_set(wd->btn, "button", "base", elm_widget_style_get(obj));
if (wd->icon)
edje_object_part_swallow(wd->btn, "elm.swallow.content", wd->icon);
if (wd->label)
EAPI void
elm_button_style_set(Evas_Object *obj, const char *style)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->style) eina_stringshare_del(wd->style);
- if (style) wd->style = eina_stringshare_add(style);
- else wd->style = NULL;
- _theme_hook(obj);
+ elm_widget_style_set(obj, style);
}
{
if (it->selected)
edje_object_signal_emit(it->base, "elm,state,selected", "elm");
- _elm_theme_set(it->base, "carousel", "item", "default");
+ _elm_theme_set(it->base, "carousel", "item", elm_widget_style_get(obj));
edje_object_scale_set(it->base, elm_widget_scale_get(obj) * _elm_config->scale);
if (it->icon)
{
it->func = func;
it->data = data;
it->base = edje_object_add(evas_object_evas_get(obj));
- _elm_theme_set(it->base, "carousel", "item", "default");
+ _elm_theme_set(it->base, "carousel", "item", elm_widget_style_get(obj));
edje_object_signal_callback_add(it->base, "elm,action,click", "elm",
_select, it);
elm_widget_sub_object_add(obj, it->base);
Widget_Data *wd = elm_widget_data_get(obj);
Edje_Message_Int msg;
int ampm = 0;
+ const char *style = elm_widget_style_get(obj);
if ((wd->cur.seconds != wd->seconds) || (wd->cur.am_pm != wd->am_pm) ||
(wd->cur.edit != wd->edit))
}
if ((wd->seconds) && (wd->am_pm))
- _elm_theme_set(wd->clk, "clock", "base-all", "default");
+ _elm_theme_set(wd->clk, "clock", "base-all", style);
else if (wd->seconds)
- _elm_theme_set(wd->clk, "clock", "base-seconds", "default");
+ _elm_theme_set(wd->clk, "clock", "base-seconds", style);
else if (wd->am_pm)
- _elm_theme_set(wd->clk, "clock", "base-am_pm", "default");
+ _elm_theme_set(wd->clk, "clock", "base-am_pm", style);
else
- _elm_theme_set(wd->clk, "clock", "base", "default");
+ _elm_theme_set(wd->clk, "clock", "base", style);
edje_object_scale_set(wd->clk, elm_widget_scale_get(obj) * _elm_config->scale);
for (i = 0; i < 6; i++)
if ((!wd->seconds) && (i >= 4)) break;
wd->digit[i] = edje_object_add(evas_object_evas_get(wd->clk));
- _elm_theme_set(wd->digit[i], "clock", "flipdigit", "default");
+ _elm_theme_set(wd->digit[i], "clock", "flipdigit", style);
edje_object_scale_set(wd->digit[i], elm_widget_scale_get(obj) * _elm_config->scale);
if (wd->edit)
edje_object_signal_emit(wd->digit[i], "elm,state,edit,on", "elm");
if (wd->am_pm)
{
wd->ampm = edje_object_add(evas_object_evas_get(wd->clk));
- _elm_theme_set(wd->ampm, "clock", "flipampm", "default");
+ _elm_theme_set(wd->ampm, "clock", "flipampm", style);
edje_object_scale_set(wd->ampm, elm_widget_scale_get(obj) * _elm_config->scale);
if (wd->edit)
edje_object_signal_emit(wd->ampm, "elm,state,edit,on", "elm");
wd->single_line = single_line;
wd->linewrap = 0;
t = eina_stringshare_add(elm_entry_entry_get(obj));
- _elm_theme_set(wd->ent, "entry", _getbase(obj), "default");
+ _elm_theme_set(wd->ent, "entry", _getbase(obj), elm_widget_style_get(obj));
elm_entry_entry_set(obj, t);
eina_stringshare_del(t);
_sizing_eval(obj);
wd->single_line = 1;
wd->linewrap = 0;
t = eina_stringshare_add(elm_entry_entry_get(obj));
- _elm_theme_set(wd->ent, "entry", _getbase(obj), "default");
+ _elm_theme_set(wd->ent, "entry", _getbase(obj), elm_widget_style_get(obj));
elm_entry_entry_set(obj, t);
eina_stringshare_del(t);
_sizing_eval(obj);
if (wd->linewrap == wrap) return;
wd->linewrap = wrap;
t = eina_stringshare_add(elm_entry_entry_get(obj));
- _elm_theme_set(wd->ent, "entry", _getbase(obj), "default");
+ _elm_theme_set(wd->ent, "entry", _getbase(obj), elm_widget_style_get(obj));
elm_entry_entry_set(obj, t);
eina_stringshare_del(t);
_sizing_eval(obj);
if (wd->editable == editable) return;
wd->editable = editable;
t = eina_stringshare_add(elm_entry_entry_get(obj));
- _elm_theme_set(wd->ent, "entry", _getbase(obj), "default");
+ _elm_theme_set(wd->ent, "entry", _getbase(obj), elm_widget_style_get(obj));
elm_entry_entry_set(obj, t);
eina_stringshare_del(t);
_sizing_eval(obj);
{
Evas_Object *frm;
Evas_Object *content;
- const char *style;
};
static void _del_hook(Evas_Object *obj);
_del_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
- if (wd->style) eina_stringshare_del(wd->style);
free(wd);
}
_theme_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
- if (wd->style) _elm_theme_set(wd->frm, "frame", "base", wd->style);
- else _elm_theme_set(wd->frm, "frame", "base", "default");
+ _elm_theme_set(wd->frm, "frame", "base", elm_widget_style_get(obj));
if (wd->content)
edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
edje_object_scale_set(wd->frm, elm_widget_scale_get(obj) * _elm_config->scale);
EAPI void
elm_frame_style_set(Evas_Object *obj, const char *style)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (wd->style) eina_stringshare_del(wd->style);
- if (style) wd->style = eina_stringshare_add(style);
- else wd->style = NULL;
- _theme_hook(obj);
+ elm_widget_style_set(obj, style);
}
{
Widget_Data *wd = elm_widget_data_get(obj);
Item_Block *itb;
- elm_smart_scroller_theme_set(wd->scr, "scroller", "base", "default");
+ elm_smart_scroller_theme_set(wd->scr, "scroller", "base", elm_widget_style_get(obj));
edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
EINA_INLIST_FOREACH(wd->blocks, itb)
{
else
snprintf(buf, sizeof(buf), "%s/%s", "item", it->itc->item_style);
}
- _elm_theme_set(it->base, "genlist", buf, "default");
+ _elm_theme_set(it->base, "genlist", buf, elm_widget_style_get(it->wd->obj));
it->spacer = evas_object_rectangle_add(evas_object_evas_get(it->wd->obj));
evas_object_color_set(it->spacer, 0, 0, 0, 0);
elm_widget_sub_object_add(it->wd->obj, it->spacer);
Evas_Object *offset, *size;
Evas_Object *parent, *target;
Eina_List *subs;
- const char *style;
};
struct _Subinfo
evas_stringshare_del(si->swallow);
free(si);
}
- if (wd->style) eina_stringshare_del(wd->style);
}
static void
{
Widget_Data *wd = elm_widget_data_get(obj);
// FIXME: hover contents doesnt seem to propagate resizes properly
- if (wd->style) _elm_theme_set(wd->cov, "hover", "base", wd->style);
- else _elm_theme_set(wd->cov, "hover", "base", "default");
+ _elm_theme_set(wd->cov, "hover", "base", elm_widget_style_get(obj));
edje_object_scale_set(wd->cov, elm_widget_scale_get(obj) * _elm_config->scale);
_reval_content(obj);
_sizing_eval(obj);
EAPI void
elm_hover_style_set(Evas_Object *obj, const char *style)
{
+ elm_widget_style_set(obj, style);
Widget_Data *wd = elm_widget_data_get(obj);
- if (wd->style) eina_stringshare_del(wd->style);
- if (style) wd->style = eina_stringshare_add(style);
- else wd->style = NULL;
- if (wd->style) _elm_theme_set(wd->cov, "hover", "base", wd->style);
- else _elm_theme_set(wd->cov, "hover", "base", "default");
- _reval_content(obj);
- _sizing_eval(obj);
}
EAPI const char *
_theme_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
- _elm_theme_set(wd->lbl, "label", "base", "default");
+ _elm_theme_set(wd->lbl, "label", "base", elm_widget_style_get(obj));
edje_object_part_text_set(wd->lbl, "elm.text", wd->label);
edje_object_scale_set(wd->lbl, elm_widget_scale_get(obj) * _elm_config->scale);
_sizing_eval(obj);
Evas_Coord minw[2] = { 0, 0 }, minh[2] = { 0, 0 };
Evas_Coord mw, mh;
int i, redo = 0;
+ const char *style = elm_widget_style_get(obj);
EINA_LIST_FOREACH(wd->items, l, it)
{
if (wd->mode == ELM_LIST_COMPRESS)
{
if (it->even)
- _elm_theme_set(it->base, "list", "item_compress", "default");
+ _elm_theme_set(it->base, "list", "item_compress", style);
else
- _elm_theme_set(it->base, "list", "item_compress_odd", "default");
+ _elm_theme_set(it->base, "list", "item_compress_odd", style);
}
else
{
if (it->even)
- _elm_theme_set(it->base, "list", "item", "default");
+ _elm_theme_set(it->base, "list", "item", style);
else
- _elm_theme_set(it->base, "list", "item_odd", "default");
+ _elm_theme_set(it->base, "list", "item_odd", style);
}
stacking = edje_object_data_get(it->base, "stacking");
if (stacking)
return elm_widget_scale_get(obj);
}
+EAPI void
+elm_object_style_set(Evas_Object *obj, const char *style)
+{
+ elm_widget_style_set(obj, style);
+}
+
+EAPI const char *
+elm_object_style_get(const Evas_Object *obj)
+{
+ return elm_widget_style_get(obj);
+}
+
EAPI double
elm_scale_get(void)
{
evas_object_resize(it->base, w, h);
elm_widget_sub_object_add(obj, it->base);
elm_widget_sub_object_add(obj, it->content);
- _elm_theme_set(it->base, "pager", "base", "default");
+ _elm_theme_set(it->base, "pager", "base", elm_widget_style_get(obj));
edje_object_signal_callback_add(it->base, "elm,action,hide,finished", "", _signal_hide_finished, it);
edje_object_part_swallow(it->base, "elm.swallow.content", it->content);
edje_object_size_min_calc(it->base, &it->minw, &it->minh);
EAPI int elm_widget_scroll_freeze_get(const Evas_Object *obj);
EAPI void elm_widget_scale_set(Evas_Object *obj, double scale);
EAPI double elm_widget_scale_get(const Evas_Object *obj);
+EAPI void elm_widget_style_set(Evas_Object *obj, const char *style);
+EAPI const char *elm_widget_style_get(const Evas_Object *obj);
extern char *_elm_appname;
extern Elm_Config *_elm_config;
_theme_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
- _elm_theme_set(wd->chk, "radio", "base", "default");
+ _elm_theme_set(wd->chk, "radio", "base", elm_widget_style_get(obj));
if (wd->icon)
edje_object_signal_emit(wd->chk, "elm,state,icon,visible", "elm");
else
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- elm_smart_scroller_theme_set(wd->scr, "scroller", "base", "default");
+ elm_smart_scroller_theme_set(wd->scr, "scroller", "base", elm_widget_style_get(obj));
edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
_sizing_eval(obj);
}
{
Widget_Data *wd = elm_widget_data_get(obj);
if (wd->horizontal)
- _elm_theme_set(wd->slider, "slider", "horizontal", "default");
+ _elm_theme_set(wd->slider, "slider", "horizontal", elm_widget_style_get(obj));
else
- _elm_theme_set(wd->slider, "slider", "vertical", "default");
+ _elm_theme_set(wd->slider, "slider", "vertical", elm_widget_style_get(obj));
if (wd->inverted)
edje_object_signal_emit(wd->slider, "elm,state,inverted,on", "elm");
else
_theme_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
- _elm_theme_set(wd->tgl, "toggle", "base", "default");
+ _elm_theme_set(wd->tgl, "toggle", "base", elm_widget_style_get(obj));
if (wd->icon)
edje_object_signal_emit(wd->tgl, "elm,state,icon,visible", "elm");
else
const Eina_List *l;
Elm_Toolbar_Item *it;
Evas_Coord mw, mh;
+ const char *style = elm_widget_style_get(obj);
+
edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
EINA_LIST_FOREACH(wd->items, l, it)
{
edje_object_scale_set(it->base, elm_widget_scale_get(obj) * _elm_config->scale);
if (it->selected)
edje_object_signal_emit(it->base, "elm,state,selected", "elm");
- _elm_theme_set(it->base, "toolbar", "item", "default");
+ _elm_theme_set(it->base, "toolbar", "item", style);
if (it->icon)
{
edje_extern_object_min_size_set(it->icon,
it->func = func;
it->data = data;
it->base = edje_object_add(evas_object_evas_get(obj));
- _elm_theme_set(it->base, "toolbar", "item", "default");
+ _elm_theme_set(it->base, "toolbar", "item", elm_widget_style_get(obj));
edje_object_signal_callback_add(it->base, "elm,action,click", "elm",
_select, it);
elm_widget_sub_object_add(obj, it->base);
int scroll_hold;
int scroll_freeze;
double scale;
+ const char *style;
unsigned char can_focus : 1;
unsigned char child_can_focus : 1;
unsigned char focused : 1;
return sd->scale;
}
+EAPI void
+elm_widget_style_set(Evas_Object *obj, const char *style)
+{
+ const char *old;
+ API_ENTRY return;
+ old = sd->style;
+ eina_stringshare_del(sd->style);
+ sd->style = eina_stringshare_add(style);
+ if (old != sd->style)
+ elm_widget_theme(obj);
+}
+
+EAPI const char *
+elm_widget_style_get(const Evas_Object *obj)
+{
+ API_ENTRY return "default";
+ if (sd->style) return sd->style;
+ return "default";
+}
+
/* local subsystem functions */
static void
_smart_reconfigure(Smart_Data *sd)
{
Evas_Object *frm;
Evas_Object *content;
- const char *style;
};
static void _del_hook(Evas_Object *obj);
_del_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
- if (wd->style) eina_stringshare_del(wd->style);
free(wd);
}
_theme_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
- if (wd->style) _elm_theme_set(wd->frm, "win", "inwin", wd->style);
- else _elm_theme_set(wd->frm, "win", "inwin", "default");
+ _elm_theme_set(wd->frm, "win", "inwin", elm_widget_style_get(obj));
if (wd->content)
edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
_sizing_eval(obj);
EAPI void
elm_win_inwin_style_set(Evas_Object *obj, const char *style)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (wd->style) eina_stringshare_del(wd->style);
- if (style) wd->style = eina_stringshare_add(style);
- else wd->style = NULL;
- _theme_hook(obj);
+ elm_widget_style_set(obj, style);
}
EAPI void