#include "els_scroller.h"
#include "elm_gen_common.h"
+// internally allocated
+#define CLASS_ALLOCATED 0x3a70f00f
+
/* --
* TODO:
* Handle non-homogeneous objects too.
struct Elm_Gen_Item_Type
{
Elm_Gen_Item *it;
- Ecore_Animator *item_moving_effect_timer;
+ Ecore_Animator *item_reorder_move_animator;
Evas_Coord gx, gy, ox, oy, tx, ty, rx, ry;
unsigned int moving_effect_start_time;
int prev_group;
Eina_Bool moving : 1;
};
-#if 0
-struct _Widget_Data
-{
- Eina_Inlist_Sorted_State *state;
- Evas_Object *obj; /* the gengrid object */
- Evas_Object *scr; /* a smart scroller object which is used internally in genlist */
- Evas_Object *pan_smart; /* "elm_genlist_pan" evas smart object. this is an extern pan of smart scroller(scr). */
- Eina_List *selected;
- Eina_List *group_items; /* list of groups index items */
- Eina_Inlist *items; /* inlist of all items */
- Elm_Gen_Item *reorder_it; /* item currently being repositioned */
- Elm_Gen_Item *last_selected_item;
- Pan *pan; /* pan_smart object's smart data */
- Ecore_Job *calc_job;
- int walking;
- int item_width, item_height;
- int group_item_width, group_item_height;
- int minw, minh;
- long count;
- Evas_Coord pan_x, pan_y;
- Eina_Bool reorder_mode : 1;
- Eina_Bool on_hold : 1;
- Eina_Bool multi : 1;
- Eina_Bool no_select : 1;
- Eina_Bool wasselected : 1;
- Eina_Bool always_select : 1;
- Eina_Bool clear_me : 1;
- Eina_Bool h_bounce : 1;
- Eina_Bool v_bounce : 1;
- Ecore_Cb del_cb, calc_cb, sizing_cb;
- Ecore_Cb clear_cb;
- ////////////////////////////////////
- double align_x, align_y;
-
- Evas_Coord old_pan_x, old_pan_y;
- Evas_Coord reorder_item_x, reorder_item_y;
- unsigned int nmax;
- long items_lost;
-
- int generation;
-
- Eina_Bool horizontal : 1;
- Eina_Bool longpressed : 1;
- Eina_Bool reorder_item_changed : 1;
- Eina_Bool move_effect_enabled : 1;
-};
-#endif
-
static const char *widtype = NULL;
static void _item_highlight(Elm_Gen_Item *it);
static void _item_unrealize_cb(Elm_Gen_Item *it);
static const char SIG_EDGE_LEFT[] = "edge,left";
static const char SIG_EDGE_RIGHT[] = "edge,right";
static const char SIG_MOVED[] = "moved";
+static const char SIG_INDEX_UPDATE[] = "index,update";
static const Evas_Smart_Cb_Description _signals[] = {
{SIG_ACTIVATED, ""},
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
if (elm_widget_disabled_get(obj)) return EINA_FALSE;
- Elm_Gen_Item *it = NULL;
+ Elm_Object_Item *it = NULL;
Evas_Coord x = 0;
Evas_Coord y = 0;
Evas_Coord step_x = 0;
elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
- if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")))
+ if ((!strcmp(ev->keyname, "Left")) ||
+ ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string)))
{
if ((wd->horizontal) &&
(((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
else
x -= step_x;
}
- else if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right")))
+ else if ((!strcmp(ev->keyname, "Right")) ||
+ ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string)))
{
if ((wd->horizontal) &&
(((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
else
x += step_x;
}
- else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
+ else if ((!strcmp(ev->keyname, "Up")) ||
+ ((!strcmp(ev->keyname, "KP_Up")) && (!ev->string)))
{
if ((wd->horizontal) &&
(((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
else
y -= step_y;
}
- else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
+ else if ((!strcmp(ev->keyname, "Down")) ||
+ ((!strcmp(ev->keyname, "KP_Down")) && (!ev->string)))
{
if ((wd->horizontal) &&
(((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
else
y += step_y;
}
- else if ((!strcmp(ev->keyname, "Home")) || (!strcmp(ev->keyname, "KP_Home")))
+ else if ((!strcmp(ev->keyname, "Home")) ||
+ ((!strcmp(ev->keyname, "KP_Home")) && (!ev->string)))
{
it = elm_gengrid_first_item_get(obj);
- elm_gengrid_item_bring_in(it);
+ elm_gengrid_item_bring_in(it, ELM_GENGRID_ITEM_SCROLLTO_IN);
+ elm_gengrid_item_selected_set(it, EINA_TRUE);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
return EINA_TRUE;
}
- else if ((!strcmp(ev->keyname, "End")) || (!strcmp(ev->keyname, "KP_End")))
+ else if ((!strcmp(ev->keyname, "End")) ||
+ ((!strcmp(ev->keyname, "KP_End")) && (!ev->string)))
{
it = elm_gengrid_last_item_get(obj);
- elm_gengrid_item_bring_in(it);
+ elm_gengrid_item_bring_in(it, ELM_GENGRID_ITEM_SCROLLTO_IN);
+ elm_gengrid_item_selected_set(it, EINA_TRUE);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
return EINA_TRUE;
}
- else if ((!strcmp(ev->keyname, "Prior")) || (!strcmp(ev->keyname, "KP_Prior")))
+ else if ((!strcmp(ev->keyname, "Prior")) ||
+ ((!strcmp(ev->keyname, "KP_Prior")) && (!ev->string)))
{
if (wd->horizontal)
{
y -= page_y;
}
}
- else if ((!strcmp(ev->keyname, "Next")) || (!strcmp(ev->keyname, "KP_Next")))
+ else if ((!strcmp(ev->keyname, "Next")) ||
+ ((!strcmp(ev->keyname, "KP_Next")) && (!ev->string)))
{
if (wd->horizontal)
{
{
if (!wd->selected) return EINA_FALSE;
while (wd->selected)
- elm_gengrid_item_selected_set(wd->selected->data, EINA_FALSE);
+ elm_gengrid_item_selected_set((Elm_Object_Item *) wd->selected->data,
+ EINA_FALSE);
return EINA_TRUE;
}
{
if (!wd->selected) return EINA_FALSE;
- Elm_Gen_Item *prev = elm_gengrid_item_prev_get(wd->last_selected_item);
+ Elm_Object_Item *prev =
+ elm_gengrid_item_prev_get(wd->last_selected_item);
if (!prev) return EINA_TRUE;
if (elm_gengrid_item_selected_get(prev))
{
elm_gengrid_item_selected_set(wd->last_selected_item, EINA_FALSE);
wd->last_selected_item = prev;
- elm_gengrid_item_show(wd->last_selected_item);
+ elm_gengrid_item_show(wd->last_selected_item, ELM_GENGRID_ITEM_SCROLLTO_IN);
}
else
{
elm_gengrid_item_selected_set(prev, EINA_TRUE);
- elm_gengrid_item_show(prev);
+ elm_gengrid_item_show(prev, ELM_GENGRID_ITEM_SCROLLTO_IN);
}
return EINA_TRUE;
{
if (!wd->selected) return EINA_FALSE;
- Elm_Gen_Item *next = elm_gengrid_item_next_get(wd->last_selected_item);
+ Elm_Object_Item *next =
+ elm_gengrid_item_next_get(wd->last_selected_item);
if (!next) return EINA_TRUE;
if (elm_gengrid_item_selected_get(next))
{
elm_gengrid_item_selected_set(wd->last_selected_item, EINA_FALSE);
wd->last_selected_item = next;
- elm_gengrid_item_show(wd->last_selected_item);
+ elm_gengrid_item_show(wd->last_selected_item, ELM_GENGRID_ITEM_SCROLLTO_IN);
}
else
{
elm_gengrid_item_selected_set(next, EINA_TRUE);
- elm_gengrid_item_show(next);
+ elm_gengrid_item_show(next, ELM_GENGRID_ITEM_SCROLLTO_IN);
}
return EINA_TRUE;
prev = ELM_GEN_ITEM_FROM_INLIST(wd->items->last);
while ((prev) && (prev->generation < wd->generation))
prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
- elm_gengrid_item_selected_set(prev, EINA_TRUE);
- elm_gengrid_item_show(prev);
+ elm_gengrid_item_selected_set((Elm_Object_Item *) prev, EINA_TRUE);
+ elm_gengrid_item_show((Elm_Object_Item *) prev, ELM_GENGRID_ITEM_SCROLLTO_IN);
return EINA_TRUE;
}
- else prev = elm_gengrid_item_prev_get(wd->last_selected_item);
+ else
+ prev = (Elm_Gen_Item *) elm_gengrid_item_prev_get(wd->last_selected_item);
if (!prev) return EINA_FALSE;
for (i = 1; i < wd->nmax; i++)
{
- Elm_Gen_Item *tmp = elm_gengrid_item_prev_get(prev);
+ Elm_Object_Item *tmp =
+ elm_gengrid_item_prev_get((Elm_Object_Item *) prev);
if (!tmp) return EINA_FALSE;
- prev = tmp;
+ prev = (Elm_Gen_Item *) tmp;
}
_deselect_all_items(wd);
- elm_gengrid_item_selected_set(prev, EINA_TRUE);
- elm_gengrid_item_show(prev);
+ elm_gengrid_item_selected_set((Elm_Object_Item *) prev, EINA_TRUE);
+ elm_gengrid_item_show((Elm_Object_Item *) prev, ELM_GENGRID_ITEM_SCROLLTO_IN);
return EINA_TRUE;
}
next = ELM_GEN_ITEM_FROM_INLIST(wd->items);
while ((next) && (next->generation < wd->generation))
next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
- elm_gengrid_item_selected_set(next, EINA_TRUE);
- elm_gengrid_item_show(next);
+ elm_gengrid_item_selected_set((Elm_Object_Item *) next, EINA_TRUE);
+ elm_gengrid_item_show((Elm_Object_Item *) next, ELM_GENGRID_ITEM_SCROLLTO_IN);
return EINA_TRUE;
}
- else next = elm_gengrid_item_next_get(wd->last_selected_item);
+ else
+ next = (Elm_Gen_Item *) elm_gengrid_item_next_get(wd->last_selected_item);
if (!next) return EINA_FALSE;
for (i = 1; i < wd->nmax; i++)
{
- Elm_Gen_Item *tmp = elm_gengrid_item_next_get(next);
+ Elm_Object_Item *tmp =
+ elm_gengrid_item_next_get((Elm_Object_Item *) next);
if (!tmp) return EINA_FALSE;
- next = tmp;
+ next = (Elm_Gen_Item *) tmp;
}
_deselect_all_items(wd);
- elm_gengrid_item_selected_set(next, EINA_TRUE);
- elm_gengrid_item_show(next);
+ elm_gengrid_item_selected_set((Elm_Object_Item *) next, EINA_TRUE);
+ elm_gengrid_item_show((Elm_Object_Item *) next, ELM_GENGRID_ITEM_SCROLLTO_IN);
return EINA_TRUE;
}
while ((prev) && (prev->generation < wd->generation))
prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
}
- else prev = elm_gengrid_item_prev_get(wd->last_selected_item);
+ else
+ prev = (Elm_Gen_Item *) elm_gengrid_item_prev_get(wd->last_selected_item);
if (!prev) return EINA_FALSE;
_deselect_all_items(wd);
- elm_gengrid_item_selected_set(prev, EINA_TRUE);
- elm_gengrid_item_show(prev);
+ elm_gengrid_item_selected_set((Elm_Object_Item *) prev, EINA_TRUE);
+ elm_gengrid_item_show((Elm_Object_Item *) prev, ELM_GENGRID_ITEM_SCROLLTO_IN);
return EINA_TRUE;
}
while ((next) && (next->generation < wd->generation))
next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
}
- else next = elm_gengrid_item_next_get(wd->last_selected_item);
+ else
+ next = (Elm_Gen_Item *) elm_gengrid_item_next_get(wd->last_selected_item);
if (!next) return EINA_FALSE;
_deselect_all_items(wd);
- elm_gengrid_item_selected_set(next, EINA_TRUE);
- elm_gengrid_item_show(next);
+ elm_gengrid_item_selected_set((Elm_Object_Item *) next, EINA_TRUE);
+ elm_gengrid_item_show((Elm_Object_Item *) next, ELM_GENGRID_ITEM_SCROLLTO_IN);
return EINA_TRUE;
}
while (it)
{
edje_object_mirrored_set(VIEW(it), rtl);
- elm_gengrid_item_update(it);
+ elm_gengrid_item_update((Elm_Object_Item *)it);
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
}
}
}
return;
}
- if (!it->display_only)
+ if (it->select_mode != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
x = ev->cur.canvas.x - x;
Elm_Gen_Item *it = data;
it->long_timer = NULL;
- if ((it->disabled) || (it->dragging)) return ECORE_CALLBACK_CANCEL;
+ if (elm_widget_item_disabled_get(it)|| (it->dragging))
+ return ECORE_CALLBACK_CANCEL;
it->wd->longpressed = EINA_TRUE;
evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, it);
if (it->wd->reorder_mode)
it->wd->longpressed = EINA_FALSE;
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
else it->wd->on_hold = EINA_FALSE;
+ if (it->wd->on_hold) return;
it->wd->wasselected = it->selected;
_item_highlight(it);
if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
if (it->want_unrealize)
_elm_genlist_item_unrealize(it, EINA_FALSE);
}
- if ((it->disabled) || (dragged)) return;
+ if (elm_widget_item_disabled_get(it) || (dragged)) return;
if (it->wd->multi)
{
if (!it->selected)
static void
_item_highlight(Elm_Gen_Item *it)
{
- if ((it->wd->no_select) || (it->generation < it->wd->generation) || (it->highlighted)) return;
+ if ((it->wd->select_mode == ELM_OBJECT_SELECT_MODE_NONE) ||
+ (!it->wd->highlight) || (it->highlighted) ||
+ (it->generation < it->wd->generation)) return;
edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
it->highlighted = EINA_TRUE;
}
static void
+_elm_gengrid_item_index_update(Elm_Gen_Item *it)
+{
+ if (it->position_update)
+ {
+ evas_object_smart_callback_call(WIDGET(it), SIG_INDEX_UPDATE, it);
+ it->position_update = EINA_FALSE;
+ }
+}
+
+static void
_item_realize(Elm_Gen_Item *it)
{
char buf[1024];
((void *)it->base.data, WIDGET(it), key);
if (s)
{
- edje_object_part_text_set(VIEW(it), key, s);
+ edje_object_part_text_escaped_set(VIEW(it), key, s);
free(s);
}
}
evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE,
_mouse_move, it);
+ _elm_gengrid_item_index_update(it);
+
if (it->selected)
edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
- if (it->disabled)
+ if (elm_widget_item_disabled_get(it))
edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm");
}
evas_object_show(VIEW(it));
}
static Eina_Bool
-_reorder_item_moving_effect_timer_cb(void *data)
+_reorder_item_move_animator_cb(void *data)
{
Elm_Gen_Item *it = data;
- double time, t;
+ double tt, t;
Evas_Coord dx, dy;
- time = REORDER_EFFECT_TIME;
+ tt = REORDER_EFFECT_TIME;
t = ((0.0 > (t = ecore_loop_time_get()-it->item->moving_effect_start_time)) ? 0.0 : t);
dx = ((it->item->tx - it->item->ox) / 10) * _elm_config->scale;
dy = ((it->item->ty - it->item->oy) / 10) * _elm_config->scale;
- if (t <= time)
+ if (t <= tt)
{
- it->item->rx += (1 * sin((t / time) * (M_PI / 2)) * dx);
- it->item->ry += (1 * sin((t / time) * (M_PI / 2)) * dy);
+ it->item->rx += (1 * sin((t / tt) * (M_PI / 2)) * dx);
+ it->item->ry += (1 * sin((t / tt) * (M_PI / 2)) * dy);
}
else
{
else
evas_object_resize(VIEW(it), it->wd->item_width, it->wd->item_height);
it->item->moving = EINA_FALSE;
- it->item->item_moving_effect_timer = NULL;
+ it->item->item_reorder_move_animator = NULL;
return ECORE_CALLBACK_CANCEL;
}
static void
_item_place(Elm_Gen_Item *it,
- Evas_Coord cx,
- Evas_Coord cy)
+ Evas_Coord cx,
+ Evas_Coord cy)
{
Evas_Coord x, y, ox, oy, cvx, cvy, cvw, cvh, iw, ih, ww;
Evas_Coord tch, tcw, alignw = 0, alignh = 0, vw, vh;
alignh = 0;
alignw = 0;
- items_count = it->wd->count - eina_list_count(it->wd->group_items) + it->wd->items_lost;
+ items_count = it->wd->item_count - eina_list_count(it->wd->group_items) + it->wd->items_lost;
if (it->wd->horizontal)
{
int columns, items_visible = 0, items_row;
alignw = (vw - tcw) * it->wd->align_x;
items_row = items_visible;
- if (items_row > it->wd->count)
- items_row = it->wd->count;
- tch = items_row * it->wd->item_height;
+ if ((unsigned int)items_row > it->wd->item_count)
+ items_row = it->wd->item_count;
+ if (it->wd->filled
+ && (unsigned int)it->wd->nmax > (unsigned int)it->wd->item_count)
+ tch = it->wd->nmax * it->wd->item_height;
+ else
+ tch = items_row * it->wd->item_height;
alignh = (vh - tch) * it->wd->align_y;
}
else
{
- int rows, items_visible = 0, items_col;
+ unsigned int rows, items_visible = 0, items_col;
if (it->wd->item_width > 0)
items_visible = vw / it->wd->item_width;
alignh = (vh - tch) * it->wd->align_y;
items_col = items_visible;
- if (items_col > it->wd->count)
- items_col = it->wd->count;
- tcw = items_col * it->wd->item_width;
+ if (items_col > it->wd->item_count)
+ items_col = it->wd->item_count;
+ if (it->wd->filled
+ && (unsigned int)it->wd->nmax > (unsigned int)it->wd->item_count)
+ tcw = it->wd->nmax * it->wd->item_width;
+ else
+ tcw = items_col * it->wd->item_width;
alignw = (vw - tcw) * it->wd->align_x;
}
it->item->ry = it->item->oy;
it->item->moving = EINA_TRUE;
it->item->moving_effect_start_time = ecore_loop_time_get();
- it->item->item_moving_effect_timer = ecore_animator_add(_reorder_item_moving_effect_timer_cb, it);
+ it->item->item_reorder_move_animator = ecore_animator_add(_reorder_item_move_animator_cb, it);
return;
}
}
}
}
}
- else if (it->item->item_moving_effect_timer)
+ else if (it->item->item_reorder_move_animator)
{
- ecore_animator_del(it->item->item_moving_effect_timer);
- it->item->item_moving_effect_timer = NULL;
+ ecore_animator_del(it->item->item_reorder_move_animator);
+ it->item->item_reorder_move_animator = NULL;
it->item->moving = EINA_FALSE;
}
}
}
static void
+_item_position_update(Eina_Inlist *list, int idx)
+{
+ Elm_Gen_Item *it;
+
+ EINA_INLIST_FOREACH(list, it)
+ {
+ it->position = idx++;
+ it->position_update = EINA_TRUE;
+ }
+}
+
+static void
_item_del(Elm_Gen_Item *it)
{
Evas_Object *obj = WIDGET(it);
evas_event_freeze(evas_object_evas_get(obj));
it->wd->selected = eina_list_remove(it->wd->selected, it);
if (it->realized) _elm_genlist_item_unrealize(it, EINA_FALSE);
- it->wd->count--;
_elm_genlist_item_del_serious(it);
+ elm_gengrid_item_class_unref((Elm_Gengrid_Item_Class *)it->itc);
evas_event_thaw(evas_object_evas_get(obj));
evas_event_thaw_eval(evas_object_evas_get(obj));
}
count++;
}
}
- count = wd->count + wd->items_lost - count_group;
+ count = wd->item_count + wd->items_lost - count_group;
if (wd->horizontal)
{
minw = (ceil(count / (float)nmax) * wd->item_width) + (count_group * wd->group_item_width);
Evas_Coord *y)
{
Pan *sd = evas_object_smart_data_get(obj);
- Evas_Coord mx, my;
+ Evas_Coord mx = 0, my = 0;
if (!sd) return;
_pan_max_get(obj, &mx, &my);
}
static void
-_hold_on(void *data __UNUSED__,
- Evas_Object *obj,
- void *event_info __UNUSED__)
+_hold_on(void *data __UNUSED__,
+ Evas_Object *obj,
+ void *event_info __UNUSED__)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
}
static void
-_hold_off(void *data __UNUSED__,
- Evas_Object *obj,
- void *event_info __UNUSED__)
+_hold_off(void *data __UNUSED__,
+ Evas_Object *obj,
+ void *event_info __UNUSED__)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
}
static void
-_freeze_on(void *data __UNUSED__,
- Evas_Object *obj,
- void *event_info __UNUSED__)
+_freeze_on(void *data __UNUSED__,
+ Evas_Object *obj,
+ void *event_info __UNUSED__)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
static void
_scr_anim_stop(void *data,
- Evas_Object *obj __UNUSED__,
- void *event_info __UNUSED__)
+ Evas_Object *obj __UNUSED__,
+ void *event_info __UNUSED__)
{
evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, NULL);
}
}
static int
-_elm_gengrid_item_compare_data(const void *data, const void *data1)
-{
- const Elm_Gen_Item *it = data;
- const Elm_Gen_Item *item1 = data1;
-
- return it->wd->item_compare_data_cb(it->base.data, item1->base.data);
-}
-
-static int
_elm_gengrid_item_compare(const void *data, const void *data1)
{
Elm_Gen_Item *it, *item1;
return it->wd->item_compare_cb(it, item1);
}
+static void
+_item_disable_hook(Elm_Object_Item *it)
+{
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+
+ if (_it->generation < _it->wd->generation) return;
+
+ if (_it->realized)
+ {
+ if (elm_widget_item_disabled_get(_it))
+ edje_object_signal_emit(VIEW(_it), "elm,state,disabled", "elm");
+ else
+ edje_object_signal_emit(VIEW(_it), "elm,state,enabled", "elm");
+ }
+}
+
+static void
+_item_del_pre_hook(Elm_Object_Item *it)
+{
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+ if ((_it->relcount > 0) || (_it->walking > 0))
+ {
+ _elm_genlist_item_del_notserious(_it);
+ return;
+ }
+
+ _item_del(_it);
+}
+
static Elm_Gen_Item *
_item_new(Widget_Data *wd,
const Elm_Gengrid_Item_Class *itc,
it = _elm_genlist_item_new(wd, itc, data, NULL, func, func_data);
if (!it) return NULL;
+ elm_widget_item_disable_hook_set(it, _item_disable_hook);
+ elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook);
+ elm_gengrid_item_class_ref((Elm_Gengrid_Item_Class *)itc);
it->item = ELM_NEW(Elm_Gen_Item_Type);
- wd->count++;
+ wd->item_count++;
it->group = it->itc->item_style && (!strcmp(it->itc->item_style, "group_index"));
ELM_GEN_ITEM_SETUP(it);
elm_smart_scroller_object_theme_set(obj, wd->scr, "gengrid", "base",
"default");
elm_smart_scroller_bounce_allow_set(wd->scr, bounce,
- _elm_config->thumbscroll_bounce_enable);
+ _elm_config->thumbscroll_bounce_enable);
elm_widget_resize_object_set(obj, wd->scr);
evas_object_smart_callback_add(wd->scr, "animate,start", _scr_anim_start, obj);
wd->align_y = 0.5;
wd->h_bounce = bounce;
wd->v_bounce = bounce;
+ wd->highlight = EINA_TRUE;
evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
EAPI void
elm_gengrid_group_item_size_set(Evas_Object *obj,
- Evas_Coord w,
- Evas_Coord h)
+ Evas_Coord w,
+ Evas_Coord h)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
EAPI void
elm_gengrid_group_item_size_get(const Evas_Object *obj,
- Evas_Coord *w,
- Evas_Coord *h)
+ Evas_Coord *w,
+ Evas_Coord *h)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (align_y) *align_y = wd->align_y;
}
-EAPI Elm_Gen_Item *
+EAPI Elm_Object_Item *
elm_gengrid_item_append(Evas_Object *obj,
const Elm_Gengrid_Item_Class *itc,
const void *data,
it = _item_new(wd, itc, data, func, func_data);
if (!it) return NULL;
wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
+ it->position = eina_inlist_count(wd->items);
+ it->position_update = EINA_TRUE;
if (it->group)
wd->group_items = eina_list_prepend(wd->group_items, it);
if (wd->calc_job) ecore_job_del(wd->calc_job);
wd->calc_job = ecore_job_add(_calc_job, wd);
- return it;
+ return (Elm_Object_Item *)it;
}
-EAPI Elm_Gen_Item *
+EAPI Elm_Object_Item *
elm_gengrid_item_prepend(Evas_Object *obj,
const Elm_Gengrid_Item_Class *itc,
const void *data,
it = _item_new(wd, itc, data, func, func_data);
if (!it) return NULL;
wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it));
+ _item_position_update(wd->items, 0);
+
if (it->group)
wd->group_items = eina_list_append(wd->group_items, it);
if (wd->calc_job) ecore_job_del(wd->calc_job);
wd->calc_job = ecore_job_add(_calc_job, wd);
- return it;
+ return (Elm_Object_Item *)it;
}
-EAPI Elm_Gen_Item *
+EAPI Elm_Object_Item *
elm_gengrid_item_insert_before(Evas_Object *obj,
const Elm_Gengrid_Item_Class *itc,
const void *data,
- Elm_Gen_Item *relative,
+ Elm_Object_Item *relative,
Evas_Smart_Cb func,
const void *func_data)
{
Elm_Gen_Item *it;
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- EINA_SAFETY_ON_NULL_RETURN_VAL(relative, NULL);
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(relative, NULL);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return NULL;
it = _item_new(wd, itc, data, func, func_data);
if (!it) return NULL;
wd->items = eina_inlist_prepend_relative
- (wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(relative));
+ (wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET((Elm_Gen_Item *) relative));
+ Eina_Inlist *tmp = eina_inlist_find(wd->items, EINA_INLIST_GET(it));
+ _item_position_update(tmp, ((Elm_Gen_Item *)relative)->position);
+
if (it->group)
- wd->group_items = eina_list_append_relative(wd->group_items, it, relative->parent);
+ wd->group_items = eina_list_append_relative(wd->group_items, it, ((Elm_Gen_Item *) relative)->parent);
if (wd->calc_job) ecore_job_del(wd->calc_job);
wd->calc_job = ecore_job_add(_calc_job, wd);
- return it;
+ return (Elm_Object_Item *)it;
}
-EAPI Elm_Gen_Item *
+EAPI Elm_Object_Item *
elm_gengrid_item_insert_after(Evas_Object *obj,
const Elm_Gengrid_Item_Class *itc,
const void *data,
- Elm_Gen_Item *relative,
+ Elm_Object_Item *relative,
Evas_Smart_Cb func,
const void *func_data)
{
Elm_Gen_Item *it;
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- EINA_SAFETY_ON_NULL_RETURN_VAL(relative, NULL);
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(relative, NULL);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return NULL;
it = _item_new(wd, itc, data, func, func_data);
if (!it) return NULL;
wd->items = eina_inlist_append_relative
- (wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(relative));
+ (wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET((Elm_Gen_Item *) relative));
+ Eina_Inlist *tmp = eina_inlist_find(wd->items, EINA_INLIST_GET(it));
+ _item_position_update(tmp, ((Elm_Gen_Item *)relative)->position+1);
+
if (it->group)
- wd->group_items = eina_list_prepend_relative(wd->group_items, it, relative->parent);
+ wd->group_items = eina_list_prepend_relative(wd->group_items, it, ((Elm_Gen_Item *) relative)->parent);
if (wd->calc_job) ecore_job_del(wd->calc_job);
wd->calc_job = ecore_job_add(_calc_job, wd);
- return it;
+ return (Elm_Object_Item *)it;
}
-EAPI Elm_Gen_Item *
-elm_gengrid_item_direct_sorted_insert(Evas_Object *obj,
- const Elm_Gengrid_Item_Class *itc,
- const void *data,
- Eina_Compare_Cb comp,
- Evas_Smart_Cb func,
- const void *func_data)
+EAPI Elm_Object_Item *
+elm_gengrid_item_sorted_insert(Evas_Object *obj,
+ const Elm_Gengrid_Item_Class *itc,
+ const void *data,
+ Eina_Compare_Cb comp,
+ Evas_Smart_Cb func,
+ const void *func_data)
{
Elm_Gen_Item *it;
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
wd->item_compare_cb = comp;
wd->items = eina_inlist_sorted_state_insert(wd->items, EINA_INLIST_GET(it),
_elm_gengrid_item_compare, wd->state);
+ _item_position_update(wd->items, 0);
+
if (wd->calc_job) ecore_job_del(wd->calc_job);
wd->calc_job = ecore_job_add(_calc_job, wd);
- return it;
-}
-
-EAPI Elm_Gen_Item *
-elm_gengrid_item_sorted_insert(Evas_Object *obj,
- const Elm_Gengrid_Item_Class *itc,
- const void *data,
- Eina_Compare_Cb comp,
- Evas_Smart_Cb func,
- const void *func_data)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- wd->item_compare_data_cb = comp;
-
- return elm_gengrid_item_direct_sorted_insert(obj, itc, data, _elm_gengrid_item_compare_data, func, func_data);
-}
-
-EAPI void
-elm_gengrid_item_del(Elm_Gen_Item *it)
-{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- if ((it->relcount > 0) || (it->walking > 0))
- {
- _elm_genlist_item_del_notserious(it);
- return;
- }
-
- _item_del(it);
+ return (Elm_Object_Item *)it;
}
EAPI void
elm_gengrid_horizontal_set(Evas_Object *obj,
- Eina_Bool setting)
+ Eina_Bool horizontal)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (setting == wd->horizontal) return;
- wd->horizontal = setting;
+ horizontal = !!horizontal;
+ if (horizontal == wd->horizontal) return;
+ wd->horizontal = horizontal;
/* Update the items to conform to the new layout */
if (wd->calc_job) ecore_job_del(wd->calc_job);
elm_genlist_clear(obj);
}
-EAPI const Evas_Object *
-elm_gengrid_item_object_get(const Elm_Gen_Item *it)
+EINA_DEPRECATED EAPI const Evas_Object *
+elm_gengrid_item_object_get(const Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
return VIEW(it);
}
EAPI void
-elm_gengrid_item_update(Elm_Gen_Item *it)
-{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- if (!it->realized) return;
- if (it->want_unrealize) return;
- _elm_genlist_item_unrealize(it, EINA_FALSE);
- _item_realize(it);
- _item_place(it, it->x, it->y);
-}
-
-EAPI void *
-elm_gengrid_item_data_get(const Elm_Gen_Item *it)
-{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
- return elm_widget_item_data_get(it);
-}
-
-EAPI void
-elm_gengrid_item_data_set(Elm_Gen_Item *it,
- const void *data)
+elm_gengrid_item_update(Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- elm_widget_item_data_set(it, data);
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+ if (!_it->realized) return;
+ if (_it->want_unrealize) return;
+ _elm_genlist_item_unrealize(_it, EINA_FALSE);
+ _item_realize(_it);
+ _item_place(_it, _it->x, _it->y);
}
EAPI const Elm_Gengrid_Item_Class *
-elm_gengrid_item_item_class_get(const Elm_Gen_Item *it)
+elm_gengrid_item_item_class_get(const Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
- if (it->generation < it->wd->generation) return NULL;
- return it->itc;
+ return (Elm_Gengrid_Item_Class *)elm_genlist_item_item_class_get(it);
}
EAPI void
-elm_gengrid_item_item_class_set(Elm_Gen_Item *it,
- const Elm_Gengrid_Item_Class *itc)
+elm_gengrid_item_item_class_update(Elm_Object_Item *it,
+ const Elm_Gengrid_Item_Class *itc)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
EINA_SAFETY_ON_NULL_RETURN(itc);
- if (it->generation < it->wd->generation) return;
- it->itc = itc;
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+ if (_it->generation < _it->wd->generation) return;
+ _it->itc = itc;
elm_gengrid_item_update(it);
}
EAPI void
-elm_gengrid_item_pos_get(const Elm_Gen_Item *it,
+elm_gengrid_item_pos_get(const Elm_Object_Item *it,
unsigned int *x,
unsigned int *y)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- if (x) *x = it->x;
- if (y) *y = it->y;
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ if (x) *x = ((Elm_Gen_Item *)it)->x;
+ if (y) *y = ((Elm_Gen_Item *)it)->y;
}
EAPI void
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- wd->multi = multi;
+ wd->multi = !!multi;
}
EAPI Eina_Bool
return wd->multi;
}
-EAPI Elm_Gen_Item *
+EAPI Elm_Object_Item *
elm_gengrid_selected_item_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
EAPI const Eina_List *
elm_gengrid_selected_items_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->selected;
+ return elm_genlist_selected_items_get(obj);
}
EAPI void
-elm_gengrid_item_selected_set(Elm_Gen_Item *it,
+elm_gengrid_item_selected_set(Elm_Object_Item *it,
Eina_Bool selected)
{
elm_genlist_item_selected_set(it, selected);
}
EAPI Eina_Bool
-elm_gengrid_item_selected_get(const Elm_Gen_Item *it)
+elm_gengrid_item_selected_get(const Elm_Object_Item *it)
{
return elm_genlist_item_selected_get(it);
}
-EAPI void
-elm_gengrid_item_disabled_set(Elm_Gen_Item *it,
- Eina_Bool disabled)
+EAPI Eina_List *
+elm_gengrid_realized_items_get(const Evas_Object *obj)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- if (it->disabled == disabled) return;
- if (it->generation < it->wd->generation) return;
- it->disabled = !!disabled;
- if (it->realized)
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Eina_List *list = NULL;
+ Elm_Gen_Item *it;
+
+ EINA_INLIST_FOREACH(wd->items, it)
{
- if (it->disabled)
- edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm");
- else
- edje_object_signal_emit(VIEW(it), "elm,state,enabled", "elm");
+ if (it->realized) list = eina_list_append(list, (Elm_Object_Item *)it);
}
+ return list;
}
-EAPI Eina_Bool
-elm_gengrid_item_disabled_get(const Elm_Gen_Item *it)
+EAPI void
+elm_gengrid_realized_items_update(Evas_Object *obj)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
- if (it->generation < it->wd->generation) return EINA_FALSE;
- return it->disabled;
+ ELM_CHECK_WIDTYPE(obj, widtype);
+
+ Eina_List *list, *l;
+ Elm_Object_Item *it;
+
+ list = elm_gengrid_realized_items_get(obj);
+ EINA_LIST_FOREACH(list, l, it)
+ elm_gengrid_item_update(it);
}
static Evas_Object *
}
EAPI void
-elm_gengrid_item_tooltip_text_set(Elm_Gen_Item *it,
+elm_gengrid_item_tooltip_text_set(Elm_Object_Item *it,
const char *text)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
text = eina_stringshare_add(text);
elm_gengrid_item_tooltip_content_cb_set(it, _elm_gengrid_item_label_create,
text,
}
EAPI void
-elm_gengrid_item_tooltip_content_cb_set(Elm_Gen_Item *it,
+elm_gengrid_item_tooltip_content_cb_set(Elm_Object_Item *it,
Elm_Tooltip_Item_Content_Cb func,
const void *data,
Evas_Smart_Cb del_cb)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(it, error);
+ ELM_OBJ_ITEM_CHECK_OR_GOTO(it, error);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
- if ((it->tooltip.content_cb == func) && (it->tooltip.data == data))
+ if ((_it->tooltip.content_cb == func) && (_it->tooltip.data == data))
return;
- if (it->tooltip.del_cb)
- it->tooltip.del_cb((void *)it->tooltip.data,
- WIDGET(it), it);
- it->tooltip.content_cb = func;
- it->tooltip.data = data;
- it->tooltip.del_cb = del_cb;
- if (VIEW(it))
+ if (_it->tooltip.del_cb)
+ _it->tooltip.del_cb((void *)_it->tooltip.data, WIDGET(_it), _it);
+ _it->tooltip.content_cb = func;
+ _it->tooltip.data = data;
+ _it->tooltip.del_cb = del_cb;
+ if (VIEW(_it))
{
- elm_widget_item_tooltip_content_cb_set(it,
- it->tooltip.content_cb,
- it->tooltip.data, NULL);
- elm_widget_item_tooltip_style_set(it, it->tooltip.style);
- elm_widget_item_tooltip_window_mode_set(it, it->tooltip.free_size);
+ elm_widget_item_tooltip_content_cb_set(_it,
+ _it->tooltip.content_cb,
+ _it->tooltip.data, NULL);
+ elm_widget_item_tooltip_style_set(_it, _it->tooltip.style);
+ elm_widget_item_tooltip_window_mode_set(_it, _it->tooltip.free_size);
}
return;
}
EAPI void
-elm_gengrid_item_tooltip_unset(Elm_Gen_Item *it)
-{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- if ((VIEW(it)) && (it->tooltip.content_cb))
- elm_widget_item_tooltip_unset(it);
-
- if (it->tooltip.del_cb)
- it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
- it->tooltip.del_cb = NULL;
- it->tooltip.content_cb = NULL;
- it->tooltip.data = NULL;
- it->tooltip.free_size = EINA_FALSE;
- if (it->tooltip.style)
+elm_gengrid_item_tooltip_unset(Elm_Object_Item *it)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+
+ if ((VIEW(_it)) && (_it->tooltip.content_cb))
+ elm_widget_item_tooltip_unset(_it);
+
+ if (_it->tooltip.del_cb)
+ _it->tooltip.del_cb((void *) _it->tooltip.data, WIDGET(_it), _it);
+ _it->tooltip.del_cb = NULL;
+ _it->tooltip.content_cb = NULL;
+ _it->tooltip.data = NULL;
+ _it->tooltip.free_size = EINA_FALSE;
+ if (_it->tooltip.style)
elm_gengrid_item_tooltip_style_set(it, NULL);
}
EAPI void
-elm_gengrid_item_tooltip_style_set(Elm_Gen_Item *it,
+elm_gengrid_item_tooltip_style_set(Elm_Object_Item *it,
const char *style)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- eina_stringshare_replace(&it->tooltip.style, style);
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ eina_stringshare_replace(&((Elm_Gen_Item *)it)->tooltip.style, style);
if (VIEW(it)) elm_widget_item_tooltip_style_set(it, style);
}
EAPI const char *
-elm_gengrid_item_tooltip_style_get(const Elm_Gen_Item *it)
+elm_gengrid_item_tooltip_style_get(const Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
- return it->tooltip.style;
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
+ return ((Elm_Gen_Item *)it)->tooltip.style;
}
EAPI Eina_Bool
-elm_gengrid_item_tooltip_window_mode_set(Elm_Gen_Item *it, Eina_Bool disable)
+elm_gengrid_item_tooltip_window_mode_set(Elm_Object_Item *it, Eina_Bool disable)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
- it->tooltip.free_size = disable;
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
+ ((Elm_Gen_Item *)it)->tooltip.free_size = disable;
if (VIEW(it)) return elm_widget_item_tooltip_window_mode_set(it, disable);
return EINA_TRUE;
}
EAPI Eina_Bool
-elm_gengrid_item_tooltip_window_mode_get(const Elm_Gen_Item *it)
+elm_gengrid_item_tooltip_window_mode_get(const Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
- return it->tooltip.free_size;
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
+ return ((Elm_Gen_Item *)it)->tooltip.free_size;
}
EAPI void
-elm_gengrid_item_cursor_set(Elm_Gen_Item *it,
+elm_gengrid_item_cursor_set(Elm_Object_Item *it,
const char *cursor)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- eina_stringshare_replace(&it->mouse_cursor, cursor);
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ eina_stringshare_replace(&((Elm_Gen_Item *)it)->mouse_cursor, cursor);
if (VIEW(it)) elm_widget_item_cursor_set(it, cursor);
}
EAPI const char *
-elm_gengrid_item_cursor_get(const Elm_Gen_Item *it)
+elm_gengrid_item_cursor_get(const Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
return elm_widget_item_cursor_get(it);
}
EAPI void
-elm_gengrid_item_cursor_unset(Elm_Gen_Item *it)
+elm_gengrid_item_cursor_unset(Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- if (!it->mouse_cursor)
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+ if (!_it->mouse_cursor)
return;
- if (VIEW(it))
- elm_widget_item_cursor_unset(it);
+ if (VIEW(_it))
+ elm_widget_item_cursor_unset(_it);
- eina_stringshare_del(it->mouse_cursor);
- it->mouse_cursor = NULL;
+ eina_stringshare_del(_it->mouse_cursor);
+ _it->mouse_cursor = NULL;
}
EAPI void
-elm_gengrid_item_cursor_style_set(Elm_Gen_Item *it,
+elm_gengrid_item_cursor_style_set(Elm_Object_Item *it,
const char *style)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
elm_widget_item_cursor_style_set(it, style);
}
EAPI const char *
-elm_gengrid_item_cursor_style_get(const Elm_Gen_Item *it)
+elm_gengrid_item_cursor_style_get(const Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
return elm_widget_item_cursor_style_get(it);
}
EAPI void
-elm_gengrid_item_cursor_engine_only_set(Elm_Gen_Item *it,
+elm_gengrid_item_cursor_engine_only_set(Elm_Object_Item *it,
Eina_Bool engine_only)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
elm_widget_item_cursor_engine_only_set(it, engine_only);
}
EAPI Eina_Bool
-elm_gengrid_item_cursor_engine_only_get(const Elm_Gen_Item *it)
+elm_gengrid_item_cursor_engine_only_get(const Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
return elm_widget_item_cursor_engine_only_get(it);
}
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- wd->reorder_mode = reorder_mode;
+ wd->reorder_mode = !!reorder_mode;
}
EAPI Eina_Bool
}
EAPI void
-elm_gengrid_always_select_mode_set(Evas_Object *obj,
- Eina_Bool always_select)
-{
- elm_genlist_always_select_mode_set(obj, always_select);
-}
-
-EAPI Eina_Bool
-elm_gengrid_always_select_mode_get(const Evas_Object *obj)
-{
- return elm_genlist_always_select_mode_get(obj);
-}
-
-EAPI void
-elm_gengrid_no_select_mode_set(Evas_Object *obj,
- Eina_Bool no_select)
-{
- elm_genlist_no_select_mode_set(obj, no_select);
-}
-
-EAPI Eina_Bool
-elm_gengrid_no_select_mode_get(const Evas_Object *obj)
-{
- return elm_genlist_no_select_mode_get(obj);
-}
-
-EAPI void
elm_gengrid_bounce_set(Evas_Object *obj,
Eina_Bool h_bounce,
Eina_Bool v_bounce)
_elm_genlist_page_bring_in(obj, h_pagenumber, v_pagenumber);
}
-EAPI Elm_Gen_Item *
+EAPI void
+elm_gengrid_scroller_policy_set(Evas_Object *obj,
+ Elm_Scroller_Policy policy_h,
+ Elm_Scroller_Policy policy_v)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if ((!wd) || (!wd->scr)) return;
+ if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
+ (policy_v >= ELM_SCROLLER_POLICY_LAST))
+ return;
+ elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v);
+}
+
+EAPI void
+elm_gengrid_scroller_policy_get(const Evas_Object *obj,
+ Elm_Scroller_Policy *policy_h,
+ Elm_Scroller_Policy *policy_v)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
+ if ((!wd) || (!wd->scr)) return;
+ elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v);
+ if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h;
+ if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v;
+}
+
+EAPI Elm_Object_Item *
elm_gengrid_first_item_get(const Evas_Object *obj)
{
return elm_genlist_first_item_get(obj);
}
-EAPI Elm_Gen_Item *
+EAPI Elm_Object_Item *
elm_gengrid_last_item_get(const Evas_Object *obj)
{
return elm_genlist_last_item_get(obj);
}
-EAPI Elm_Gen_Item *
-elm_gengrid_item_next_get(const Elm_Gen_Item *it)
+EAPI Elm_Object_Item *
+elm_gengrid_item_next_get(const Elm_Object_Item *it)
{
return elm_genlist_item_next_get(it);
}
-EAPI Elm_Gen_Item *
-elm_gengrid_item_prev_get(const Elm_Gen_Item *it)
+EAPI Elm_Object_Item *
+elm_gengrid_item_prev_get(const Elm_Object_Item *it)
{
return elm_genlist_item_prev_get(it);
}
-EAPI Evas_Object *
-elm_gengrid_item_gengrid_get(const Elm_Gen_Item *it)
-{
- return _elm_genlist_item_widget_get(it);
-}
-
EAPI void
-elm_gengrid_item_show(Elm_Gen_Item *it)
+elm_gengrid_item_show(Elm_Object_Item *it, Elm_Gengrid_Item_Scrollto_Type type)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- Widget_Data *wd = it->wd;
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+ Widget_Data *wd = _it->wd;
Evas_Coord minx = 0, miny = 0;
- if (!wd) return;
- if ((!it) || (it->generation < it->wd->generation)) return;
+ if ((_it->generation < _it->wd->generation)) return;
_pan_min_get(wd->pan_smart, &minx, &miny);
+ if (type==ELM_GENGRID_ITEM_SCROLLTO_IN)
+ {
+ //TODO : type based handling like genlist
+ }
+
if (wd->horizontal)
- elm_smart_scroller_region_bring_in(it->wd->scr,
- ((it->x - it->item->prev_group) * wd->item_width) + (it->item->prev_group * it->wd->group_item_width) + minx,
- it->y * wd->item_height + miny,
- it->wd->item_width,
- it->wd->item_height);
+ elm_smart_scroller_region_bring_in(_it->wd->scr,
+ ((_it->x - _it->item->prev_group) * wd->item_width) + (_it->item->prev_group * _it->wd->group_item_width) + minx,
+ _it->y * wd->item_height + miny,
+ _it->wd->item_width,
+ _it->wd->item_height);
else
- elm_smart_scroller_region_bring_in(it->wd->scr,
- it->x * wd->item_width + minx,
- ((it->y - it->item->prev_group)* wd->item_height) + (it->item->prev_group * it->wd->group_item_height) + miny,
- it->wd->item_width,
- it->wd->item_height);
+ elm_smart_scroller_region_bring_in(_it->wd->scr,
+ _it->x * wd->item_width + minx,
+ ((_it->y - _it->item->prev_group) * wd->item_height) + (_it->item->prev_group * _it->wd->group_item_height) + miny,
+ _it->wd->item_width,
+ _it->wd->item_height);
}
EAPI void
-elm_gengrid_item_bring_in(Elm_Gen_Item *it)
+elm_gengrid_item_bring_in(Elm_Object_Item *it, Elm_Gengrid_Item_Scrollto_Type type)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- if (it->generation < it->wd->generation) return;
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+
+ if (_it->generation < _it->wd->generation) return;
Evas_Coord minx = 0, miny = 0;
- Widget_Data *wd = it->wd;
- if (!wd) return;
+ Widget_Data *wd = _it->wd;
_pan_min_get(wd->pan_smart, &minx, &miny);
+ if (type==ELM_GENGRID_ITEM_SCROLLTO_IN)
+ {
+ //TODO : type based handling like genlist
+ }
+
if (wd->horizontal)
- elm_smart_scroller_region_bring_in(it->wd->scr,
- ((it->x - it->item->prev_group) * wd->item_width) + (it->item->prev_group * it->wd->group_item_width) + minx,
- it->y * wd->item_height + miny,
- it->wd->item_width,
- it->wd->item_height);
+ elm_smart_scroller_region_bring_in(_it->wd->scr,
+ ((_it->x - _it->item->prev_group) * wd->item_width) + (_it->item->prev_group * _it->wd->group_item_width) + minx,
+ _it->y * wd->item_height + miny,
+ _it->wd->item_width,
+ _it->wd->item_height);
else
- elm_smart_scroller_region_bring_in(it->wd->scr,
- it->x * wd->item_width + minx,
- ((it->y - it->item->prev_group)* wd->item_height) + (it->item->prev_group * it->wd->group_item_height) + miny,
- it->wd->item_width,
- it->wd->item_height);
+ elm_smart_scroller_region_bring_in(_it->wd->scr,
+ _it->x * wd->item_width + minx,
+ ((_it->y - _it->item->prev_group)* wd->item_height) + (_it->item->prev_group * _it->wd->group_item_height) + miny,
+ _it->wd->item_width,
+ _it->wd->item_height);
+}
+
+EAPI void
+elm_gengrid_filled_set(Evas_Object *obj, Eina_Bool fill)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ fill = !!fill;
+ if (wd->filled != fill)
+ wd->filled = fill;
+}
+
+EAPI Eina_Bool
+elm_gengrid_filled_get(const Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return EINA_FALSE;
+ return wd->filled;
+}
+
+EAPI unsigned int
+elm_gengrid_items_count(const Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) 0;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return 0;
+ return wd->item_count;
+}
+
+EAPI Elm_Gengrid_Item_Class *
+elm_gengrid_item_class_new(void)
+{
+ Elm_Gengrid_Item_Class *itc;
+
+ itc = calloc(1, sizeof(Elm_Gengrid_Item_Class));
+ if (!itc)
+ return NULL;
+ itc->version = CLASS_ALLOCATED;
+ itc->refcount = 1;
+ itc->delete_me = EINA_FALSE;
+
+ return itc;
+}
+
+EAPI void
+elm_gengrid_item_class_free(Elm_Gengrid_Item_Class *itc)
+{
+ if (itc && (itc->version == CLASS_ALLOCATED))
+ {
+ if (!itc->delete_me) itc->delete_me = EINA_TRUE;
+ if (itc->refcount > 0) elm_gengrid_item_class_unref(itc);
+ else
+ {
+ itc->version = 0;
+ free(itc);
+ }
+ }
+}
+
+EAPI void
+elm_gengrid_item_class_ref(Elm_Gengrid_Item_Class *itc)
+{
+ if (itc && (itc->version == CLASS_ALLOCATED))
+ {
+ itc->refcount++;
+ if (itc->refcount == 0) itc->refcount--;
+ }
+}
+
+EAPI void
+elm_gengrid_item_class_unref(Elm_Gengrid_Item_Class *itc)
+{
+ if (itc && (itc->version == CLASS_ALLOCATED))
+ {
+ if (itc->refcount > 0) itc->refcount--;
+ if (itc->delete_me && (!itc->refcount))
+ elm_gengrid_item_class_free(itc);
+ }
+}
+
+EAPI void
+elm_gengrid_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode mode)
+{
+ elm_genlist_select_mode_set(obj, mode);
+}
+
+EAPI Elm_Object_Select_Mode
+elm_gengrid_select_mode_get(const Evas_Object *obj)
+{
+ return elm_genlist_select_mode_get(obj);
+}
+
+EAPI void
+elm_gengrid_highlight_mode_set(Evas_Object *obj,
+ Eina_Bool highlight)
+{
+ elm_genlist_highlight_mode_set(obj, highlight);
+}
+
+EAPI Eina_Bool
+elm_gengrid_highlight_mode_get(const Evas_Object *obj)
+{
+ return elm_genlist_highlight_mode_get(obj);
+}
+
+EAPI int
+elm_gengrid_item_index_get(const Elm_Object_Item *it)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, -1);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+
+ return _it->position;
+}
+
+EAPI void
+elm_gengrid_item_select_mode_set(Elm_Object_Item *it,
+ Elm_Object_Select_Mode mode)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+ if (!_it) return;
+ if (_it->generation < _it->wd->generation) return;
+ if (mode >= ELM_OBJECT_SELECT_MODE_MAX)
+ return;
+ if (_it->select_mode != mode)
+ _it->select_mode = mode;
+
+ if (_it->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)
+ elm_gengrid_item_update(it);
+}
+
+EAPI Elm_Object_Select_Mode
+elm_gengrid_item_select_mode_get(const Elm_Object_Item *it)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, ELM_OBJECT_SELECT_MODE_MAX);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+ if (!_it) return ELM_OBJECT_SELECT_MODE_MAX;
+ return _it->select_mode;
}