#include "elm_priv.h"
typedef struct _Widget_Data Widget_Data;
-typedef struct _Item Item;
struct _Widget_Data
{
Eina_List *items;
};
-struct _Item
+struct _Elm_Hoversel_Item
{
Evas_Object *obj;
const char *label;
static void
_item_clicked(void *data, Evas_Object *obj, void *event_info)
{
- Item *it = data;
+ Elm_Hoversel_Item *it = data;
Evas_Object *obj2 = it->obj;
elm_hoversel_hover_end(obj2);
if (it->func) it->func(it->data, obj2, it);
Widget_Data *wd = elm_widget_data_get(data);
if (!wd) return;
Evas_Object *bt, *bx, *ic;
- Eina_List *l;
+ const Eina_List *l;
+ const Elm_Hoversel_Item *it;
+
wd->hover = elm_hover_add(data);
elm_hover_style_set(wd->hover, "hoversel_vertical");
evas_object_smart_callback_add(wd->hover, "clicked", _hover_clicked, data);
bx = elm_box_add(wd->hover);
elm_box_homogenous_set(bx, 1);
-
- for (l = wd->items; l; l = l->next)
+
+ EINA_LIST_FOREACH(wd->items, l, it)
{
- Item *it = l->data;
bt = elm_button_add(wd->hover);
elm_button_style_set(bt, "hoversel_vertical_entry");
elm_button_label_set(bt, it->label);
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return NULL;
- Item *it = calloc(1, sizeof(Item));
+ Elm_Hoversel_Item *it = calloc(1, sizeof(Elm_Hoversel_Item));
if (!it) return NULL;
wd->items = eina_list_append(wd->items, it);
it->obj = obj;
it->icon_type = icon_type;
it->func = func;
it->data = (void *)data;
- return (Elm_Hoversel_Item *)it;
+ return it;
}
EAPI void
-elm_hoversel_item_del(Elm_Hoversel_Item *item)
+elm_hoversel_item_del(Elm_Hoversel_Item *it)
{
- Item *it = (Item *)item;
Widget_Data *wd = elm_widget_data_get(it->obj);
if (!wd) return;
elm_hoversel_hover_end(it->obj);
Elm_Carousel_Item *it2;
Widget_Data *wd = elm_widget_data_get(it->obj);
Evas_Object *obj2;
- Eina_List *l;
+ const Eina_List *l;
if (it->selected) return;
- for (l = wd->items; l; l = l->next)
+ EINA_LIST_FOREACH(wd->items, l, it2)
{
- it2 = l->data;
if (it2->selected)
{
it2->selected = 0;
_theme_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
- Eina_List *l;
- Elm_Carousel_Item *it;
+ const Eina_List *l;
+ const Elm_Carousel_Item *it;
Evas_Coord mw, mh;
- for (l = wd->items; l; l = l->next)
+ EINA_LIST_FOREACH(wd->items, l, it)
{
- it = l->data;
if (it->selected)
edje_object_signal_emit(it->base, "elm,state,selected", "elm");
_elm_theme_set(it->base, "carousel", "item", "default");
{
Widget_Data *wd = elm_widget_data_get(data);
Evas_Coord mw, mh, vw, vh, w, h;
- Eina_List *l;
+ const Eina_List *l;
Elm_Carousel_Item *it;
elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
{
if (w != vw) evas_object_resize(wd->bx, vw, h);
}
- for (l = wd->items; l; l = l->next)
+ EINA_LIST_FOREACH(wd->items, l, it)
{
- it = l->data;
if (it->selected)
{
_item_show(it);
_signal_selection_start(void *data, Evas_Object *obj, const char *emission, const char *source)
{
Widget_Data *wd = elm_widget_data_get(data);
- Eina_List *l;
- for (l = entries; l; l = l->next)
+ const Eina_List *l;
+ Evas_Object *entry;
+ EINA_LIST_FOREACH(entries, l, entry)
{
- if (l->data != data) elm_entry_select_none(l->data);
+ if (entry != data) elm_entry_select_none(entry);
}
wd->have_selection = 1;
evas_object_smart_callback_call(data, "selection,start", NULL);
// debug
#if 0
{
- Eina_List *l, *an;
+ const Eina_List *l, *an;
+ const char *anchor;
an = edje_object_part_text_anchor_list_get(wd->ent, "elm.text");
- for (l = an; l; l = l->next)
- printf("ANCHOR: %s\n", l->data);
+ EINA_LIST_FOREACH(an, l, anchor)
+ printf("ANCHOR: %s\n", anchor);
}
#endif
wd->changed = 1;
}
else
{
- for (l = it->wd->selected; l;)
- {
- Elm_Genlist_Item *it2 = l->data;
- l = l->next;
- if ((it2 != it) && (it2->selected)) _item_unselect(it2);
+ if (!it->selected)
+ {
+ Widget_Data *wd = it->wd;
+ while (wd->selected)
+ _item_unselect(wd->selected->data);
+ _item_select(it);
+ }
+ else
+ {
+ const Eina_List *l, *l_next;
+ Elm_Genlist_Item *it2;
+ EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, it2)
+ if (it2 != it) _item_unselect(it2);
}
- if (!it->selected) _item_select(it);
}
}
if (it->itc->func.label_get)
{
- Eina_List *l;
-
+ const Eina_List *l;
+ const char *key;
+
it->labels = _stringlist_get(edje_object_data_get(it->base, "labels"));
- for (l = it->labels; l; l = l->next)
+ EINA_LIST_FOREACH(it->labels, l, key)
{
- const char *key = l->data;
char *s = it->itc->func.label_get(it->data, it->wd->obj, l->data);
if (s)
{
}
if (it->itc->func.icon_get)
{
- Eina_List *l;
-
+ const Eina_List *l;
+ const char *key;
+
it->icons = _stringlist_get(edje_object_data_get(it->base, "icons"));
- for (l = it->icons; l; l = l->next)
+ EINA_LIST_FOREACH(it->icons, l, key)
{
- const char *key = l->data;
Evas_Object *ic = it->itc->func.icon_get(it->data, it->wd->obj, l->data);
if (ic)
{
}
if (it->itc->func.state_get)
{
- Eina_List *l;
-
+ const Eina_List *l;
+ const char *key;
+
it->states = _stringlist_get(edje_object_data_get(it->base, "states"));
- for (l = it->states; l; l = l->next)
+ EINA_LIST_FOREACH(it->states, l, key)
{
- const char *key = l->data;
Evas_Bool on = it->itc->func.state_get(it->data, it->wd->obj, l->data);
if (on)
{
static int
_item_block_recalc(Item_Block *itb, int in)
{
- Eina_List *l;
+ const Eina_List *l;
+ Elm_Genlist_Item *it;
Evas_Coord minw = 0, minh = 0;
int showme = 0;
Evas_Coord y = 0;
-
- for (l = itb->items; l; l = l->next)
+
+ EINA_LIST_FOREACH(itb->items, l, it)
{
- Elm_Genlist_Item *it = l->data;
if (it->delete_me) continue;
showme |= it->showme;
if (!itb->realized)
static void
_item_block_realize(Item_Block *itb, int in)
{
- Eina_List *l;
+ const Eina_List *l;
+ Elm_Genlist_Item *it;
if (itb->realized) return;
- for (l = itb->items; l; l = l->next)
+ EINA_LIST_FOREACH(itb->items, l, it)
{
- Elm_Genlist_Item *it = l->data;
if (it->delete_me) continue;
_item_realize(it, in, 0);
in++;
static void
_item_block_unrealize(Item_Block *itb)
{
- Eina_List *l;
-
+ const Eina_List *l;
+ Elm_Genlist_Item *it;
+
if (!itb->realized) return;
- for (l = itb->items; l; l = l->next)
+ EINA_LIST_FOREACH(itb->items, l, it)
{
- Elm_Genlist_Item *it = l->data;
_item_unrealize(it);
}
itb->realized = 0;
static void
_item_block_position(Item_Block *itb)
{
- Eina_List *l;
+ const Eina_List *l;
+ Elm_Genlist_Item *it;
Evas_Coord y = 0, ox, oy;
evas_object_geometry_get(itb->wd->pan_smart, &ox, &oy, NULL, NULL);
- for (l = itb->items; l; l = l->next)
+ EINA_LIST_FOREACH(itb->items, l, it)
{
- Elm_Genlist_Item *it = l->data;
-
if (it->delete_me) continue;
it->x = 0;
it->y = y;
_reval_content(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
- Eina_List *l;
- for (l = wd->subs; l; l = l->next)
- {
- Subinfo *si = l->data;
- edje_object_part_swallow(wd->cov, si->swallow, si->obj);
- }
+ const Eina_List *l;
+ const Subinfo *si;
+ EINA_LIST_FOREACH(wd->subs, l, si)
+ edje_object_part_swallow(wd->cov, si->swallow, si->obj);
}
static void
_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Widget_Data *wd = elm_widget_data_get(data);
- Eina_List *l;
- for (l = wd->subs; l; l = l->next)
+ const Eina_List *l;
+ const Subinfo *si;
+ EINA_LIST_FOREACH(wd->subs, l, si)
{
- Subinfo *si = l->data;
if (si->obj == obj)
{
edje_object_part_swallow(wd->cov, si->swallow, si->obj);
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Object *sub = event_info;
Eina_List *l;
-
- for (l = wd->subs; l; l = l->next)
+ Subinfo *si;
+ EINA_LIST_FOREACH(wd->subs, l, si)
{
- Subinfo *si = l->data;
if (si->obj == sub)
{
evas_object_event_callback_del
_hov_show_do(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
- Eina_List *l;
+ const Eina_List *l;
+ const Subinfo *si;
if (wd->cov)
{
evas_object_show(wd->cov);
edje_object_signal_emit(wd->cov, "elm,action,show", "elm");
}
- for (l = wd->subs; l; l = l->next)
+ EINA_LIST_FOREACH(wd->subs, l, si)
{
- Subinfo *si = l->data;
char buf[1024];
if (!strncmp(si->swallow, "elm.swallow.slot.", 17))
{
_hov_hide(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Widget_Data *wd = elm_widget_data_get(data);
- Eina_List *l;
+ const Eina_List *l;
+ const Subinfo *si;
if (wd->cov)
{
edje_object_signal_emit(wd->cov, "elm,action,hide", "elm");
evas_object_hide(wd->cov);
}
- for (l = wd->subs; l; l = l->next)
+ EINA_LIST_FOREACH(wd->subs, l, si)
{
- Subinfo *si = l->data;
char buf[1024];
if (!strncmp(si->swallow, "elm.swallow.slot.", 17))
{
{
Widget_Data *wd = elm_widget_data_get(obj);
Subinfo *si;
- Eina_List *l;
+ const Eina_List *l;
char buf[1024];
snprintf(buf, sizeof(buf), "elm.swallow.slot.%s", swallow);
- for (l = wd->subs; l; l = l->next)
+ EINA_LIST_FOREACH(wd->subs, l, si)
{
- si = l->data;
if (!strcmp(buf, si->swallow))
{
if (content == si->obj) return;
_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Widget_Data *wd = elm_widget_data_get(data);
- Eina_List *l;
- for (l = wd->subs; l; l = l->next)
+ const Eina_List *l;
+ const Subinfo *si;
+ EINA_LIST_FOREACH(wd->subs, l, si)
{
- Subinfo *si = l->data;
if (si->obj == obj)
{
edje_object_part_swallow(wd->lay, si->swallow, obj);
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Object *sub = event_info;
Eina_List *l;
-
- for (l = wd->subs; l; l = l->next)
+ Subinfo *si;
+ EINA_LIST_FOREACH(wd->subs, l, si)
{
- Subinfo *si = l->data;
if (si->obj == sub)
{
evas_object_event_callback_del
{
Widget_Data *wd = elm_widget_data_get(obj);
Subinfo *si;
- Eina_List *l;
-
- for (l = wd->subs; l; l = l->next)
+ const Eina_List *l;
+
+ EINA_LIST_FOREACH(wd->subs, l, si)
{
- si = l->data;
if (!strcmp(swallow, si->swallow))
{
if (content == si->obj) return;
{
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Object *sub = event_info;
- Eina_List *l;
-
- for (l = wd->items; l; l = l->next)
+ const Eina_List *l;
+ Elm_List_Item *it;
+
+ EINA_LIST_FOREACH(wd->items, l, it)
{
- Elm_List_Item *it = l->data;
-
if ((sub == it->icon) || (sub == it->end))
{
if (it->icon == sub) it->icon = NULL;
Elm_List_Item *it = data;
Widget_Data *wd = elm_widget_data_get(it->obj);
Evas_Event_Mouse_Up *ev = event_info;
- Eina_List *l;
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) wd->on_hold = 1;
else wd->on_hold = 0;
if (wd->on_hold)
}
else
{
- for (l = wd->selected; l;)
- {
- Elm_List_Item *it2 = l->data;
- l = l->next;
- if ((it2 != it) && (it2->selected)) _item_unselect(it2);
+ if (!it->selected)
+ {
+ while (wd->selected)
+ _item_unselect(wd->selected->data);
+ _item_select(it);
}
- if (!it->selected) _item_select(it);
+ else
+ {
+ const Eina_List *l, *l_next;
+ Elm_List_Item *it2;
+ EINA_LIST_FOREACH_SAFE(wd->selected, l, l_next, it2)
+ if (it2 != it) _item_unselect(it2);
+ }
}
}
_fix_items(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
- Eina_List *l;
+ const Eina_List *l;
+ Elm_List_Item *it;
Evas_Coord minw[2] = { 0, 0 }, minh[2] = { 0, 0 };
Evas_Coord mw, mh;
int i, redo = 0;
-
- for (l = wd->items; l; l = l->next)
+
+ EINA_LIST_FOREACH(wd->items, l, it)
{
Evas_Coord mw, mh;
- Elm_List_Item *it = l->data;
if (it->icon)
{
evas_object_size_hint_min_get(it->icon, &mw, &mh);
wd->minh[1] = minh[1];
redo = 1;
}
- for (i = 0, l = wd->items; l; l = l->next, i++)
+ i = 0;
+ EINA_LIST_FOREACH(wd->items, l, it)
{
- Elm_List_Item *it = l->data;
it->even = i & 0x1;
if ((it->even != it->is_even) || (!it->fixed) || (redo))
{
it->fixed = 1;
it->is_even = it->even;
}
+ i++;
}
mw = 0; mh = 0;
evas_object_size_hint_min_get(wd->box, &mw, &mh);
{
static char *path = NULL;
static Eina_List *pathlist = NULL;
- Eina_List *l;
+ const char *pathitr;
+ const Eina_List *l;
char buf[PATH_MAX];
if (exe[0] == '/') return strdup(exe);
if ((exe[0] == '.') && (exe[1] == '/')) return strdup(exe);
}
}
}
- for (l = pathlist; l; l = l->next)
+ EINA_LIST_FOREACH(pathlist, l, pathitr)
{
- snprintf(buf, sizeof(buf), "%s/%s", (char *)l->data, exe);
+ snprintf(buf, sizeof(buf), "%s/%s", pathitr, exe);
if (access(buf, R_OK | X_OK) == 0) return strdup(buf);
}
return NULL;
}
static void
+_state_set_all(Widget_Data *wd)
+{
+ const Eina_List *l;
+ Evas_Object *child;
+
+ EINA_LIST_FOREACH(wd->group->radios, l, child)
+ {
+ Widget_Data *wd2 = elm_widget_data_get(child);
+ if (wd2->value == wd->group->value) _state_set(child, 1);
+ else _state_set(child, 0);
+ }
+}
+
+static void
_signal_radio_on(void *data, Evas_Object *obj, const char *emission, const char *source)
{
Widget_Data *wd = elm_widget_data_get(data);
- Eina_List *l;
if (wd->group->value == wd->value) return;
wd->group->value = wd->value;
if (wd->group->valuep) *(wd->group->valuep) = wd->group->value;
- for (l = wd->group->radios; l; l = l->next)
- {
- Widget_Data *wd2 = elm_widget_data_get(l->data);
- if (wd2->value == wd->group->value) _state_set(l->data, 1);
- else _state_set(l->data, 0);
- }
+ _state_set_all(wd);
evas_object_smart_callback_call(data, "changed", NULL);
}
elm_radio_value_set(Evas_Object *obj, int value)
{
Widget_Data *wd = elm_widget_data_get(obj);
- Eina_List *l;
+ const Eina_List *l;
+ Evas_Object *child;
if (value == wd->group->value) return;
wd->group->value = value;
if (wd->group->valuep) *(wd->group->valuep) = wd->group->value;
- for (l = wd->group->radios; l; l = l->next)
- {
- Widget_Data *wd2 = elm_widget_data_get(l->data);
- if (wd2->value == wd->group->value) _state_set(l->data, 1);
- else _state_set(l->data, 0);
- }
+ _state_set_all(wd);
}
EAPI int
wd->group->valuep = valuep;
if (*(wd->group->valuep) != wd->group->value)
{
- Eina_List *l;
-
+ const Eina_List *l;
+ Evas_Object *child;
+
wd->group->value = *(wd->group->valuep);
- for (l = wd->group->radios; l; l = l->next)
- {
- Widget_Data *wd2 = elm_widget_data_get(l->data);
- if (wd2->value == wd->group->value) _state_set(l->data, 1);
- else _state_set(l->data, 0);
- }
+ _state_set_all(wd);
}
}
else
static const char *
_elm_theme_group_file_find(const char *group)
{
- Eina_List *l;
+ const Eina_List *l;
+ const char *f;
char *p;
static const char *home = NULL;
const char *file = eina_hash_find(cache, group);
home = getenv("HOME");
if (!home) home = "";
}
- for (l = overlay; l; l = l->next)
+ EINA_LIST_FOREACH(overlay, l, f)
{
- file = _elm_theme_theme_element_try(home, l->data, group);
+ file = _elm_theme_theme_element_try(home, f, group);
if (file) return file;
}
- for (l = themes; l; l = l->next)
+ EINA_LIST_FOREACH(themes, l, f)
{
- file = _elm_theme_theme_element_try(home, l->data, group);
+ file = _elm_theme_theme_element_try(home, f, group);
if (file) return file;
}
- for (l = extension; l; l = l->next)
+ EINA_LIST_FOREACH(extension, l, f)
{
- file = _elm_theme_theme_element_try(home, l->data, group);
+ file = _elm_theme_theme_element_try(home, f, group);
if (file) return file;
}
return NULL;
Elm_Toolbar_Item *it2;
Widget_Data *wd = elm_widget_data_get(it->obj);
Evas_Object *obj2;
- Eina_List *l;
+ const Eina_List *l;
if (it->selected) return;
- for (l = wd->items; l; l = l->next)
+ EINA_LIST_FOREACH(wd->items, l, it2)
{
- it2 = l->data;
if (it2->selected)
{
it2->selected = 0;
_theme_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
- Eina_List *l;
+ const Eina_List *l;
Elm_Toolbar_Item *it;
Evas_Coord mw, mh;
- for (l = wd->items; l; l = l->next)
+ EINA_LIST_FOREACH(wd->items, l, it)
{
- it = l->data;
if (it->selected)
edje_object_signal_emit(it->base, "elm,state,selected", "elm");
_elm_theme_set(it->base, "toolbar", "item", "default");
{
Widget_Data *wd = elm_widget_data_get(data);
Evas_Coord mw, mh, vw, vh, w, h;
- Eina_List *l;
+ const Eina_List *l;
Elm_Toolbar_Item *it;
elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
{
if (w != vw) evas_object_resize(wd->bx, vw, h);
}
- for (l = wd->items; l; l = l->next)
+ EINA_LIST_FOREACH(wd->items, l, it)
{
- it = l->data;
if (it->selected)
{
_item_show(it);
EAPI void
elm_widget_theme(Evas_Object *obj)
{
- Eina_List *l;
-
+ const Eina_List *l;
+ Evas_Object *child;
+
API_ENTRY return;
- for (l = sd->subobjs; l; l = l->next) elm_widget_theme(l->data);
+ EINA_LIST_FOREACH(sd->subobjs, l, child)
+ elm_widget_theme(child);
if (sd->resize_obj) elm_widget_theme(sd->resize_obj);
if (sd->hover_obj) elm_widget_theme(sd->hover_obj);
if (sd->theme_func) sd->theme_func(obj);
/* its some container */
else
{
- Eina_List *l;
int focus_next;
int noloop = 0;
}
if (!noloop)
{
- for (l = sd->subobjs; l; l = l->next)
+ const Eina_List *l;
+ Evas_Object *child;
+ EINA_LIST_FOREACH(sd->subobjs, l, child)
{
- if (elm_widget_can_focus_get(l->data))
+ if (elm_widget_can_focus_get(child))
{
if ((focus_next) &&
- (!elm_widget_disabled_get(l->data)))
+ (!elm_widget_disabled_get(child)))
{
/* the previous focused item was unfocused - so focus
* the next one (that can be focused) */
- if (elm_widget_focus_jump(l->data, forward)) return 1;
+ if (elm_widget_focus_jump(child, forward)) return 1;
else break;
}
else
{
- if (elm_widget_focus_get(l->data))
+ if (elm_widget_focus_get(child))
{
/* jump to the next focused item or focus this item */
- if (elm_widget_focus_jump(l->data, forward)) return 1;
+ if (elm_widget_focus_jump(child, forward)) return 1;
/* it returned 0 - it got to the last item and is past it */
focus_next = 1;
}
}
else
{
- for (l = eina_list_last(sd->subobjs); l; l = l->prev)
+ const Eina_List *l;
+ Evas_Object *child;
+
+ EINA_LIST_REVERSE_FOREACH(sd->subobjs, l, child)
{
- if (elm_widget_can_focus_get(l->data))
+ if (elm_widget_can_focus_get(child))
{
if ((focus_next) &&
- (!elm_widget_disabled_get(l->data)))
+ (!elm_widget_disabled_get(child)))
{
/* the previous focused item was unfocused - so focus
* the next one (that can be focused) */
- if (elm_widget_focus_jump(l->data, forward)) return 1;
+ if (elm_widget_focus_jump(child, forward)) return 1;
else break;
}
else
{
- if (elm_widget_focus_get(l->data))
+ if (elm_widget_focus_get(child))
{
/* jump to the next focused item or focus this item */
- if (elm_widget_focus_jump(l->data, forward)) return 1;
+ if (elm_widget_focus_jump(child, forward)) return 1;
/* it returned 0 - it got to the last item and is past it */
focus_next = 1;
}
}
else
{
- Eina_List *l;
-
if (first)
{
if ((elm_widget_can_focus_get(sd->resize_obj)) &&
}
else
{
- for (l = sd->subobjs; l; l = l->next)
+ const Eina_List *l;
+ Evas_Object *child;
+ EINA_LIST_FOREACH(sd->subobjs, l, child)
{
- if ((elm_widget_can_focus_get(l->data)) &&
- (!elm_widget_disabled_get(l->data)))
+ if ((elm_widget_can_focus_get(child)) &&
+ (!elm_widget_disabled_get(child)))
{
- elm_widget_focus_set(l->data, first);
+ elm_widget_focus_set(child, first);
break;
}
}
}
else
{
- for (l = eina_list_last(sd->subobjs); l; l = l->prev)
+ const Eina_List *l;
+ Evas_Object *child;
+ EINA_LIST_REVERSE_FOREACH(sd->subobjs, l, child)
{
- if ((elm_widget_can_focus_get(l->data)) &&
- (!elm_widget_disabled_get(l->data)))
+ if ((elm_widget_can_focus_get(child)) &&
+ (!elm_widget_disabled_get(child)))
{
- elm_widget_focus_set(l->data, first);
+ elm_widget_focus_set(child, first);
break;
}
}
EAPI void
elm_widget_focused_object_clear(Evas_Object *obj)
{
- Eina_List *l;
API_ENTRY return;
if (!sd->focused) return;
if (elm_widget_focus_get(sd->resize_obj))
}
else
{
- for (l = sd->subobjs; l; l = l->next)
- {
- if (elm_widget_focus_get(l->data))
+ const Eina_List *l;
+ Evas_Object *child;
+ EINA_LIST_FOREACH(sd->subobjs, l, child)
+ {
+ if (elm_widget_focus_get(child))
{
- elm_widget_focused_object_clear(l->data);
+ elm_widget_focused_object_clear(child);
break;
}
}
elm_widget_focused_object_clear(parent);
else
{
- Eina_List *l;
parent = elm_widget_parent_get(parent);
sd = evas_object_smart_data_get(parent);
if (elm_widget_focus_get(sd->resize_obj))
elm_widget_focused_object_clear(sd->resize_obj);
else
{
- for (l = sd->subobjs; l; l = l->next)
+ const Eina_List *l;
+ Evas_Object *child;
+ EINA_LIST_FOREACH(sd->subobjs, l, child)
{
- if (elm_widget_focus_get(l->data))
+ if (elm_widget_focus_get(child))
{
- elm_widget_focused_object_clear(l->data);
+ elm_widget_focused_object_clear(child);
break;
}
}
_elm_win_resize_job(void *data)
{
Elm_Win *win = data;
- Eina_List *l;
+ const Eina_List *l;
+ Evas_Object *obj;
int w, h;
win->deferred_resize_job = NULL;
ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
evas_object_resize(win->win_obj, w, h);
- for (l = win->subobjs; l; l = l->next)
+ EINA_LIST_FOREACH(win->subobjs, l, obj)
{
- evas_object_move(l->data, 0, 0);
- evas_object_resize(l->data, w, h);
+ evas_object_move(obj, 0, 0);
+ evas_object_resize(obj, w, h);
}
}
static void
_elm_win_eval_subobjs(Evas_Object *obj)
{
- Eina_List *l;
+ const Eina_List *l;
+ const Evas_Object *child;
Elm_Win *win = elm_widget_data_get(obj);
Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
int xx = 1, xy = 1;
double wx, wy;
- for (l = win->subobjs; l; l = l->next)
+ EINA_LIST_FOREACH(win->subobjs, l, child)
{
- evas_object_size_hint_weight_get(l->data, &wx, &wy);
+ evas_object_size_hint_weight_get(child, &wx, &wy);
if (wx == 0.0) xx = 0;
if (wy == 0.0) xy = 0;
- evas_object_size_hint_min_get(l->data, &w, &h);
+ evas_object_size_hint_min_get(child, &w, &h);
if (w < 1) w = -1;
if (h < 1) h = -1;
if (w > minw) minw = w;
if (h > minh) minh = h;
- evas_object_size_hint_max_get(l->data, &w, &h);
+ evas_object_size_hint_max_get(child, &w, &h);
if (w < 1) w = -1;
if (h < 1) h = -1;
if (maxw == -1) maxw = w;
void
_elm_win_rescale(void)
{
- Eina_List *l;
-
- for (l = _elm_win_list; l; l = l->next) elm_widget_theme(l->data);
+ const Eina_List *l;
+ Evas_Object *obj;
+ EINA_LIST_FOREACH(_elm_win_list, l, obj)
+ elm_widget_theme(obj);
}
EAPI Evas_Object *
elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
{
Elm_Win *win;
- Eina_List *l;
+ const Eina_List *l;
+ const char *fontpath;
win = ELM_NEW(Elm_Win);
switch (_elm_config->engine)
ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
evas_image_cache_set(win->evas, _elm_config->image_cache * 1024);
evas_font_cache_set(win->evas, _elm_config->font_cache * 1024);
- for (l = _elm_config->font_dirs; l; l = l->next)
- evas_font_path_append(win->evas, l->data);
+ EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
+ evas_font_path_append(win->evas, fontpath);
if (_elm_config->font_hinting == 0)
evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
else if (_elm_config->font_hinting == 1)
return eina_list_count(sd->items) - 1;
}
+static int
+_els_smart_box_find(const Smart_Data *sd, const Evas_Object *child)
+{
+ int i = 0;
+ const Eina_List *l;
+ const Evas_Object *oitr;
+ EINA_LIST_FOREACH(sd->items, l, oitr)
+ {
+ if (oitr == child)
+ return i;
+ i++;
+ }
+ return -1;
+}
+
int
_els_smart_box_pack_before(Evas_Object *obj, Evas_Object *child, Evas_Object *before)
{
Smart_Data *sd;
- int i = 0;
- Eina_List *l;
-
+
if (!child) return 0;
sd = evas_object_smart_data_get(obj);
if (!sd) return 0;
_smart_adopt(sd, child);
sd->items = eina_list_prepend_relative(sd->items, child, before);
- for (i = 0, l = sd->items; l; l = l->next, i++)
- {
- if (l->data == child) break;
- }
_smart_reconfigure(sd);
- return i;
+
+ return _els_smart_box_find(sd, child);
}
int
_els_smart_box_pack_after(Evas_Object *obj, Evas_Object *child, Evas_Object *after)
{
Smart_Data *sd;
- int i = 0;
- Eina_List *l;
-
+
if (!child) return 0;
sd = evas_object_smart_data_get(obj);
if (!sd) return 0;
_smart_adopt(sd, child);
sd->items = eina_list_append_relative(sd->items, child, after);
- for (i = 0, l = sd->items; l; l = l->next, i++)
- {
- if (l->data == child) break;
- }
_smart_reconfigure(sd);
- return i;
+ return _els_smart_box_find(sd, child);
}
void
_smart_reconfigure(Smart_Data *sd)
{
Evas_Coord x, y, w, h, xx, yy;
- Eina_List *l;
+ const Eina_List *l;
+ Evas_Object *obj;
Evas_Coord minw, minh, wdif, hdif, mnw, mnh, mxw, mxh;
int count, expand, fw, fh, xw, xh;
double ax, ay, wx, wy;
y = y + ((h - minh) * (1.0 - ay));
h = minh;
}
- for (l = sd->items; l; l = l->next)
+ EINA_LIST_FOREACH(sd->items, l, obj)
{
- evas_object_size_hint_weight_get(l->data, &wx, &wy);
+ evas_object_size_hint_weight_get(obj, &wx, &wy);
if (sd->horizontal)
{
if (wx > 0.0) expand++;
hdif = h - minh;
xx = x;
yy = y;
- for (l = sd->items; l; l = l->next)
+ EINA_LIST_FOREACH(sd->items, l, obj)
{
- Evas_Object *obj;
-
- obj = l->data;
- evas_object_size_hint_align_get(l->data, &ax, &ay);
- evas_object_size_hint_weight_get(l->data, &wx, &wy);
- evas_object_size_hint_min_get(l->data, &mnw, &mnh);
- evas_object_size_hint_max_get(l->data, &mxw, &mxh);
+ evas_object_size_hint_align_get(obj, &ax, &ay);
+ evas_object_size_hint_weight_get(obj, &wx, &wy);
+ evas_object_size_hint_min_get(obj, &mnw, &mnh);
+ evas_object_size_hint_max_get(obj, &mxw, &mxh);
fw = fh = 0;
xw = xh = 0;
if (ax == -1.0) {fw = 1; ax = 0.5;}
static void
_smart_extents_calculate(Smart_Data *sd)
{
- Eina_List *l;
Evas_Coord minw, minh, maxw, maxh, mnw, mnh;
/* FIXME: need to calc max */
maxh = -1;
if (sd->homogenous)
{
- for (l = sd->items; l; l = l->next)
+ const Eina_List *l;
+ const Evas_Object *obj;
+ EINA_LIST_FOREACH(sd->items, l, obj)
{
- evas_object_size_hint_min_get(l->data, &mnw, &mnh);
+ evas_object_size_hint_min_get(obj, &mnw, &mnh);
if (minh < mnh) minh = mnh;
if (minw < mnw) minw = mnw;
}
}
else
{
- for (l = sd->items; l; l = l->next)
+ const Eina_List *l;
+ const Evas_Object *obj;
+ EINA_LIST_FOREACH(sd->items, l, obj)
{
- evas_object_size_hint_min_get(l->data, &mnw, &mnh);
+ evas_object_size_hint_min_get(obj, &mnw, &mnh);
if (sd->horizontal)
{
if (minh < mnh) minh = mnh;
_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
{
Smart_Data *sd;
- Eina_List *l;
+ const Eina_List *l;
+ Evas_Object *child;
Evas_Coord dx, dy;
sd = evas_object_smart_data_get(obj);
dy = y - sd->y;
sd->x = x;
sd->y = y;
- for (l = sd->items; l; l = l->next)
+ EINA_LIST_FOREACH(sd->items, l, child)
{
Evas_Coord ox, oy;
-
- evas_object_geometry_get(l->data, &ox, &oy, NULL, NULL);
- evas_object_move(l->data, ox + dx, oy + dy);
+
+ evas_object_geometry_get(child, &ox, &oy, NULL, NULL);
+ evas_object_move(child, ox + dx, oy + dy);
}
}
_smart_reconfigure(Smart_Data *sd)
{
Evas_Coord x, y, w, h, xx, yy;
- Eina_List *l;
+ const Eina_List *l;
+ Evas_Object *obj;
Evas_Coord minw, minh;
int expandw, expandh;
double ax, ay;
y = y + ((h - minh) * (1.0 - ay));
h = minh;
}
- for (l = sd->items; l; l = l->next)
+ EINA_LIST_FOREACH(sd->items, l, obj)
{
Table_Item *ti;
- Evas_Object *obj;
int xw, xh;
double wx, wy;
-
- obj = l->data;
+
ti = evas_object_data_get(obj, "e_table_data");
- evas_object_size_hint_weight_get(l->data, &wx, &wy);
+ evas_object_size_hint_weight_get(obj, &wx, &wy);
xw = 0;
xh = 0;
if (wx > 0.0) xw = 1;
y = sd->y;
if (sd->homogenous)
{
- for (l = sd->items; l; l = l->next)
+ EINA_LIST_FOREACH(sd->items, l, obj)
{
Table_Item *ti;
- Evas_Object *obj;
Evas_Coord ww, hh, ow, oh;
Evas_Coord mxw, mxh;
int xw, xh;
double wx, wy;
-
- obj = l->data;
+
ti = evas_object_data_get(obj, "e_table_data");
-
+
xx = x + ((ti->col) * (w / (Evas_Coord)sd->size.cols));
yy = y + ((ti->row) * (h / (Evas_Coord)sd->size.rows));
ww = ((w / (Evas_Coord)sd->size.cols) * (ti->colspan));
hh = ((h / (Evas_Coord)sd->size.rows) * (ti->rowspan));
- evas_object_size_hint_min_get(l->data, &ow, &oh);
- evas_object_size_hint_max_get(l->data, &mxw, &mxh);
- evas_object_size_hint_weight_get(l->data, &wx, &wy);
- evas_object_size_hint_align_get(l->data, &ax, &ay);
+ evas_object_size_hint_min_get(obj, &ow, &oh);
+ evas_object_size_hint_max_get(obj, &mxw, &mxh);
+ evas_object_size_hint_weight_get(obj, &wx, &wy);
+ evas_object_size_hint_align_get(obj, &ax, &ay);
xw = 0;
xh = 0;
if (wx > 0.0) xw = 1;
else
{
int i, ex, tot, need, num, dif, left, nx;
- for (l = sd->items; l; l = l->next)
+ EINA_LIST_FOREACH(sd->items, l, obj)
{
Table_Item *ti;
- Evas_Object *obj;
-
- obj = l->data;
+
ti = evas_object_data_get(obj, "e_table_data");
if (sd->size.cols < (ti->col + ti->colspan))
sd->size.cols = ti->col + ti->colspan;
rows = calloc(sd->size.rows, sizeof(int));
colsx = calloc(sd->size.cols, sizeof(int));
rowsx = calloc(sd->size.rows, sizeof(int));
-
- for (l = sd->items; l; l = l->next)
+
+ EINA_LIST_FOREACH(sd->items, l, obj)
{
Table_Item *ti;
- Evas_Object *obj;
int xw, xh;
double wx, wy;
- obj = l->data;
ti = evas_object_data_get(obj, "e_table_data");
- evas_object_size_hint_weight_get(l->data, &wx, &wy);
+ evas_object_size_hint_weight_get(obj, &wx, &wy);
xw = 0;
xh = 0;
if (wx > 0.0) xw = 1;
for (i = ti->row; i < (ti->row + ti->rowspan); i++)
rowsx[i] |= xh;
}
-
- for (l = sd->items; l; l = l->next)
+
+ EINA_LIST_FOREACH(sd->items, l, obj)
{
Table_Item *ti;
- Evas_Object *obj;
Evas_Coord mnw, mnh, mxw, mxh;
int xw, xh;
double wx, wy;
-
- obj = l->data;
+
ti = evas_object_data_get(obj, "e_table_data");
-
- evas_object_size_hint_min_get(l->data, &mnw, &mnh);
- evas_object_size_hint_max_get(l->data, &mxw, &mxh);
- evas_object_size_hint_weight_get(l->data, &wx, &wy);
- evas_object_size_hint_align_get(l->data, &ax, &ay);
+
+ evas_object_size_hint_min_get(obj, &mnw, &mnh);
+ evas_object_size_hint_max_get(obj, &mxw, &mxh);
+ evas_object_size_hint_weight_get(obj, &wx, &wy);
+ evas_object_size_hint_align_get(obj, &ax, &ay);
xw = 0;
xh = 0;
if (wx > 0.0) xw = 1;
}
}
}
-
- for (l = sd->items; l; l = l->next)
+
+ EINA_LIST_FOREACH(sd->items, l, obj)
{
Table_Item *ti;
- Evas_Object *obj;
Evas_Coord ww, hh, ow, oh, i;
Evas_Coord mxw, mxh;
-
- obj = l->data;
+
ti = evas_object_data_get(obj, "e_table_data");
- evas_object_size_hint_min_get(l->data, &ow, &oh);
- evas_object_size_hint_max_get(l->data, &mxw, &mxh);
- evas_object_size_hint_align_get(l->data, &ax, &ay);
-
+ evas_object_size_hint_min_get(obj, &ow, &oh);
+ evas_object_size_hint_max_get(obj, &mxw, &mxh);
+ evas_object_size_hint_align_get(obj, &ax, &ay);
+
xx = x;
for (i = 0; i < ti->col; i++) xx += cols[i];
ww = 0;
static void
_smart_extents_calcuate(Smart_Data *sd)
{
- Eina_List *l;
Evas_Coord minw, minh, maxw, maxh;
minw = 0;
sd->size.rows = 0;
if (sd->homogenous)
{
- for (l = sd->items; l; l = l->next)
+ const Eina_List *l;
+ const Evas_Object *obj;
+ EINA_LIST_FOREACH(sd->items, l, obj)
{
Table_Item *ti;
- Evas_Object *obj;
int mw, mh;
Evas_Coord w, h;
-
- obj = l->data;
+
ti = evas_object_data_get(obj, "e_table_data");
if (sd->size.cols < (ti->col + ti->colspan))
sd->size.cols = ti->col + ti->colspan;
if (sd->size.rows < (ti->row + ti->rowspan))
sd->size.rows = ti->row + ti->rowspan;
- evas_object_size_hint_min_get(l->data, &w, &h);
+ evas_object_size_hint_min_get(obj, &w, &h);
mw = (w + (ti->colspan - 1)) / ti->colspan;
mh = (h + (ti->rowspan - 1)) / ti->rowspan;
if (minw < mw) minw = mw;
}
else
{
+ const Eina_List *l;
+ const Evas_Object *obj;
int i, ex, tot, need, num, dif, left, nx;
- for (l = sd->items; l; l = l->next)
+ EINA_LIST_FOREACH(sd->items, l, obj)
{
Table_Item *ti;
- Evas_Object *obj;
-
- obj = l->data;
- ti = evas_object_data_get(obj, "e_table_data");
+
+ ti = evas_object_data_get(obj, "e_table_data");
if (sd->size.cols < (ti->col + ti->colspan))
sd->size.cols = ti->col + ti->colspan;
if (sd->size.rows < (ti->row + ti->rowspan))
rows = calloc(sd->size.rows, sizeof(int));
colsx = calloc(sd->size.cols, sizeof(int));
rowsx = calloc(sd->size.rows, sizeof(int));
-
- for (l = sd->items; l; l = l->next)
+
+ EINA_LIST_FOREACH(sd->items, l, obj)
{
Table_Item *ti;
- Evas_Object *obj;
int xw, xh;
double wx, wy;
-
- obj = l->data;
+
ti = evas_object_data_get(obj, "e_table_data");
- evas_object_size_hint_weight_get(l->data, &wx, &wy);
+ evas_object_size_hint_weight_get(obj, &wx, &wy);
xw = 0;
xh = 0;
if (wx > 0.0) xw = 1;
for (i = ti->row; i < (ti->row + ti->rowspan); i++)
rowsx[i] |= xh;
}
-
- for (l = sd->items; l; l = l->next)
+
+ EINA_LIST_FOREACH(sd->items, l, obj)
{
Table_Item *ti;
- Evas_Object *obj;
Evas_Coord w, h;
-
- obj = l->data;
+
ti = evas_object_data_get(obj, "e_table_data");
- evas_object_size_hint_min_get(l->data, &w, &h);
-
+ evas_object_size_hint_min_get(obj, &w, &h);
+
/* handle horizontal */
ex = 0;
tot = 0;
_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
{
Smart_Data *sd;
- Eina_List *l;
+ const Eina_List *l;
+ Evas_Object *child;
Evas_Coord dx, dy;
sd = evas_object_smart_data_get(obj);
if (!sd) return;
dx = x - sd->x;
dy = y - sd->y;
- for (l = sd->items; l; l = l->next)
+ EINA_LIST_FOREACH(sd->items, l, child)
{
Evas_Coord ox, oy;
-
- evas_object_geometry_get(l->data, &ox, &oy, NULL, NULL);
- evas_object_move(l->data, ox + dx, oy + dy);
+
+ evas_object_geometry_get(child, &ox, &oy, NULL, NULL);
+ evas_object_move(child, ox + dx, oy + dy);
}
sd->x = x;
sd->y = y;