1 #include <Elementary.h>
3 # include "elementary_config.h"
6 #ifndef ELM_LIB_QUICKLAUNCH
8 _file_chosen(void *data,
9 Evas_Object *obj __UNUSED__,
12 Evas_Object *entry = data;
13 char *file = event_info;
14 elm_entry_entry_set(entry, file);
15 printf("File chosen: %s\n", file);
19 _inwin_mode_toggle(void *data,
20 Evas_Object *obj __UNUSED__,
21 void *event_info __UNUSED__)
23 Evas_Object *fs_en = data;
24 Eina_Bool value = elm_fileselector_entry_inwin_mode_get(fs_en);
25 elm_fileselector_entry_inwin_mode_set(fs_en, !value);
26 printf("Inwin mode set to: %s\n", value ? "false" : "true");
30 _folder_only_toggle(void *data,
31 Evas_Object *obj __UNUSED__,
32 void *event_info __UNUSED__)
34 Evas_Object *fs_en = data;
35 Evas_Object *ic = elm_fileselector_entry_button_icon_get(fs_en);
36 Eina_Bool value = elm_fileselector_entry_folder_only_get(fs_en);
37 elm_fileselector_entry_folder_only_set(fs_en, !value);
38 printf("Folder only flag set to: %s\n", value ? "false" : "true");
41 elm_icon_standard_set(ic, "folder");
42 elm_object_text_set(fs_en, "Select a folder");
46 elm_icon_standard_set(ic, "file");
47 elm_object_text_set(fs_en, "Select a file");
52 _expandable_toggle(void *data,
53 Evas_Object *obj __UNUSED__,
54 void *event_info __UNUSED__)
56 Evas_Object *fs_en = data;
57 Eina_Bool value = elm_fileselector_entry_expandable_get(fs_en);
58 elm_fileselector_entry_expandable_set(fs_en, !value);
59 printf("Expandable flag set to: %s\n", value ? "false" : "true");
63 _disabled_toggle(void *data,
64 Evas_Object *obj __UNUSED__,
65 void *event_info __UNUSED__)
67 Evas_Object *fs_en = data;
68 Eina_Bool value = elm_object_disabled_get(fs_en);
69 elm_object_disabled_set(fs_en, !value);
70 printf("Disabled flag set to: %s\n", value ? "false" : "true");
74 test_fileselector_entry(void *data __UNUSED__,
75 Evas_Object *obj __UNUSED__,
76 void *event_info __UNUSED__)
78 Evas_Object *win, *bg, *vbox, *hbox, *ic, *bt, *fs_en, *en, *lb;
80 win = elm_win_add(NULL, "fileselector-entry", ELM_WIN_BASIC);
81 elm_win_title_set(win, "File Selector Entry");
82 elm_win_autodel_set(win, EINA_TRUE);
85 elm_win_resize_object_add(win, bg);
86 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
89 vbox = elm_box_add(win);
90 evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
91 elm_win_resize_object_add(win, vbox);
92 evas_object_show(vbox);
94 /* file selector entry */
95 ic = elm_icon_add(win);
96 elm_icon_standard_set(ic, "file");
97 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
98 fs_en = elm_fileselector_entry_add(win);
99 elm_object_text_set(fs_en, "Select a file");
100 elm_fileselector_entry_button_icon_set(fs_en, ic);
101 evas_object_size_hint_weight_set(fs_en, EVAS_HINT_EXPAND, 0.0);
102 evas_object_size_hint_align_set(fs_en, EVAS_HINT_FILL, EVAS_HINT_FILL);
104 elm_box_pack_end(vbox, fs_en);
105 evas_object_show(fs_en);
106 evas_object_show(ic);
108 /* attribute setting buttons */
109 hbox = elm_box_add(win);
110 elm_box_horizontal_set(hbox, EINA_TRUE);
111 elm_box_pack_end(vbox, hbox);
112 evas_object_show(hbox);
114 bt = elm_button_add(win);
115 elm_object_text_set(bt, "Toggle inwin mode");
116 evas_object_smart_callback_add(bt, "clicked", _inwin_mode_toggle, fs_en);
117 elm_box_pack_end(hbox, bt);
118 evas_object_show(bt);
120 bt = elm_button_add(win);
121 elm_object_text_set(bt, "Toggle folder only mode");
122 evas_object_smart_callback_add(bt, "clicked", _folder_only_toggle, fs_en);
123 elm_box_pack_end(hbox, bt);
124 evas_object_show(bt);
126 bt = elm_button_add(win);
127 elm_object_text_set(bt, "Toggle expandable mode");
128 evas_object_smart_callback_add(bt, "clicked", _expandable_toggle, fs_en);
129 elm_box_pack_end(hbox, bt);
130 evas_object_show(bt);
132 lb = elm_label_add(win);
133 elm_object_text_set(lb, "Last selection:");
134 elm_box_pack_end(vbox, lb);
135 evas_object_show(lb);
137 hbox = elm_box_add(win);
138 elm_box_horizontal_set(hbox, EINA_TRUE);
139 elm_box_pack_end(vbox, hbox);
140 evas_object_show(hbox);
142 bt = elm_button_add(win);
143 elm_object_text_set(bt, "Toggle disabled");
144 evas_object_smart_callback_add(bt, "clicked", _disabled_toggle, fs_en);
145 elm_box_pack_end(hbox, bt);
146 evas_object_show(bt);
148 en = elm_entry_add(win);
149 elm_entry_line_wrap_set(en, ELM_WRAP_NONE);
150 elm_entry_editable_set(en, EINA_FALSE);
151 evas_object_smart_callback_add(fs_en, "file,chosen", _file_chosen, en);
152 elm_box_pack_end(vbox, en);
153 evas_object_show(en);
155 evas_object_resize(win, 400, 500);
156 evas_object_show(win);