forked from enlightenment/efl
parent
2c90cd89ae
commit
d63440b865
|
@ -1593,6 +1593,7 @@ my_bt_21(void *data, Evas_Object *obj, void *event_info)
|
|||
elm_win_resize_object_add(win, li);
|
||||
evas_object_size_hint_weight_set(li, 1.0, 1.0);
|
||||
elm_list_horizontal_mode_set(li, ELM_LIST_LIMIT);
|
||||
elm_list_multi_select_set(li, 1);
|
||||
|
||||
ic = elm_icon_add(win);
|
||||
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
|
||||
|
|
|
@ -198,6 +198,7 @@ extern "C" {
|
|||
EAPI Evas_Object *elm_scroller_add(Evas_Object *parent);
|
||||
EAPI void elm_scroller_content_set(Evas_Object *obj, Evas_Object *child);
|
||||
EAPI void elm_scroller_content_min_limit(Evas_Object *obj, Evas_Bool w, Evas_Bool h);
|
||||
EAPI void elm_scroller_region_show(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
|
||||
/* smart callbacks called:
|
||||
*/
|
||||
|
||||
|
@ -409,8 +410,26 @@ extern "C" {
|
|||
typedef struct _Elm_List_Item Elm_List_Item;
|
||||
EAPI Evas_Object *elm_list_add(Evas_Object *parent);
|
||||
EAPI Elm_List_Item *elm_list_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *end, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *data);
|
||||
EAPI Elm_List_Item *elm_list_item_prepend(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *end, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *data);
|
||||
EAPI Elm_List_Item *elm_list_item_insert_before(Evas_Object *obj, Elm_List_Item *before, const char *label, Evas_Object *icon, Evas_Object *end, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *data);
|
||||
EAPI Elm_List_Item *elm_list_item_insert_after(Evas_Object *obj, Elm_List_Item *after, const char *label, Evas_Object *icon, Evas_Object *end, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *data);
|
||||
EAPI void elm_list_go(Evas_Object *obj);
|
||||
EAPI void elm_list_multi_select_set(Evas_Object *obj, Evas_Bool multi);
|
||||
EAPI void elm_list_horizontal_mode_set(Evas_Object *obj, Elementary_List_Mode mode);
|
||||
EAPI const Eina_List *elm_list_items_get(Evas_Object *obj);
|
||||
EAPI const Elm_List_Item *elm_list_selected_item_get(Evas_Object *obj);
|
||||
EAPI const Eina_List *elm_list_selected_items_get(Evas_Object *obj);
|
||||
EAPI void elm_list_item_selected_set(Elm_List_Item *item, Evas_Bool selected);
|
||||
EAPI void elm_list_item_show(Elm_List_Item *item);
|
||||
EAPI void elm_list_item_del(Elm_List_Item *item);
|
||||
EAPI const void *elm_list_item_data_get(Elm_List_Item *item);
|
||||
EAPI Evas_Object *elm_list_item_icon_get(Elm_List_Item *item);
|
||||
EAPI Evas_Object *elm_list_item_end_get(Elm_List_Item *item);
|
||||
|
||||
/* smart callbacks called:
|
||||
* "clicked" - when the user double-clicked an item
|
||||
* "selected" - when the user selected an item
|
||||
* "unselected" - when the user selected an item
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -10,8 +10,9 @@ struct _Widget_Data
|
|||
Eina_List *items;
|
||||
Eina_List *selected;
|
||||
Elementary_List_Mode mode;
|
||||
Evas_Bool on_hold : 1;
|
||||
Evas_Coord minw[2], minh[2];
|
||||
Evas_Bool on_hold : 1;
|
||||
Evas_Bool multi : 1;
|
||||
};
|
||||
|
||||
struct _Item
|
||||
|
@ -38,6 +39,20 @@ static void
|
|||
_del_hook(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
while (wd->items)
|
||||
{
|
||||
Item *it = wd->items->data;
|
||||
wd->items = eina_list_remove_list(wd->items, wd->items);
|
||||
eina_stringshare_del(it->label);
|
||||
if (!it->fixed)
|
||||
{
|
||||
if (it->icon) evas_object_del(it->icon);
|
||||
if (it->end) evas_object_del(it->end);
|
||||
}
|
||||
if (it->base) evas_object_del(it->base);
|
||||
free(it);
|
||||
}
|
||||
eina_list_free(wd->selected);
|
||||
free(wd);
|
||||
}
|
||||
|
||||
|
@ -76,6 +91,7 @@ _mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info)
|
|||
static void
|
||||
_item_select(Item *it)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(it->obj);
|
||||
const char *selectraise;
|
||||
if (it->selected) return;
|
||||
edje_object_signal_emit(it->base, "elm,state,selected", "elm");
|
||||
|
@ -83,12 +99,15 @@ _item_select(Item *it)
|
|||
if ((selectraise) && (!strcmp(selectraise, "on")))
|
||||
evas_object_raise(it->base);
|
||||
it->selected = 1;
|
||||
wd->selected = eina_list_append(wd->selected, it);
|
||||
if (it->func) it->func((void *)it->data, it->obj, it);
|
||||
evas_object_smart_callback_call(it->obj, "selected", it);
|
||||
}
|
||||
|
||||
static void
|
||||
_item_unselect(Item *it)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(it->obj);
|
||||
const char *stacking, *selectraise;
|
||||
if (!it->selected) return;
|
||||
edje_object_signal_emit(it->base, "elm,state,unselected", "elm");
|
||||
|
@ -100,6 +119,8 @@ _item_unselect(Item *it)
|
|||
evas_object_lower(it->base);
|
||||
}
|
||||
it->selected = 0;
|
||||
wd->selected = eina_list_remove(wd->selected, it);
|
||||
evas_object_smart_callback_call(it->obj, "unselected", it);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -116,12 +137,20 @@ _mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info)
|
|||
wd->on_hold = 0;
|
||||
return;
|
||||
}
|
||||
for (l = wd->items; l; l = l->next)
|
||||
if (wd->multi)
|
||||
{
|
||||
Item *it2 = l->data;
|
||||
if ((it2 != it) && (it2->selected)) _item_unselect(it2);
|
||||
if (!it->selected) _item_select(it);
|
||||
else _item_unselect(it);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (l = wd->items; l; l = l->next)
|
||||
{
|
||||
Item *it2 = l->data;
|
||||
if ((it2 != it) && (it2->selected)) _item_unselect(it2);
|
||||
}
|
||||
if (!it->selected) _item_select(it);
|
||||
}
|
||||
if (!it->selected) _item_select(it);
|
||||
}
|
||||
|
||||
static Item *
|
||||
|
@ -337,7 +366,7 @@ EAPI void
|
|||
elm_list_multi_select_set(Evas_Object *obj, Evas_Bool multi)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
// FIXME: implement
|
||||
wd->multi = multi;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -352,48 +381,73 @@ elm_list_horizontal_mode_set(Evas_Object *obj, Elementary_List_Mode mode)
|
|||
elm_scroller_content_min_limit(wd->scroller, 0, 0);
|
||||
}
|
||||
|
||||
EAPI const Elm_List_Item *
|
||||
elm_list_selected_item_get(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
// FIXME: implement
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EAPI const Eina_List *
|
||||
elm_list_items_get(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (wd->selected) return wd->selected;
|
||||
// FIXME: implement
|
||||
return wd->items;
|
||||
}
|
||||
|
||||
EAPI const Elm_List_Item *
|
||||
elm_list_selected_item_get(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (wd->selected) return wd->selected->data;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EAPI const Eina_List *
|
||||
elm_list_selected_items_get(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
return wd->selected;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_list_item_selected_set(Elm_List_Item *item, Evas_Bool selected)
|
||||
{
|
||||
Item *it = (Item *)item;
|
||||
Widget_Data *wd = elm_widget_data_get(it->obj);
|
||||
Eina_List *l;
|
||||
if (it->selected) return;
|
||||
for (l = wd->items; l; l = l->next)
|
||||
if (selected)
|
||||
{
|
||||
Item *it2 = l->data;
|
||||
if ((it2 != it) && (it2->selected)) _item_unselect(it2);
|
||||
if (!wd->multi)
|
||||
{
|
||||
Item *it2 = l->data;
|
||||
if ((it2 != it) && (it2->selected)) _item_unselect(it2);
|
||||
}
|
||||
if (!it->selected) _item_select(it);
|
||||
}
|
||||
_item_select(it);
|
||||
else if (it->selected)
|
||||
_item_unselect(it);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_list_item_show(Elm_List_Item *item)
|
||||
{
|
||||
// FIXME: implement
|
||||
Item *it = (Item *)item;
|
||||
Widget_Data *wd = elm_widget_data_get(it->obj);
|
||||
Evas_Coord bx, by, bw, bh;
|
||||
Evas_Coord x, y, w, h;
|
||||
evas_object_geometry_get(wd->box, &bx, &by, &bw, &bh);
|
||||
evas_object_geometry_get(it->base, &x, &y, &w, &h);
|
||||
x -= bx;
|
||||
y -= by;
|
||||
elm_scroller_region_show(wd->scroller, x, y, w, h);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_list_item_del(Elm_List_Item *item)
|
||||
{
|
||||
// FIXME: implement
|
||||
Item *it = (Item *)item;
|
||||
Widget_Data *wd = elm_widget_data_get(it->obj);
|
||||
if (it->selected) _item_unselect(it);
|
||||
wd->items = eina_list_remove(wd->items, it);
|
||||
eina_stringshare_del(it->label);
|
||||
if (it->icon) evas_object_del(it->icon);
|
||||
if (it->end) evas_object_del(it->end);
|
||||
if (it->base) evas_object_del(it->base);
|
||||
free(it);
|
||||
}
|
||||
|
||||
EAPI const void *
|
||||
|
|
|
@ -70,7 +70,6 @@ _sizing_eval(Evas_Object *obj)
|
|||
edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
|
||||
if (wd->min_w) w = vmw + minw;
|
||||
if (wd->min_h) h = vmh + minh;
|
||||
printf("%i : %i + %i\n",wd->min_w, vmw, minw);
|
||||
evas_object_size_hint_min_set(obj, w, h);
|
||||
}
|
||||
|
||||
|
@ -155,3 +154,10 @@ elm_scroller_content_min_limit(Evas_Object *obj, Evas_Bool w, Evas_Bool h)
|
|||
wd->min_h = h;
|
||||
_sizing_eval(obj);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_scroller_region_show(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue