elm_test: add a example that shows efl_ui_item instances
this is just a little showcase to show the possible items Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D9430
This commit is contained in:
parent
7f2ce2f99a
commit
764f35b7a3
|
@ -157,6 +157,7 @@ elementary_test_src = [
|
|||
'test_ui_tab_pager.c',
|
||||
'test_ui_relative_layout.c',
|
||||
'test_ui_item_container.c',
|
||||
'test_ui_items.c',
|
||||
'test.h'
|
||||
]
|
||||
|
||||
|
|
|
@ -402,6 +402,8 @@ void test_ui_relative_layout(void *data, Evas_Object *obj, void *event_info);
|
|||
void test_efl_ui_radio(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_efl_ui_collection_list(void *data, Evas_Object *obj, void *event_info );
|
||||
void test_efl_ui_collection_grid(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_efl_ui_item(void *data, Evas_Object *obj, void *event_info);
|
||||
|
||||
static void _list_udpate(void);
|
||||
|
||||
static Evas_Object *win, *tbx, *entry; // TODO: refactoring
|
||||
|
@ -905,6 +907,7 @@ add_tests:
|
|||
ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Relative_Layout", test_ui_relative_layout);
|
||||
ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Collection List", test_efl_ui_collection_list);
|
||||
ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Collection Grid", test_efl_ui_collection_grid);
|
||||
ADD_TEST_EO(NULL, "Containers", "Items", test_efl_ui_item);
|
||||
|
||||
//------------------------------//
|
||||
ADD_TEST_EO(NULL, "Events", "Event Refeed", test_events);
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "elementary_config.h"
|
||||
#endif
|
||||
|
||||
#include <Efl_Ui.h>
|
||||
|
||||
static Efl_Ui_Widget*
|
||||
_item_add(Eo *box, const Efl_Class *c, int i)
|
||||
{
|
||||
Eo *check, *rect, *il = efl_add(c, box);
|
||||
int r = 0, g = 0, b = 0;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
snprintf(buf, sizeof(buf), "%d - Test %d", i, i%13);
|
||||
efl_text_set(il, buf);
|
||||
|
||||
rect = efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas_object_evas_get(il));
|
||||
switch (i % 5)
|
||||
{
|
||||
case 0:
|
||||
r = 255;
|
||||
break;
|
||||
case 1:
|
||||
g = 255;
|
||||
break;
|
||||
case 2:
|
||||
b = 255;
|
||||
break;
|
||||
case 3:
|
||||
r = g = b = 255;
|
||||
break;
|
||||
case 4:
|
||||
r = g = b = 0;
|
||||
break;
|
||||
}
|
||||
efl_gfx_color_set(rect, r, g, b, 255);
|
||||
efl_content_set(il, rect);
|
||||
|
||||
check = efl_add(EFL_UI_CHECK_CLASS, il);
|
||||
efl_content_set(efl_part(il, "extra"), check);
|
||||
|
||||
if (c == EFL_UI_GRID_DEFAULT_ITEM_CLASS)
|
||||
efl_gfx_hint_size_min_set(il, EINA_SIZE2D(100, 180));
|
||||
else
|
||||
efl_gfx_hint_size_min_set(il, EINA_SIZE2D(40, 40+(i%2)*40));
|
||||
|
||||
return il;
|
||||
}
|
||||
|
||||
void test_efl_ui_item(void *data EINA_UNUSED,
|
||||
Evas_Object *obj EINA_UNUSED,
|
||||
void *event_info EINA_UNUSED)
|
||||
{
|
||||
Eo *win, *box, *o;
|
||||
|
||||
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
|
||||
efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
|
||||
efl_text_set(efl_added, "Item examples"),
|
||||
efl_ui_win_autodel_set(efl_added, EINA_TRUE)
|
||||
);
|
||||
|
||||
box = efl_add(EFL_UI_BOX_CLASS, win,
|
||||
efl_content_set(win, efl_added));
|
||||
|
||||
o = _item_add(box, EFL_UI_GRID_DEFAULT_ITEM_CLASS, 1);
|
||||
efl_pack_end(box, o);
|
||||
|
||||
o = _item_add(box, EFL_UI_GRID_DEFAULT_ITEM_CLASS, 2);
|
||||
efl_ui_widget_disabled_set(o, EINA_TRUE);
|
||||
efl_pack_end(box, o);
|
||||
|
||||
o = _item_add(box, EFL_UI_LIST_DEFAULT_ITEM_CLASS, 3);
|
||||
efl_pack_end(box, o);
|
||||
|
||||
o = _item_add(box, EFL_UI_LIST_DEFAULT_ITEM_CLASS, 4);
|
||||
efl_ui_widget_disabled_set(o, EINA_TRUE);
|
||||
efl_pack_end(box, o);
|
||||
|
||||
o = efl_add(EFL_UI_LIST_PLACEHOLDER_ITEM_CLASS, box);
|
||||
efl_gfx_hint_size_min_set(o, EINA_SIZE2D(40, 40+40));
|
||||
efl_pack_end(box, o);
|
||||
|
||||
o = efl_add(EFL_UI_LIST_PLACEHOLDER_ITEM_CLASS, box);
|
||||
efl_gfx_hint_size_min_set(o, EINA_SIZE2D(40, 40));
|
||||
efl_ui_widget_disabled_set(o, EINA_TRUE);
|
||||
efl_pack_end(box, o);
|
||||
}
|
|
@ -258,6 +258,7 @@ typedef Eo Efl_Ui_Spotlight_Indicator;
|
|||
# include <efl_ui_position_manager_grid.eo.h>
|
||||
# include <efl_ui_list_default_item.eo.h>
|
||||
# include <efl_ui_grid_default_item.eo.h>
|
||||
# include <efl_ui_list_placeholder_item.eo.h>
|
||||
|
||||
/**
|
||||
* Initialize Elementary
|
||||
|
|
Loading…
Reference in New Issue