efl_gfx_entity_visible_set(f, 1);
efl_pack_table_columns_set(table, 4);
- efl_pack_table_direction_set(table, EFL_UI_DIR_RIGHT, EFL_UI_DIR_DOWN);
+ efl_ui_direction_set(table, EFL_UI_DIR_RIGHT);
efl_gfx_hint_weight_set(table, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_object_content_set(f, table);
efl_gfx_entity_visible_set(table, 1);
-import efl_ui_direction;
-
interface @beta Efl.Pack_Table extends Efl.Pack
{
- [[2D containers aligned on a table with rows and columns]]
+ [[Interface for 2D containers which arrange their elements on a table with rows and columns.
+
+ Elements can be positioned on a specific row and column, or they can be simply added to
+ the table using @Efl.Pack.pack and the container will chose where to put them.
+ ]]
c_prefix: efl_pack;
methods {
pack_table {
}
}
@property table_columns {
- [[Gird columns property]]
- set { [[Specifies limit for linear adds - if direction is horizontal]] }
+ [[Specifies the amount of columns the table will have when the fill direction is horizontal.
+ If it is vertical, the amount of columns depends on the amount of cells added and @.table_rows.
+ ]]
+ set {}
get {}
values {
- cols: int; [[Number of columns]]
+ cols: int; [[Amount of columns.]]
}
}
@property table_rows {
- [[Table rows property]]
- set { [[Specifies limit for linear adds - if direction is vertical]] }
- get {}
- values {
- rows: int; [[Number of rows]]
- }
- }
- @property table_direction {
- [[Primary and secondary up/left/right/down directions for linear apis.
-
- Default is horizontal and vertical.
- This overrides @Efl.Ui.Direction.direction.
+ [[Specifies the amount of rows the table will have when the fill direction is vertical.
+ If it is horizontal, the amount of rows depends on the amount of cells added and @.table_columns.
]]
set {}
get {}
values {
- primary: Efl.Ui.Dir(Efl.Ui.Dir.horizontal); [[Primary direction]]
- secondary: Efl.Ui.Dir(Efl.Ui.Dir.vertical); [[Secondary direction]]
+ rows: int; [[Amount of rows.]]
}
}
}
efl_pack_table_size_get(obj, &req_cols, &req_rows);
- if (efl_ui_dir_is_horizontal(pd->dir1, EINA_TRUE))
+ if (efl_ui_dir_is_horizontal(pd->fill_dir, EINA_TRUE))
{
EINA_INLIST_REVERSE_FOREACH(EINA_INLIST_GET(pd->items), gi)
{
//efl_access_object_access_type_set(obj, EFL_ACCESS_TYPE_SKIPPED);
efl_access_object_role_set(obj, EFL_ACCESS_ROLE_FILLER);
- pd->dir1 = EFL_UI_DIR_RIGHT;
- pd->dir2 = EFL_UI_DIR_DOWN;
+ pd->fill_dir = EFL_UI_DIR_RIGHT;
pd->last_col = -1;
pd->last_row = -1;
pd->req_cols = 0;
EOLIAN static void
_efl_ui_table_efl_ui_direction_direction_set(Eo *obj, Efl_Ui_Table_Data *pd, Efl_Ui_Dir dir)
{
- if (pd->dir1 == dir)
+ if (pd->fill_dir == dir)
return;
if (dir == EFL_UI_DIR_DEFAULT)
dir = EFL_UI_DIR_RIGHT;
- pd->dir1 = dir;
-
- /* if both directions are either horizontal or vertical, need to adjust
- * secondary direction (dir2) */
- if (efl_ui_dir_is_horizontal(pd->dir1, EINA_TRUE) ==
- efl_ui_dir_is_horizontal(pd->dir2, EINA_FALSE))
- {
- if (efl_ui_dir_is_horizontal(pd->dir1, EINA_TRUE))
- pd->dir2 = EFL_UI_DIR_DOWN;
- else
- pd->dir2 = EFL_UI_DIR_RIGHT;
- }
+ pd->fill_dir = dir;
efl_pack_layout_request(obj);
}
EOLIAN static Efl_Ui_Dir
_efl_ui_table_efl_ui_direction_direction_get(const Eo *obj EINA_UNUSED, Efl_Ui_Table_Data *pd)
{
- return pd->dir1;
-}
-
-EOLIAN static void
-_efl_ui_table_efl_pack_table_table_direction_set(Eo *obj, Efl_Ui_Table_Data *pd, Efl_Ui_Dir primary, Efl_Ui_Dir secondary)
-{
- if ((pd->dir1 == primary) && (pd->dir2 == secondary))
- return;
-
- pd->dir1 = primary;
- pd->dir2 = secondary;
-
- if (efl_ui_dir_is_horizontal(pd->dir1, EINA_TRUE) ==
- efl_ui_dir_is_horizontal(pd->dir2, EINA_FALSE))
- {
- ERR("specified two directions in the same axis, secondary directions "
- " is reset to a valid default");
- if (efl_ui_dir_is_horizontal(pd->dir1, EINA_TRUE))
- pd->dir2 = EFL_UI_DIR_DOWN;
- else
- pd->dir2 = EFL_UI_DIR_RIGHT;
- }
-
- efl_pack_layout_request(obj);
-}
-
-EOLIAN static void
-_efl_ui_table_efl_pack_table_table_direction_get(const Eo *obj EINA_UNUSED, Efl_Ui_Table_Data *pd, Efl_Ui_Dir *primary, Efl_Ui_Dir *secondary)
-{
- if (primary) *primary = pd->dir1;
- if (secondary) *secondary = pd->dir2;
+ return pd->fill_dir;
}
EOLIAN static void
_efl_ui_table_last_position_get(obj, pd, &last_col, &last_row);
- if (efl_ui_dir_is_horizontal(pd->dir1, EINA_TRUE))
+ if (efl_ui_dir_is_horizontal(pd->fill_dir, EINA_TRUE))
{
last_col++;
if (pd->req_cols && (last_col >= pd->req_cols))
class @beta Efl.Ui.Table extends Efl.Ui.Widget implements Efl.Pack_Table, Efl.Pack_Layout,
Efl.Ui.Direction, Efl.Gfx.Arrangement
{
- [[Efl UI table class]]
+ [[Widget container that arranges its elements in a grid.
+
+ The amount of rows and columns can be controlled with @Efl.Pack_Table.table_rows
+ and @Efl.Pack_Table.table_columns, and elements can be manually positioned with
+ @Efl.Pack_Table.pack_table.
+ Additionally, a fill direction can be defined with @Efl.Ui.Direction.direction and
+ elements added with @Efl.Pack.pack. Elements are then added following this direction
+ (horizontal or vertical) and when the amount of columns or rows has been reached,
+ a step is taken in the orthogonal direction.
+ In this second case there is no need to define both the amount of columns and rows,
+ as the table will expand as needed.
+ The default fill direction is @Efl.Ui.Dir.right.
+ ]]
methods {
@property homogeneous {
[[Control homogeneous mode.
Efl.Pack_Table.table_size { get; set; }
Efl.Pack_Table.table_columns { get; set; }
Efl.Pack_Table.table_rows { get; set; }
- Efl.Pack_Table.table_direction { get; set; }
Efl.Pack_Layout.layout_update;
Efl.Pack_Layout.layout_request;
}
int cols, rows;
int req_cols, req_rows; // requested - 0 means infinite
int last_col, last_row; // only used by pack api
- Efl_Ui_Dir dir1, dir2; // must be orthogonal (H,V or V,H)
+ Efl_Ui_Dir fill_dir; // direction in which cells are added when using pack()
struct {
double h, v;
Eina_Bool scalable: 1;
double h, v;
Eina_Bool b;
Eina_Bool homogeneoush, homogeneousv;
- Efl_Ui_Dir dirh, dirv;
//align test
efl_gfx_arrangement_content_align_get(layout, &h, &v);
ck_assert_int_eq(b, 1);
//direction test
- efl_pack_table_direction_get(layout, &dirh, &dirv);
- ck_assert_int_eq(dirh, EFL_UI_DIR_RIGHT);
- ck_assert_int_eq(dirv, EFL_UI_DIR_DOWN);
-
- efl_pack_table_direction_set(layout, EFL_UI_DIR_VERTICAL, EFL_UI_DIR_HORIZONTAL);
- efl_pack_table_direction_get(layout, &dirh, &dirv);
- ck_assert_int_eq(dirh, EFL_UI_DIR_VERTICAL);
- ck_assert_int_eq(dirv, EFL_UI_DIR_HORIZONTAL);
+ ck_assert_int_eq(efl_ui_direction_get(layout), EFL_UI_DIR_RIGHT);
- efl_pack_table_direction_set(layout, EFL_UI_DIR_RIGHT, EFL_UI_DIR_RIGHT);
- efl_pack_table_direction_get(layout, &dirh, &dirv);
- ck_assert_int_eq(dirh, EFL_UI_DIR_RIGHT);
- ck_assert_int_eq(dirv, EFL_UI_DIR_DOWN);
+ efl_ui_direction_set(layout, EFL_UI_DIR_VERTICAL);
+ ck_assert_int_eq(efl_ui_direction_get(layout), EFL_UI_DIR_VERTICAL);
+ efl_ui_direction_set(layout, EFL_UI_DIR_RIGHT);
ck_assert_int_eq(efl_ui_direction_get(layout), EFL_UI_DIR_RIGHT);
efl_ui_direction_set(layout, EFL_UI_DIR_DEFAULT);