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
|
|
|
#ifndef _EFL_UI_CONTAINER_HELPER_H_
|
|
|
|
#define _EFL_UI_CONTAINER_HELPER_H_
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <Elementary.h>
|
|
|
|
#include "elm_priv.h"
|
|
|
|
|
|
|
|
typedef struct _Efl_Ui_Container_Item_Hints Efl_Ui_Container_Item_Hints;
|
|
|
|
typedef struct _Efl_Ui_Container_Layout_Calc Efl_Ui_Container_Layout_Calc;
|
|
|
|
|
|
|
|
struct _Efl_Ui_Container_Item_Hints
|
|
|
|
{
|
|
|
|
int max;
|
|
|
|
int min;
|
|
|
|
int aspect;
|
|
|
|
int margin[2]; // start, end
|
|
|
|
Efl_Gfx_Hint_Aspect aspect_type;
|
|
|
|
double weight;
|
|
|
|
double align;
|
|
|
|
double space;
|
|
|
|
Eina_Bool fill;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _Efl_Ui_Container_Layout_Calc
|
|
|
|
{
|
|
|
|
int pos;
|
|
|
|
int size;
|
|
|
|
int margin[2];
|
|
|
|
double align;
|
2019-10-02 03:04:12 -07:00
|
|
|
unsigned int 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
|
|
|
Eina_Bool fill : 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
void _efl_ui_container_layout_min_max_calc(Efl_Ui_Container_Item_Hints *item, int *cw, int *ch, Eina_Bool aspect_check);
|
|
|
|
void _efl_ui_container_layout_item_init(Eo* o, Efl_Ui_Container_Item_Hints *item);
|
|
|
|
void _efl_ui_container_layout_init(Eo* obj, Efl_Ui_Container_Layout_Calc *calc);
|
|
|
|
|
|
|
|
#endif
|