The problem that e17 couldn't move/resize window when the window fetch the rotation...
[platform/core/uifw/e17.git] / src / bin / e_widget_framelist.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_frame, *o_box;
7 };
8
9 static void _e_wid_del_hook(Evas_Object *obj);
10 static void _e_wid_disable_hook(Evas_Object *obj);
11
12 /* local subsystem functions */
13
14 /* externally accessible functions */
15 EAPI Evas_Object *
16 e_widget_framelist_add(Evas *evas, const char *label, int horiz)
17 {
18    Evas_Object *obj, *o;
19    E_Widget_Data *wd;
20    Evas_Coord mw = 0, mh = 0;
21
22    obj = e_widget_add(evas);
23
24    e_widget_del_hook_set(obj, _e_wid_del_hook);
25    e_widget_disable_hook_set(obj, _e_wid_disable_hook);
26    wd = calloc(1, sizeof(E_Widget_Data));
27    e_widget_data_set(obj, wd);
28
29    o = edje_object_add(evas);
30    wd->o_frame = o;
31    e_theme_edje_object_set(o, "base/theme/widgets",
32                            "e/widgets/frame");
33    edje_object_part_text_set(o, "e.text.label", label);
34    evas_object_show(o);
35    e_widget_sub_object_add(obj, o);
36    e_widget_resize_object_set(obj, o);
37
38    o = e_box_add(evas);
39    wd->o_box = o;
40    e_box_orientation_set(o, horiz);
41    e_box_homogenous_set(o, 0);
42    edje_object_part_swallow(wd->o_frame, "e.swallow.content", 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_size_min_set(obj, mw, mh);
48
49    return obj;
50 }
51
52 EAPI void
53 e_widget_framelist_object_append_full(Evas_Object *obj, Evas_Object *sobj, int fill_w, int fill_h, int expand_w, int expand_h, double align_x, double align_y, Evas_Coord min_w, Evas_Coord min_h, Evas_Coord max_w, Evas_Coord max_h)
54 {
55    E_Widget_Data *wd;
56    Evas_Coord mw = 0, mh = 0;
57
58    wd = e_widget_data_get(obj);
59
60    e_box_pack_end(wd->o_box, sobj);
61    e_widget_size_min_get(sobj, &mw, &mh);
62    e_box_pack_options_set(sobj,
63                           fill_w, fill_h,
64                           expand_w, expand_h,
65                           align_x, align_y,
66                           min_w, min_h,
67                           max_w, max_h
68                           );
69    e_box_size_min_get(wd->o_box, &mw, &mh);
70    edje_extern_object_min_size_set(wd->o_box, mw, mh);
71    edje_object_part_swallow(wd->o_frame, "e.swallow.content", wd->o_box);
72    edje_object_size_min_calc(wd->o_frame, &mw, &mh);
73    e_widget_size_min_set(obj, mw, mh);
74    e_widget_sub_object_add(obj, sobj);
75    evas_object_show(sobj);
76 }
77
78 EAPI void
79 e_widget_framelist_object_append(Evas_Object *obj, Evas_Object *sobj)
80 {
81    E_Widget_Data *wd;
82    Evas_Coord mw = 0, mh = 0;
83
84    wd = e_widget_data_get(obj);
85
86    e_box_pack_end(wd->o_box, sobj);
87    e_widget_size_min_get(sobj, &mw, &mh);
88    e_box_pack_options_set(sobj,
89                           1, 1, /* fill */
90                           1, 1, /* expand */
91                           0.5, 0.5, /* align */
92                           mw, mh, /* min */
93                           99999, 99999 /* max */
94                           );
95    e_box_size_min_get(wd->o_box, &mw, &mh);
96    edje_extern_object_min_size_set(wd->o_box, mw, mh);
97    edje_object_part_swallow(wd->o_frame, "e.swallow.content", wd->o_box);
98    edje_object_size_min_calc(wd->o_frame, &mw, &mh);
99    e_widget_size_min_set(obj, mw, mh);
100    e_widget_sub_object_add(obj, sobj);
101    evas_object_show(sobj);
102 }
103
104 EAPI void
105 e_widget_framelist_content_align_set(Evas_Object *obj, double halign, double valign)
106 {
107    E_Widget_Data *wd;
108
109    wd = e_widget_data_get(obj);
110    e_box_align_set(wd->o_box, halign, valign);
111 }
112
113 EAPI void
114 e_widget_framelist_label_set(Evas_Object *obj, const char *label)
115 {
116    E_Widget_Data *wd;
117
118    wd = e_widget_data_get(obj);
119    edje_object_part_text_set(wd->o_frame, "e.text.label", label);
120 }
121
122
123 static void
124 _e_wid_del_hook(Evas_Object *obj)
125 {
126    E_Widget_Data *wd;
127
128    wd = e_widget_data_get(obj);
129    free(wd);
130 }
131
132 static void
133 _e_wid_disable_hook(Evas_Object *obj)
134 {
135    E_Widget_Data *wd;
136
137    wd = e_widget_data_get(obj);
138    if (e_widget_disabled_get(obj))
139      edje_object_signal_emit(wd->o_frame, "e,state,disabled", "e");
140    else
141      edje_object_signal_emit(wd->o_frame, "e,state,enabled", "e");
142 }