forked from enlightenment/efl
103 lines
2.9 KiB
C
103 lines
2.9 KiB
C
#ifdef HAVE_CONFIG_H
|
|
# include "elementary_config.h"
|
|
#endif
|
|
#include <Elementary.h>
|
|
|
|
typedef struct _Testitem
|
|
{
|
|
Elm_Object_Item *item;
|
|
int mode;
|
|
int onoff;
|
|
} Testitem;
|
|
|
|
static Elm_Genlist_Item_Class itc1;
|
|
static char *glf_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
|
|
{
|
|
char buf[256];
|
|
snprintf(buf, sizeof(buf), "Item # %i", (int)(uintptr_t)data);
|
|
return strdup(buf);
|
|
}
|
|
|
|
static Evas_Object *glf_content_get(void *data EINA_UNUSED, Evas_Object *obj, const char *part EINA_UNUSED)
|
|
{
|
|
char buf[PATH_MAX];
|
|
Evas_Object *ic = elm_icon_add(obj);
|
|
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
|
|
elm_image_file_set(ic, buf, NULL);
|
|
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
|
|
return ic;
|
|
}
|
|
static Eina_Bool glf_state_get(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
|
|
{
|
|
return EINA_FALSE;
|
|
}
|
|
static void glf_del(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED)
|
|
{
|
|
}
|
|
|
|
static void
|
|
gl_sel(void *data, Evas_Object *obj, void *event_info)
|
|
{
|
|
printf("sel item data [%p] on genlist obj [%p], item pointer [%p]\n", data, obj, event_info);
|
|
}
|
|
|
|
static Eina_Bool
|
|
anim(void *data)
|
|
{
|
|
Evas_Object *gl = data;
|
|
Evas_Coord x, y;
|
|
|
|
y = 0;
|
|
x = (sin(ecore_loop_time_get()) * 500);
|
|
evas_object_move(gl, x, y);
|
|
return ECORE_CALLBACK_RENEW;
|
|
}
|
|
|
|
static void
|
|
_del(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
|
{
|
|
Ecore_Animator *ani = data;
|
|
|
|
ecore_animator_del(ani);
|
|
}
|
|
|
|
void
|
|
test_floating(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
|
{
|
|
Evas_Object *win, *gl;
|
|
int i;
|
|
Ecore_Animator *ani;
|
|
|
|
win = elm_win_util_standard_add("floating", "Floating");
|
|
elm_win_autodel_set(win, EINA_TRUE);
|
|
|
|
gl = elm_genlist_add(win);
|
|
evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
evas_object_move(gl, 800, 0);
|
|
evas_object_resize(gl, 480, 800);
|
|
evas_object_show(gl);
|
|
|
|
itc1.item_style = "default";
|
|
itc1.func.text_get = glf_text_get;
|
|
itc1.func.content_get = glf_content_get;
|
|
itc1.func.state_get = glf_state_get;
|
|
itc1.func.del = glf_del;
|
|
|
|
for (i = 0; i < 20; i++)
|
|
{
|
|
elm_genlist_item_append(gl, &itc1,
|
|
(void *)(uintptr_t)i/* item data */,
|
|
NULL/* parent */,
|
|
ELM_GENLIST_ITEM_NONE,
|
|
gl_sel/* func */,
|
|
(void *)(uintptr_t)(i * 10)/* func data */);
|
|
}
|
|
evas_object_resize(win, 480 * elm_config_scale_get(),
|
|
800 * elm_config_scale_get());
|
|
evas_object_show(win);
|
|
|
|
ani = ecore_animator_add(anim, gl);
|
|
evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _del, ani);
|
|
}
|