forked from enlightenment/efl
parent
43c07afbf1
commit
6372dcdc2d
|
@ -585,7 +585,7 @@ test_ui_grid_linear(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|||
efl_gfx_visible_set(f, 1);
|
||||
|
||||
efl_pack_grid_columns_set(grid, 4);
|
||||
efl_pack_grid_orientation_set(grid, EFL_ORIENT_RIGHT, EFL_ORIENT_DOWN);
|
||||
efl_pack_grid_direction_set(grid, EFL_UI_DIR_RIGHT, EFL_UI_DIR_DOWN);
|
||||
efl_gfx_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
elm_object_content_set(f, grid);
|
||||
efl_gfx_visible_set(grid, 1);
|
||||
|
|
|
@ -71,16 +71,17 @@ interface Efl.Pack.Grid (Efl.Pack.Linear)
|
|||
rows: int; [[Number of rows]]
|
||||
}
|
||||
}
|
||||
@property grid_orientation {
|
||||
[[Primary and secondary up/left/right/down orientations for linear apis.
|
||||
@property grid_direction {
|
||||
[[Primary and secondary up/left/right/down directions for linear apis.
|
||||
|
||||
Default is right and down. Overrides @Efl.Orientation.orientation.
|
||||
Default is horizontal and vertical.
|
||||
This overrides @Efl.Ui.Direction.direction.
|
||||
]]
|
||||
set {}
|
||||
get {}
|
||||
values {
|
||||
primary: Efl.Orient; [[Primary orientation]]
|
||||
secondary: Efl.Orient; [[Secondary orientation]]
|
||||
primary: Efl.Ui.Dir(Efl.Ui.Dir.horizontal); [[Primary direction]]
|
||||
secondary: Efl.Ui.Dir(Efl.Ui.Dir.vertical); [[Secondary direction]]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -274,8 +274,8 @@ _efl_ui_grid_efl_object_constructor(Eo *obj, Efl_Ui_Grid_Data *pd)
|
|||
efl_canvas_object_type_set(obj, MY_CLASS_NAME);
|
||||
elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_FILLER);
|
||||
|
||||
pd->dir1 = EFL_ORIENT_RIGHT;
|
||||
pd->dir2 = EFL_ORIENT_DOWN;
|
||||
pd->dir1 = EFL_UI_DIR_RIGHT;
|
||||
pd->dir2 = EFL_UI_DIR_DOWN;
|
||||
pd->last_col = -1;
|
||||
pd->last_row = -1;
|
||||
pd->req_cols = 0;
|
||||
|
@ -474,7 +474,7 @@ _item_remove(Efl_Ui_Grid *obj, Efl_Ui_Grid_Data *pd, Efl_Gfx *subobj)
|
|||
}
|
||||
if (last)
|
||||
{
|
||||
if (_horiz(pd->dir1))
|
||||
if (efl_ui_dir_is_horizontal(pd->dir1, EINA_TRUE))
|
||||
{
|
||||
pd->last_col = last->col + last->col_span - 1;
|
||||
pd->last_row = last->row;
|
||||
|
@ -634,61 +634,52 @@ _efl_ui_grid_efl_pack_grid_grid_contents_get(Eo *obj, Efl_Ui_Grid_Data *pd EINA_
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_grid_efl_orientation_orientation_set(Eo *obj, Efl_Ui_Grid_Data *pd, Efl_Orient orient)
|
||||
_efl_ui_grid_efl_ui_direction_direction_set(Eo *obj, Efl_Ui_Grid_Data *pd, Efl_Ui_Dir dir)
|
||||
{
|
||||
EINA_SAFETY_ON_FALSE_RETURN((orient % 90) == 0);
|
||||
pd->dir1 = dir;
|
||||
|
||||
pd->dir1 = orient;
|
||||
|
||||
/* if both orientations are either horizontal or vertical, need to adjust
|
||||
* secondary orientation (dir2) */
|
||||
if (_horiz(pd->dir1) == _horiz(pd->dir2))
|
||||
/* 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 (!_horiz(pd->dir1))
|
||||
pd->dir2 = EFL_ORIENT_RIGHT;
|
||||
if (!efl_ui_dir_is_horizontal(pd->dir1, EINA_TRUE))
|
||||
pd->dir2 = EFL_UI_DIR_RIGHT;
|
||||
else
|
||||
pd->dir2 = EFL_ORIENT_DOWN;
|
||||
pd->dir2 = EFL_UI_DIR_DOWN;
|
||||
}
|
||||
|
||||
efl_pack_layout_request(obj);
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Orient
|
||||
_efl_ui_grid_efl_orientation_orientation_get(Eo *obj EINA_UNUSED, Efl_Ui_Grid_Data *pd)
|
||||
EOLIAN static Efl_Ui_Dir
|
||||
_efl_ui_grid_efl_ui_direction_direction_get(Eo *obj EINA_UNUSED, Efl_Ui_Grid_Data *pd)
|
||||
{
|
||||
return pd->dir1;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_grid_efl_pack_grid_grid_orientation_set(Eo *obj, Efl_Ui_Grid_Data *pd, Efl_Orient primary, Efl_Orient secondary)
|
||||
_efl_ui_grid_efl_pack_grid_grid_direction_set(Eo *obj, Efl_Ui_Grid_Data *pd, Efl_Ui_Dir primary, Efl_Ui_Dir secondary)
|
||||
{
|
||||
EINA_SAFETY_ON_FALSE_RETURN((primary % 90) == 0);
|
||||
EINA_SAFETY_ON_FALSE_RETURN((secondary % 90) == 0);
|
||||
|
||||
pd->dir1 = primary;
|
||||
pd->dir2 = secondary;
|
||||
|
||||
if (_horiz(pd->dir1) == _horiz(pd->dir2))
|
||||
if (efl_ui_dir_is_horizontal(pd->dir1, EINA_TRUE) ==
|
||||
efl_ui_dir_is_horizontal(pd->dir2, EINA_FALSE))
|
||||
{
|
||||
ERR("specified two orientations in the same axis, secondary orientation "
|
||||
ERR("specified two directions in the same axis, secondary directions "
|
||||
" is reset to a valid default");
|
||||
switch (pd->dir1)
|
||||
{
|
||||
case EFL_ORIENT_DOWN:
|
||||
case EFL_ORIENT_UP:
|
||||
pd->dir2 = EFL_ORIENT_RIGHT;
|
||||
break;
|
||||
default:
|
||||
pd->dir2 = EFL_ORIENT_DOWN;
|
||||
break;
|
||||
}
|
||||
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_grid_efl_pack_grid_grid_orientation_get(Eo *obj EINA_UNUSED, Efl_Ui_Grid_Data *pd, Efl_Orient *primary, Efl_Orient *secondary)
|
||||
_efl_ui_grid_efl_pack_grid_grid_direction_get(Eo *obj EINA_UNUSED, Efl_Ui_Grid_Data *pd, Efl_Ui_Dir *primary, Efl_Ui_Dir *secondary)
|
||||
{
|
||||
if (primary) *primary = pd->dir1;
|
||||
if (secondary) *secondary = pd->dir2;
|
||||
|
@ -770,7 +761,7 @@ _efl_ui_grid_efl_pack_linear_pack_end(Eo *obj, Efl_Ui_Grid_Data *pd, Efl_Gfx *su
|
|||
int col = pd->last_col;
|
||||
int row = pd->last_row;
|
||||
|
||||
if (_horiz(pd->dir1))
|
||||
if (efl_ui_dir_is_horizontal(pd->dir1, EINA_TRUE))
|
||||
{
|
||||
col++;
|
||||
if (pd->req_cols && (col >= pd->req_cols))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class Efl.Ui.Grid (Elm.Widget, Efl.Pack.Grid, Efl.Pack.Layout,
|
||||
Efl.Orientation)
|
||||
Efl.Ui.Direction)
|
||||
{
|
||||
[[Efl UI grid class]]
|
||||
implements {
|
||||
|
@ -12,7 +12,7 @@ class Efl.Ui.Grid (Elm.Widget, Efl.Pack.Grid, Efl.Pack.Layout,
|
|||
Elm.Widget.theme_apply;
|
||||
Efl.Container.content_iterate;
|
||||
Efl.Container.content_count;
|
||||
Efl.Orientation.orientation { get; set; }
|
||||
Efl.Ui.Direction.direction { get; set; }
|
||||
Efl.Pack.pack_clear;
|
||||
Efl.Pack.unpack_all;
|
||||
Efl.Pack.unpack;
|
||||
|
@ -25,7 +25,7 @@ class Efl.Ui.Grid (Elm.Widget, Efl.Pack.Grid, Efl.Pack.Layout,
|
|||
Efl.Pack.Grid.grid_size { get; set; }
|
||||
Efl.Pack.Grid.grid_columns { get; set; }
|
||||
Efl.Pack.Grid.grid_rows { get; set; }
|
||||
Efl.Pack.Grid.grid_orientation { get; set; }
|
||||
Efl.Pack.Grid.grid_direction { get; set; }
|
||||
Efl.Pack.Linear.pack_end;
|
||||
Efl.Pack.Layout.layout_update;
|
||||
Efl.Pack.Layout.layout_request;
|
||||
|
|
|
@ -34,7 +34,7 @@ struct _Efl_Ui_Grid_Data
|
|||
|
||||
int req_cols, req_rows; // requested - 0 means infinite
|
||||
int last_col, last_row; // only used by linear apis
|
||||
Efl_Orient dir1, dir2; // must be orthogonal (H,V or V,H)
|
||||
Efl_Ui_Dir dir1, dir2; // must be orthogonal (H,V or V,H)
|
||||
struct {
|
||||
double h, v;
|
||||
Eina_Bool scalable: 1;
|
||||
|
@ -50,10 +50,4 @@ struct _Grid_Item_Iterator
|
|||
Efl_Ui_Grid *object;
|
||||
};
|
||||
|
||||
static inline Eina_Bool
|
||||
_horiz(Efl_Orient dir)
|
||||
{
|
||||
return dir % 180 == EFL_ORIENT_RIGHT;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -653,6 +653,7 @@ efl_ui_dir_is_horizontal(Efl_Ui_Dir dir, Eina_Bool def_val)
|
|||
case EFL_UI_DIR_RTL: return EINA_TRUE;
|
||||
case EFL_UI_DIR_DOWN: return EINA_FALSE;
|
||||
case EFL_UI_DIR_UP: return EINA_FALSE;
|
||||
default: return !!def_val;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue