summaryrefslogtreecommitdiff
path: root/src/lib/elementary/efl_ui_grid.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/elementary/efl_ui_grid.c')
-rw-r--r--src/lib/elementary/efl_ui_grid.c57
1 files changed, 24 insertions, 33 deletions
diff --git a/src/lib/elementary/efl_ui_grid.c b/src/lib/elementary/efl_ui_grid.c
index 181db543d5..58a8e0515a 100644
--- a/src/lib/elementary/efl_ui_grid.c
+++ b/src/lib/elementary/efl_ui_grid.c
@@ -274,8 +274,8 @@ _efl_ui_grid_efl_object_constructor(Eo *obj, Efl_Ui_Grid_Data *pd)
274 efl_canvas_object_type_set(obj, MY_CLASS_NAME); 274 efl_canvas_object_type_set(obj, MY_CLASS_NAME);
275 elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_FILLER); 275 elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_FILLER);
276 276
277 pd->dir1 = EFL_ORIENT_RIGHT; 277 pd->dir1 = EFL_UI_DIR_RIGHT;
278 pd->dir2 = EFL_ORIENT_DOWN; 278 pd->dir2 = EFL_UI_DIR_DOWN;
279 pd->last_col = -1; 279 pd->last_col = -1;
280 pd->last_row = -1; 280 pd->last_row = -1;
281 pd->req_cols = 0; 281 pd->req_cols = 0;
@@ -474,7 +474,7 @@ _item_remove(Efl_Ui_Grid *obj, Efl_Ui_Grid_Data *pd, Efl_Gfx *subobj)
474 } 474 }
475 if (last) 475 if (last)
476 { 476 {
477 if (_horiz(pd->dir1)) 477 if (efl_ui_dir_is_horizontal(pd->dir1, EINA_TRUE))
478 { 478 {
479 pd->last_col = last->col + last->col_span - 1; 479 pd->last_col = last->col + last->col_span - 1;
480 pd->last_row = last->row; 480 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_
634} 634}
635 635
636EOLIAN static void 636EOLIAN static void
637_efl_ui_grid_efl_orientation_orientation_set(Eo *obj, Efl_Ui_Grid_Data *pd, Efl_Orient orient) 637_efl_ui_grid_efl_ui_direction_direction_set(Eo *obj, Efl_Ui_Grid_Data *pd, Efl_Ui_Dir dir)
638{ 638{
639 EINA_SAFETY_ON_FALSE_RETURN((orient % 90) == 0); 639 pd->dir1 = dir;
640 640
641 pd->dir1 = orient; 641 /* if both directions are either horizontal or vertical, need to adjust
642 642 * secondary direction (dir2) */
643 /* if both orientations are either horizontal or vertical, need to adjust 643 if (efl_ui_dir_is_horizontal(pd->dir1, EINA_TRUE) ==
644 * secondary orientation (dir2) */ 644 efl_ui_dir_is_horizontal(pd->dir2, EINA_FALSE))
645 if (_horiz(pd->dir1) == _horiz(pd->dir2))
646 { 645 {
647 if (!_horiz(pd->dir1)) 646 if (!efl_ui_dir_is_horizontal(pd->dir1, EINA_TRUE))
648 pd->dir2 = EFL_ORIENT_RIGHT; 647 pd->dir2 = EFL_UI_DIR_RIGHT;
649 else 648 else
650 pd->dir2 = EFL_ORIENT_DOWN; 649 pd->dir2 = EFL_UI_DIR_DOWN;
651 } 650 }
652 651
653 efl_pack_layout_request(obj); 652 efl_pack_layout_request(obj);
654} 653}
655 654
656EOLIAN static Efl_Orient 655EOLIAN static Efl_Ui_Dir
657_efl_ui_grid_efl_orientation_orientation_get(Eo *obj EINA_UNUSED, Efl_Ui_Grid_Data *pd) 656_efl_ui_grid_efl_ui_direction_direction_get(Eo *obj EINA_UNUSED, Efl_Ui_Grid_Data *pd)
658{ 657{
659 return pd->dir1; 658 return pd->dir1;
660} 659}
661 660
662EOLIAN static void 661EOLIAN static void
663_efl_ui_grid_efl_pack_grid_grid_orientation_set(Eo *obj, Efl_Ui_Grid_Data *pd, Efl_Orient primary, Efl_Orient secondary) 662_efl_ui_grid_efl_pack_grid_grid_direction_set(Eo *obj, Efl_Ui_Grid_Data *pd, Efl_Ui_Dir primary, Efl_Ui_Dir secondary)
664{ 663{
665 EINA_SAFETY_ON_FALSE_RETURN((primary % 90) == 0);
666 EINA_SAFETY_ON_FALSE_RETURN((secondary % 90) == 0);
667
668 pd->dir1 = primary; 664 pd->dir1 = primary;
669 pd->dir2 = secondary; 665 pd->dir2 = secondary;
670 666
671 if (_horiz(pd->dir1) == _horiz(pd->dir2)) 667 if (efl_ui_dir_is_horizontal(pd->dir1, EINA_TRUE) ==
668 efl_ui_dir_is_horizontal(pd->dir2, EINA_FALSE))
672 { 669 {
673 ERR("specified two orientations in the same axis, secondary orientation " 670 ERR("specified two directions in the same axis, secondary directions "
674 " is reset to a valid default"); 671 " is reset to a valid default");
675 switch (pd->dir1) 672 if (efl_ui_dir_is_horizontal(pd->dir1, EINA_TRUE))
676 { 673 pd->dir2 = EFL_UI_DIR_DOWN;
677 case EFL_ORIENT_DOWN: 674 else
678 case EFL_ORIENT_UP: 675 pd->dir2 = EFL_UI_DIR_RIGHT;
679 pd->dir2 = EFL_ORIENT_RIGHT;
680 break;
681 default:
682 pd->dir2 = EFL_ORIENT_DOWN;
683 break;
684 }
685 } 676 }
686 677
687 efl_pack_layout_request(obj); 678 efl_pack_layout_request(obj);
688} 679}
689 680
690EOLIAN static void 681EOLIAN static void
691_efl_ui_grid_efl_pack_grid_grid_orientation_get(Eo *obj EINA_UNUSED, Efl_Ui_Grid_Data *pd, Efl_Orient *primary, Efl_Orient *secondary) 682_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)
692{ 683{
693 if (primary) *primary = pd->dir1; 684 if (primary) *primary = pd->dir1;
694 if (secondary) *secondary = pd->dir2; 685 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
770 int col = pd->last_col; 761 int col = pd->last_col;
771 int row = pd->last_row; 762 int row = pd->last_row;
772 763
773 if (_horiz(pd->dir1)) 764 if (efl_ui_dir_is_horizontal(pd->dir1, EINA_TRUE))
774 { 765 {
775 col++; 766 col++;
776 if (pd->req_cols && (col >= pd->req_cols)) 767 if (pd->req_cols && (col >= pd->req_cols))