summaryrefslogtreecommitdiff
path: root/src/lib/elementary/efl_ui_box_flow.c
blob: 99042b7a8ada65eec54c80992c32a03ca64e14db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include "efl_ui_box_private.h"

#define MY_CLASS EFL_UI_BOX_FLOW_CLASS

typedef struct _Efl_Ui_Box_Flow_Data Efl_Ui_Box_Flow_Data;

struct _Efl_Ui_Box_Flow_Data
{
   Efl_Ui_Box_Flow_Params params;
};

EOLIAN static Eo *
_efl_ui_box_flow_efl_object_constructor(Eo *obj, Efl_Ui_Box_Flow_Data *pd)
{
   efl_constructor(eo_super(obj, MY_CLASS));
   efl_pack_layout_engine_set(obj, MY_CLASS, &pd->params);
   return obj;
}

EOLIAN static void
_efl_ui_box_flow_box_flow_homogenous_set(Eo *obj EINA_UNUSED, Efl_Ui_Box_Flow_Data *pd, Eina_Bool val)
{
   pd->params.homogenous = val;
}

EOLIAN static Eina_Bool
_efl_ui_box_flow_box_flow_homogenous_get(Eo *obj EINA_UNUSED, Efl_Ui_Box_Flow_Data *pd)
{
   return pd->params.homogenous;
}

EOLIAN static void
_efl_ui_box_flow_box_flow_max_size_set(Eo *obj EINA_UNUSED, Efl_Ui_Box_Flow_Data *pd, Eina_Bool val)
{
   pd->params.max_size = val;
}

EOLIAN static Eina_Bool
_efl_ui_box_flow_box_flow_max_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Box_Flow_Data *pd)
{
   return pd->params.max_size;
}

EOLIAN static void
_efl_ui_box_flow_efl_pack_layout_layout_do(Efl_Class *klass EINA_UNUSED,
                                           void *_pd EINA_UNUSED,
                                           Eo *obj, const void *data)
{
   void (*func)(Evas_Box *obj, Evas_Object_Box_Data *priv, void *data);
   const Efl_Ui_Box_Flow_Params *params = data;
   Evas_Object_Box_Data *bd;
   Efl_Ui_Box_Data *pd;
   Eina_Bool homo = EINA_FALSE, maxsize = EINA_FALSE;

   EINA_SAFETY_ON_FALSE_RETURN(eo_isa(obj, EFL_UI_BOX_CLASS));
   ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
   bd = eo_data_scope_get(wd->resize_obj, EVAS_BOX_CLASS);
   pd = eo_data_scope_get(obj, EFL_UI_BOX_CLASS);

   if (params)
     {
        homo = params->homogenous;
        maxsize = params->max_size;
     }

   if (_horiz(pd->orient))
     {
        if (homo)
          {
             if (maxsize)
               func = evas_object_box_layout_homogeneous_max_size_horizontal;
             else
               func = evas_object_box_layout_homogeneous_horizontal;
          }
        else
          func = evas_object_box_layout_flow_horizontal;
     }
   else
     {
        if (homo)
          {
             if (maxsize)
               func = evas_object_box_layout_homogeneous_max_size_vertical;
             else
               func = evas_object_box_layout_homogeneous_vertical;
          }
        else
          func = evas_object_box_layout_flow_vertical;
     }

   func(wd->resize_obj, bd, NULL);
}

#include "efl_ui_box_flow.eo.c"