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 E_API Evas_Object *
e_widget_framelist_add(Evas * evas,const char * label,int horiz)16 e_widget_framelist_add(Evas *evas, const char *label, int horiz)
17 {
18    Evas_Object *obj, *o, *win;
19    E_Widget_Data *wd;
20 
21    win = e_win_evas_win_get(evas);
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 = elm_frame_add(win);
30    wd->o_frame = o;
31    elm_object_text_set(o, label);
32    evas_object_show(o);
33    e_widget_sub_object_add(obj, o);
34    e_widget_resize_object_set(obj, o);
35 
36    o = elm_box_add(win);
37    wd->o_box = o;
38    elm_box_horizontal_set(o, horiz);
39    elm_box_homogeneous_set(o, 0);
40    elm_object_content_set(wd->o_frame, o);
41    e_widget_sub_object_add(obj, o);
42    evas_object_show(o);
43 
44    return obj;
45 }
46 
47 E_API void
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)48 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)
49 {
50    E_Widget_Data *wd;
51    Evas_Coord mw = 0, mh = 0;
52 
53    wd = e_widget_data_get(obj);
54 
55    elm_box_pack_end(wd->o_box, sobj);
56    e_widget_size_min_get(sobj, &mw, &mh);
57    if (fill_w) align_x = -1;
58    if (fill_h) align_y = -1;
59    E_WEIGHT(sobj, expand_w, expand_h);
60    E_ALIGN(sobj, align_x, align_y);
61    evas_object_size_hint_min_set(sobj, min_w, min_h);
62    evas_object_size_hint_max_set(sobj, max_w, max_h);
63    elm_box_recalculate(wd->o_box);
64    e_widget_sub_object_add(obj, sobj);
65    evas_object_show(sobj);
66 }
67 
68 E_API void
e_widget_framelist_object_append(Evas_Object * obj,Evas_Object * sobj)69 e_widget_framelist_object_append(Evas_Object *obj, Evas_Object *sobj)
70 {
71    E_Widget_Data *wd;
72 
73    wd = e_widget_data_get(obj);
74 
75    elm_box_pack_end(wd->o_box, sobj);
76    E_EXPAND(sobj);
77    E_FILL(sobj);
78    elm_box_recalculate(wd->o_box);
79    e_widget_sub_object_add(obj, sobj);
80    evas_object_show(sobj);
81 }
82 
83 E_API void
e_widget_framelist_content_align_set(Evas_Object * obj,double halign,double valign)84 e_widget_framelist_content_align_set(Evas_Object *obj, double halign, double valign)
85 {
86    E_Widget_Data *wd;
87 
88    wd = e_widget_data_get(obj);
89    elm_box_align_set(wd->o_box, halign, valign);
90 }
91 
92 E_API void
e_widget_framelist_label_set(Evas_Object * obj,const char * label)93 e_widget_framelist_label_set(Evas_Object *obj, const char *label)
94 {
95    E_Widget_Data *wd;
96 
97    wd = e_widget_data_get(obj);
98    edje_object_part_text_set(wd->o_frame, "e.text.label", label);
99 }
100 
101 static void
_e_wid_del_hook(Evas_Object * obj)102 _e_wid_del_hook(Evas_Object *obj)
103 {
104    E_Widget_Data *wd;
105 
106    wd = e_widget_data_get(obj);
107    free(wd);
108 }
109 
110 static void
_e_wid_disable_hook(Evas_Object * obj)111 _e_wid_disable_hook(Evas_Object *obj)
112 {
113    E_Widget_Data *wd;
114 
115    wd = e_widget_data_get(obj);
116    if (e_widget_disabled_get(obj))
117      edje_object_signal_emit(wd->o_frame, "e,state,disabled", "e");
118    else
119      edje_object_signal_emit(wd->o_frame, "e,state,enabled", "e");
120 }
121 
122