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
95
96
97
98
99
100
101
102
103
104
105
106
107
|
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "e.h"
typedef struct _E_Widget_Data E_Widget_Data;
struct _E_Widget_Data
{
Evas_Object *o_table;
};
static void _e_wid_del_hook(Evas_Object *obj);
/* local subsystem functions */
/* externally accessible functions */
EAPI Evas_Object *
e_widget_table_add(Evas *evas, int homogenous)
{
Evas_Object *obj, *o;
E_Widget_Data *wd;
obj = e_widget_add(evas);
e_widget_del_hook_set(obj, _e_wid_del_hook);
wd = calloc(1, sizeof(E_Widget_Data));
e_widget_data_set(obj, wd);
o = e_table_add(evas);
wd->o_table = o;
e_table_homogenous_set(o, homogenous);
evas_object_show(o);
e_widget_sub_object_add(obj, o);
e_widget_resize_object_set(obj, o);
return obj;
}
EAPI void
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)
{
e_widget_table_object_align_append(obj, sobj,
col, row, colspan, rowspan,
fill_w, fill_h, expand_w, expand_h,
0.5, 0.5);
}
EAPI void
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)
{
E_Widget_Data *wd;
Evas_Coord mw = 0, mh = 0;
wd = e_widget_data_get(obj);
e_table_pack(wd->o_table, sobj, col, row, colspan, rowspan);
e_widget_size_min_get(sobj, &mw, &mh);
e_table_pack_options_set(sobj,
fill_w, fill_h, /* fill */
expand_w, expand_h, /* expand */
ax, ay, /* align */
mw, mh, /* min */
99999, 99999 /* max */
);
e_table_size_min_get(wd->o_table, &mw, &mh);
e_widget_size_min_set(obj, mw, mh);
e_widget_sub_object_add(obj, sobj);
evas_object_show(sobj);
}
EAPI void
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)
{
E_Widget_Data *wd;
Evas_Coord mw = 0, mh = 0;
wd = e_widget_data_get(obj);
e_table_unpack(sobj);
e_table_pack(wd->o_table, sobj, col, row, colspan, rowspan);
e_widget_size_min_get(sobj, &mw, &mh);
e_table_pack_options_set(sobj,
fill_w, fill_h, /* fill */
expand_w, expand_h, /* expand */
0.5, 0.5, /* align */
mw, mh, /* min */
99999, 99999 /* max */
);
e_table_size_min_get(wd->o_table, &mw, &mh);
e_widget_size_min_set(obj, mw, mh);
}
EAPI void
e_widget_table_unpack(Evas_Object *obj, Evas_Object *sobj)
{
e_widget_sub_object_del(obj, sobj);
e_table_unpack(sobj);
}
static void
_e_wid_del_hook(Evas_Object *obj)
{
E_Widget_Data *wd;
wd = e_widget_data_get(obj);
free(wd);
}
|