summaryrefslogtreecommitdiff
path: root/src/bin/e_widget_frametable.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/e_widget_frametable.c')
-rw-r--r--src/bin/e_widget_frametable.c85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/bin/e_widget_frametable.c b/src/bin/e_widget_frametable.c
new file mode 100644
index 000000000..19b8f4fc8
--- /dev/null
+++ b/src/bin/e_widget_frametable.c
@@ -0,0 +1,85 @@
1/*
2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
3 */
4#include "e.h"
5
6typedef struct _E_Widget_Data E_Widget_Data;
7struct _E_Widget_Data
8{
9 Evas_Object *o_frame, *o_table;
10};
11
12static void _e_wid_del_hook(Evas_Object *obj);
13
14/* local subsystem functions */
15
16/* externally accessible functions */
17Evas_Object *
18e_widget_frametable_add(Evas *evas, char *label, int homogenous)
19{
20 Evas_Object *obj, *o;
21 E_Widget_Data *wd;
22 Evas_Coord mw, mh;
23
24 obj = e_widget_add(evas);
25
26 e_widget_del_hook_set(obj, _e_wid_del_hook);
27 wd = calloc(1, sizeof(E_Widget_Data));
28 e_widget_data_set(obj, wd);
29
30 o = edje_object_add(evas);
31 wd->o_frame = o;
32 e_theme_edje_object_set(o, "base/theme/widgets",
33 "widgets/frame");
34 edje_object_part_text_set(o, "label", label);
35 evas_object_show(o);
36 e_widget_sub_object_add(obj, o);
37 e_widget_resize_object_set(obj, o);
38
39 o = e_table_add(evas);
40 wd->o_table = o;
41 e_table_homogenous_set(o, homogenous);
42 edje_object_part_swallow(wd->o_frame, "items", o);
43 e_widget_sub_object_add(obj, o);
44 evas_object_show(o);
45
46 edje_object_size_min_calc(wd->o_frame, &mw, &mh);
47 e_widget_min_size_set(obj, mw, mh);
48
49 return obj;
50}
51
52void
53e_widget_frametable_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)
54{
55 E_Widget_Data *wd;
56 Evas_Coord mw, mh;
57
58 wd = e_widget_data_get(obj);
59
60 e_table_pack(wd->o_table, sobj, col, row, colspan, rowspan);
61 e_widget_min_size_get(sobj, &mw, &mh);
62 e_table_pack_options_set(sobj,
63 fill_w, fill_h, /* fill */
64 expand_w, expand_h, /* expand */
65 0.5, 0.5, /* align */
66 mw, mh, /* min */
67 99999, 99999 /* max */
68 );
69 e_table_min_size_get(wd->o_table, &mw, &mh);
70 edje_extern_object_min_size_set(wd->o_table, mw, mh);
71 edje_object_part_swallow(wd->o_frame, "items", wd->o_table);
72 edje_object_size_min_calc(wd->o_frame, &mw, &mh);
73 e_widget_min_size_set(obj, mw, mh);
74 e_widget_sub_object_add(obj, sobj);
75 evas_object_show(sobj);
76}
77
78static void
79_e_wid_del_hook(Evas_Object *obj)
80{
81 E_Widget_Data *wd;
82
83 wd = e_widget_data_get(obj);
84 free(wd);
85}