2017-12-18 21:13:58 -08:00
|
|
|
#ifndef EFL_UI_TABLE_PRIVATE_H
|
|
|
|
#define EFL_UI_TABLE_PRIVATE_H
|
2016-06-09 21:29:33 -07:00
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define EFL_PACK_LAYOUT_PROTECTED
|
|
|
|
|
|
|
|
#include <Elementary.h>
|
|
|
|
#include "elm_priv.h"
|
|
|
|
|
2017-12-18 21:13:58 -08:00
|
|
|
typedef struct _Efl_Ui_Table_Data Efl_Ui_Table_Data;
|
|
|
|
typedef struct _Table_Item_Iterator Table_Item_Iterator;
|
|
|
|
typedef struct _Table_Item Table_Item;
|
2016-06-09 21:29:33 -07:00
|
|
|
|
efl_ui_table: refactor layout_update
Summary:
There are three reasons to refactor layout_update of Efl.Ui.Table.
=== 1. Inconsistency of hint behavior. ===
Some hint property is often not respected. for example, hint_min is ignored in
Table when it is used with hint_max even if hint_weight is 0. hint_aspect is
always ignored in Table.
The ambiguous behavior make it hard to layout widgets in container. of course,
we documented 'it's just a hint that should be used whenever appropriate.' but i
don't think it means that 'hint API is sometimes respected and we also don't
know when that API is respected.'. at least there is rule for consistent
behavior and we should be able to explain why a widget is located here and
why some hint property is ignored.
So, i'll suggest priority of hint property. this refactoring support following
priority.
1) HintMin
2) HintMin + HintAspect
3) HintMargin
4) HintMax
5) HintAspect
6) HintWeight, HintFill
7) HintAlign
ref T5487
Please check with unit test D7840
=== 2. To Enhance usability. ===
Efl.Ui.Table is using homogeneous mode of evas_table which have same columns,
rows size. but i think a table can generally change columns, rows size and
we can provide homogeneous mode option.(D7892)
In this patch
- table columns(rows) min size is decided by maximum size among its cells
width(height) min size.
- table columns(rows) weight is decided by maximum weight among its cells
horizontal(vertical) weight.
Also, pack_align is implemented. it is used if no item has a weight.
=== 3. To remove internal evas_table. ===
This is low priority work. however, i guess is is necessary for lightweight
container widget. there are two size_hint callback to adjust table size and
efl_canvas_group_calculate is called twice when it is resized.
This patch is first step to remove internal evas_table.
Test Plan:
make check
elementary_test -to 'efl.ui.table'
Reviewers: jpeg, Jaehyun_Cho, zmike
Reviewed By: zmike
Subscribers: zmike, cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T5487
Differential Revision: https://phab.enlightenment.org/D7841
2019-02-27 11:45:27 -08:00
|
|
|
void _efl_ui_table_custom_layout(Efl_Ui_Table *ui_table, Efl_Ui_Table_Data *pd);
|
|
|
|
|
2017-12-18 21:13:58 -08:00
|
|
|
#define TABLE_ITEM_KEY "__table_item"
|
2016-06-09 21:29:33 -07:00
|
|
|
|
2017-12-18 21:13:58 -08:00
|
|
|
struct _Table_Item
|
2016-06-09 21:29:33 -07:00
|
|
|
{
|
|
|
|
EINA_INLIST;
|
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
Efl_Gfx_Entity *object;
|
2016-06-09 21:29:33 -07:00
|
|
|
int col_span, row_span;
|
|
|
|
int col, row;
|
|
|
|
};
|
|
|
|
|
2017-12-18 21:13:58 -08:00
|
|
|
struct _Efl_Ui_Table_Data
|
2016-06-09 21:29:33 -07:00
|
|
|
{
|
2017-12-18 21:13:58 -08:00
|
|
|
Table_Item *items;
|
2019-04-18 01:22:44 -07:00
|
|
|
Eo *clipper;
|
2016-06-09 21:29:33 -07:00
|
|
|
int count;
|
|
|
|
|
2019-04-18 01:22:44 -07:00
|
|
|
int cols, rows;
|
2016-06-09 21:29:33 -07:00
|
|
|
int req_cols, req_rows; // requested - 0 means infinite
|
2019-04-18 01:22:44 -07:00
|
|
|
int last_col, last_row; // only used by pack api
|
2019-05-24 09:30:31 -07:00
|
|
|
Efl_Ui_Layout_Orientation fill_dir; // direction in which cells are added when using pack()
|
2016-06-09 21:29:33 -07:00
|
|
|
struct {
|
|
|
|
double h, v;
|
|
|
|
Eina_Bool scalable: 1;
|
|
|
|
} pad;
|
efl_ui_table: refactor layout_update
Summary:
There are three reasons to refactor layout_update of Efl.Ui.Table.
=== 1. Inconsistency of hint behavior. ===
Some hint property is often not respected. for example, hint_min is ignored in
Table when it is used with hint_max even if hint_weight is 0. hint_aspect is
always ignored in Table.
The ambiguous behavior make it hard to layout widgets in container. of course,
we documented 'it's just a hint that should be used whenever appropriate.' but i
don't think it means that 'hint API is sometimes respected and we also don't
know when that API is respected.'. at least there is rule for consistent
behavior and we should be able to explain why a widget is located here and
why some hint property is ignored.
So, i'll suggest priority of hint property. this refactoring support following
priority.
1) HintMin
2) HintMin + HintAspect
3) HintMargin
4) HintMax
5) HintAspect
6) HintWeight, HintFill
7) HintAlign
ref T5487
Please check with unit test D7840
=== 2. To Enhance usability. ===
Efl.Ui.Table is using homogeneous mode of evas_table which have same columns,
rows size. but i think a table can generally change columns, rows size and
we can provide homogeneous mode option.(D7892)
In this patch
- table columns(rows) min size is decided by maximum size among its cells
width(height) min size.
- table columns(rows) weight is decided by maximum weight among its cells
horizontal(vertical) weight.
Also, pack_align is implemented. it is used if no item has a weight.
=== 3. To remove internal evas_table. ===
This is low priority work. however, i guess is is necessary for lightweight
container widget. there are two size_hint callback to adjust table size and
efl_canvas_group_calculate is called twice when it is resized.
This patch is first step to remove internal evas_table.
Test Plan:
make check
elementary_test -to 'efl.ui.table'
Reviewers: jpeg, Jaehyun_Cho, zmike
Reviewed By: zmike
Subscribers: zmike, cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T5487
Differential Revision: https://phab.enlightenment.org/D7841
2019-02-27 11:45:27 -08:00
|
|
|
struct {
|
|
|
|
double h, v;
|
|
|
|
} align;
|
2019-04-18 01:22:44 -07:00
|
|
|
Eina_Bool cols_recalc : 1;
|
|
|
|
Eina_Bool rows_recalc : 1;
|
2016-06-09 21:29:33 -07:00
|
|
|
Eina_Bool linear_recalc : 1;
|
2019-02-27 11:45:32 -08:00
|
|
|
Eina_Bool homogeneoush : 1;
|
|
|
|
Eina_Bool homogeneousv : 1;
|
2016-06-09 21:29:33 -07:00
|
|
|
};
|
|
|
|
|
2017-12-18 21:13:58 -08:00
|
|
|
struct _Table_Item_Iterator
|
2016-06-09 21:29:33 -07:00
|
|
|
{
|
|
|
|
Eina_Iterator iterator;
|
2019-04-18 01:22:44 -07:00
|
|
|
Efl_Ui_Table *object;
|
|
|
|
Eina_Inlist *cur;
|
2016-06-09 21:29:33 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|