--- /dev/null
+#include "widget_preview_tmpl_head.c"
+
+Evas_Object *ic, *pb, *bx;
+
+bx = elm_box_add(win);
+evas_object_show(bx);
+elm_win_resize_object_add(win, bx);
+
+ic = elm_icon_add(win);
+elm_icon_standard_set(ic, "file");
+evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+evas_object_show(ic);
+
+/* pb with label, icon, custom unit label and span size set */
+pb = elm_progressbar_add(win);
+elm_object_text_set(pb, "Label");
+elm_progressbar_span_size_set(pb, 100);
+elm_object_content_set(pb, ic);
+elm_progressbar_unit_format_set(pb, "%1.1f units");
+evas_object_size_hint_align_set(pb, EVAS_HINT_FILL, EVAS_HINT_FILL);
+evas_object_size_hint_weight_set(pb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+evas_object_show(pb);
+elm_progressbar_value_set(pb, 0.5);
+elm_box_pack_end(bx, pb);
+
+#include "widget_preview_tmpl_foot.c"
--- /dev/null
+#include "widget_preview_tmpl_head.c"
+
+Evas_Object *o = elm_scroller_add(win);
+elm_scroller_policy_set(o, ELM_SCROLLER_POLICY_ON, ELM_SCROLLER_POLICY_ON);
+evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+elm_win_resize_object_add(win, o);
+evas_object_show(o);
+
+Evas_Object *o2 = elm_label_add(win);
+elm_object_text_set(o2, "This is the content of the scroller");
+evas_object_show(o2);
+elm_object_content_set(o, o2);
+
+#include "widget_preview_tmpl_foot.c"
evas_object_show(sc);
sample = _sample_theme_new(win);
- elm_scroller_content_set(sc, sample);
+ elm_object_content_set(sc, sample);
evas_object_show(sample);
evas_object_data_set(win, "theme_preview", sample);
evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_scroller_bounce_set(sc, EINA_FALSE, EINA_TRUE);
evas_object_show(sc);
- elm_scroller_content_set(sc, bx);
+ elm_object_content_set(sc, bx);
ck = elm_check_add(win);
elm_object_tooltip_text_set(ck, "Set whether scrollers should bounce<br>"
elm_box_pack_end(bx, bb);
evas_object_show(bb);
- elm_scroller_content_set(sc, bx);
+ elm_object_content_set(sc, bx);
evas_object_show(bx);
evas_object_show(sc);
bx = elm_box_add(win);
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_scroller_content_set(scr, bx);
+ elm_object_content_set(scr, bx);
evas_object_show(bx);
ic = elm_icon_add(win);
elm_object_text_set(btn, "Enlightenment");
evas_object_size_hint_min_set(btn, 140, 140);
- elm_scroller_content_set(sc, btn);
+ elm_object_content_set(sc, btn);
elm_box_pack_end(bx, sc);
EVAS_HINT_FILL);
evas_object_size_hint_weight_set(bt, 0.0, 0.0);
elm_object_event_callback_add(bt, _event, NULL);
- elm_scroller_content_set(sc, bt);
+ elm_object_content_set(sc, bt);
my_show(bt);
elm_object_event_callback_del(bt, _event, NULL);
}
evas_object_size_hint_align_set(bx3, EVAS_HINT_FILL,
EVAS_HINT_FILL);
evas_object_size_hint_weight_set(bx3, 0.0, 0.0);
- elm_scroller_content_set(sc, bx3);
+ elm_object_content_set(sc, bx3);
my_show(bx3);
for (i = 5; i; i--)
elm_win_resize_object_add(win, bx2);
evas_object_show(bx2);
- elm_scroller_content_set(sc, bx);
+ elm_object_content_set(sc, bx);
evas_object_show(bx);
elm_scroller_page_relative_set(sc, 1.0, 1.0);
evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, sc);
- elm_scroller_content_set(sc, bx);
+ elm_object_content_set(sc, bx);
evas_object_show(bx);
elm_scroller_page_relative_set(sc, 1.0, 1.0);
elm_win_resize_object_add(win, bx2);
evas_object_show(bx2);
- elm_scroller_content_set(sc, bx);
+ elm_object_content_set(sc, bx);
evas_object_show(bx);
elm_scroller_page_relative_set(sc, 1.0, 1.0);
evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, sc);
- elm_scroller_content_set(sc, tb);
+ elm_object_content_set(sc, tb);
evas_object_show(tb);
evas_object_show(sc);
pb = elm_progressbar_add(win);
elm_object_text_set(pb, "Label");
- elm_progressbar_icon_set(pb, ic1);
+ elm_object_content_set(pb, ic1);
elm_progressbar_inverted_set(pb, 1);
elm_progressbar_unit_format_set(pb, "%1.1f units");
elm_progressbar_span_size_set(pb, 200);
pb = elm_progressbar_add(win);
elm_progressbar_horizontal_set(pb, EINA_FALSE);
elm_object_text_set(pb, "Label");
- elm_progressbar_icon_set(pb, ic2);
+ elm_object_content_set(pb, ic2);
elm_progressbar_inverted_set(pb, 1);
elm_progressbar_unit_format_set(pb, "%1.2f%%");
elm_progressbar_span_size_set(pb, 200);
evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, 0.5);
elm_object_text_set(rd, "Icon sized to radio");
- elm_radio_icon_set(rd, ic);
+ elm_object_content_set(rd, ic);
elm_box_pack_end(bx, rd);
evas_object_show(rd);
evas_object_show(ic);
elm_radio_state_value_set(rd, 1);
elm_radio_group_add(rd, rdg);
elm_object_text_set(rd, "Icon no scale");
- elm_radio_icon_set(rd, ic);
+ elm_object_content_set(rd, ic);
elm_box_pack_end(bx, rd);
evas_object_show(rd);
evas_object_show(ic);
rd = elm_radio_add(win);
elm_radio_state_value_set(rd, 4);
elm_radio_group_add(rd, rdg);
- elm_radio_icon_set(rd, ic);
+ elm_object_content_set(rd, ic);
elm_box_pack_end(bx, rd);
evas_object_show(rd);
evas_object_show(ic);
rd = elm_radio_add(win);
elm_radio_state_value_set(rd, 5);
elm_radio_group_add(rd, rdg);
- elm_radio_icon_set(rd, ic);
+ elm_object_content_set(rd, ic);
elm_object_disabled_set(rd, 1);
elm_box_pack_end(bx, rd);
evas_object_show(rd);
evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, sc);
- elm_scroller_content_set(sc, tb);
+ elm_object_content_set(sc, tb);
evas_object_show(tb);
elm_scroller_page_relative_set(sc, 1.0, 1.0);
-// elm_scroller_page_size_set(sc, 200, 200);
evas_object_show(sc);
tb2 = elm_table_add(win);
evas_object_show(bt);
}
- elm_scroller_content_set(sc, bx2);
+ elm_object_content_set(sc, bx2);
evas_object_show(bx2);
/* } */
}
}
- elm_scroller_content_set(sc, tb2);
+ elm_object_content_set(sc, tb2);
evas_object_show(tb2);
/* } */
evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_scroller_bounce_set(sc, 0, 1);
elm_win_resize_object_add(win, sc);
- elm_scroller_content_set(sc, bx);
+ elm_object_content_set(sc, bx);
evas_object_show(bx);
evas_object_show(sc);
sl = elm_slider_add(win);
sl1 = sl;
elm_object_text_set(sl, "Horizontal");
- elm_slider_icon_set(sl, ic);
+ elm_object_content_part_set(sl, ELM_SLIDER_CONTENT_ICON, ic);
elm_slider_unit_format_set(sl, "%1.1f units");
elm_slider_span_size_set(sl, 120);
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
sl = elm_slider_add(win);
elm_object_text_set(sl, "Disabled");
- elm_slider_icon_set(sl, ic);
+ elm_object_content_part_set(sl, ELM_SLIDER_CONTENT_ICON, ic);
elm_slider_unit_format_set(sl, "%1.1f units");
elm_slider_span_size_set(sl, 120);
elm_slider_min_max_set(sl, 50, 150);
sl = elm_slider_add(win);
elm_object_text_set(sl, "Horizontal inverted");
- elm_slider_end_set(sl, ic);
+ elm_object_content_part_set(sl, ELM_SLIDER_CONTENT_END, ic);
elm_slider_span_size_set(sl, 80);
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
sl = elm_slider_add(win);
elm_object_text_set(sl, "Disabled inverted");
- elm_slider_end_set(sl, ic);
+ elm_object_content_part_set(sl, ELM_SLIDER_CONTENT_END, ic);
elm_slider_span_size_set(sl, 80);
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
sl = elm_slider_add(win);
- elm_slider_icon_set(sl, ic);
+ elm_object_content_part_set(sl, ELM_SLIDER_CONTENT_ICON, ic);
elm_object_text_set(sl, "Vertical inverted");
elm_slider_inverted_set(sl, EINA_TRUE);
elm_slider_unit_format_set(sl, "units");
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
sl = elm_slider_add(win);
- elm_slider_icon_set(sl, ic);
+ elm_object_content_part_set(sl, ELM_SLIDER_CONTENT_ICON, ic);
elm_object_text_set(sl, "Disabled vertical");
elm_slider_inverted_set(sl, EINA_TRUE);
elm_slider_unit_format_set(sl, "units");
evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, sc);
- elm_scroller_content_set(sc, tb);
+ elm_object_content_set(sc, tb);
evas_object_show(tb);
evas_object_show(sc);
elm_box_pack_end(bx, bb);
evas_object_show(bb);
- elm_scroller_content_set(sc, bx);
+ elm_object_content_set(sc, bx);
evas_object_show(bx);
evas_object_show(sc);
if (p->label)
elm_object_text_set(obj, p->label);
if (p->icon)
- elm_progressbar_icon_set(obj, p->icon);
+ elm_object_content_set(obj, p->icon);
if (p->span_exists)
elm_progressbar_span_size_set(obj, p->span);
if (p->value_exists)
{
Evas_Object *icon = external_common_param_icon_get(obj, param);
if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE;
- elm_progressbar_icon_set(obj, icon);
+ elm_object_content_set(obj, icon);
return EINA_TRUE;
}
}
if (p->label)
elm_object_text_set(obj, p->label);
if (p->icon)
- elm_radio_icon_set(obj, p->icon);
+ elm_object_content_set(obj, p->icon);
if (p->value_exists)
elm_radio_state_value_set(obj, p->value);
if (p->group_name)
{
Evas_Object *icon = external_common_param_icon_get(obj, param);
if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE;
- elm_radio_icon_set(obj, icon);
+ elm_object_content_set(obj, icon);
return EINA_TRUE;
}
}
else return;
if (p->content) {
- elm_scroller_content_set(obj, p->content);
+ elm_object_content_set(obj, p->content);
}
}
Evas_Object *content = external_common_param_edje_object_get(obj, param);
if ((strcmp(param->s, "")) && (!content))
return EINA_FALSE;
- elm_scroller_content_set(obj, content);
+ elm_object_content_set(obj, content);
return EINA_TRUE;
}
const Evas_Object *obj, const char *content)
{
if (!strcmp(content, "content"))
- return elm_scroller_content_get(obj);
+ return elm_object_content_get(obj);
ERR("unknown content '%s'", content);
return NULL;
if (p->label)
elm_object_text_set(obj, p->label);
if (p->icon)
- elm_slider_icon_set(obj, p->icon);
+ elm_object_content_part_set(obj, ELM_SLIDER_CONTENT_ICON, p->icon);
if (p->span_exists)
elm_slider_span_size_set(obj, p->span);
if ((p->min_exists) && (p->max_exists))
{
Evas_Object *icon = external_common_param_icon_get(obj, param);
if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE;
- elm_slider_icon_set(obj, icon);
+ elm_object_content_part_set(obj, ELM_SLIDER_CONTENT_ICON, icon);
return EINA_TRUE;
}
}
* elm_scroller_content_unset() function.
* @deprecated See elm_object_content_set()
*/
- EAPI void elm_scroller_content_set(Evas_Object *obj, Evas_Object *child) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI void elm_scroller_content_set(Evas_Object *obj, Evas_Object *child) EINA_ARG_NONNULL(1);
/**
* @brief Get the content of the scroller widget
*
* @see elm_scroller_content_set()
* @deprecated use elm_object_content_get() instead.
*/
- EAPI Evas_Object *elm_scroller_content_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI Evas_Object *elm_scroller_content_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* @brief Unset the content of the scroller widget
*
* @see elm_scroller_content_set()
* @deprecated use elm_object_content_unset() instead.
*/
- EAPI Evas_Object *elm_scroller_content_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI Evas_Object *elm_scroller_content_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* @brief Set custom theme elements for the scroller
*
* @ingroup Slider
* @deprecated use elm_object_content_set() instead.
*/
- EAPI void elm_slider_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI void elm_slider_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1);
/**
* Unset an icon set on a given slider widget.
*
* @ingroup Slider
*/
- EAPI Evas_Object *elm_slider_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI Evas_Object *elm_slider_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* Retrieve the icon object set for a given slider widget.
*
* @ingroup Slider
*/
- EAPI Evas_Object *elm_slider_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI Evas_Object *elm_slider_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* Set the end object of the slider object.
*
* @ingroup Slider
*/
- EAPI void elm_slider_end_set(Evas_Object *obj, Evas_Object *end) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI void elm_slider_end_set(Evas_Object *obj, Evas_Object *end) EINA_ARG_NONNULL(1);
/**
* Unset an end object set on a given slider widget.
*
* @ingroup Slider
*/
- EAPI Evas_Object *elm_slider_end_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI Evas_Object *elm_slider_end_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* Retrieve the end object set for a given slider widget.
*
* @ingroup Slider
*/
- EAPI Evas_Object *elm_slider_end_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI Evas_Object *elm_slider_end_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* Set the (exact) length of the bar region of a given slider widget.
&
* @deprecated use elm_object_content_set() instead.
*/
- EAPI void elm_radio_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI void elm_radio_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1);
/**
* @brief Get the icon object of the radio object
*
*
* @see elm_radio_icon_set()
*/
- EAPI Evas_Object *elm_radio_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI Evas_Object *elm_radio_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* @brief Unset the icon used for the radio object
*
* @see elm_radio_icon_set()
* @deprecated use elm_object_content_unset() instead.
*/
- EAPI Evas_Object *elm_radio_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI Evas_Object *elm_radio_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* @brief Add this radio to a group of other radio objects
*
*
* @ingroup Progressbar
*/
- EAPI void elm_progressbar_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI void elm_progressbar_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1);
/**
* Retrieve the icon object set for a given progress bar widget
*
* @ingroup Progressbar
*/
- EAPI Evas_Object *elm_progressbar_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI Evas_Object *elm_progressbar_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* Unset an icon set on a given progress bar widget
*
* @ingroup Progressbar
*/
- EAPI Evas_Object *elm_progressbar_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI Evas_Object *elm_progressbar_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* Set the (exact) length of the bar region of a given progress bar
elm_entry_editable_set(wd->entry, 0);
evas_object_size_hint_weight_set(wd->entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(wd->entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_scroller_content_set(wd->scroller, wd->entry);
+ elm_object_content_set(wd->scroller, wd->entry);
evas_object_show(wd->entry);
evas_object_event_callback_add(wd->entry, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
evas_object_size_hint_weight_set(wd->box, EVAS_HINT_EXPAND,
EVAS_HINT_EXPAND);
- elm_scroller_content_set(wd->scr, wd->box);
+ elm_object_content_set(wd->scr, wd->box);
elm_ctxpopup_horizontal_set(obj, wd->horizontal);
}
return wd->label;
}
+static void
+_content_set_hook(Evas_Object *obj, const char *part __UNUSED__, Evas_Object *content)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (wd->icon == content) return;
+ if (wd->icon) evas_object_del(wd->icon);
+ wd->icon = content;
+ if (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->progressbar, "elm.swallow.content", content);
+ edje_object_signal_emit(wd->progressbar, "elm,state,icon,visible", "elm");
+ edje_object_message_signal_process(wd->progressbar);
+ }
+ _sizing_eval(obj);
+}
+
+static Evas_Object *
+_content_get_hook(const Evas_Object *obj, const char *part __UNUSED__)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ return wd->icon;
+}
+
+static Evas_Object *
+_content_unset_hook(Evas_Object *obj, const char *part __UNUSED__)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ if (!wd->icon) return NULL;
+ Evas_Object *icon = wd->icon;
+ elm_widget_sub_object_del(obj, wd->icon);
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ _changed_size_hints, obj);
+ edje_object_part_unswallow(wd->progressbar, wd->icon);
+ wd->icon = NULL;
+ return icon;
+}
+
+
EAPI Evas_Object *
elm_progressbar_add(Evas_Object *parent)
{
elm_widget_can_focus_set(obj, EINA_FALSE);
elm_widget_text_set_hook_set(obj, _elm_progressbar_label_set);
elm_widget_text_get_hook_set(obj, _elm_progressbar_label_get);
+ elm_widget_content_set_hook_set(obj, _content_set_hook);
+ elm_widget_content_get_hook_set(obj, _content_get_hook);
+ elm_widget_content_unset_hook_set(obj, _content_unset_hook);
wd->horizontal = EINA_TRUE;
wd->inverted = EINA_FALSE;
EAPI void
elm_progressbar_icon_set(Evas_Object *obj, Evas_Object *icon)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->icon == icon) return;
- if (wd->icon) evas_object_del(wd->icon);
- wd->icon = icon;
- if (icon)
- {
- elm_widget_sub_object_add(obj, icon);
- evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
- edje_object_part_swallow(wd->progressbar, "elm.swallow.content", icon);
- edje_object_signal_emit(wd->progressbar, "elm,state,icon,visible", "elm");
- edje_object_message_signal_process(wd->progressbar);
- }
- _sizing_eval(obj);
+ _content_set_hook(obj, NULL, icon);
}
EAPI Evas_Object *
elm_progressbar_icon_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->icon;
+ return _content_get_hook(obj, NULL);
}
EAPI Evas_Object *
elm_progressbar_icon_unset(Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- if (!wd->icon) return NULL;
- Evas_Object *icon = wd->icon;
- elm_widget_sub_object_del(obj, wd->icon);
- edje_object_part_unswallow(wd->progressbar, wd->icon);
- wd->icon = NULL;
- return icon;
+ return _content_unset_hook(obj, NULL);
}
EAPI void
return wd->label;
}
+static char *
+_access_info_cb(void *data __UNUSED__, Evas_Object *obj, Elm_Widget_Item *item __UNUSED__)
+{
+ const char *txt = elm_widget_access_info_get(obj);
+ if (!txt) txt = _elm_radio_label_get(obj, NULL);
+ if (txt) return strdup(txt);
+ return NULL;
+}
+
+static char *
+_access_state_cb(void *data __UNUSED__, Evas_Object *obj, Elm_Widget_Item *item __UNUSED__)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ if (elm_widget_disabled_get(obj))
+ return strdup(E_("State: Disabled"));
+ if (wd->state)
+ return strdup(E_("State: On"));
+ return strdup(E_("State: Off"));
+}
+
+static void
+_content_set_hook(Evas_Object *obj, const char *part __UNUSED__, Evas_Object *content)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (wd->icon == content) return;
+ if (wd->icon) evas_object_del(wd->icon);
+ wd->icon = content;
+ if (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->radio, "elm.swallow.content", content);
+ edje_object_signal_emit(wd->radio, "elm,state,icon,visible", "elm");
+ edje_object_message_signal_process(wd->radio);
+ }
+ _sizing_eval(obj);
+}
+
+static Evas_Object *
+_content_get_hook(const Evas_Object *obj, const char *part __UNUSED__)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ return wd->icon;
+}
+
+static Evas_Object *
+_content_unset_hook(Evas_Object *obj, const char *part __UNUSED__)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ if (!wd->icon) return NULL;
+ Evas_Object *icon = wd->icon;
+ elm_widget_sub_object_del(obj, wd->icon);
+ evas_object_event_callback_del_full(wd->icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ _changed_size_hints, obj);
+ edje_object_part_unswallow(wd->radio, wd->icon);
+ wd->icon = NULL;
+ return icon;
+}
+
EAPI Evas_Object *
elm_radio_add(Evas_Object *parent)
{
elm_widget_event_hook_set(obj, _event_hook);
elm_widget_text_set_hook_set(obj, _elm_radio_label_set);
elm_widget_text_get_hook_set(obj, _elm_radio_label_get);
+ elm_widget_content_set_hook_set(obj, _content_set_hook);
+ elm_widget_content_get_hook_set(obj, _content_get_hook);
+ elm_widget_content_unset_hook_set(obj, _content_unset_hook);
wd->radio = edje_object_add(e);
_elm_theme_object_set(obj, wd->radio, "radio", "base", "default");
EAPI void
elm_radio_icon_set(Evas_Object *obj, Evas_Object *icon)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->icon == icon) return;
- if (wd->icon) evas_object_del(wd->icon);
- wd->icon = icon;
- if (icon)
- {
- elm_widget_sub_object_add(obj, icon);
- evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
- edje_object_part_swallow(wd->radio, "elm.swallow.content", icon);
- edje_object_signal_emit(wd->radio, "elm,state,icon,visible", "elm");
- edje_object_message_signal_process(wd->radio);
- }
- _sizing_eval(obj);
+ _content_set_hook(obj, NULL, icon);
}
EAPI Evas_Object *
elm_radio_icon_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->icon;
+ return _content_get_hook(obj, NULL);
}
EAPI Evas_Object *
elm_radio_icon_unset(Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- if (!wd->icon) return NULL;
- Evas_Object *icon = wd->icon;
- elm_widget_sub_object_del(obj, wd->icon);
- edje_object_part_unswallow(wd->radio, wd->icon);
- wd->icon = NULL;
- return icon;
}
EAPI void
evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL);
}
+Evas_Object *
+_elm_scroller_edje_object_get(Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ return elm_smart_scroller_edje_object_get(wd->scr);
+}
+
+static void
+_content_set_hook(Evas_Object *obj, const char *part __UNUSED__, Evas_Object *content)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (wd->content == content) return;
+ if (wd->content) evas_object_del(wd->content);
+ wd->content = content;
+ if (content)
+ {
+ elm_widget_on_show_region_hook_set(content, _show_region_hook, obj);
+ elm_widget_sub_object_add(obj, content);
+ if (wd->scr)
+ elm_smart_scroller_child_set(wd->scr, content);
+ evas_object_event_callback_add(content,
+ EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ _changed_size_hints, obj);
+ }
+ _sizing_eval(obj);
+}
+
+static Evas_Object *
+_content_get_hook(const Evas_Object *obj, const char *part __UNUSED__)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ return wd->content;
+}
+
+static Evas_Object *
+_content_unset_hook(Evas_Object *obj, const char *part __UNUSED__)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Evas_Object *content;
+ if (!wd) return NULL;
+ if (!wd->content) return NULL;
+ content = wd->content;
+ elm_widget_sub_object_del(obj, wd->content);
+ evas_object_event_callback_del_full(wd->content,
+ EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ _changed_size_hints, obj);
+ edje_object_part_unswallow(elm_smart_scroller_edje_object_get(wd->scr),
+ wd->content);
+ wd->content = NULL;
+ return content;
+}
+
EAPI Evas_Object *
elm_scroller_add(Evas_Object *parent)
{
elm_widget_can_focus_set(obj, EINA_TRUE);
elm_widget_event_hook_set(obj, _event_hook);
elm_widget_focus_region_hook_set(obj, _focus_region_hook);
+ elm_widget_content_set_hook_set(obj, _content_set_hook);
+ elm_widget_content_get_hook_set(obj, _content_get_hook);
+ elm_widget_content_unset_hook_set(obj, _content_unset_hook);
wd->widget_name = eina_stringshare_add("scroller");
wd->widget_base = eina_stringshare_add("base");
return obj;
}
-Evas_Object *
-_elm_scroller_edje_object_get(Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return elm_smart_scroller_edje_object_get(wd->scr);
-}
-
EAPI void
elm_scroller_content_set(Evas_Object *obj, Evas_Object *content)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->content == content) return;
- if (wd->content) evas_object_del(wd->content);
- wd->content = content;
- if (content)
- {
- elm_widget_on_show_region_hook_set(content, _show_region_hook, obj);
- elm_widget_sub_object_add(obj, content);
- if (wd->scr)
- elm_smart_scroller_child_set(wd->scr, content);
- evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
- }
- _sizing_eval(obj);
+ _content_set_hook(obj, NULL, content);
}
EAPI Evas_Object *
elm_scroller_content_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->content;
+ return _content_get_hook(obj, NULL);
}
EAPI Evas_Object *
elm_scroller_content_unset(Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Object *content;
- if (!wd) return NULL;
- if (!wd->content) return NULL;
- content = wd->content;
- elm_widget_sub_object_del(obj, wd->content);
- edje_object_part_unswallow(wd->scr, wd->content);
- wd->content = NULL;
- return content;
+ return _content_unset_hook(obj, NULL);
}
EAPI void
return wd->label;
}
+static void
+_icon_set(Evas_Object *obj, Evas_Object *icon)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (wd->icon == icon) return;
+ if (wd->icon) evas_object_del(wd->icon);
+ wd->icon = icon;
+ if (icon)
+ {
+ elm_widget_sub_object_add(obj, icon);
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ _changed_size_hints, obj);
+ edje_object_part_swallow(wd->slider, "elm.swallow.icon", icon);
+ edje_object_signal_emit(wd->slider, "elm,state,icon,visible", "elm");
+ edje_object_message_signal_process(wd->slider);
+ }
+ _sizing_eval(obj);
+}
+
+static Evas_Object *
+_icon_unset(Evas_Object *obj)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Evas_Object *ret = NULL;
+ if (!wd) return NULL;
+ if (wd->icon)
+ {
+ elm_widget_sub_object_del(obj, wd->icon);
+ evas_object_event_callback_del_full(wd->icon,
+ EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ _changed_size_hints, obj);
+ ret = wd->icon;
+ edje_object_part_unswallow(wd->slider, wd->icon);
+ edje_object_signal_emit(wd->slider, "elm,state,icon,hidden", "elm");
+ wd->icon = NULL;
+ _sizing_eval(obj);
+ }
+ return ret;
+}
+
+static void
+_end_set(Evas_Object *obj, Evas_Object *end)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (wd->end == end) return;
+ if (wd->end) evas_object_del(wd->end);
+ wd->end = end;
+ if (end)
+ {
+ elm_widget_sub_object_add(obj, end);
+ evas_object_event_callback_add(end, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ _changed_size_hints, obj);
+ edje_object_part_swallow(wd->slider, "elm.swallow.end", end);
+ edje_object_signal_emit(wd->slider, "elm,state,end,visible", "elm");
+ edje_object_message_signal_process(wd->slider);
+ }
+ _sizing_eval(obj);
+}
+
+static Evas_Object *
+_end_unset(Evas_Object *obj)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Evas_Object *ret = NULL;
+ if (!wd) return NULL;
+ if (wd->end)
+ {
+ elm_widget_sub_object_del(obj, wd->end);
+ evas_object_event_callback_del_full(wd->end,
+ EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ _changed_size_hints, obj);
+ ret = wd->end;
+ edje_object_part_unswallow(wd->slider, wd->end);
+ edje_object_signal_emit(wd->slider, "elm,state,end,hidden", "elm");
+ wd->end = NULL;
+ _sizing_eval(obj);
+ }
+ return ret;
+}
+
+static void
+_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ if ((!part) || (!strcmp(part, "elm.swallow.icon")))
+ _icon_set(obj, content);
+ else if (!strcmp(part, "elm.swallow.end"))
+ _end_set(obj, content);
+}
+
+static Evas_Object *
+_content_get_hook(const Evas_Object *obj, const char *part __UNUSED__)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ if ((!part) || (!strcmp(part, "elm.swallow.icon")))
+ return wd->icon;
+ else if (!strcmp(part, "elm.swallow.end"))
+ return wd->end;
+ return NULL;
+}
+
+static Evas_Object *
+_content_unset_hook(Evas_Object *obj, const char *part __UNUSED__)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ if ((!part) || (!strcmp(part, "elm.swallow.icon")))
+ return _icon_unset(obj);
+ else if (!strcmp(part, "elm.swallow.end"))
+ return _end_unset(obj);
+ return NULL;
+}
+
EAPI Evas_Object *
elm_slider_add(Evas_Object *parent)
{
elm_widget_event_hook_set(obj, _event_hook);
elm_widget_text_set_hook_set(obj, _elm_slider_label_set);
elm_widget_text_get_hook_set(obj, _elm_slider_label_get);
+ elm_widget_content_set_hook_set(obj, _content_set_hook);
+ elm_widget_content_get_hook_set(obj, _content_get_hook);
+ elm_widget_content_unset_hook_set(obj, _content_unset_hook);
wd->horizontal = EINA_TRUE;
wd->indicator_show = EINA_TRUE;
EAPI void
elm_slider_icon_set(Evas_Object *obj, Evas_Object *icon)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->icon == icon) return;
- if (wd->icon) evas_object_del(wd->icon);
- wd->icon = icon;
- if (icon)
- {
- elm_widget_sub_object_add(obj, icon);
- evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
- edje_object_part_swallow(wd->slider, "elm.swallow.icon", icon);
- edje_object_signal_emit(wd->slider, "elm,state,icon,visible", "elm");
- edje_object_message_signal_process(wd->slider);
- }
- _sizing_eval(obj);
+ _content_set_hook(obj, NULL, icon);
}
EAPI Evas_Object *
elm_slider_icon_unset(Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Object *ret = NULL;
- if (!wd) return NULL;
- if (wd->icon)
- {
- elm_widget_sub_object_del(obj, wd->icon);
- ret = wd->icon;
- edje_object_part_unswallow(wd->slider, wd->icon);
- edje_object_signal_emit(wd->slider, "elm,state,icon,hidden", "elm");
- wd->icon = NULL;
- _sizing_eval(obj);
- }
- return ret;
+ return _content_unset_hook(obj, NULL);
}
EAPI Evas_Object *
elm_slider_icon_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->icon;
+ return _content_get_hook(obj, NULL);
}
EAPI void
EAPI void
elm_slider_end_set(Evas_Object *obj, Evas_Object *end)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->end == end) return;
- if (wd->end) evas_object_del(wd->end);
- wd->end = end;
- if (end)
- {
- elm_widget_sub_object_add(obj, end);
- evas_object_event_callback_add(end, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
- edje_object_part_swallow(wd->slider, "elm.swallow.end", end);
- edje_object_signal_emit(wd->slider, "elm,state,end,visible", "elm");
- edje_object_message_signal_process(wd->slider);
- }
- _sizing_eval(obj);
+ _content_set_hook(obj, "elm.swallow.end", end);
}
EAPI Evas_Object *
elm_slider_end_unset(Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Object *ret = NULL;
- if (!wd) return NULL;
- if (wd->end)
- {
- elm_widget_sub_object_del(obj, wd->end);
- ret = wd->end;
- edje_object_part_unswallow(wd->slider, wd->end);
- edje_object_signal_emit(wd->slider, "elm,state,end,hidden", "elm");
- wd->end = NULL;
- _sizing_eval(obj);
- }
- return ret;
+ return _content_unset_hook(obj, "elm.swallow.end");
}
EAPI Evas_Object *
elm_slider_end_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->end;
+ return _content_get_hook(obj, "elm.swallow.end");
}
EAPI void