Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "anchorblock");
elm_widget_type_set(obj, "anchorblock");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "anchorview");
elm_widget_type_set(obj, "anchorview");
elm_widget_sub_object_add(parent, obj);
Widget_Data *wd;
Evas_Coord x, y, w, h;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "ctxpopup");
elm_widget_type_set(obj, "ctxpopup");
elm_widget_sub_object_add(parent, obj);
EAPI Evas_Object *
elm_fileselector_add(Evas_Object *parent)
{
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- Evas *e = evas_object_evas_get(parent);
- if (!e) return NULL;
+ Evas *e;
Evas_Object *obj, *ic, *bt, *li, *en, *grid;
Widget_Data *wd;
int s;
- // Elementary Widget
- wd = ELM_NEW(Widget_Data);
- wd->expand = !!_elm_config->fileselector_expand_enable;
- obj = elm_widget_add(evas_object_evas_get(parent));
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "fileselector");
elm_widget_type_set(obj, "fileselector");
elm_widget_sub_object_add(parent, obj);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_can_focus_set(obj, EINA_FALSE);
+ wd->expand = !!_elm_config->fileselector_expand_enable;
+
wd->edje = edje_object_add(e);
_elm_theme_object_set(obj, wd->edje, "fileselector", "base", "default");
elm_widget_resize_object_set(obj, wd->edje);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- wd->window_title = eina_stringshare_add(DEFAULT_WINDOW_TITLE);
- wd->fsd.path = eina_stringshare_add(getenv("HOME"));
- wd->fsd.expandable = _elm_config->fileselector_expand_enable;
- wd->inwin_mode = _elm_config->inwin_dialogs_enable;
- wd->w = 400;
- wd->h = 400;
-
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "fileselector_button");
elm_widget_type_set(obj, "fileselector_button");
elm_widget_sub_object_add(parent, obj);
- wd->self = obj;
elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
elm_widget_data_set(obj, wd);
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_can_focus_set(obj, EINA_TRUE);
elm_widget_activate_hook_set(obj, _activate_hook);
+ wd->self = obj;
+ wd->window_title = eina_stringshare_add(DEFAULT_WINDOW_TITLE);
+ if (getenv("HOME")) wd->fsd.path = eina_stringshare_add(getenv("HOME"));
+ else wd->fsd.path = eina_stringshare_add("/");
+ wd->fsd.expandable = _elm_config->fileselector_expand_enable;
+ wd->inwin_mode = _elm_config->inwin_dialogs_enable;
+ wd->w = 400;
+ wd->h = 400;
+
wd->btn = elm_button_add(parent);
elm_widget_mirrored_automatic_set(wd->btn, EINA_FALSE);
elm_widget_resize_object_set(obj, wd->btn);
elm_fileselector_entry_add(Evas_Object *parent)
{
Evas_Object *obj;
- Evas *e = evas_object_evas_get(parent);
- if (!e) return NULL;
+ Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
-
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "fileselector_entry");
elm_widget_type_set(obj, "fileselector_entry");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "hoversel");
elm_widget_type_set(obj, "hoversel");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "scrolled_entry");
elm_widget_type_set(obj, "scrolled_entry");
elm_widget_sub_object_add(parent, obj);
Widget_Data *wd;
Evas *e;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "actionslider");
elm_widget_type_set(obj, "actionslider");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "bg");
elm_widget_type_set(obj, "bg");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "box");
elm_widget_type_set(obj, "box");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "bubble");
elm_widget_type_set(obj, "bubble");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "button");
elm_widget_type_set(obj, "button");
elm_widget_sub_object_add(parent, obj);
int i, t;
Evas *e;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "calendar");
elm_widget_type_set(obj, "calendar");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "check");
elm_widget_type_set(obj, "check");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "clock");
elm_widget_type_set(obj, "clock");
elm_widget_sub_object_add(parent, obj);
Widget_Data *wd = NULL;
Evas *e;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "colorselector");
elm_widget_type_set(obj, "colorselector");
elm_widget_sub_object_add(parent, obj);
elm_conformant_add(Evas_Object *parent)
{
Evas_Object *obj;
- Evas *evas;
+ Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
-
- evas = evas_object_evas_get(parent);
- if (!evas) return NULL;
-
- obj = elm_widget_add(evas);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "conformant");
elm_widget_type_set(obj, "conformant");
elm_widget_sub_object_add(parent, obj);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_can_focus_set(obj, EINA_FALSE);
- wd->base = edje_object_add(evas);
+ wd->base = edje_object_add(e);
_elm_theme_object_set(obj, wd->base, "conformant", "base", "default");
elm_widget_resize_object_set(obj, wd->base);
ecore_x_e_illume_indicator_geometry_get(zone, NULL, NULL, NULL, &sh);
if (sh < 0) sh = 0;
- wd->shelf = evas_object_rectangle_add(evas);
+ wd->shelf = evas_object_rectangle_add(e);
evas_object_color_set(wd->shelf, 0, 0, 0, 0);
evas_object_size_hint_min_set(wd->shelf, -1, sh);
evas_object_size_hint_max_set(wd->shelf, -1, sh);
sh = -1;
ecore_x_e_illume_softkey_geometry_get(zone, NULL, NULL, NULL, &sh);
if (sh < 0) sh = 0;
- wd->panel = evas_object_rectangle_add(evas);
+ wd->panel = evas_object_rectangle_add(e);
evas_object_color_set(wd->panel, 0, 0, 0, 0);
evas_object_size_hint_min_set(wd->panel, -1, sh);
evas_object_size_hint_max_set(wd->panel, -1, sh);
EAPI Evas_Object *
elm_diskselector_add(Evas_Object *parent)
{
+ Evas *e;
Evas_Object *obj;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- wd->self = obj = elm_widget_add(evas_object_evas_get(parent));
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "diskselector");
elm_widget_type_set(obj, "diskselector");
elm_widget_sub_object_add(parent, obj);
elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
elm_widget_event_hook_set(obj, _event_hook);
+ wd->self = obj;
wd->item_count = 0;
wd->round = EINA_FALSE;
wd->init = EINA_FALSE;
wd->len_side = 3;
- wd->scroller = elm_smart_scroller_add(evas_object_evas_get(parent));
+ wd->scroller = elm_smart_scroller_add(e);
elm_smart_scroller_widget_set(wd->scroller, obj);
_theme_hook(obj);
elm_widget_resize_object_set(obj, wd->scroller);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "entry");
elm_widget_type_set(obj, "entry");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "flip");
elm_widget_type_set(obj, "flip");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
- wd->self = obj;
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "flipselector");
elm_widget_type_set(obj, "flipselector");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "frame");
elm_widget_type_set(obj, "frame");
elm_widget_sub_object_add(parent, obj);
static Evas_Smart *smart = NULL;
Eina_Bool bounce = _elm_config->thumbscroll_bounce_enable;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "gengrid");
elm_widget_type_set(obj, "gengrid");
elm_widget_sub_object_add(parent, obj);
Evas_Coord minw, minh;
static Evas_Smart *smart = NULL;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
if (!smart)
{
static Evas_Smart_Class sc;
sc.calculate = _pan_calculate;
if (!(smart = evas_smart_class_new(&sc))) return NULL;
}
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "genlist");
elm_widget_type_set(obj, "genlist");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
-
- ELM_HOVER_PARTS_FOREACH
- wd->subs[i].swallow = _directions[i];
-
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "hover");
elm_widget_type_set(obj, "hover");
elm_widget_sub_object_add(parent, obj);
elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
+ ELM_HOVER_PARTS_FOREACH
+ wd->subs[i].swallow = _directions[i];
+
wd->hov = evas_object_rectangle_add(e);
evas_object_pass_events_set(wd->hov, EINA_TRUE);
evas_object_color_set(wd->hov, 0, 0, 0, 0);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "icon");
elm_widget_type_set(obj, "icon");
elm_widget_can_focus_set(obj, EINA_FALSE);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "image");
elm_widget_type_set(obj, "image");
elm_widget_sub_object_add(parent, obj);
Widget_Data *wd;
Evas_Coord minw, minh;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "index");
elm_widget_type_set(obj, "index");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- wd->bgcolor = EINA_FALSE;
- wd->bg = evas_object_rectangle_add(e);
- evas_object_color_set(wd->bg, 0, 0, 0, 0);
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "label");
elm_widget_type_set(obj, "label");
elm_widget_sub_object_add(parent, obj);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_can_focus_set(obj, EINA_FALSE);
+ wd->bgcolor = EINA_FALSE;
+ wd->bg = evas_object_rectangle_add(e);
+ evas_object_color_set(wd->bg, 0, 0, 0, 0);
+
wd->linewrap = EINA_FALSE;
wd->ellipsis = EINA_FALSE;
wd->slidingmode = EINA_FALSE;
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- wd->obj = obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "layout");
elm_widget_type_set(obj, "layout");
elm_widget_sub_object_add(parent, obj);
elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
+ wd->obj = obj;
wd->lay = edje_object_add(e);
elm_widget_resize_object_set(obj, wd->lay);
edje_object_signal_callback_add(wd->lay, "size,eval", "elm",
Widget_Data *wd;
Evas_Coord minw, minh;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- wd->self = obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "list");
elm_widget_type_set(obj, "list");
elm_widget_sub_object_add(parent, obj);
static Evas_Smart *smart = NULL;
Eina_Bool bounce = _elm_config->thumbscroll_bounce_enable;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- if (!ecore_file_download_protocol_available("http://"))
- {
- ERR("Ecore must be built with the support of HTTP for the widget map !");
- return NULL;
- }
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "map");
elm_widget_type_set(obj, "map");
elm_widget_sub_object_add(parent, obj);
// TODO: convert Elementary to subclassing of Evas_Smart_Class
// TODO: and save some bytes, making descriptions per-class and not instance!
evas_object_smart_callbacks_descriptions_set(obj, _signals);
+
+ if (!ecore_file_download_protocol_available("http://"))
+ {
+ ERR("Ecore must be built with curl support for the map widget!");
+ }
+
return obj;
}
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "mapbuf");
elm_widget_type_set(obj, "mapbuf");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "menu");
elm_widget_type_set(obj, "menu");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "notify");
elm_widget_type_set(obj, "notify");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "pager");
elm_widget_type_set(obj, "pager");
elm_widget_sub_object_add(parent, obj);
elm_panel_add(Evas_Object *parent)
{
Evas_Object *obj;
- Evas *evas;
+ Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- evas = evas_object_evas_get(parent);
- if (!evas) return NULL;
- obj = elm_widget_add(evas);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "panel");
elm_widget_type_set(obj, "panel");
elm_widget_sub_object_add(parent, obj);
elm_widget_can_focus_set(obj, EINA_TRUE);
elm_widget_event_hook_set(obj, _event_hook);
- wd->scr = elm_smart_scroller_add(evas);
+ wd->scr = elm_smart_scroller_add(e);
elm_smart_scroller_widget_set(wd->scr, obj);
_theme_hook(obj);
elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE, EINA_FALSE);
wd->hidden = EINA_FALSE;
wd->orient = ELM_PANEL_ORIENT_LEFT;
- wd->bx = evas_object_box_add(evas);
+ wd->bx = evas_object_box_add(e);
evas_object_size_hint_align_set(wd->bx, 0.5, 0.5);
evas_object_box_layout_set(wd->bx, _layout, wd, NULL);
elm_widget_sub_object_add(obj, wd->bx);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "panes");
elm_widget_type_set(obj, "panes");
elm_widget_sub_object_add(parent, obj);
Widget_Data *wd;
Evas_Object *icon;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "photo");
elm_widget_type_set(obj, "photo");
elm_widget_sub_object_add(parent, obj);
static Evas_Smart *smart = NULL;
Eina_Bool bounce = _elm_config->thumbscroll_bounce_enable;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "photocam");
elm_widget_type_set(obj, "photocam");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "progressbar");
elm_widget_type_set(obj, "progressbar");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "radio");
elm_widget_type_set(obj, "radio");
elm_widget_sub_object_add(parent, obj);
Widget_Data *wd;
Evas_Coord minw, minh;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "scroller");
elm_widget_type_set(obj, "scroller");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "separator");
wd->horizontal = EINA_FALSE;
elm_widget_type_set(obj, "separator");
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "slider");
elm_widget_type_set(obj, "slider");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "slideshow");
elm_widget_type_set(obj, "slideshow");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "spinner");
elm_widget_type_set(obj, "spinner");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "table");
elm_widget_type_set(obj, "table");
elm_widget_sub_object_add(parent, obj);
EAPI Evas_Object *
elm_thumb_add(Evas_Object *parent)
{
- Evas *evas;
+ Evas *e;
Widget_Data *wd;
Evas_Object *obj;
Evas_Coord minw, minh;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- evas = evas_object_evas_get(parent);
- if (!evas) return NULL;
- obj = elm_widget_add(evas);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "thumb");
elm_widget_type_set(obj, "thumb");
elm_widget_sub_object_add(parent, obj);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_can_focus_set(obj, EINA_FALSE);
- wd->frame = edje_object_add(evas);
+ wd->frame = edje_object_add(e);
_elm_theme_object_set(obj, wd->frame, "thumb", "base", "default");
elm_widget_resize_object_set(obj, wd->frame);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "toggle");
elm_widget_type_set(obj, "toggle");
elm_widget_sub_object_add(parent, obj);
Evas *e;
Widget_Data *wd;
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "toolbar");
elm_widget_type_set(obj, "toolbar");
elm_widget_sub_object_add(parent, obj);
* // elementary and that the api hasn't broken. if it has this returns
* // false and you need to handle this error gracefully
* if (!elm_widget_api_check(ELM_INTERNAL_API_VERSION)) return NULL;
+ *
+ * // standard widget setup and allocate wd, create obj given parent etc.
+ * ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
*
- * // basic - allocate data for widget and fill it
- * wd = ELM_NEW(Widget_Data);
- * e = evas_object_evas_get(parent);
- * if (!e) return NULL;
- * obj = elm_widget_add(e);
* // give it a type name and set up a mywidget type string if needed
* ELM_SET_WIDTYPE(widtype, "mywidget");
* elm_widget_type_set(obj, "mywidget");
ELM_WIDGET_ITEM_CHECK_OR_GOTO((Elm_Widget_Item *)it, label); \
if (!elm_widget_type_check((it->base.widget), (widtype))) goto label;
+#define ELM_WIDGET_STANDARD_SETUP(wdat, wdtype, par, evas, ob, ret) \
+ do { \
+ EINA_SAFETY_ON_NULL_RETURN_VAL((par), (ret)); \
+ evas = evas_object_evas_get(par); if (!(evas)) return (ret); \
+ wdat = ELM_NEW(wdtype); if (!(wdat)) return (ret); \
+ ob = elm_widget_add(evas); if (!(ob)) { free(wdat); return (ret); } \
+ } while (0);
/**
* The drag and drop API.