[WM_ROT] Fixed floating mode window rotation bug that window doesn't send ROTATION_DO...
[platform/core/uifw/e17.git] / src / bin / e_widget_table.c
1 #include "e.h"
2
3 typedef struct _E_Widget_Data E_Widget_Data;
4 struct _E_Widget_Data
5 {
6    Evas_Object *o_table;
7 };
8
9 static void _e_wid_del_hook(Evas_Object *obj);
10
11 /* local subsystem functions */
12
13 /* externally accessible functions */
14 EAPI Evas_Object *
15 e_widget_table_add(Evas *evas, int homogenous)
16 {
17    Evas_Object *obj, *o;
18    E_Widget_Data *wd;
19
20    obj = e_widget_add(evas);
21
22    e_widget_del_hook_set(obj, _e_wid_del_hook);
23    wd = calloc(1, sizeof(E_Widget_Data));
24    e_widget_data_set(obj, wd);
25
26    o = e_table_add(evas);
27    wd->o_table = o;
28    e_table_homogenous_set(o, homogenous);
29    evas_object_show(o);
30    e_widget_sub_object_add(obj, o);
31    e_widget_resize_object_set(obj, o);
32
33    return obj;
34 }
35
36 EAPI void
37 e_widget_table_object_append(Evas_Object *obj, Evas_Object *sobj, int col, int row, int colspan, int rowspan, int fill_w, int fill_h, int expand_w, int expand_h)
38 {
39    e_widget_table_object_align_append(obj, sobj,
40                                       col, row, colspan, rowspan,
41                                       fill_w, fill_h, expand_w, expand_h,
42                                       0.5, 0.5);
43 }
44
45 EAPI void
46 e_widget_table_object_align_append(Evas_Object *obj, Evas_Object *sobj, int col, int row, int colspan, int rowspan, int fill_w, int fill_h, int expand_w, int expand_h, double ax, double ay)
47 {
48    E_Widget_Data *wd;
49    Evas_Coord mw = 0, mh = 0;
50
51    wd = e_widget_data_get(obj);
52
53    e_table_pack(wd->o_table, sobj, col, row, colspan, rowspan);
54    e_widget_size_min_get(sobj, &mw, &mh);
55    e_table_pack_options_set(sobj,
56                             fill_w, fill_h, /* fill */
57                             expand_w, expand_h, /* expand */
58                             ax, ay, /* align */
59                             mw, mh, /* min */
60                             99999, 99999 /* max */
61                             );
62    e_table_size_min_get(wd->o_table, &mw, &mh);
63    e_widget_size_min_set(obj, mw, mh);
64    e_widget_sub_object_add(obj, sobj);
65    evas_object_show(sobj);
66 }
67
68 EAPI void
69 e_widget_table_object_repack(Evas_Object *obj, Evas_Object *sobj, int col, int row, int colspan, int rowspan, int fill_w, int fill_h, int expand_w, int expand_h)
70 {
71    E_Widget_Data *wd;
72    Evas_Coord mw = 0, mh = 0;
73
74    wd = e_widget_data_get(obj);
75
76    e_table_unpack(sobj);
77    e_table_pack(wd->o_table, sobj, col, row, colspan, rowspan);
78    e_widget_size_min_get(sobj, &mw, &mh);
79    e_table_pack_options_set(sobj,
80                             fill_w, fill_h, /* fill */
81                             expand_w, expand_h, /* expand */
82                             0.5, 0.5, /* align */
83                             mw, mh, /* min */
84                             99999, 99999 /* max */
85                             );
86    e_table_size_min_get(wd->o_table, &mw, &mh);
87    e_widget_size_min_set(obj, mw, mh);
88 }
89
90 EAPI void
91 e_widget_table_unpack(Evas_Object *obj, Evas_Object *sobj)
92 {
93    e_widget_sub_object_del(obj, sobj);
94    e_table_unpack(sobj);
95 }
96
97 EAPI void
98 e_widget_table_freeze(Evas_Object *obj)
99 {
100    E_Widget_Data *wd;
101
102    wd = e_widget_data_get(obj);
103    e_table_freeze(wd->o_table);
104 }
105
106 EAPI void
107 e_widget_table_thaw(Evas_Object *obj)
108 {
109    E_Widget_Data *wd;
110
111    wd = e_widget_data_get(obj);
112    e_table_thaw(wd->o_table);
113 }
114
115 static void
116 _e_wid_del_hook(Evas_Object *obj)
117 {
118    E_Widget_Data *wd;
119
120    wd = e_widget_data_get(obj);
121    free(wd);
122 }
123