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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
#include "e.h"
typedef struct _E_Widget_Data E_Widget_Data;
struct _E_Widget_Data
{
Evas_Object *o_scroll, *o_fm;
E_Fm2_Config fmc;
};
/* private function prototypes */
static void _e_wid_del_hook(Evas_Object *obj);
static void _e_wid_focus_hook(Evas_Object *obj);
static void _e_wid_focus_steal(void *data, Evas *evas, Evas_Object *obj, void *event);
static void _e_wid_cb_selected(void *data, Evas_Object *obj, void *event);
static void _e_wid_cb_dir_changed(void *data, Evas_Object *obj, void *event);
static void _e_wid_cb_changed(void *data, Evas_Object *obj, void *event);
static void _e_wid_cb_file_deleted(void *data, Evas_Object *obj, void *event);
EAPI Evas_Object *
e_widget_flist_add(Evas *evas)
{
Evas_Object *obj, *o;
E_Widget_Data *wd;
wd = E_NEW(E_Widget_Data, 1);
if (!wd) return NULL;
obj = e_widget_add(evas);
e_widget_del_hook_set(obj, _e_wid_del_hook);
e_widget_focus_hook_set(obj, _e_wid_focus_hook);
e_widget_data_set(obj, wd);
o = e_scrollframe_add(evas);
wd->o_scroll = o;
evas_object_show(o);
e_widget_sub_object_add(obj, o);
e_widget_resize_object_set(obj, o);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
_e_wid_focus_steal, obj);
o = e_fm2_add(evas);
wd->o_fm = o;
memset(&wd->fmc, 0, sizeof(E_Fm2_Config));
wd->fmc.view.mode = E_FM2_VIEW_MODE_LIST;
wd->fmc.view.open_dirs_in_place = 1;
wd->fmc.view.selector = 1;
wd->fmc.view.single_click = 0;
wd->fmc.view.no_subdir_jump = 0;
wd->fmc.icon.list.w = 48;
wd->fmc.icon.list.h = 48;
wd->fmc.icon.fixed.w = 1;
wd->fmc.icon.fixed.h = 1;
wd->fmc.icon.extension.show = 0;
wd->fmc.icon.key_hint = NULL;
wd->fmc.list.sort.no_case = 1;
wd->fmc.list.sort.dirs.first = 0;
wd->fmc.list.sort.dirs.last = 0;
wd->fmc.selection.single = 1;
wd->fmc.selection.windows_modifiers = 0;
e_fm2_config_set(wd->o_fm, &wd->fmc);
e_fm2_icon_menu_flags_set(wd->o_fm, E_FM2_MENU_NO_SHOW_HIDDEN);
evas_object_smart_callback_add(wd->o_fm, "dir_changed",
_e_wid_cb_dir_changed, obj);
evas_object_smart_callback_add(wd->o_fm, "selection_change",
_e_wid_cb_selected, obj);
evas_object_smart_callback_add(wd->o_fm, "changed",
_e_wid_cb_changed, obj);
evas_object_smart_callback_add(wd->o_fm, "files_deleted",
_e_wid_cb_file_deleted, obj);
e_scrollframe_key_navigation_set(wd->o_scroll, EINA_FALSE);
e_scrollframe_extern_pan_set(wd->o_scroll, o, e_fm2_pan_set,
e_fm2_pan_get, e_fm2_pan_max_get,
e_fm2_pan_child_size_get);
e_widget_sub_object_add(obj, o);
evas_object_show(o);
evas_object_smart_callback_add(o, "selected",
_e_wid_cb_selected, obj);
evas_object_resize(obj, 32, 32);
e_widget_size_min_set(obj, 32, 32);
return obj;
}
EAPI E_Fm2_Config *
e_widget_flist_config_get(Evas_Object *obj)
{
E_Widget_Data *wd = NULL;
wd = e_widget_data_get(obj);
return e_fm2_config_get(wd->o_fm);
}
EAPI void
e_widget_flist_path_set(Evas_Object *obj, const char *dev, const char *path)
{
E_Widget_Data *wd = NULL;
wd = e_widget_data_get(obj);
e_fm2_path_set(wd->o_fm, dev, path);
e_scrollframe_child_pos_set(wd->o_scroll, 0, 0);
}
EAPI Eina_List *
e_widget_flist_all_list_get(Evas_Object *obj)
{
E_Widget_Data *wd = NULL;
wd = e_widget_data_get(obj);
return e_fm2_all_list_get(wd->o_fm);
}
EAPI Eina_List *
e_widget_flist_selected_list_get(Evas_Object *obj)
{
E_Widget_Data *wd = NULL;
wd = e_widget_data_get(obj);
return e_fm2_selected_list_get(wd->o_fm);
}
EAPI const char *
e_widget_flist_real_path_get(Evas_Object *obj)
{
E_Widget_Data *wd = NULL;
wd = e_widget_data_get(obj);
return e_fm2_real_path_get(wd->o_fm);
}
EAPI int
e_widget_flist_has_parent_get(Evas_Object *obj)
{
E_Widget_Data *wd = NULL;
wd = e_widget_data_get(obj);
return e_fm2_has_parent_get(wd->o_fm);
}
EAPI void
e_widget_flist_select_set(Evas_Object *obj, const char *file, int s)
{
E_Widget_Data *wd = NULL;
wd = e_widget_data_get(obj);
e_fm2_select_set(wd->o_fm, file, s);
}
EAPI void
e_widget_flist_file_show(Evas_Object *obj, const char *file)
{
E_Widget_Data *wd = NULL;
wd = e_widget_data_get(obj);
e_fm2_file_show(wd->o_fm, file);
}
EAPI void
e_widget_flist_parent_go(Evas_Object *obj)
{
E_Widget_Data *wd = NULL;
wd = e_widget_data_get(obj);
e_fm2_parent_go(wd->o_fm);
e_scrollframe_child_pos_set(wd->o_scroll, 0, 0);
}
EAPI void
e_widget_flist_refresh(Evas_Object *obj)
{
E_Widget_Data *wd = NULL;
wd = e_widget_data_get(obj);
e_fm2_refresh(wd->o_fm);
}
/* private functions */
static void
_e_wid_del_hook(Evas_Object *obj)
{
E_Widget_Data *wd = NULL;
wd = e_widget_data_get(obj);
E_FREE(wd);
}
static void
_e_wid_focus_hook(Evas_Object *obj)
{
E_Widget_Data *wd = NULL;
wd = e_widget_data_get(obj);
if (e_widget_focus_get(obj))
{
edje_object_signal_emit(e_scrollframe_edje_object_get(wd->o_scroll),
"e,state,focused", "e");
evas_object_focus_set(wd->o_fm, 1);
}
else
{
edje_object_signal_emit(e_scrollframe_edje_object_get(wd->o_scroll),
"e,state,unfocused", "e");
evas_object_focus_set(wd->o_fm, 0);
}
}
static void
_e_wid_focus_steal(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
e_widget_focus_steal(data);
}
static void
_e_wid_cb_selected(void *data, Evas_Object *obj __UNUSED__, void *event)
{
evas_object_smart_callback_call(data, "selection_change", event);
}
static void
_e_wid_cb_dir_changed(void *data, Evas_Object *obj __UNUSED__, void *event)
{
evas_object_smart_callback_call(data, "dir_changed", event);
}
static void
_e_wid_cb_changed(void *data, Evas_Object *obj __UNUSED__, void *event)
{
evas_object_smart_callback_call(data, "changed", event);
}
static void
_e_wid_cb_file_deleted(void *data, Evas_Object *obj __UNUSED__, void *event)
{
evas_object_smart_callback_call(data, "files_deleted", event);
}
|