Merge from TIZEN 2.3
[platform/core/uifw/e17.git] / src / bin / e_int_toolbar_config.c
1 #include "e.h"
2
3 /* local function protos */
4 static void        *_create_data  (E_Config_Dialog *cfd);
5 static void         _fill_data    (E_Config_Dialog_Data *cfdata);
6 static void         _free_data    (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
7 static int          _basic_apply  (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
8 static Evas_Object *_basic_create (E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
9
10 struct _E_Config_Dialog_Data
11 {
12    E_Toolbar *tbar;
13    int orient;
14 };
15
16 EAPI void
17 e_int_toolbar_config(E_Toolbar *tbar)
18 {
19    E_Config_Dialog *cfd;
20    E_Config_Dialog_View *v;
21    E_Container *con;
22
23    v = E_NEW(E_Config_Dialog_View, 1);
24    if (!v) return;
25    con = e_container_current_get(e_manager_current_get());
26    v->create_cfdata = _create_data;
27    v->free_cfdata = _free_data;
28    v->basic.apply_cfdata = _basic_apply;
29    v->basic.create_widgets = _basic_create;
30    cfd = e_config_dialog_new(con, _("Toolbar Settings"), "E",
31                              "_toolbar_config_dialog", "preferences-desktop-shelf",
32                              0, v, tbar);
33    tbar->cfg_dlg = cfd;
34 }
35
36 /* local functions */
37 static void *
38 _create_data(E_Config_Dialog *cfd)
39 {
40    E_Config_Dialog_Data *cfdata;
41
42    cfdata = E_NEW(E_Config_Dialog_Data, 1);
43    cfdata->tbar = cfd->data;
44    _fill_data(cfdata);
45    return cfdata;
46 }
47
48 static void
49 _fill_data(E_Config_Dialog_Data *cfdata)
50 {
51    cfdata->orient = cfdata->tbar->gadcon->orient;
52 }
53
54 static void
55 _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
56 {
57    cfdata->tbar->cfg_dlg = NULL;
58    E_FREE(cfdata);
59 }
60
61 static int
62 _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
63 {
64    E_Toolbar *tbar;
65
66    tbar = cfdata->tbar;
67    if (!tbar) return 0;
68    e_toolbar_orient(tbar, cfdata->orient);
69    e_toolbar_position_calc(tbar);
70    if ((tbar->fwin) && (tbar->fwin->cb_resize))
71      tbar->fwin->cb_resize(tbar->fwin);
72    return 1;
73 }
74
75 static Evas_Object *
76 _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata)
77 {
78    Evas_Object *o, *ot, *ow;
79    E_Radio_Group *rg;
80
81    o = e_widget_list_add(evas, 0, 0);
82    ot = e_widget_frametable_add(evas, _("Layout"), 1);
83    rg = e_widget_radio_group_new(&(cfdata->orient));
84    /*
85    ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-left",
86                                 24, 24, E_GADCON_ORIENT_LEFT, rg);
87    e_widget_frametable_object_append(ot, ow, 0, 1, 1, 1, 1, 1, 1, 1);
88    */
89    ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-top",
90                                 24, 24, E_GADCON_ORIENT_TOP, rg);
91    e_widget_frametable_object_append(ot, ow, 0, 0, 1, 1, 1, 1, 1, 1);
92    /*
93    ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-right",
94                                 24, 24, E_GADCON_ORIENT_RIGHT, rg);
95    e_widget_frametable_object_append(ot, ow, 2, 1, 1, 1, 1, 1, 1, 1);
96    */
97    ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-bottom",
98                                 24, 24, E_GADCON_ORIENT_BOTTOM, rg);
99    e_widget_frametable_object_append(ot, ow, 0, 1, 1, 1, 1, 1, 1, 1);
100    e_widget_list_object_append(o, ot, 1, 1, 0.5);
101    return o;
102 }