forked from enlightenment/efl
efl_ui_grid : introduce new packable grid widget for Efl.Ui.Widget
Summary: Introduce new packable grid for Efl.Ui.Widget toolkits. most of parts are same as Efl.Ui.List, and it also support Efl.Pack_Linear, although it will not support Efl.Pack_Table, because item must be arranged sequential orders. Test Plan: We will make the tests on efl ui test suite. please test by make check. Reviewers: Hermet, cedric, felipealmeida, eagleeye, woohyun Reviewed By: Hermet, eagleeye Subscribers: CHAN, bu5hm4n, cedric Tags: #efl Differential Revision: https://phab.enlightenment.org/D6985
This commit is contained in:
parent
4f9c8d524c
commit
4b5304d7f2
|
@ -174,6 +174,7 @@ collections {
|
||||||
// XXX: mobile mode needs invisible scrollers... make signals that do this
|
// XXX: mobile mode needs invisible scrollers... make signals that do this
|
||||||
#include "edc/efl/scroller.edc"
|
#include "edc/efl/scroller.edc"
|
||||||
#include "edc/efl/list.edc"
|
#include "edc/efl/list.edc"
|
||||||
|
#include "edc/efl/grid.edc"
|
||||||
// XXX: mobile mode needs different entry setup
|
// XXX: mobile mode needs different entry setup
|
||||||
#include "edc/efl/text.edc"
|
#include "edc/efl/text.edc"
|
||||||
#include "edc/efl/frame.edc"
|
#include "edc/efl/frame.edc"
|
||||||
|
|
|
@ -0,0 +1,269 @@
|
||||||
|
group { "efl/grid";
|
||||||
|
inherit: "efl/scroller";
|
||||||
|
}
|
||||||
|
|
||||||
|
group { "efl/view_grid";
|
||||||
|
inherit: "efl/grid";
|
||||||
|
}
|
||||||
|
|
||||||
|
group { "efl/grid_item";
|
||||||
|
data.item: "selectraise" "on";
|
||||||
|
data.item: "focusraise" "on";
|
||||||
|
images.image: "bevel_dark_out.png" COMP;
|
||||||
|
images.image: "shadow_rounded_horiz.png" COMP;
|
||||||
|
images.image: "vgrad_med_dark.png" COMP;
|
||||||
|
images.image: "bevel_out.png" COMP;
|
||||||
|
images.image: "shine.png" COMP;
|
||||||
|
parts {
|
||||||
|
|
||||||
|
// BASE PARTS //
|
||||||
|
rect { "event";
|
||||||
|
desc { "default";
|
||||||
|
color: 0 0 0 0;
|
||||||
|
}
|
||||||
|
desc { "disabled";
|
||||||
|
inherit: "default";
|
||||||
|
hid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rect { "base"; mouse;
|
||||||
|
desc { "default";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
image { "bevel"; nomouse;
|
||||||
|
desc { "default";
|
||||||
|
image.normal: "bevel_dark_out.png";
|
||||||
|
image.border: 2 2 2 2;
|
||||||
|
image.middle: 0;
|
||||||
|
fill.smooth: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
image { "sel_shadow"; nomouse;
|
||||||
|
desc { "default";
|
||||||
|
image.normal: "shadow_rounded_horiz.png";
|
||||||
|
image.border: 0 0 9 9;
|
||||||
|
rel1.offset: 0 -4;
|
||||||
|
rel2.offset: -1 5;
|
||||||
|
fill.smooth: 0;
|
||||||
|
hid;
|
||||||
|
}
|
||||||
|
desc { "selected";
|
||||||
|
inherit: "default";
|
||||||
|
vis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
image { "sel_base"; nomouse;
|
||||||
|
desc { "default";
|
||||||
|
image.normal: "vgrad_med_dark.png";
|
||||||
|
fill.smooth: 0;
|
||||||
|
hid;
|
||||||
|
TILED_HORIZ(120)
|
||||||
|
}
|
||||||
|
desc { "selected";
|
||||||
|
inherit: "default";
|
||||||
|
vis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
image { "sel_bevel"; nomouse;
|
||||||
|
desc { "default";
|
||||||
|
image.normal: "bevel_out.png";
|
||||||
|
image.border: 2 2 2 2;
|
||||||
|
image.middle: 0;
|
||||||
|
fill.smooth: 0;
|
||||||
|
hid;
|
||||||
|
}
|
||||||
|
desc { "selected";
|
||||||
|
inherit: "default";
|
||||||
|
vis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// BASE PARTS //
|
||||||
|
|
||||||
|
// TEXT PARTS //
|
||||||
|
text { "efl.text"; nomouse;
|
||||||
|
effect: SHADOW BOTTOM;
|
||||||
|
scale: 1;
|
||||||
|
desc { "default";
|
||||||
|
fixed: 0 1;
|
||||||
|
rel1.relative: 0.0 1.0;
|
||||||
|
rel1.offset: 5 -5;
|
||||||
|
rel2.relative: 1.0 1.0;
|
||||||
|
rel2.offset: -5 -5;
|
||||||
|
color: FN_COL_DEFAULT;
|
||||||
|
color_class: "grid_item";
|
||||||
|
align: 0.5 1.0;
|
||||||
|
text { font: FN; size: 10;
|
||||||
|
min: 0 1;
|
||||||
|
align: 0.5 1.0;
|
||||||
|
text_class: "grid_item";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
desc { "selected";
|
||||||
|
inherit: "default";
|
||||||
|
hid;
|
||||||
|
}
|
||||||
|
desc { "disabled";
|
||||||
|
inherit: "default";
|
||||||
|
hid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
text { "label2"; nomouse;
|
||||||
|
effect: SHADOW BOTTOM;
|
||||||
|
scale: 1;
|
||||||
|
desc { "default";
|
||||||
|
rel1.to: "efl.text";
|
||||||
|
rel2.to: "efl.text";
|
||||||
|
color: FN_COL_DISABLE;
|
||||||
|
color_class: "grid_item_disabled";
|
||||||
|
text { font: FN; size: 10;
|
||||||
|
text_source: "efl.text";
|
||||||
|
align: 0.5 1.0;
|
||||||
|
text_class: "grid_item";
|
||||||
|
}
|
||||||
|
hid;
|
||||||
|
}
|
||||||
|
desc { "selected";
|
||||||
|
inherit: "default";
|
||||||
|
hid;
|
||||||
|
}
|
||||||
|
desc { "disabled";
|
||||||
|
inherit: "default";
|
||||||
|
vis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
text { "label3"; nomouse;
|
||||||
|
effect: GLOW;
|
||||||
|
scale: 1;
|
||||||
|
desc { "default";
|
||||||
|
rel1.offset: -2 -2;
|
||||||
|
rel1.to: "efl.text";
|
||||||
|
rel2.offset: 1 0;
|
||||||
|
rel2.to: "efl.text";
|
||||||
|
color: FN_COL_HIGHLIGHT;
|
||||||
|
color_class: "grid_item_selected";
|
||||||
|
text { font: FN; size: 10;
|
||||||
|
text_source: "efl.text";
|
||||||
|
align: 0.5 1.0;
|
||||||
|
text_class: "grid_item";
|
||||||
|
}
|
||||||
|
hid;
|
||||||
|
}
|
||||||
|
desc { "selected";
|
||||||
|
inherit: "default";
|
||||||
|
vis;
|
||||||
|
}
|
||||||
|
desc { "disabled";
|
||||||
|
inherit: "default";
|
||||||
|
hid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// TEXT PARTS //
|
||||||
|
|
||||||
|
// CONTENT PARTS //
|
||||||
|
rect { "icon_area";
|
||||||
|
desc { "default";
|
||||||
|
fixed: 1 0;
|
||||||
|
rel1.offset: 2 2;
|
||||||
|
rel2.to_y: "efl.text";
|
||||||
|
rel2.relative: 1.0 0.0;
|
||||||
|
rel2.offset: -3 -3;
|
||||||
|
}
|
||||||
|
desc { "disabled";
|
||||||
|
inherit: "default";
|
||||||
|
color: 255 255 255 64;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
swallow { "efl.icon";
|
||||||
|
clip_to: "icon_area";
|
||||||
|
desc { "default";
|
||||||
|
rel1.to: "icon_area";
|
||||||
|
rel2.to: "icon_area";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
swallow { "efl.end";
|
||||||
|
clip_to: "icon_area";
|
||||||
|
desc { "default";
|
||||||
|
fixed: 1 1;
|
||||||
|
align: 1.0 0.0;
|
||||||
|
rel1.relative: 1.0 0.0;
|
||||||
|
rel1.offset: -3 2;
|
||||||
|
rel2.relative: 1.0 0.0;
|
||||||
|
rel2.offset: -3 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// CONTENT PARTS //
|
||||||
|
|
||||||
|
// TOP PARTS //
|
||||||
|
image { "sel_shine"; nomouse;
|
||||||
|
desc { "default";
|
||||||
|
image.normal: "shine.png";
|
||||||
|
rel1.offset: 0 -2;
|
||||||
|
rel1.to: "sel_base";
|
||||||
|
rel2.relative: 1.0 0.0;
|
||||||
|
rel2.offset: -1 2;
|
||||||
|
rel2.to: "sel_base";
|
||||||
|
hid;
|
||||||
|
FIXED_SIZE(69, 5)
|
||||||
|
}
|
||||||
|
desc { "selected";
|
||||||
|
inherit: "default";
|
||||||
|
vis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rect { "event_block";
|
||||||
|
desc { "default";
|
||||||
|
color: 0 0 0 0;
|
||||||
|
hid;
|
||||||
|
}
|
||||||
|
desc { "disabled";
|
||||||
|
inherit: "default";
|
||||||
|
vis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// TOP PARTS //
|
||||||
|
}
|
||||||
|
programs {
|
||||||
|
program {
|
||||||
|
signal: "efl,state,selected"; source: "efl";
|
||||||
|
action: STATE_SET "selected";
|
||||||
|
target: "sel_shadow";
|
||||||
|
target: "sel_base";
|
||||||
|
target: "sel_bevel";
|
||||||
|
target: "sel_shine";
|
||||||
|
target: "efl.text";
|
||||||
|
target: "label2";
|
||||||
|
target: "label3";
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
signal: "efl,state,unselected"; source: "efl";
|
||||||
|
action: STATE_SET "default";
|
||||||
|
target: "sel_shadow";
|
||||||
|
target: "sel_base";
|
||||||
|
target: "sel_bevel";
|
||||||
|
target: "sel_shine";
|
||||||
|
target: "efl.text";
|
||||||
|
target: "label2";
|
||||||
|
target: "label3";
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
signal: "efl,state,disabled"; source: "efl";
|
||||||
|
action: STATE_SET "disabled";
|
||||||
|
target: "event";
|
||||||
|
target: "event_block";
|
||||||
|
target: "efl.text";
|
||||||
|
target: "label2";
|
||||||
|
target: "label3";
|
||||||
|
target: "icon_area";
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
signal: "efl,state,enabled"; source: "efl";
|
||||||
|
action: STATE_SET "default";
|
||||||
|
target: "event";
|
||||||
|
target: "event_block";
|
||||||
|
target: "efl.text";
|
||||||
|
target: "label2";
|
||||||
|
target: "label3";
|
||||||
|
target: "icon_area";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -89,6 +89,11 @@ elm_public_eolian_files = \
|
||||||
lib/elementary/efl_ui_list_default_item.eo \
|
lib/elementary/efl_ui_list_default_item.eo \
|
||||||
lib/elementary/efl_ui_list_empty_item.eo \
|
lib/elementary/efl_ui_list_empty_item.eo \
|
||||||
lib/elementary/efl_ui_list.eo \
|
lib/elementary/efl_ui_list.eo \
|
||||||
|
lib/elementary/efl_ui_grid_item.eo \
|
||||||
|
lib/elementary/efl_ui_grid_default_item_part_icon.eo \
|
||||||
|
lib/elementary/efl_ui_grid_default_item_part_end.eo \
|
||||||
|
lib/elementary/efl_ui_grid_default_item.eo \
|
||||||
|
lib/elementary/efl_ui_grid.eo \
|
||||||
lib/elementary/efl_ui_panes_part.eo \
|
lib/elementary/efl_ui_panes_part.eo \
|
||||||
lib/elementary/efl_ui_progressbar_part.eo \
|
lib/elementary/efl_ui_progressbar_part.eo \
|
||||||
lib/elementary/elm_slider.eo \
|
lib/elementary/elm_slider.eo \
|
||||||
|
@ -415,6 +420,8 @@ includesunstable_HEADERS = \
|
||||||
lib/elementary/efl_ui_item_private.h \
|
lib/elementary/efl_ui_item_private.h \
|
||||||
lib/elementary/efl_ui_list_item_private.h \
|
lib/elementary/efl_ui_list_item_private.h \
|
||||||
lib/elementary/efl_ui_list_private.h \
|
lib/elementary/efl_ui_list_private.h \
|
||||||
|
lib/elementary/efl_ui_grid_item_private.h \
|
||||||
|
lib/elementary/efl_ui_grid_private.h \
|
||||||
lib/elementary/efl_ui_list_view_private.h \
|
lib/elementary/efl_ui_list_view_private.h \
|
||||||
lib/elementary/efl_ui_list_view_seg_array.h \
|
lib/elementary/efl_ui_list_view_seg_array.h \
|
||||||
lib/elementary/elm_widget_web.h \
|
lib/elementary/elm_widget_web.h \
|
||||||
|
@ -844,6 +851,9 @@ lib_elementary_libelementary_la_SOURCES = \
|
||||||
lib/elementary/efl_ui_list_default_item.c \
|
lib/elementary/efl_ui_list_default_item.c \
|
||||||
lib/elementary/efl_ui_list_empty_item.c \
|
lib/elementary/efl_ui_list_empty_item.c \
|
||||||
lib/elementary/efl_ui_list.c \
|
lib/elementary/efl_ui_list.c \
|
||||||
|
lib/elementary/efl_ui_grid_item.c \
|
||||||
|
lib/elementary/efl_ui_grid_default_item.c \
|
||||||
|
lib/elementary/efl_ui_grid.c \
|
||||||
lib/elementary/efl_ui_list_view.c \
|
lib/elementary/efl_ui_list_view.c \
|
||||||
lib/elementary/efl_ui_list_view_precise_layouter.c \
|
lib/elementary/efl_ui_list_view_precise_layouter.c \
|
||||||
lib/elementary/efl_ui_list_view_seg_array.c \
|
lib/elementary/efl_ui_list_view_seg_array.c \
|
||||||
|
@ -1566,7 +1576,8 @@ tests_elementary_elm_suite_SOURCES = \
|
||||||
tests/elementary/elm_test_focus_common.c \
|
tests/elementary/elm_test_focus_common.c \
|
||||||
tests/elementary/elm_test_focus_common.h \
|
tests/elementary/elm_test_focus_common.h \
|
||||||
tests/elementary/elm_test_focus.c \
|
tests/elementary/elm_test_focus.c \
|
||||||
tests/elementary/elm_test_focus_sub.c
|
tests/elementary/elm_test_focus_sub.c \
|
||||||
|
tests/elementary/efl_ui_test_grid.c
|
||||||
|
|
||||||
tests_elementary_elm_suite_CPPFLAGS = \
|
tests_elementary_elm_suite_CPPFLAGS = \
|
||||||
-DELM_INTERNAL_API_ARGESFSDFEFC=1 \
|
-DELM_INTERNAL_API_ARGESFSDFEFC=1 \
|
||||||
|
|
|
@ -0,0 +1,104 @@
|
||||||
|
// gcc -o efl_ui_grid_example_1 efl_ui_grid_example_1.c `pkg-config --cflags --libs elementary`
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "elementary_config.h"
|
||||||
|
#else
|
||||||
|
#define EFL_BETA_API_SUPPORT 1
|
||||||
|
#define EFL_EO_API_SUPPORT 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <Elementary.h>
|
||||||
|
#include <Efl.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define IMAX 500;
|
||||||
|
|
||||||
|
typedef struct _Grid_Event_Data {
|
||||||
|
Eo *grid;
|
||||||
|
Eo *item;
|
||||||
|
} Grid_Event_Data;
|
||||||
|
|
||||||
|
Eo *
|
||||||
|
EoGenerate(const Efl_Class *klass, Eo *parent, Efl_Ui_Dir dir)
|
||||||
|
{
|
||||||
|
Eo* obj = efl_add(klass, parent);
|
||||||
|
if (dir != EFL_UI_DIR_DEFAULT) efl_ui_direction_set(obj, dir);
|
||||||
|
efl_gfx_size_hint_weight_set(obj, EFL_GFX_SIZE_HINT_EXPAND, EFL_GFX_SIZE_HINT_EXPAND);
|
||||||
|
efl_gfx_size_hint_align_set(obj, EFL_GFX_SIZE_HINT_FILL, EFL_GFX_SIZE_HINT_FILL);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI_MAIN int
|
||||||
|
elm_main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
int itemmax = IMAX;
|
||||||
|
int i = 0;
|
||||||
|
if (argv[1]) itemmax = atoi(argv[1]);
|
||||||
|
Eo *win, *box, *bbx, *upbtn, *allbtn, *clrbtn;
|
||||||
|
Eo *grid, *gitem;
|
||||||
|
Grid_Event_Data *gd = calloc(sizeof(Grid_Event_Data *), 1);
|
||||||
|
|
||||||
|
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
|
||||||
|
efl_ui_win_type_set(efl_added, EFL_UI_WIN_BASIC),
|
||||||
|
efl_text_set(efl_added, "Efl.Ui.Grid"),
|
||||||
|
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
|
||||||
|
|
||||||
|
box = EoGenerate(EFL_UI_BOX_CLASS, win, EFL_UI_DIR_VERTICAL);
|
||||||
|
elm_win_resize_object_add(win, box);
|
||||||
|
|
||||||
|
Eo *btn = efl_add(EFL_UI_BUTTON_CLASS, box);
|
||||||
|
efl_gfx_size_hint_weight_set(btn, 0.3, 0.3);
|
||||||
|
efl_gfx_size_hint_align_set(btn, EFL_GFX_SIZE_HINT_FILL, EFL_GFX_SIZE_HINT_FILL);
|
||||||
|
efl_text_set(btn, "BUTTON");
|
||||||
|
efl_pack_end(box, btn);
|
||||||
|
|
||||||
|
Eina_Bool horiz = 0;
|
||||||
|
// TEST#1 : Create Grid
|
||||||
|
gd->grid = grid = EoGenerate(EFL_UI_GRID_CLASS, box, (horiz ? EFL_UI_DIR_HORIZONTAL : EFL_UI_DIR_VERTICAL));
|
||||||
|
efl_ui_grid_item_size_set(grid, EINA_SIZE2D(100, 120)); // 4X4
|
||||||
|
efl_pack_padding_set(grid, 5.0, 5.0, EINA_TRUE);
|
||||||
|
efl_pack_align_set(grid, 0.5, 0.5);
|
||||||
|
efl_pack_end(box, grid);
|
||||||
|
|
||||||
|
// TEST#2 : Set Item Default Size
|
||||||
|
|
||||||
|
Efl_Ui_Grid_Item *target = NULL;
|
||||||
|
|
||||||
|
for (i = 0; i < itemmax; i++)
|
||||||
|
{
|
||||||
|
int r = 0, g = 0, b = 0;
|
||||||
|
// TEST#3 : Create Grid Item
|
||||||
|
gitem = efl_add(EFL_UI_GRID_DEFAULT_ITEM_CLASS, grid);
|
||||||
|
if (i == 300) target = gitem;
|
||||||
|
if (i == 0) gd->item = gitem;
|
||||||
|
Eo *rect = evas_object_rectangle_add(evas_object_evas_get(win));
|
||||||
|
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(gitem, rect);
|
||||||
|
// TEST#4 : Pack end
|
||||||
|
efl_pack_end(grid, gitem);
|
||||||
|
}
|
||||||
|
|
||||||
|
efl_gfx_entity_size_set(win, EINA_SIZE2D(417, 600));
|
||||||
|
|
||||||
|
elm_run();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
ELM_MAIN()
|
|
@ -334,6 +334,11 @@ typedef Eo Efl_Ui_Focus_Manager;
|
||||||
# include <efl_ui_list_default_item.eo.h>
|
# include <efl_ui_list_default_item.eo.h>
|
||||||
# include <efl_ui_list_empty_item.eo.h>
|
# include <efl_ui_list_empty_item.eo.h>
|
||||||
# include <efl_ui_list.eo.h>
|
# include <efl_ui_list.eo.h>
|
||||||
|
# include <efl_ui_grid_item.eo.h>
|
||||||
|
# include <efl_ui_grid_default_item_part_icon.eo.h>
|
||||||
|
# include <efl_ui_grid_default_item_part_end.eo.h>
|
||||||
|
# include <efl_ui_grid_default_item.eo.h>
|
||||||
|
# include <efl_ui_grid.eo.h>
|
||||||
# include <efl_ui_list_view_types.eot.h>
|
# include <efl_ui_list_view_types.eot.h>
|
||||||
# include <efl_ui_list_view_seg_array.h>
|
# include <efl_ui_list_view_seg_array.h>
|
||||||
# include <efl_ui_list_view_seg_array.eo.h>
|
# include <efl_ui_list_view_seg_array.eo.h>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,96 @@
|
||||||
|
import efl_ui_grid_item;
|
||||||
|
|
||||||
|
class Efl.Ui.Grid (Efl.Ui.Layout,
|
||||||
|
Efl.Ui.Scrollable_Interactive,
|
||||||
|
Efl.Ui.Scrollbar,
|
||||||
|
Efl.Pack_Linear, Efl.Pack_Layout,
|
||||||
|
Efl.Ui.Direction,
|
||||||
|
Efl.Ui.Clickable,
|
||||||
|
Efl.Ui.Selectable,
|
||||||
|
Efl.Ui.Multi_Selectable)
|
||||||
|
{
|
||||||
|
[[Simple grid widget with Pack interface.]]
|
||||||
|
methods {
|
||||||
|
@property item_size {
|
||||||
|
[[Property data of item size.]]
|
||||||
|
set {}
|
||||||
|
get {}
|
||||||
|
values {
|
||||||
|
size: Eina.Size2D; [[last selected item of grid.]]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
item_scroll {
|
||||||
|
[[scroll move the item to show in the viewport.]]
|
||||||
|
params {
|
||||||
|
@in item: Efl.Ui.Grid_Item; [[Target item.]]
|
||||||
|
@in animation: bool; [[Boolean value for animation of scroll move.]]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
item_scroll_align {
|
||||||
|
[[scroll move the item to show at the align position of the viewport.]]
|
||||||
|
params {
|
||||||
|
@in item: Efl.Ui.Grid_Item; [[Target item.]]
|
||||||
|
@in align: double; [[align value in Viewport.]]
|
||||||
|
@in animation: bool; [[Boolean value for animation of scroll move.]]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@property last_selected_item {
|
||||||
|
[[Property data of last selected item.]]
|
||||||
|
get {}
|
||||||
|
values {
|
||||||
|
item: Efl.Ui.Grid_Item; [[last selected item of grid.]]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
selected_items_get {
|
||||||
|
[[Get the selected items iterator. The iterator sequence will be decided by selection.]]
|
||||||
|
return: iterator<Efl.Ui.Grid_Item> @owned @warn_unused; [[Iterator covered by selected items list.
|
||||||
|
user have to free the iterator after used.]]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
implements {
|
||||||
|
//Efl.Object
|
||||||
|
Efl.Object.constructor;
|
||||||
|
Efl.Object.finalize;
|
||||||
|
Efl.Object.destructor;
|
||||||
|
Efl.Object.invalidate;
|
||||||
|
|
||||||
|
//Efl.Canvas
|
||||||
|
Efl.Canvas.Group.group_calculate;
|
||||||
|
//Efl.Container
|
||||||
|
Efl.Container.content_iterate;
|
||||||
|
Efl.Container.content_count;
|
||||||
|
|
||||||
|
Efl.Ui.Direction.direction { get; set; }
|
||||||
|
|
||||||
|
//Efl.Ui.Widget
|
||||||
|
Efl.Ui.Widget.theme_apply;
|
||||||
|
|
||||||
|
//Efl.Ui.Focus
|
||||||
|
//Efl.Ui.Focus.Object.on_focus_update;
|
||||||
|
|
||||||
|
//Efl.Pack
|
||||||
|
Efl.Pack.pack_clear;
|
||||||
|
Efl.Pack.unpack_all;
|
||||||
|
Efl.Pack.unpack;
|
||||||
|
Efl.Pack.pack;
|
||||||
|
Efl.Pack_Linear.pack_end;
|
||||||
|
|
||||||
|
Efl.Pack_Linear.pack_begin;
|
||||||
|
Efl.Pack_Linear.pack_before;
|
||||||
|
Efl.Pack_Linear.pack_after;
|
||||||
|
Efl.Pack_Linear.pack_at;
|
||||||
|
Efl.Pack_Linear.pack_unpack_at;
|
||||||
|
Efl.Pack_Linear.pack_index_get;
|
||||||
|
Efl.Pack_Linear.pack_content_get;
|
||||||
|
Efl.Pack_Layout.layout_update;
|
||||||
|
Efl.Pack_Layout.layout_request;
|
||||||
|
Efl.Pack.pack_padding { get; set; }
|
||||||
|
Efl.Pack.pack_align { get; set; }
|
||||||
|
|
||||||
|
//Efl.Ui.Scrollable
|
||||||
|
Efl.Ui.Scrollable_Interactive.match_content { set; }
|
||||||
|
|
||||||
|
//Efl.Ui.Multi_Selectable
|
||||||
|
Efl.Ui.Multi_Selectable.select_mode {get; set;}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,112 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "elementary_config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define EFL_UI_GRID_DEFAULT_ITEM_PROTECTED
|
||||||
|
#define EFL_PART_PROTECTED
|
||||||
|
|
||||||
|
#include <Elementary.h>
|
||||||
|
|
||||||
|
#include "elm_priv.h"
|
||||||
|
#include "efl_ui_grid_default_item_part_icon.eo.h"
|
||||||
|
#include "efl_ui_grid_default_item_part_end.eo.h"
|
||||||
|
#include "elm_part_helper.h"
|
||||||
|
|
||||||
|
#define MY_CLASS EFL_UI_GRID_DEFAULT_ITEM_CLASS
|
||||||
|
#define MY_CLASS_PFX efl_ui_grid_default_item
|
||||||
|
|
||||||
|
#define MY_CLASS_NAME "Efl.Ui.Grid_Default_Item"
|
||||||
|
|
||||||
|
EOLIAN static Efl_Object *
|
||||||
|
_efl_ui_grid_default_item_efl_object_finalize(Eo *obj, void *pd EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Eo *eo;
|
||||||
|
eo = efl_finalize(efl_super(obj, MY_CLASS));
|
||||||
|
ELM_WIDGET_DATA_GET_OR_RETURN(eo, wd, eo);
|
||||||
|
Efl_Ui_Theme_Apply_Result theme_apply = efl_ui_layout_theme_set(obj, "grid_item", NULL, NULL);
|
||||||
|
|
||||||
|
if (theme_apply == EFL_UI_THEME_APPLY_RESULT_FAIL)
|
||||||
|
CRI("Default Item(%p) failed to set theme [efl/grid_item]!", eo);
|
||||||
|
return eo;
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_efl_ui_grid_default_item_efl_object_destructor(Eo *obj, void *pd EINA_UNUSED)
|
||||||
|
{
|
||||||
|
efl_destructor(efl_super(obj, MY_CLASS));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Efl.Part */
|
||||||
|
|
||||||
|
ELM_PART_TEXT_DEFAULT_GET(efl_ui_grid_default_item, "efl.text")
|
||||||
|
ELM_PART_TEXT_DEFAULT_IMPLEMENT(efl_ui_grid_default_item, void)
|
||||||
|
ELM_PART_MARKUP_DEFAULT_IMPLEMENT(efl_ui_grid_default_item, void)
|
||||||
|
ELM_PART_CONTENT_DEFAULT_GET(efl_ui_grid_default_item, "efl.icon")
|
||||||
|
ELM_PART_CONTENT_DEFAULT_IMPLEMENT(efl_ui_grid_default_item, void
|
||||||
|
)
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
_efl_ui_grid_default_item_part_icon_efl_content_content_set(Eo *obj, void *pd EINA_UNUSED, Efl_Gfx_Entity *content)
|
||||||
|
{
|
||||||
|
Elm_Part_Data *wd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
|
||||||
|
return efl_content_set(efl_part(efl_super(wd->obj, MY_CLASS), wd->part), content);
|
||||||
|
}
|
||||||
|
|
||||||
|
Efl_Gfx_Entity *
|
||||||
|
_efl_ui_grid_default_item_part_icon_efl_content_content_get(const Eo *obj, void *pd EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Elm_Part_Data *wd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
|
||||||
|
return efl_content_get(efl_part(efl_super(wd->obj, MY_CLASS), wd->part));
|
||||||
|
}
|
||||||
|
|
||||||
|
Efl_Gfx_Entity *
|
||||||
|
_efl_ui_grid_default_item_part_icon_efl_content_content_unset(Eo *obj, void *pd EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Elm_Part_Data *wd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
|
||||||
|
return efl_content_unset(efl_part(efl_super(wd->obj, MY_CLASS), wd->part));
|
||||||
|
}
|
||||||
|
#include "efl_ui_grid_default_item_part_icon.eo.c"
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
_efl_ui_grid_default_item_part_end_efl_content_content_set(Eo *obj, void *pd EINA_UNUSED, Efl_Gfx_Entity *content)
|
||||||
|
{
|
||||||
|
Elm_Part_Data *wd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
|
||||||
|
return efl_content_set(efl_part(efl_super(wd->obj, MY_CLASS), wd->part), content);
|
||||||
|
}
|
||||||
|
|
||||||
|
Efl_Gfx_Entity *
|
||||||
|
_efl_ui_grid_default_item_part_end_efl_content_content_get(const Eo *obj, void *pd EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Elm_Part_Data *wd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
|
||||||
|
return efl_content_get(efl_part(efl_super(wd->obj, MY_CLASS), wd->part));
|
||||||
|
}
|
||||||
|
|
||||||
|
Efl_Gfx_Entity *
|
||||||
|
_efl_ui_grid_default_item_part_end_efl_content_content_unset(Eo *obj, void *pd EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Elm_Part_Data *wd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
|
||||||
|
return efl_content_unset(efl_part(efl_super(wd->obj, MY_CLASS), wd->part));
|
||||||
|
}
|
||||||
|
#include "efl_ui_grid_default_item_part_end.eo.c"
|
||||||
|
|
||||||
|
EOLIAN static Efl_Object *
|
||||||
|
_efl_ui_grid_default_item_efl_part_part_get(const Eo *obj, void *wd EINA_UNUSED, const char *part)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
|
||||||
|
if (eina_streq(part, "text"))
|
||||||
|
return ELM_PART_IMPLEMENT(EFL_UI_LAYOUT_PART_TEXT_CLASS, obj, "efl.text");
|
||||||
|
else if (eina_streq(part, "icon"))
|
||||||
|
return ELM_PART_IMPLEMENT(EFL_UI_GRID_DEFAULT_ITEM_PART_ICON_CLASS, obj, "efl.icon");
|
||||||
|
else if (eina_streq(part, "end"))
|
||||||
|
return ELM_PART_IMPLEMENT(EFL_UI_GRID_DEFAULT_ITEM_PART_END_CLASS, obj, "efl.end");
|
||||||
|
|
||||||
|
return efl_part_get(efl_super(obj, MY_CLASS), part);
|
||||||
|
}
|
||||||
|
/* Efl.Part end */
|
||||||
|
|
||||||
|
/* Internal EO APIs and hidden overrides */
|
||||||
|
#define EFL_UI_GRID_DEFAULT_ITEM_EXTRA_OPS \
|
||||||
|
ELM_PART_TEXT_DEFAULT_OPS(efl_ui_grid_default_item), \
|
||||||
|
ELM_PART_CONTENT_DEFAULT_OPS(efl_ui_grid_default_item)
|
||||||
|
|
||||||
|
#include "efl_ui_grid_default_item.eo.c"
|
|
@ -0,0 +1,28 @@
|
||||||
|
|
||||||
|
class Efl.Ui.Grid_Default_Item (Efl.Ui.Grid_Item,
|
||||||
|
Efl.Text,
|
||||||
|
Efl.Text_Markup,
|
||||||
|
Efl.Ui.Translatable,
|
||||||
|
Efl.Content)
|
||||||
|
{
|
||||||
|
[[Grid Default Item class.
|
||||||
|
This class need to be sub object of list widget.
|
||||||
|
text and contents can be appliable by efl_text,
|
||||||
|
efl_content or efl_part APIs.]]
|
||||||
|
data: null;
|
||||||
|
parts {
|
||||||
|
icon: Efl.Ui.Grid_Default_Item_Part_Icon; [[]]
|
||||||
|
end: Efl.Ui.Grid_Default_Item_Part_End; [[]]
|
||||||
|
}
|
||||||
|
implements {
|
||||||
|
//Efl.Object
|
||||||
|
Efl.Object.finalize;
|
||||||
|
Efl.Object.destructor;
|
||||||
|
Efl.Text.text { get; set; }
|
||||||
|
Efl.Text_Markup.markup { get; set; }
|
||||||
|
Efl.Ui.Translatable.translatable_text { get; set; }
|
||||||
|
Efl.Content.content { get; set; }
|
||||||
|
Efl.Content.content_unset;
|
||||||
|
Efl.Part.part_get;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
class Efl.Ui.Grid_Default_Item_Part_End (Efl.Ui.Layout_Part, Efl.Content)
|
||||||
|
{
|
||||||
|
[[Grid Default Item internal content of end part class]]
|
||||||
|
data: null;
|
||||||
|
implements {
|
||||||
|
Efl.Content.content { get; set; }
|
||||||
|
Efl.Content.content_unset;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
class Efl.Ui.Grid_Default_Item_Part_Icon (Efl.Ui.Layout_Part, Efl.Content)
|
||||||
|
{
|
||||||
|
[[Grid Default Item internal content of icon part class]]
|
||||||
|
data: null;
|
||||||
|
implements {
|
||||||
|
Efl.Content.content { get; set; }
|
||||||
|
Efl.Content.content_unset;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,83 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "elementary_config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define EFL_ACCESS_PROTECTED
|
||||||
|
#define EFL_UI_WIDGET_PART_BG_PROTECTED
|
||||||
|
|
||||||
|
#include <Elementary.h>
|
||||||
|
|
||||||
|
#include "elm_priv.h"
|
||||||
|
#include "efl_ui_grid_item_private.h"
|
||||||
|
|
||||||
|
#define MY_CLASS EFL_UI_GRID_ITEM_CLASS
|
||||||
|
#define MY_CLASS_PFX efl_ui_grid_item
|
||||||
|
|
||||||
|
#define MY_CLASS_NAME "Efl.Ui.Grid_Item"
|
||||||
|
|
||||||
|
static void
|
||||||
|
_sizing_eval(Evas_Object *obj, Efl_Ui_Grid_Item_Data *pd)
|
||||||
|
{
|
||||||
|
Evas_Coord minh = -1, minw = -1;
|
||||||
|
Evas_Coord rest_w = 0, rest_h = 0;
|
||||||
|
ELM_WIDGET_DATA_GET_OR_RETURN(pd->obj, wd);
|
||||||
|
|
||||||
|
edje_object_size_min_restricted_calc(wd->resize_obj, &minw, &minh,
|
||||||
|
rest_w, rest_h);
|
||||||
|
evas_object_size_hint_min_set(obj, minw, minh);
|
||||||
|
|
||||||
|
pd->needs_size_calc = EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_efl_ui_grid_item_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Grid_Item_Data *pd)
|
||||||
|
{
|
||||||
|
if (pd->needs_size_calc) return;
|
||||||
|
pd->needs_size_calc = EINA_TRUE;
|
||||||
|
|
||||||
|
efl_canvas_group_change(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_efl_ui_grid_item_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Grid_Item_Data *pd)
|
||||||
|
{
|
||||||
|
if (pd->needs_size_calc)
|
||||||
|
{
|
||||||
|
_sizing_eval(obj, pd);
|
||||||
|
pd->needs_size_calc = EINA_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eo *
|
||||||
|
_efl_ui_grid_item_efl_object_constructor(Eo *obj, Efl_Ui_Grid_Item_Data *pd)
|
||||||
|
{
|
||||||
|
pd->obj = obj;
|
||||||
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Efl_Object *
|
||||||
|
_efl_ui_grid_item_efl_object_finalize(Eo *obj, Efl_Ui_Grid_Item_Data *pd EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Eo *eo;
|
||||||
|
eo = efl_finalize(efl_super(obj, MY_CLASS));
|
||||||
|
ELM_WIDGET_DATA_GET_OR_RETURN(eo, wd, eo);
|
||||||
|
|
||||||
|
return eo;
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_efl_ui_grid_item_efl_object_destructor(Eo *obj, Efl_Ui_Grid_Item_Data *pd EINA_UNUSED)
|
||||||
|
{
|
||||||
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||||
|
|
||||||
|
efl_destructor(efl_super(obj, MY_CLASS));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Internal EO APIs and hidden overrides */
|
||||||
|
|
||||||
|
#define EFL_UI_GRID_ITEM_EXTRA_OPS \
|
||||||
|
ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_grid_item)
|
||||||
|
|
||||||
|
#include "efl_ui_grid_item.eo.c"
|
|
@ -0,0 +1,12 @@
|
||||||
|
|
||||||
|
abstract Efl.Ui.Grid_Item (Efl.Ui.Item)
|
||||||
|
{
|
||||||
|
implements {
|
||||||
|
//Efl.Object
|
||||||
|
Efl.Object.constructor;
|
||||||
|
Efl.Object.finalize;
|
||||||
|
Efl.Object.destructor;
|
||||||
|
//Efl.Canvas
|
||||||
|
Efl.Canvas.Group.group_calculate;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
#ifndef EFL_UI_GRID_ITEM_PRIVATE_H
|
||||||
|
#define EFL_UI_GRID_ITEM_PRIVATE_H
|
||||||
|
|
||||||
|
#include "Elementary.h"
|
||||||
|
|
||||||
|
typedef struct _Efl_Ui_Grid_Item_Data
|
||||||
|
{
|
||||||
|
// Eo Objects
|
||||||
|
Eo *obj; /* Self-Object */
|
||||||
|
Eo *parent; /* Parent Widget */
|
||||||
|
Eina_Rect geo;
|
||||||
|
int index;
|
||||||
|
struct {
|
||||||
|
int row;
|
||||||
|
int col;
|
||||||
|
} pos;
|
||||||
|
|
||||||
|
/* Boolean Values */
|
||||||
|
Eina_Bool needs_size_calc : 1; /* Flag for Size calculation */
|
||||||
|
Eina_Bool update_me: 1;
|
||||||
|
Eina_Bool update_begin: 1;
|
||||||
|
} Efl_Ui_Grid_Item_Data;
|
||||||
|
|
||||||
|
|
||||||
|
#define EFL_UI_GRID_ITEM_DATA_GET(o, pd) \
|
||||||
|
Efl_Ui_Grid_Item_Data * pd = efl_data_scope_safe_get(o, EFL_UI_GRID_ITEM_CLASS)
|
||||||
|
|
||||||
|
#define EFL_UI_GRID_ITEM_DATA_GET_OR_RETURN(o, ptr, ...) \
|
||||||
|
EFL_UI_GRID_ITEM_DATA_GET(o, ptr); \
|
||||||
|
if (EINA_UNLIKELY(!ptr)) \
|
||||||
|
{ \
|
||||||
|
ERR("No widget data for object %p (%s)", \
|
||||||
|
o, evas_object_type_get(o)); \
|
||||||
|
return __VA_ARGS__; \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define EFL_UI_GRID_ITEM_CHECK_OR_RETURN(obj, ...) \
|
||||||
|
if (EINA_UNLIKELY(!efl_isa((obj), EFL_UI_GRID_ITEM_CLASS))) \
|
||||||
|
return __VA_ARGS__;
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,83 @@
|
||||||
|
#ifndef EFL_UI_GRID_PRIVATE_H
|
||||||
|
#define EFL_UI_GRID_PRIVATE_H
|
||||||
|
|
||||||
|
#include "Elementary.h"
|
||||||
|
|
||||||
|
typedef struct _Efl_Ui_Grid_Data
|
||||||
|
{
|
||||||
|
// Eo Objects
|
||||||
|
Eo *obj;
|
||||||
|
Eo *pan; /* Internal pan for scroll */
|
||||||
|
Eo *content;
|
||||||
|
Eo *smanager; /* Scroll Manager for support scroll with pan */
|
||||||
|
Eina_Rect geo;
|
||||||
|
Eina_Position2D pre_pos;
|
||||||
|
Efl_Ui_Dir dir;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
Efl_Ui_Grid_Item *item; /* Scroll target item */
|
||||||
|
double align; /* Item scroll aligned position.
|
||||||
|
-1 is for default case of scroll in */
|
||||||
|
Eina_Bool anim : 1; /* boolean data for animation on scroll */
|
||||||
|
} scroll; /* Item scroll values for deferred operation */
|
||||||
|
|
||||||
|
struct {
|
||||||
|
Eina_Size2D size;
|
||||||
|
Eina_Size2D pad;
|
||||||
|
struct {
|
||||||
|
double w;
|
||||||
|
double h;
|
||||||
|
} align;
|
||||||
|
int count;
|
||||||
|
int row;
|
||||||
|
int col;
|
||||||
|
} item;
|
||||||
|
|
||||||
|
int linemax;
|
||||||
|
|
||||||
|
Eina_List *items; /* All item list for internal maintaining */
|
||||||
|
Eina_List *selected; /* Selected items list */
|
||||||
|
Efl_Ui_Grid_Item *last_selected; /* latest selected item */
|
||||||
|
|
||||||
|
Efl_Ui_Select_Mode select_mode; /* Select mode for items
|
||||||
|
with single or multiple seleciton */
|
||||||
|
|
||||||
|
// Boolean Data
|
||||||
|
Eina_Bool freeze_want : 1; /* Flag for Scroll freezing */
|
||||||
|
Eina_Bool match_content_w: 1; /* Flag for size matching on content width.
|
||||||
|
it will disable horizontal scroll */
|
||||||
|
Eina_Bool match_content_h: 1; /* Flag for size matching on content height.
|
||||||
|
it will disable vertical scroll */
|
||||||
|
Eina_Bool pan_resized : 1; /* Flag for pan resized.
|
||||||
|
This value is used for checking scroll is
|
||||||
|
calculated after initialized */
|
||||||
|
Eina_Bool need_update: 1;
|
||||||
|
Eina_Bool pad_scalable: 1;
|
||||||
|
} Efl_Ui_Grid_Data;
|
||||||
|
|
||||||
|
typedef struct _Item_Iterator
|
||||||
|
{
|
||||||
|
Eina_Iterator iterator;
|
||||||
|
Eina_List *list;
|
||||||
|
Eina_Iterator *real_iterator;
|
||||||
|
Eo *object;
|
||||||
|
} Item_Iterator;
|
||||||
|
|
||||||
|
|
||||||
|
#define EFL_UI_GRID_DATA_GET(o, pd) \
|
||||||
|
Efl_Ui_Grid_Data * pd = efl_data_scope_safe_get(o, EFL_UI_GRID_CLASS)
|
||||||
|
|
||||||
|
#define EFL_UI_GRID_DATA_GET_OR_RETURN(o, ptr, ...) \
|
||||||
|
EFL_UI_GRID_DATA_GET(o, ptr); \
|
||||||
|
if (EINA_UNLIKELY(!ptr)) \
|
||||||
|
{ \
|
||||||
|
ERR("No widget data for object %p (%s)", \
|
||||||
|
o, evas_object_type_get(o)); \
|
||||||
|
return __VA_ARGS__; \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define EFL_UI_GRID_CHECK(obj) \
|
||||||
|
if (EINA_UNLIKELY(!efl_isa((obj), EFL_UI_GRID_CLASS))) \
|
||||||
|
return
|
||||||
|
|
||||||
|
#endif
|
|
@ -6,4 +6,4 @@ class Efl.Ui.List_Default_Item_Part_Icon (Efl.Ui.Layout_Part, Efl.Content)
|
||||||
Efl.Content.content { get; set; }
|
Efl.Content.content { get; set; }
|
||||||
Efl.Content.content_unset;
|
Efl.Content.content_unset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,6 +216,11 @@ pub_eo_files = [
|
||||||
'efl_ui_list_default_item.eo',
|
'efl_ui_list_default_item.eo',
|
||||||
'efl_ui_list_empty_item.eo',
|
'efl_ui_list_empty_item.eo',
|
||||||
'efl_ui_list.eo',
|
'efl_ui_list.eo',
|
||||||
|
'efl_ui_grid_item.eo',
|
||||||
|
'efl_ui_grid_default_item_part_icon.eo',
|
||||||
|
'efl_ui_grid_default_item_part_end.eo',
|
||||||
|
'efl_ui_grid_default_item.eo',
|
||||||
|
'efl_ui_grid.eo',
|
||||||
'efl_ui_panes_part.eo',
|
'efl_ui_panes_part.eo',
|
||||||
'efl_ui_progressbar_part.eo',
|
'efl_ui_progressbar_part.eo',
|
||||||
'elm_slider.eo',
|
'elm_slider.eo',
|
||||||
|
@ -441,6 +446,8 @@ elementary_headers_unstable = [
|
||||||
'efl_ui_item_private.h',
|
'efl_ui_item_private.h',
|
||||||
'efl_ui_list_item_private.h',
|
'efl_ui_list_item_private.h',
|
||||||
'efl_ui_list_private.h',
|
'efl_ui_list_private.h',
|
||||||
|
'efl_ui_grid_item_private.h',
|
||||||
|
'efl_ui_grid_private.h',
|
||||||
'efl_ui_list_view_private.h',
|
'efl_ui_list_view_private.h',
|
||||||
'efl_ui_list_view_seg_array.h',
|
'efl_ui_list_view_seg_array.h',
|
||||||
'elm_widget_web.h',
|
'elm_widget_web.h',
|
||||||
|
@ -866,6 +873,9 @@ elementary_src = [
|
||||||
'efl_ui_list_default_item.c',
|
'efl_ui_list_default_item.c',
|
||||||
'efl_ui_list_empty_item.c',
|
'efl_ui_list_empty_item.c',
|
||||||
'efl_ui_list.c',
|
'efl_ui_list.c',
|
||||||
|
'efl_ui_grid_item.c',
|
||||||
|
'efl_ui_grid_default_item.c',
|
||||||
|
'efl_ui_grid.c',
|
||||||
'efl_ui_list_view.c',
|
'efl_ui_list_view.c',
|
||||||
'efl_ui_list_view_precise_layouter.c',
|
'efl_ui_list_view_precise_layouter.c',
|
||||||
'efl_ui_list_view_seg_array.c',
|
'efl_ui_list_view_seg_array.c',
|
||||||
|
|
|
@ -0,0 +1,338 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "elementary_config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define EFL_ACCESS_OBJECT_BETA
|
||||||
|
#include <Elementary.h>
|
||||||
|
#include "elm_suite.h"
|
||||||
|
|
||||||
|
static Eo *win, *box;
|
||||||
|
static Efl_Ui_Grid *grid;
|
||||||
|
|
||||||
|
static void
|
||||||
|
grid_setup()
|
||||||
|
{
|
||||||
|
//win = win_add();
|
||||||
|
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
|
||||||
|
efl_ui_win_type_set(efl_added, EFL_UI_WIN_BASIC),
|
||||||
|
efl_text_set(efl_added, "Efl.Ui.Grid"),
|
||||||
|
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
|
||||||
|
box = efl_add(EFL_UI_BOX_CLASS, win,
|
||||||
|
efl_ui_direction_set(efl_added, EFL_UI_DIR_VERTICAL));
|
||||||
|
efl_gfx_size_hint_weight_set(box, EFL_GFX_SIZE_HINT_EXPAND, EFL_GFX_SIZE_HINT_EXPAND);
|
||||||
|
efl_gfx_size_hint_align_set(box, EFL_GFX_SIZE_HINT_FILL, EFL_GFX_SIZE_HINT_FILL);
|
||||||
|
elm_win_resize_object_add(win, box);
|
||||||
|
|
||||||
|
grid = efl_add(EFL_UI_GRID_CLASS, box);
|
||||||
|
|
||||||
|
efl_ui_grid_item_size_set(grid, EINA_SIZE2D(100, 100));
|
||||||
|
efl_pack_padding_set(grid, 5.0, 5.0, EINA_TRUE);
|
||||||
|
efl_pack_align_set(grid, 0.5, 0.5);
|
||||||
|
efl_pack_end(box, grid);
|
||||||
|
|
||||||
|
efl_gfx_entity_size_set(win, EINA_SIZE2D(500, 500));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
grid_teardown()
|
||||||
|
{
|
||||||
|
if (grid)
|
||||||
|
{
|
||||||
|
efl_del(grid);
|
||||||
|
grid = NULL;
|
||||||
|
}
|
||||||
|
if (win)
|
||||||
|
{
|
||||||
|
efl_del(win);
|
||||||
|
win = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
grid_item_pack(Eo *grid, int count, Eina_List **l)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
Efl_Ui_Grid_Item *item;
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
item = efl_add(EFL_UI_GRID_DEFAULT_ITEM_CLASS, grid);
|
||||||
|
if (!item) return EINA_FALSE;
|
||||||
|
if (l) *l = eina_list_append(*l, item);
|
||||||
|
efl_pack(grid, item);
|
||||||
|
}
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFL_START_TEST (efl_ui_grid_class_check)
|
||||||
|
{
|
||||||
|
const char *class;
|
||||||
|
|
||||||
|
class = efl_class_name_get(grid);
|
||||||
|
|
||||||
|
ck_assert(class != NULL);
|
||||||
|
ck_assert(!strcmp(class, "Efl.Ui.Grid"));
|
||||||
|
}
|
||||||
|
EFL_END_TEST
|
||||||
|
|
||||||
|
EFL_START_TEST (efl_ui_grid_pack)
|
||||||
|
{
|
||||||
|
Efl_Ui_Grid_Item *item;
|
||||||
|
int count;
|
||||||
|
|
||||||
|
item = efl_add(EFL_UI_GRID_DEFAULT_ITEM_CLASS, grid);
|
||||||
|
efl_pack(grid, item);
|
||||||
|
|
||||||
|
count = efl_content_count(grid);
|
||||||
|
|
||||||
|
ck_assert(count == 1);
|
||||||
|
}
|
||||||
|
EFL_END_TEST
|
||||||
|
|
||||||
|
EFL_START_TEST (efl_ui_grid_unpack)
|
||||||
|
{
|
||||||
|
Efl_Ui_Grid_Item *item;
|
||||||
|
int count;
|
||||||
|
|
||||||
|
item = efl_add(EFL_UI_GRID_DEFAULT_ITEM_CLASS, grid);
|
||||||
|
efl_pack(grid, item);
|
||||||
|
|
||||||
|
efl_pack_unpack(grid, item);
|
||||||
|
|
||||||
|
count = efl_content_count(grid);
|
||||||
|
ck_assert(count == 0);
|
||||||
|
|
||||||
|
efl_del(item);
|
||||||
|
}
|
||||||
|
EFL_END_TEST
|
||||||
|
|
||||||
|
EFL_START_TEST (efl_ui_grid_unpack_all)
|
||||||
|
{
|
||||||
|
Efl_Ui_Grid_Item *item;
|
||||||
|
int count_before = 10;
|
||||||
|
int count;
|
||||||
|
Eina_Iterator *itor;
|
||||||
|
|
||||||
|
ck_assert(grid_item_pack(grid, count_before, NULL) != EINA_FALSE);
|
||||||
|
|
||||||
|
itor = efl_content_iterate(grid);
|
||||||
|
efl_pack_unpack_all(grid);
|
||||||
|
|
||||||
|
count = efl_content_count(grid);
|
||||||
|
ck_assert(count == 0);
|
||||||
|
|
||||||
|
EINA_ITERATOR_FOREACH(itor, item)
|
||||||
|
efl_del(item);
|
||||||
|
|
||||||
|
free(itor);
|
||||||
|
}
|
||||||
|
EFL_END_TEST
|
||||||
|
|
||||||
|
EFL_START_TEST (efl_ui_grid_pack_clear)
|
||||||
|
{
|
||||||
|
int count_before = 10;
|
||||||
|
int count;
|
||||||
|
|
||||||
|
ck_assert(grid_item_pack(grid, count_before, NULL) != EINA_FALSE);
|
||||||
|
|
||||||
|
efl_pack_clear(grid);
|
||||||
|
|
||||||
|
count = efl_content_count(grid);
|
||||||
|
ck_assert(count == 0);
|
||||||
|
}
|
||||||
|
EFL_END_TEST
|
||||||
|
|
||||||
|
|
||||||
|
EFL_START_TEST (efl_ui_grid_pack_end)
|
||||||
|
{
|
||||||
|
Efl_Ui_Grid_Item *item, *compare;
|
||||||
|
int count_before = 10;
|
||||||
|
int count;
|
||||||
|
|
||||||
|
ck_assert(grid_item_pack(grid, count_before, NULL) != EINA_FALSE);
|
||||||
|
|
||||||
|
item = efl_add(EFL_UI_GRID_DEFAULT_ITEM_CLASS, grid);
|
||||||
|
ck_assert(item != NULL);
|
||||||
|
efl_pack_end(grid, item);
|
||||||
|
|
||||||
|
count = efl_content_count(grid);
|
||||||
|
ck_assert(count == (count_before + 1));
|
||||||
|
|
||||||
|
compare = efl_pack_content_get(grid, (count - 1));
|
||||||
|
ck_assert(compare != NULL);
|
||||||
|
ck_assert(item == compare);
|
||||||
|
}
|
||||||
|
EFL_END_TEST
|
||||||
|
|
||||||
|
EFL_START_TEST (efl_ui_grid_pack_begin)
|
||||||
|
{
|
||||||
|
Efl_Ui_Grid_Item *item, *compare;
|
||||||
|
int count_before = 10;
|
||||||
|
int count;
|
||||||
|
|
||||||
|
ck_assert(grid_item_pack(grid, count_before, NULL) != EINA_FALSE);
|
||||||
|
|
||||||
|
item = efl_add(EFL_UI_GRID_DEFAULT_ITEM_CLASS, grid);
|
||||||
|
ck_assert(item != NULL);
|
||||||
|
efl_pack_begin(grid, item);
|
||||||
|
|
||||||
|
count = efl_content_count(grid);
|
||||||
|
ck_assert(count == (count_before + 1));
|
||||||
|
|
||||||
|
compare = efl_pack_content_get(grid, 0);
|
||||||
|
ck_assert(compare != NULL);
|
||||||
|
ck_assert(item == compare);
|
||||||
|
}
|
||||||
|
EFL_END_TEST
|
||||||
|
|
||||||
|
EFL_START_TEST (efl_ui_grid_pack_after)
|
||||||
|
{
|
||||||
|
Efl_Ui_Grid_Item *item, *after, *compare;
|
||||||
|
int count_before = 10;
|
||||||
|
int count;
|
||||||
|
int index = 5;
|
||||||
|
|
||||||
|
ck_assert(grid_item_pack(grid, count_before, NULL) != EINA_FALSE);
|
||||||
|
|
||||||
|
after = efl_pack_content_get(grid, index);
|
||||||
|
ck_assert(after != NULL);
|
||||||
|
|
||||||
|
item = efl_add(EFL_UI_GRID_DEFAULT_ITEM_CLASS, grid);
|
||||||
|
ck_assert(item != NULL);
|
||||||
|
efl_pack_after(grid, item, after);
|
||||||
|
|
||||||
|
count = efl_content_count(grid);
|
||||||
|
ck_assert(count == (count_before + 1));
|
||||||
|
|
||||||
|
compare = efl_pack_content_get(grid, index + 1);
|
||||||
|
ck_assert(compare != NULL);
|
||||||
|
ck_assert(item == compare);
|
||||||
|
}
|
||||||
|
EFL_END_TEST
|
||||||
|
|
||||||
|
EFL_START_TEST (efl_ui_grid_pack_before)
|
||||||
|
{
|
||||||
|
Efl_Ui_Grid_Item *item, *before, *compare;
|
||||||
|
int count_before = 10;
|
||||||
|
int count;
|
||||||
|
int index = 5;
|
||||||
|
|
||||||
|
ck_assert(grid_item_pack(grid, count_before, NULL) != EINA_FALSE);
|
||||||
|
|
||||||
|
before = efl_pack_content_get(grid, index);
|
||||||
|
ck_assert(before != NULL);
|
||||||
|
|
||||||
|
item = efl_add(EFL_UI_GRID_DEFAULT_ITEM_CLASS, grid);
|
||||||
|
ck_assert(item != NULL);
|
||||||
|
efl_pack_before(grid, item, before);
|
||||||
|
|
||||||
|
count = efl_content_count(grid);
|
||||||
|
ck_assert(count == (count_before + 1));
|
||||||
|
|
||||||
|
compare = efl_pack_content_get(grid, index);
|
||||||
|
ck_assert(compare != NULL);
|
||||||
|
ck_assert(item == compare);
|
||||||
|
}
|
||||||
|
EFL_END_TEST
|
||||||
|
|
||||||
|
EFL_START_TEST (efl_ui_grid_content_count)
|
||||||
|
{
|
||||||
|
int count = 10, compare;
|
||||||
|
|
||||||
|
ck_assert(grid_item_pack(grid, count, NULL) != EINA_FALSE);
|
||||||
|
|
||||||
|
compare = efl_content_count(grid);
|
||||||
|
|
||||||
|
ck_assert(count == compare);
|
||||||
|
}
|
||||||
|
EFL_END_TEST
|
||||||
|
|
||||||
|
EFL_START_TEST (efl_ui_grid_content_iterate)
|
||||||
|
{
|
||||||
|
int count = 10;
|
||||||
|
Efl_Ui_Grid_Item *item;
|
||||||
|
Eina_List *item_list = NULL;
|
||||||
|
Eina_Iterator *item_itr;
|
||||||
|
|
||||||
|
ck_assert(grid_item_pack(grid, count, &item_list) != EINA_FALSE);
|
||||||
|
|
||||||
|
/* Get Item Content Iterator */
|
||||||
|
item_itr = efl_content_iterate(grid);
|
||||||
|
|
||||||
|
EINA_ITERATOR_FOREACH(item_itr, item)
|
||||||
|
{
|
||||||
|
/* Compare the iterator data and list data */
|
||||||
|
ck_assert(item == eina_list_data_get(item_list));
|
||||||
|
item_list = eina_list_remove(item_list, item);
|
||||||
|
}
|
||||||
|
eina_iterator_free(item_itr);
|
||||||
|
|
||||||
|
ck_assert(item_list == NULL);
|
||||||
|
}
|
||||||
|
EFL_END_TEST
|
||||||
|
|
||||||
|
|
||||||
|
int tcount = 0;
|
||||||
|
|
||||||
|
static void
|
||||||
|
grid_timer_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
||||||
|
{
|
||||||
|
ck_assert(0);
|
||||||
|
efl_del(event->object);
|
||||||
|
ecore_main_loop_quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
grid_scroll_start_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
|
||||||
|
{
|
||||||
|
//printf("LSH :: scroll start!!!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
grid_scroll_stop_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Efl_Loop_Timer *timer = data;
|
||||||
|
efl_del(timer);
|
||||||
|
ecore_main_loop_quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
EFL_CALLBACKS_ARRAY_DEFINE(grid_scroll_callbacks,
|
||||||
|
{ EFL_UI_EVENT_SCROLL_START, grid_scroll_start_cb },
|
||||||
|
{ EFL_UI_EVENT_SCROLL_STOP, grid_scroll_stop_cb });
|
||||||
|
|
||||||
|
EFL_START_TEST (efl_ui_grid_scroll)
|
||||||
|
{
|
||||||
|
Efl_Ui_Grid_Item *item;
|
||||||
|
Efl_Loop_Timer *timer;
|
||||||
|
|
||||||
|
ck_assert(grid_item_pack(grid, 100, NULL) != EINA_FALSE);
|
||||||
|
item = efl_pack_content_get(grid, 50);
|
||||||
|
|
||||||
|
timer = efl_add(EFL_LOOP_TIMER_CLASS, efl_main_loop_get(),
|
||||||
|
efl_event_callback_add(efl_added, EFL_LOOP_TIMER_EVENT_TICK, grid_timer_cb, NULL),
|
||||||
|
efl_loop_timer_loop_reset(efl_added),
|
||||||
|
efl_loop_timer_interval_set(efl_added, 3.0));
|
||||||
|
|
||||||
|
efl_event_callback_array_add(grid, grid_scroll_callbacks(), timer);
|
||||||
|
/*FIXME: efl_ui_scroll_interface only emit scroll event when animation exist */
|
||||||
|
efl_ui_grid_item_scroll(grid, item, EINA_TRUE);
|
||||||
|
ecore_main_loop_begin();
|
||||||
|
}
|
||||||
|
EFL_END_TEST
|
||||||
|
|
||||||
|
|
||||||
|
void efl_ui_test_grid(TCase *tc)
|
||||||
|
{
|
||||||
|
tcase_add_checked_fixture(tc, grid_setup, grid_teardown);
|
||||||
|
tcase_add_test(tc, efl_ui_grid_class_check);
|
||||||
|
tcase_add_test(tc, efl_ui_grid_pack);
|
||||||
|
tcase_add_test(tc, efl_ui_grid_unpack);
|
||||||
|
tcase_add_test(tc, efl_ui_grid_unpack_all);
|
||||||
|
tcase_add_test(tc, efl_ui_grid_pack_clear);
|
||||||
|
tcase_add_test(tc, efl_ui_grid_pack_end);
|
||||||
|
tcase_add_test(tc, efl_ui_grid_pack_begin);
|
||||||
|
tcase_add_test(tc, efl_ui_grid_pack_after);
|
||||||
|
tcase_add_test(tc, efl_ui_grid_pack_before);
|
||||||
|
tcase_add_test(tc, efl_ui_grid_content_count);
|
||||||
|
tcase_add_test(tc, efl_ui_grid_content_iterate);
|
||||||
|
tcase_add_test(tc, efl_ui_grid_scroll);
|
||||||
|
}
|
|
@ -89,6 +89,10 @@ static const Efl_Test_Case etc[] = {
|
||||||
{ "elm_code_widget_undo", elm_code_test_widget_undo },
|
{ "elm_code_widget_undo", elm_code_test_widget_undo },
|
||||||
{ "elm_focus", elm_test_focus},
|
{ "elm_focus", elm_test_focus},
|
||||||
{ "elm_focus_sub", elm_test_focus_sub},
|
{ "elm_focus_sub", elm_test_focus_sub},
|
||||||
|
/* FIXME : This test must move efl_ui_suite when it ready *
|
||||||
|
* EFL_UI_TEST BEGIN */
|
||||||
|
{ "efl_ui_grid", efl_ui_test_grid},
|
||||||
|
/* EFL_UI_TEST END */
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,10 @@ void elm_test_spinner(TCase *tc);
|
||||||
void elm_test_plug(TCase *tc);
|
void elm_test_plug(TCase *tc);
|
||||||
void elm_test_focus(TCase *tc);
|
void elm_test_focus(TCase *tc);
|
||||||
void elm_test_focus_sub(TCase *tc);
|
void elm_test_focus_sub(TCase *tc);
|
||||||
|
/* FIXME : This test must move efl_ui_suite when it ready *
|
||||||
|
* EFL_UI_TEST BEGIN */
|
||||||
|
void efl_ui_test_grid(TCase *tc);
|
||||||
|
/* EFL_UI_TEST END */
|
||||||
|
|
||||||
void elm_code_file_test_load(TCase *tc);
|
void elm_code_file_test_load(TCase *tc);
|
||||||
void elm_code_file_test_memory(TCase *tc);
|
void elm_code_file_test_memory(TCase *tc);
|
||||||
|
|
|
@ -99,7 +99,8 @@ elementary_suite_src = [
|
||||||
'elm_test_focus_common.c',
|
'elm_test_focus_common.c',
|
||||||
'elm_test_focus_common.h',
|
'elm_test_focus_common.h',
|
||||||
'elm_test_focus.c',
|
'elm_test_focus.c',
|
||||||
'elm_test_focus_sub.c'
|
'elm_test_focus_sub.c',
|
||||||
|
'efl_ui_test_grid.c'
|
||||||
]
|
]
|
||||||
|
|
||||||
elementary_suite = executable('elementary_suite',
|
elementary_suite = executable('elementary_suite',
|
||||||
|
|
Loading…
Reference in New Issue