0d443319a396a7aadf9395e6942099c58078ea19
[framework/uifw/elementary.git] / src / bin / test_entry.c
1 #include <Elementary.h>
2 #ifdef HAVE_CONFIG_H
3 # include "elementary_config.h"
4 #endif
5 #ifndef ELM_LIB_QUICKLAUNCH
6 static void
7 my_entry_bt_1(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
8 {
9    Evas_Object *en = data;
10    elm_entry_entry_set(en, "");
11 }
12
13 static void
14 my_entry_bt_2(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
15 {
16    Evas_Object *en = data;
17    const char *s = elm_entry_entry_get(en);
18    printf("ENTRY:\n");
19    if (s) printf("%s\n", s);
20    printf("ENTRY PLAIN UTF8:\n");
21    if (s)
22      {
23         s = elm_entry_markup_to_utf8(s);
24         if (s)
25           {
26              printf("%s\n", s);
27              free((char *)s);
28           }
29      }
30 }
31
32 static void
33 my_entry_bt_3(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
34 {
35    Evas_Object *en = data;
36    const char *s = elm_entry_selection_get(en);
37    printf("SELECTION:\n");
38    if (s) printf("%s\n", s);
39    printf("SELECTION PLAIN UTF8:\n");
40    if (s)
41      {
42         s = elm_entry_markup_to_utf8(s);
43         if (s)
44           {
45              printf("%s\n", s);
46              free((char *)s);
47           }
48      }
49 }
50
51 static void
52 my_entry_bt_4(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
53 {
54    Evas_Object *en = data;
55    elm_entry_entry_insert(en, "Insert some <b>BOLD</> text");
56 }
57
58 void
59 test_entry(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
60 {
61    Evas_Object *win, *bg, *bx, *bx2, *bt, *en;
62    char buf[4096];
63
64    win = elm_win_add(NULL, "entry", ELM_WIN_BASIC);
65    elm_win_title_set(win, "Entry");
66    elm_win_autodel_set(win, 1);
67
68    bg = elm_bg_add(win);
69    elm_win_resize_object_add(win, bg);
70    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
71    evas_object_show(bg);
72
73    bx = elm_box_add(win);
74    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
75    elm_win_resize_object_add(win, bx);
76    evas_object_show(bx);
77
78    en = elm_entry_add(win);
79    elm_entry_line_wrap_set(en, 0);
80    snprintf(buf, sizeof(buf),
81             "This is an entry widget in this window that<br>"
82             "uses markup <b>like this</> for styling and<br>"
83             "formatting <em>like this</>, as well as<br>"
84             "<a href=X><link>links in the text</></a>, so enter text<br>"
85             "in here to edit it. By the way, links are<br>"
86             "called <a href=anc-02>Anchors</a> so you will need<br>"
87             "to refer to them this way.<br>"
88             "<br>"
89             
90             "Also you can stick in items with (relsize + ascent): "
91             "<item relsize=16x16 vsize=ascent href=emoticon/evil-laugh></item>"
92             " (full) "
93             "<item relsize=16x16 vsize=full href=emoticon/guilty-smile></item>"
94             " (to the left)<br>"
95             
96             "Also (size + ascent): "
97             "<item size=16x16 vsize=ascent href=emoticon/haha></item>"
98             " (full) "
99             "<item size=16x16 vsize=full href=emoticon/happy-panting></item>"
100             " (before this)<br>"
101             
102             "And as well (absize + ascent): "
103             "<item absize=64x64 vsize=ascent href=emoticon/knowing-grin></item>"
104             " (full) "
105             "<item absize=64x64 vsize=full href=emoticon/not-impressed></item>"
106             " or even paths to image files on disk too like: "
107             "<item absize=96x128 vsize=full href=file://%s/images/sky_01.jpg></item>"
108             " ... end."
109             , PACKAGE_DATA_DIR
110             );
111    elm_entry_entry_set(en, buf);
112    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
113    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
114    elm_box_pack_end(bx, en);
115    evas_object_show(en);
116
117    bx2 = elm_box_add(win);
118    elm_box_horizontal_set(bx2, 1);
119    evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
120    evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
121
122    bt = elm_button_add(win);
123    elm_button_label_set(bt, "Clear");
124    evas_object_smart_callback_add(bt, "clicked", my_entry_bt_1, en);
125    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
126    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
127    elm_box_pack_end(bx2, bt);
128    evas_object_propagate_events_set(bt, 0);
129    elm_object_focus_allow_set(bt, 0);
130    evas_object_show(bt);
131
132    bt = elm_button_add(win);
133    elm_button_label_set(bt, "Print");
134    evas_object_smart_callback_add(bt, "clicked", my_entry_bt_2, en);
135    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
136    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
137    elm_box_pack_end(bx2, bt);
138    evas_object_propagate_events_set(bt, 0);
139    elm_object_focus_allow_set(bt, 0);
140    evas_object_show(bt);
141
142    bt = elm_button_add(win);
143    elm_button_label_set(bt, "Selection");
144    evas_object_smart_callback_add(bt, "clicked", my_entry_bt_3, en);
145    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
146    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
147    elm_box_pack_end(bx2, bt);
148    evas_object_propagate_events_set(bt, 0);
149    elm_object_focus_allow_set(bt, 0);
150    evas_object_show(bt);
151
152    bt = elm_button_add(win);
153    elm_button_label_set(bt, "Insert");
154    evas_object_smart_callback_add(bt, "clicked", my_entry_bt_4, en);
155    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
156    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
157    elm_box_pack_end(bx2, bt);
158    evas_object_propagate_events_set(bt, 0);
159    elm_object_focus_allow_set(bt, 0);
160    evas_object_show(bt);
161
162    elm_box_pack_end(bx, bx2);
163    evas_object_show(bx2);
164
165    elm_object_focus(en);
166    evas_object_show(win);
167 }
168
169 static void
170 my_scrolled_entry_bt_1(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
171 {
172    Evas_Object *en = data;
173    elm_scrolled_entry_entry_set(en, "");
174 }
175
176 static void
177 my_scrolled_entry_bt_2(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
178 {
179    Evas_Object *en = data;
180    const char *s = elm_scrolled_entry_entry_get(en);
181    printf("ENTRY:\n");
182    if (s) printf("%s\n", s);
183    printf("ENTRY PLAIN UTF8:\n");
184    if (s)
185      {
186         s = elm_entry_markup_to_utf8(s);
187         if (s)
188           {
189              printf("%s\n", s);
190              free((char *)s);
191           }
192      }
193 }
194
195 static void
196 my_scrolled_entry_bt_3(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
197 {
198    Evas_Object *en = data;
199    const char *s = elm_scrolled_entry_selection_get(en);
200    printf("SELECTION:\n");
201    if (s) printf("%s\n", s);
202    printf("SELECTION PLAIN UTF8:\n");
203    if (s)
204      {
205         s = elm_entry_markup_to_utf8(s);
206         if (s)
207           {
208              printf("%s\n", s);
209              free((char *)s);
210           }
211      }
212 }
213
214 static void
215 my_scrolled_entry_bt_4(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
216 {
217    Evas_Object *en = data;
218    elm_scrolled_entry_entry_insert(en, "Insert some <b>BOLD</> text");
219 }
220
221 static void
222 my_scrolled_entry_bt_5(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
223 {
224    Evas_Object *en = data;
225    const char *s = elm_scrolled_entry_entry_get(en);
226    printf("PASSWORD: '%s'\n", s ? s : "");
227 }
228
229 static void
230 scrolled_anchor_test(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
231 {
232    Evas_Object *en = data;
233    elm_scrolled_entry_entry_insert(en, "ANCHOR CLICKED");
234 }
235
236 void
237 test_entry_scrolled(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
238 {
239    Evas_Object *win, *bg, *bx, *bx2, *bt, *en, *en_p, *sp;
240    static Elm_Entry_Filter_Accept_Set digits_filter_data, digits_filter_data2;
241    static Elm_Entry_Filter_Limit_Size limit_filter_data, limit_filter_data2;
242
243    win = elm_win_add(NULL, "entry-scrolled", ELM_WIN_BASIC);
244    elm_win_title_set(win, "Entry Scrolled");
245    elm_win_autodel_set(win, 1);
246
247    bg = elm_bg_add(win);
248    elm_win_resize_object_add(win, bg);
249    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
250    evas_object_show(bg);
251
252    bx = elm_box_add(win);
253    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
254    elm_win_resize_object_add(win, bx);
255    evas_object_show(bx);
256
257    /* disabled entry */
258    en = elm_scrolled_entry_add(win);
259    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
260    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
261    elm_scrolled_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
262    elm_scrolled_entry_entry_set(en, "Disabled entry");
263    elm_scrolled_entry_single_line_set(en, 1);
264    elm_object_disabled_set(en, 1);
265    evas_object_show(en);
266    elm_box_pack_end(bx, en);
267
268    /* password entry */
269    en = elm_scrolled_entry_add(win);
270    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
271    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
272    elm_scrolled_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
273    elm_scrolled_entry_password_set(en, 1);
274    elm_scrolled_entry_single_line_set(en, 1);
275    elm_scrolled_entry_entry_set(en, "Access denied, give up!");
276    elm_object_disabled_set(en, 1);
277    evas_object_show(en);
278    elm_box_pack_end(bx, en);
279
280    /* multi-line disable entry */
281    en = elm_scrolled_entry_add(win);
282    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
283    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
284    elm_scrolled_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_ON, ELM_SCROLLER_POLICY_ON);
285    elm_object_disabled_set(en, 1);
286    elm_scrolled_entry_context_menu_item_add(en, "Hello", NULL, ELM_ICON_NONE, NULL, NULL);
287    elm_scrolled_entry_context_menu_item_add(en, "World", NULL, ELM_ICON_NONE, NULL, NULL);
288    elm_scrolled_entry_entry_set(en,
289                                 "Multi-line disabled entry widget :)<br>"
290                                 "We can use markup <b>like this</> for styling and<br>"
291                                 "formatting <em>like this</>, as well as<br>"
292                                 "<a href=X><link>links in the text</></a>,"
293                                 "but it won't be editable or clickable.");
294    evas_object_show(en);
295    elm_box_pack_end(bx, en);
296
297    sp = elm_separator_add(win);
298    elm_separator_horizontal_set(sp, 1);
299    elm_box_pack_end(bx, sp);
300    evas_object_show(sp);
301
302    /* Single line selected entry */
303    en = elm_scrolled_entry_add(win);
304    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
305    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
306    elm_scrolled_entry_entry_set(en, "This is a single line");
307    elm_scrolled_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
308    elm_scrolled_entry_single_line_set(en, 1);
309    elm_scrolled_entry_select_all(en);
310    evas_object_show(en);
311    elm_box_pack_end(bx, en);
312
313    /* Only digits entry */
314    en = elm_scrolled_entry_add(win);
315    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
316    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
317    elm_scrolled_entry_entry_set(en, "01234");
318    elm_scrolled_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
319    elm_scrolled_entry_single_line_set(en, 1);
320    evas_object_show(en);
321    elm_box_pack_end(bx, en);
322
323    digits_filter_data.accepted = "0123456789";
324    digits_filter_data.rejected = NULL;
325    elm_scrolled_entry_text_filter_append(en, elm_entry_filter_accept_set, &digits_filter_data);
326
327    /* No digits entry */
328    en = elm_scrolled_entry_add(win);
329    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
330    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
331    elm_scrolled_entry_entry_set(en, "No numbers here");
332    elm_scrolled_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
333    elm_scrolled_entry_single_line_set(en, 1);
334    evas_object_show(en);
335    elm_box_pack_end(bx, en);
336
337    digits_filter_data2.accepted = NULL;
338    digits_filter_data2.rejected = "0123456789";
339    elm_scrolled_entry_text_filter_append(en, elm_entry_filter_accept_set, &digits_filter_data2);
340
341    /* Size limited entry */
342    en = elm_scrolled_entry_add(win);
343    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
344    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
345    elm_scrolled_entry_entry_set(en, "Just 20 chars");
346    elm_scrolled_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
347    elm_scrolled_entry_single_line_set(en, 1);
348    evas_object_show(en);
349    elm_box_pack_end(bx, en);
350
351    limit_filter_data.max_char_count = 20;
352    limit_filter_data.max_byte_count = 0;
353    elm_scrolled_entry_text_filter_append(en, elm_entry_filter_limit_size, &limit_filter_data);
354
355    /* Byte size limited entry */
356    en = elm_scrolled_entry_add(win);
357    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
358    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
359    elm_scrolled_entry_entry_set(en, "And now only 30 bytes");
360    elm_scrolled_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
361    elm_scrolled_entry_single_line_set(en, 1);
362    evas_object_show(en);
363    elm_box_pack_end(bx, en);
364
365    limit_filter_data2.max_char_count = 0;
366    limit_filter_data2.max_byte_count = 30;
367    elm_scrolled_entry_text_filter_append(en, elm_entry_filter_limit_size, &limit_filter_data2);
368
369    /* Single line password entry */
370    en_p = elm_scrolled_entry_add(win);
371    evas_object_size_hint_weight_set(en_p, EVAS_HINT_EXPAND, 0.0);
372    evas_object_size_hint_align_set(en_p, EVAS_HINT_FILL, 0.5);
373    elm_scrolled_entry_scrollbar_policy_set(en_p, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
374    elm_scrolled_entry_entry_set(en_p, "Password here");
375    elm_scrolled_entry_single_line_set(en_p, 1);
376    elm_scrolled_entry_password_set(en_p, 1);
377    evas_object_show(en_p);
378    elm_box_pack_end(bx, en_p);
379
380    /* scrolled entry with icon/end widgets*/
381    en = elm_scrolled_entry_add(win);
382    elm_scrolled_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
383    elm_scrolled_entry_single_line_set(en, 1);
384    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
385    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
386    bt = elm_icon_add(win);
387    elm_icon_standard_set(bt, "home");
388    evas_object_size_hint_min_set(bt, 48, 48);
389    evas_object_color_set(bt, 255, 0, 0, 128);
390    evas_object_show(bt);
391    elm_scrolled_entry_icon_set(en, bt);
392    bt = elm_icon_add(win);
393    elm_icon_standard_set(bt, "delete");
394    evas_object_color_set(bt, 255, 0, 0, 128);
395    evas_object_size_hint_min_set(bt, 48, 48);
396    evas_object_show(bt);
397    elm_scrolled_entry_end_set(en, bt);
398    elm_scrolled_entry_entry_set(en, "scrolled entry with icon and end objects");
399    evas_object_show(en);
400    elm_box_pack_end(bx, en);
401
402    /* markup scrolled entry */
403    en = elm_scrolled_entry_add(win);
404    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
405    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
406    elm_scrolled_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_ON, ELM_SCROLLER_POLICY_ON);
407    elm_scrolled_entry_entry_set(en,
408                                 "This is an entry widget in this window that<br>"
409                                 "uses markup <b>like this</> for styling and<br>"
410                                 "formatting <em>like this</>, as well as<br>"
411                                 "<a href=X><link>links in the text</></a>, so enter text<br>"
412                                 "in here to edit it. By them way, links are<br>"
413                                 "called <a href=anc-02>Anchors</a> so you will need<br>"
414                                 "to refer to them this way. At the end here is a really long "
415                                 "line to test line wrapping to see if it works. But just in "
416                                 "case this line is not long enough I will add more here to "
417                                 "really test it out, as Elementary really needs some "
418                                 "good testing to see if entry widgets work as advertised.");
419    evas_object_smart_callback_add(en, "anchor,clicked", scrolled_anchor_test, en);
420    evas_object_show(en);
421    elm_box_pack_end(bx, en);
422
423    bx2 = elm_box_add(win);
424    elm_box_horizontal_set(bx2, 1);
425    evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
426    evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
427
428    bt = elm_button_add(win);
429    elm_button_label_set(bt, "Clear");
430    evas_object_smart_callback_add(bt, "clicked", my_scrolled_entry_bt_1, en);
431    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
432    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
433    elm_box_pack_end(bx2, bt);
434    evas_object_propagate_events_set(bt, 0);
435    elm_object_focus_allow_set(bt, 0);
436    evas_object_show(bt);
437
438    bt = elm_button_add(win);
439    elm_button_label_set(bt, "Print");
440    evas_object_smart_callback_add(bt, "clicked", my_scrolled_entry_bt_2, en);
441    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
442    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
443    elm_box_pack_end(bx2, bt);
444    evas_object_propagate_events_set(bt, 0);
445    elm_object_focus_allow_set(bt, 0);
446    evas_object_show(bt);
447
448    bt = elm_button_add(win);
449    elm_button_label_set(bt, "Print pwd");
450    evas_object_smart_callback_add(bt, "clicked", my_scrolled_entry_bt_5, en_p);
451    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
452    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
453    elm_box_pack_end(bx2, bt);
454    evas_object_propagate_events_set(bt, 0);
455    elm_object_focus_allow_set(bt, 0);
456    evas_object_show(bt);
457
458    bt = elm_button_add(win);
459    elm_button_label_set(bt, "Selection");
460    evas_object_smart_callback_add(bt, "clicked", my_scrolled_entry_bt_3, en);
461    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
462    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
463    elm_box_pack_end(bx2, bt);
464    evas_object_propagate_events_set(bt, 0);
465    elm_object_focus_allow_set(bt, 0);
466    evas_object_show(bt);
467
468    bt = elm_button_add(win);
469    elm_button_label_set(bt, "Insert");
470    evas_object_smart_callback_add(bt, "clicked", my_scrolled_entry_bt_4, en);
471    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
472    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
473    elm_box_pack_end(bx2, bt);
474    evas_object_propagate_events_set(bt, 0);
475    elm_object_focus_allow_set(bt, 0);
476    evas_object_show(bt);
477
478    elm_box_pack_end(bx, bx2);
479    evas_object_show(bx2);
480
481    evas_object_resize(win, 320, 300);
482
483    elm_object_focus(win);
484    evas_object_show(win);
485 }
486
487 static void
488 my_ent_bt_clr(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
489 {
490    Evas_Object *en = data;
491    elm_scrolled_entry_entry_set(en, "");
492 }
493
494 static void
495 my_ent_bt_pri(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
496 {
497    Evas_Object *en = data;
498    const char *s = elm_scrolled_entry_entry_get(en);
499    printf("ENTRY:\n");
500    if (s) printf("%s\n", s);
501    printf("ENTRY PLAIN UTF8:\n");
502    if (s)
503      {
504         s = elm_entry_markup_to_utf8(s);
505         if (s)
506           {
507              printf("%s\n", s);
508              free((char *)s);
509           }
510      }
511 }
512
513 static void
514 my_ent_bt_sel(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
515 {
516    Evas_Object *en = data;
517    const char *s = elm_scrolled_entry_selection_get(en);
518    printf("SELECTION:\n");
519    if (s) printf("%s\n", s);
520    printf("SELECTION PLAIN UTF8:\n");
521    if (s)
522      {
523         s = elm_entry_markup_to_utf8(s);
524         if (s)
525           {
526              printf("%s\n", s);
527              free((char *)s);
528           }
529      }
530 }
531
532 static void
533 my_ent_bt_all(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
534 {
535    Evas_Object *en = data;
536    elm_scrolled_entry_select_all(en);
537 }
538
539 static void
540 my_ent_bt_non(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
541 {
542    Evas_Object *en = data;
543    elm_scrolled_entry_select_none(en);
544 }
545
546 static void
547 my_ent_bt_ins(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
548 {
549    Evas_Object *en = data;
550    elm_scrolled_entry_entry_insert(en, "Insert text");
551 }
552
553 static void
554 my_ent_bt_lef(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
555 {
556    Evas_Object *en = data;
557    elm_scrolled_entry_cursor_prev(en);
558 }
559
560 static void
561 my_ent_bt_rig(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
562 {
563    Evas_Object *en = data;
564    elm_scrolled_entry_cursor_next(en);
565 }
566
567 static void
568 my_ent_bt_up_(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
569 {
570    Evas_Object *en = data;
571    elm_scrolled_entry_cursor_up(en);
572 }
573
574 static void
575 my_ent_bt_dow(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
576 {
577    Evas_Object *en = data;
578    elm_scrolled_entry_cursor_down(en);
579 }
580
581 static void
582 my_ent_bt_beg(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
583 {
584    Evas_Object *en = data;
585    elm_scrolled_entry_cursor_begin_set(en);
586 }
587
588 static void
589 my_ent_bt_end(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
590 {
591    Evas_Object *en = data;
592    elm_scrolled_entry_cursor_end_set(en);
593 }
594
595 static void
596 my_ent_bt_lbe(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
597 {
598    Evas_Object *en = data;
599    elm_scrolled_entry_cursor_line_begin_set(en);
600 }
601
602 static void
603 my_ent_bt_len(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
604 {
605    Evas_Object *en = data;
606    elm_scrolled_entry_cursor_line_end_set(en);
607 }
608
609 static void
610 my_ent_bt_sbe(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
611 {
612    Evas_Object *en = data;
613    elm_scrolled_entry_cursor_selection_begin(en);
614 }
615
616 static void
617 my_ent_bt_sen(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
618 {
619    Evas_Object *en = data;
620    elm_scrolled_entry_cursor_selection_end(en);
621 }
622
623 static void
624 my_ent_bt_fmt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
625 {
626    Evas_Object *en = data;
627    printf("IS FORMAT: %i\n", 
628           (int)elm_scrolled_entry_cursor_is_format_get(en));
629 }
630
631 static void
632 my_ent_bt_vfm(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
633 {
634    Evas_Object *en = data;
635    printf("IS VISIBLE FORMAT %i\n",
636           (int)elm_scrolled_entry_cursor_is_visible_format_get(en));
637 }
638
639 static void
640 my_ent_bt_chr(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
641 {
642    Evas_Object *en = data;
643    printf("CHAR '%s'\n", elm_scrolled_entry_cursor_content_get(en));
644 }
645
646 static void
647 my_ent_bt_cut(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
648 {
649    Evas_Object *en = data;
650    elm_scrolled_entry_selection_cut(en);
651 }
652
653 static void
654 my_ent_bt_cop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
655 {
656    Evas_Object *en = data;
657    elm_scrolled_entry_selection_copy(en);
658 }
659
660 static void
661 my_ent_bt_pas(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
662 {
663    Evas_Object *en = data;
664    elm_scrolled_entry_selection_paste(en);
665 }
666
667 void
668 test_entry3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
669 {
670    Evas_Object *win, *bg, *bx, *bx2, *bt, *en;
671
672    win = elm_win_add(NULL, "entry3", ELM_WIN_BASIC);
673    elm_win_title_set(win, "Entry 3");
674    elm_win_autodel_set(win, 1);
675
676    bg = elm_bg_add(win);
677    elm_win_resize_object_add(win, bg);
678    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
679    evas_object_show(bg);
680
681    bx = elm_box_add(win);
682    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
683    elm_win_resize_object_add(win, bx);
684    evas_object_show(bx);
685
686    /* Single line selected entry */
687    en = elm_scrolled_entry_add(win);
688    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
689    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
690    elm_scrolled_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
691    elm_scrolled_entry_entry_set(en, "This is a single line");
692    elm_scrolled_entry_single_line_set(en, 1);
693    elm_box_pack_end(bx, en);
694    evas_object_show(en);
695
696    bx2 = elm_box_add(win);
697    elm_box_horizontal_set(bx2, 1);
698    evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
699    evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
700
701    bt = elm_button_add(win);
702    elm_button_label_set(bt, "Clr");
703    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_clr, en);
704    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
705    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
706    elm_box_pack_end(bx2, bt);
707    evas_object_propagate_events_set(bt, 0);
708    elm_object_focus_allow_set(bt, 0);
709    evas_object_show(bt);
710
711    bt = elm_button_add(win);
712    elm_button_label_set(bt, "Pri");
713    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_pri, en);
714    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
715    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
716    elm_box_pack_end(bx2, bt);
717    evas_object_propagate_events_set(bt, 0);
718    elm_object_focus_allow_set(bt, 0);
719    evas_object_show(bt);
720
721    bt = elm_button_add(win);
722    elm_button_label_set(bt, "Sel");
723    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_sel, en);
724    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
725    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
726    elm_box_pack_end(bx2, bt);
727    evas_object_propagate_events_set(bt, 0);
728    elm_object_focus_allow_set(bt, 0);
729    evas_object_show(bt);
730
731    bt = elm_button_add(win);
732    elm_button_label_set(bt, "All");
733    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_all, en);
734    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
735    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
736    elm_box_pack_end(bx2, bt);
737    evas_object_propagate_events_set(bt, 0);
738    elm_object_focus_allow_set(bt, 0);
739    evas_object_show(bt);
740
741    bt = elm_button_add(win);
742    elm_button_label_set(bt, "Non");
743    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_non, en);
744    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
745    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
746    elm_box_pack_end(bx2, bt);
747    evas_object_propagate_events_set(bt, 0);
748    elm_object_focus_allow_set(bt, 0);
749    evas_object_show(bt);
750
751    bt = elm_button_add(win);
752    elm_button_label_set(bt, "Ins");
753    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_ins, en);
754    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
755    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
756    elm_box_pack_end(bx2, bt);
757    evas_object_propagate_events_set(bt, 0);
758    elm_object_focus_allow_set(bt, 0);
759    evas_object_show(bt);
760
761    elm_box_pack_end(bx, bx2);
762    evas_object_show(bx2);
763
764    bx2 = elm_box_add(win);
765    elm_box_horizontal_set(bx2, 1);
766    evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
767    evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
768
769    bt = elm_button_add(win);
770    elm_button_label_set(bt, "Lef");
771    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_lef, en);
772    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
773    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
774    elm_box_pack_end(bx2, bt);
775    evas_object_propagate_events_set(bt, 0);
776    elm_object_focus_allow_set(bt, 0);
777    evas_object_show(bt);
778
779    bt = elm_button_add(win);
780    elm_button_label_set(bt, "Rig");
781    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_rig, en);
782    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
783    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
784    elm_box_pack_end(bx2, bt);
785    evas_object_propagate_events_set(bt, 0);
786    elm_object_focus_allow_set(bt, 0);
787    evas_object_show(bt);
788
789    bt = elm_button_add(win);
790    elm_button_label_set(bt, "Up ");
791    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_up_, en);
792    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
793    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
794    elm_box_pack_end(bx2, bt);
795    evas_object_propagate_events_set(bt, 0);
796    elm_object_focus_allow_set(bt, 0);
797    evas_object_show(bt);
798
799    bt = elm_button_add(win);
800    elm_button_label_set(bt, "Dow");
801    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_dow, en);
802    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
803    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
804    elm_box_pack_end(bx2, bt);
805    evas_object_propagate_events_set(bt, 0);
806    elm_object_focus_allow_set(bt, 0);
807    evas_object_show(bt);
808
809    bt = elm_button_add(win);
810    elm_button_label_set(bt, "Beg");
811    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_beg, en);
812    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
813    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
814    elm_box_pack_end(bx2, bt);
815    evas_object_propagate_events_set(bt, 0);
816    elm_object_focus_allow_set(bt, 0);
817    evas_object_show(bt);
818
819    bt = elm_button_add(win);
820    elm_button_label_set(bt, "End");
821    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_end, en);
822    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
823    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
824    elm_box_pack_end(bx2, bt);
825    evas_object_propagate_events_set(bt, 0);
826    elm_object_focus_allow_set(bt, 0);
827    evas_object_show(bt);
828
829    elm_box_pack_end(bx, bx2);
830    evas_object_show(bx2);
831
832    bx2 = elm_box_add(win);
833    elm_box_horizontal_set(bx2, 1);
834    evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
835    evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
836
837    bt = elm_button_add(win);
838    elm_button_label_set(bt, "LBe");
839    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_lbe, en);
840    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
841    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
842    elm_box_pack_end(bx2, bt);
843    evas_object_propagate_events_set(bt, 0);
844    elm_object_focus_allow_set(bt, 0);
845    evas_object_show(bt);
846
847    bt = elm_button_add(win);
848    elm_button_label_set(bt, "LEn");
849    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_len, en);
850    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
851    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
852    elm_box_pack_end(bx2, bt);
853    evas_object_propagate_events_set(bt, 0);
854    elm_object_focus_allow_set(bt, 0);
855    evas_object_show(bt);
856
857    bt = elm_button_add(win);
858    elm_button_label_set(bt, "SBe");
859    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_sbe, en);
860    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
861    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
862    elm_box_pack_end(bx2, bt);
863    evas_object_propagate_events_set(bt, 0);
864    elm_object_focus_allow_set(bt, 0);
865    evas_object_show(bt);
866
867    bt = elm_button_add(win);
868    elm_button_label_set(bt, "SEn");
869    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_sen, en);
870    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
871    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
872    elm_box_pack_end(bx2, bt);
873    evas_object_propagate_events_set(bt, 0);
874    elm_object_focus_allow_set(bt, 0);
875    evas_object_show(bt);
876
877    bt = elm_button_add(win);
878    elm_button_label_set(bt, "Fmt");
879    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_fmt, en);
880    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
881    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
882    elm_box_pack_end(bx2, bt);
883    evas_object_propagate_events_set(bt, 0);
884    elm_object_focus_allow_set(bt, 0);
885    evas_object_show(bt);
886
887    bt = elm_button_add(win);
888    elm_button_label_set(bt, "VFm");
889    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_vfm, en);
890    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
891    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
892    elm_box_pack_end(bx2, bt);
893    evas_object_propagate_events_set(bt, 0);
894    elm_object_focus_allow_set(bt, 0);
895    evas_object_show(bt);
896
897    elm_box_pack_end(bx, bx2);
898    evas_object_show(bx2);
899
900    bx2 = elm_box_add(win);
901    elm_box_horizontal_set(bx2, 1);
902    evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
903    evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
904
905    bt = elm_button_add(win);
906    elm_button_label_set(bt, "Chr");
907    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_chr, en);
908    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
909    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
910    elm_box_pack_end(bx2, bt);
911    evas_object_propagate_events_set(bt, 0);
912    elm_object_focus_allow_set(bt, 0);
913    evas_object_show(bt);
914
915    bt = elm_button_add(win);
916    elm_button_label_set(bt, "Cut");
917    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_cut, en);
918    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
919    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
920    elm_box_pack_end(bx2, bt);
921    evas_object_propagate_events_set(bt, 0);
922    elm_object_focus_allow_set(bt, 0);
923    evas_object_show(bt);
924
925    bt = elm_button_add(win);
926    elm_button_label_set(bt, "Cop");
927    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_cop, en);
928    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
929    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
930    elm_box_pack_end(bx2, bt);
931    evas_object_propagate_events_set(bt, 0);
932    elm_object_focus_allow_set(bt, 0);
933    evas_object_show(bt);
934
935    bt = elm_button_add(win);
936    elm_button_label_set(bt, "Pas");
937    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_pas, en);
938    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
939    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
940    elm_box_pack_end(bx2, bt);
941    evas_object_propagate_events_set(bt, 0);
942    elm_object_focus_allow_set(bt, 0);
943    evas_object_show(bt);
944
945    elm_box_pack_end(bx, bx2);
946    evas_object_show(bx2);
947
948    /* markup scrolled entry */
949    en = elm_scrolled_entry_add(win);
950    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
951    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
952    elm_scrolled_entry_entry_set(en,
953                                 "This is an entry widget in this window that<br>"
954                                 "uses markup <b>like this</> for styling and<br>"
955                                 "formatting <em>like this</>, as well as<br>"
956                                 "<a href=X><link>links in the text</></a>, so enter text<br>"
957                                 "in here to edit it. By them way, links are<br>"
958                                 "called <a href=anc-02>Anchors</a> so you will need<br>"
959                                 "to refer to them this way. At the end here is a really long "
960                                 "line to test line wrapping to see if it works. But just in "
961                                 "case this line is not long enough I will add more here to "
962                                 "really test it out, as Elementary really needs some "
963                                 "good testing to see if entry widgets work as advertised."
964                                 );
965    evas_object_smart_callback_add(en, "anchor,clicked", scrolled_anchor_test, en);
966    elm_box_pack_end(bx, en);
967    evas_object_show(en);
968    
969    bx2 = elm_box_add(win);
970    elm_box_horizontal_set(bx2, 1);
971    evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
972    evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
973
974    bt = elm_button_add(win);
975    elm_button_label_set(bt, "Clr");
976    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_clr, en);
977    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
978    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
979    elm_box_pack_end(bx2, bt);
980    evas_object_propagate_events_set(bt, 0);
981    elm_object_focus_allow_set(bt, 0);
982    evas_object_show(bt);
983
984    bt = elm_button_add(win);
985    elm_button_label_set(bt, "Pri");
986    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_pri, en);
987    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
988    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
989    elm_box_pack_end(bx2, bt);
990    evas_object_propagate_events_set(bt, 0);
991    elm_object_focus_allow_set(bt, 0);
992    evas_object_show(bt);
993
994    bt = elm_button_add(win);
995    elm_button_label_set(bt, "Sel");
996    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_sel, en);
997    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
998    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
999    elm_box_pack_end(bx2, bt);
1000    evas_object_propagate_events_set(bt, 0);
1001    elm_object_focus_allow_set(bt, 0);
1002    evas_object_show(bt);
1003
1004    bt = elm_button_add(win);
1005    elm_button_label_set(bt, "All");
1006    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_all, en);
1007    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1008    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1009    elm_box_pack_end(bx2, bt);
1010    evas_object_propagate_events_set(bt, 0);
1011    elm_object_focus_allow_set(bt, 0);
1012    evas_object_show(bt);
1013
1014    bt = elm_button_add(win);
1015    elm_button_label_set(bt, "Non");
1016    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_non, en);
1017    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1018    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1019    elm_box_pack_end(bx2, bt);
1020    evas_object_propagate_events_set(bt, 0);
1021    elm_object_focus_allow_set(bt, 0);
1022    evas_object_show(bt);
1023
1024    bt = elm_button_add(win);
1025    elm_button_label_set(bt, "Ins");
1026    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_ins, en);
1027    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1028    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1029    elm_box_pack_end(bx2, bt);
1030    evas_object_propagate_events_set(bt, 0);
1031    elm_object_focus_allow_set(bt, 0);
1032    evas_object_show(bt);
1033
1034    elm_box_pack_end(bx, bx2);
1035    evas_object_show(bx2);
1036
1037    bx2 = elm_box_add(win);
1038    elm_box_horizontal_set(bx2, 1);
1039    evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
1040    evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
1041
1042    bt = elm_button_add(win);
1043    elm_button_label_set(bt, "Lef");
1044    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_lef, en);
1045    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1046    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1047    elm_box_pack_end(bx2, bt);
1048    evas_object_propagate_events_set(bt, 0);
1049    elm_object_focus_allow_set(bt, 0);
1050    evas_object_show(bt);
1051
1052    bt = elm_button_add(win);
1053    elm_button_label_set(bt, "Rig");
1054    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_rig, en);
1055    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1056    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1057    elm_box_pack_end(bx2, bt);
1058    evas_object_propagate_events_set(bt, 0);
1059    elm_object_focus_allow_set(bt, 0);
1060    evas_object_show(bt);
1061
1062    bt = elm_button_add(win);
1063    elm_button_label_set(bt, "Up ");
1064    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_up_, en);
1065    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1066    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1067    elm_box_pack_end(bx2, bt);
1068    evas_object_propagate_events_set(bt, 0);
1069    elm_object_focus_allow_set(bt, 0);
1070    evas_object_show(bt);
1071
1072    bt = elm_button_add(win);
1073    elm_button_label_set(bt, "Dow");
1074    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_dow, en);
1075    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1076    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1077    elm_box_pack_end(bx2, bt);
1078    evas_object_propagate_events_set(bt, 0);
1079    elm_object_focus_allow_set(bt, 0);
1080    evas_object_show(bt);
1081
1082    bt = elm_button_add(win);
1083    elm_button_label_set(bt, "Beg");
1084    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_beg, en);
1085    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1086    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1087    elm_box_pack_end(bx2, bt);
1088    evas_object_propagate_events_set(bt, 0);
1089    elm_object_focus_allow_set(bt, 0);
1090    evas_object_show(bt);
1091
1092    bt = elm_button_add(win);
1093    elm_button_label_set(bt, "End");
1094    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_end, en);
1095    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1096    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1097    elm_box_pack_end(bx2, bt);
1098    evas_object_propagate_events_set(bt, 0);
1099    elm_object_focus_allow_set(bt, 0);
1100    evas_object_show(bt);
1101
1102    elm_box_pack_end(bx, bx2);
1103    evas_object_show(bx2);
1104
1105    bx2 = elm_box_add(win);
1106    elm_box_horizontal_set(bx2, 1);
1107    evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
1108    evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
1109
1110    bt = elm_button_add(win);
1111    elm_button_label_set(bt, "LBe");
1112    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_lbe, en);
1113    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1114    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1115    elm_box_pack_end(bx2, bt);
1116    evas_object_propagate_events_set(bt, 0);
1117    elm_object_focus_allow_set(bt, 0);
1118    evas_object_show(bt);
1119
1120    bt = elm_button_add(win);
1121    elm_button_label_set(bt, "LEn");
1122    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_len, en);
1123    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1124    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1125    elm_box_pack_end(bx2, bt);
1126    evas_object_propagate_events_set(bt, 0);
1127    elm_object_focus_allow_set(bt, 0);
1128    evas_object_show(bt);
1129
1130    bt = elm_button_add(win);
1131    elm_button_label_set(bt, "SBe");
1132    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_sbe, en);
1133    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1134    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1135    elm_box_pack_end(bx2, bt);
1136    evas_object_propagate_events_set(bt, 0);
1137    elm_object_focus_allow_set(bt, 0);
1138    evas_object_show(bt);
1139
1140    bt = elm_button_add(win);
1141    elm_button_label_set(bt, "SEn");
1142    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_sen, en);
1143    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1144    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1145    elm_box_pack_end(bx2, bt);
1146    evas_object_propagate_events_set(bt, 0);
1147    elm_object_focus_allow_set(bt, 0);
1148    evas_object_show(bt);
1149
1150    bt = elm_button_add(win);
1151    elm_button_label_set(bt, "Fmt");
1152    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_fmt, en);
1153    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1154    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1155    elm_box_pack_end(bx2, bt);
1156    evas_object_propagate_events_set(bt, 0);
1157    elm_object_focus_allow_set(bt, 0);
1158    evas_object_show(bt);
1159
1160    bt = elm_button_add(win);
1161    elm_button_label_set(bt, "VFm");
1162    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_vfm, en);
1163    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1164    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1165    elm_box_pack_end(bx2, bt);
1166    evas_object_propagate_events_set(bt, 0);
1167    elm_object_focus_allow_set(bt, 0);
1168    evas_object_show(bt);
1169
1170    elm_box_pack_end(bx, bx2);
1171    evas_object_show(bx2);
1172
1173    bx2 = elm_box_add(win);
1174    elm_box_horizontal_set(bx2, 1);
1175    evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
1176    evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
1177
1178    bt = elm_button_add(win);
1179    elm_button_label_set(bt, "Chr");
1180    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_chr, en);
1181    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1182    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1183    elm_box_pack_end(bx2, bt);
1184    evas_object_propagate_events_set(bt, 0);
1185    elm_object_focus_allow_set(bt, 0);
1186    evas_object_show(bt);
1187
1188    bt = elm_button_add(win);
1189    elm_button_label_set(bt, "Cut");
1190    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_cut, en);
1191    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1192    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1193    elm_box_pack_end(bx2, bt);
1194    evas_object_propagate_events_set(bt, 0);
1195    elm_object_focus_allow_set(bt, 0);
1196    evas_object_show(bt);
1197
1198    bt = elm_button_add(win);
1199    elm_button_label_set(bt, "Cop");
1200    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_cop, en);
1201    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1202    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1203    elm_box_pack_end(bx2, bt);
1204    evas_object_propagate_events_set(bt, 0);
1205    elm_object_focus_allow_set(bt, 0);
1206    evas_object_show(bt);
1207
1208    bt = elm_button_add(win);
1209    elm_button_label_set(bt, "Pas");
1210    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_pas, en);
1211    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1212    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1213    elm_box_pack_end(bx2, bt); 
1214    evas_object_propagate_events_set(bt, 0);
1215    elm_object_focus_allow_set(bt, 0);
1216    evas_object_show(bt);
1217
1218    elm_box_pack_end(bx, bx2);
1219    evas_object_show(bx2);
1220
1221    evas_object_resize(win, 320, 480);
1222
1223    elm_object_focus(win);
1224    evas_object_show(win);
1225 }
1226
1227 void
1228 test_entry4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1229 {
1230    Evas_Object *win, *bg, *ly, *en;
1231    char buf[PATH_MAX];
1232    
1233    win = elm_win_add(NULL, "entry4", ELM_WIN_BASIC);
1234    elm_win_title_set(win, "Entry 4");
1235    elm_win_autodel_set(win, 1);
1236
1237    bg = elm_bg_add(win);
1238    elm_win_resize_object_add(win, bg);
1239    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1240    evas_object_show(bg);
1241
1242    ly = elm_layout_add(win);
1243    snprintf(buf, sizeof(buf), "%s/objects/test.edj", PACKAGE_DATA_DIR);
1244    elm_layout_file_set(ly, buf, "layout");
1245    evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1246    elm_win_resize_object_add(win, ly);
1247    evas_object_show(ly);
1248    
1249    en = elm_scrolled_entry_add(win);
1250    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
1251    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
1252    elm_scrolled_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
1253    elm_scrolled_entry_entry_set(en, "This is a single line");
1254    elm_scrolled_entry_single_line_set(en, 1);
1255    elm_layout_content_set(ly, "element1", en);
1256    evas_object_show(en);
1257    
1258    en = elm_entry_add(win);
1259    elm_entry_line_wrap_set(en, 0);
1260    elm_entry_entry_set(en,
1261                        "This is an entry widget<br>"
1262                        "that uses markup<br>"
1263                        "<b>like this</> and has<br>"
1264                        "no scroller, so you can<br>"
1265                        "use it more flexibly.");
1266    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1267    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
1268    elm_layout_content_set(ly, "element2", en);
1269    evas_object_show(en);
1270
1271    en = elm_scrolled_entry_add(win);
1272    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1273    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
1274    elm_scrolled_entry_entry_set(en,
1275                                 "This is an entry widget in this window that<br>"
1276                                 "uses markup <b>like this</> for styling and<br>"
1277                                 "formatting <em>like this</>, as well as<br>"
1278                                 "<a href=X><link>links in the text</></a>, so enter text<br>"
1279                                 "in here to edit it. By them way, links are<br>"
1280                                 "called <a href=anc-02>Anchors</a> so you will need<br>"
1281                                 "to refer to them this way. At the end here is a really long "
1282                                 "line to test line wrapping to see if it works. But just in "
1283                                 "case this line is not long enough I will add more here to "
1284                                 "really test it out, as Elementary really needs some "
1285                                 "good testing to see if entry widgets work as advertised."
1286                                 );
1287    evas_object_smart_callback_add(en, "anchor,clicked", scrolled_anchor_test, en);
1288    elm_layout_content_set(ly, "element3", en);
1289    evas_object_show(en);
1290
1291    evas_object_show(win);
1292 }
1293
1294 void
1295 test_entry5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1296 {
1297    Evas_Object *win, *bg, *bx, *bx2, *bt, *en;
1298
1299    win = elm_win_add(NULL, "entry5", ELM_WIN_BASIC);
1300    elm_win_title_set(win, "Entry 5");
1301    elm_win_autodel_set(win, 1);
1302
1303    bg = elm_bg_add(win);
1304    elm_win_resize_object_add(win, bg);
1305    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1306    evas_object_show(bg);
1307
1308    bx = elm_box_add(win);
1309    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1310    elm_win_resize_object_add(win, bx);
1311    evas_object_show(bx);
1312
1313    en = elm_scrolled_entry_add(win);
1314    elm_scrolled_entry_line_char_wrap_set(en, 1);
1315    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1316    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
1317    elm_scrolled_entry_entry_set(en,
1318                                 "This is an entry widget in this window that "
1319                                 "uses markup like this for styling and "
1320                                 "formatting like this, as well as "
1321                                 "to refer to them this way. At the end here is a really long "
1322                                 "line to test line wrapping to see if it works. But just in "
1323                                 "case this line is not long enough I will add more here to "
1324                                 "really test it out, as Elementary really needs some "
1325                                 "good testing to see if entry widgets work as advertised."
1326                                 );
1327    evas_object_smart_callback_add(en, "anchor,clicked", scrolled_anchor_test, en);
1328    elm_box_pack_end(bx, en);
1329    evas_object_show(en);
1330    
1331    bx2 = elm_box_add(win);
1332    elm_box_horizontal_set(bx2, 1);
1333    evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
1334    evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
1335
1336    bt = elm_button_add(win);
1337    elm_button_label_set(bt, "Clr");
1338    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_clr, en);
1339    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1340    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1341    elm_box_pack_end(bx2, bt);
1342    evas_object_propagate_events_set(bt, 0);
1343    elm_object_focus_allow_set(bt, 0);
1344    evas_object_show(bt);
1345
1346    bt = elm_button_add(win);
1347    elm_button_label_set(bt, "Pri");
1348    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_pri, en);
1349    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1350    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1351    elm_box_pack_end(bx2, bt);
1352    evas_object_propagate_events_set(bt, 0);
1353    elm_object_focus_allow_set(bt, 0);
1354    evas_object_show(bt);
1355
1356    bt = elm_button_add(win);
1357    elm_button_label_set(bt, "Sel");
1358    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_sel, en);
1359    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1360    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1361    elm_box_pack_end(bx2, bt);
1362    evas_object_propagate_events_set(bt, 0);
1363    elm_object_focus_allow_set(bt, 0);
1364    evas_object_show(bt);
1365
1366    bt = elm_button_add(win);
1367    elm_button_label_set(bt, "All");
1368    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_all, en);
1369    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1370    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1371    elm_box_pack_end(bx2, bt);
1372    evas_object_propagate_events_set(bt, 0);
1373    elm_object_focus_allow_set(bt, 0);
1374    evas_object_show(bt);
1375
1376    bt = elm_button_add(win);
1377    elm_button_label_set(bt, "Non");
1378    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_non, en);
1379    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1380    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1381    elm_box_pack_end(bx2, bt);
1382    evas_object_propagate_events_set(bt, 0);
1383    elm_object_focus_allow_set(bt, 0);
1384    evas_object_show(bt);
1385
1386    bt = elm_button_add(win);
1387    elm_button_label_set(bt, "Ins");
1388    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_ins, en);
1389    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1390    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1391    elm_box_pack_end(bx2, bt);
1392    evas_object_propagate_events_set(bt, 0);
1393    elm_object_focus_allow_set(bt, 0);
1394    evas_object_show(bt);
1395
1396    elm_box_pack_end(bx, bx2);
1397    evas_object_show(bx2);
1398
1399    bx2 = elm_box_add(win);
1400    elm_box_horizontal_set(bx2, 1);
1401    evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
1402    evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
1403
1404    bt = elm_button_add(win);
1405    elm_button_label_set(bt, "Lef");
1406    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_lef, en);
1407    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1408    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1409    elm_box_pack_end(bx2, bt);
1410    evas_object_propagate_events_set(bt, 0);
1411    elm_object_focus_allow_set(bt, 0);
1412    evas_object_show(bt);
1413
1414    bt = elm_button_add(win);
1415    elm_button_label_set(bt, "Rig");
1416    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_rig, en);
1417    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1418    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1419    elm_box_pack_end(bx2, bt);
1420    evas_object_propagate_events_set(bt, 0);
1421    elm_object_focus_allow_set(bt, 0);
1422    evas_object_show(bt);
1423
1424    bt = elm_button_add(win);
1425    elm_button_label_set(bt, "Up ");
1426    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_up_, en);
1427    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1428    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1429    elm_box_pack_end(bx2, bt);
1430    evas_object_propagate_events_set(bt, 0);
1431    elm_object_focus_allow_set(bt, 0);
1432    evas_object_show(bt);
1433
1434    bt = elm_button_add(win);
1435    elm_button_label_set(bt, "Dow");
1436    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_dow, en);
1437    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1438    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1439    elm_box_pack_end(bx2, bt);
1440    evas_object_propagate_events_set(bt, 0);
1441    elm_object_focus_allow_set(bt, 0);
1442    evas_object_show(bt);
1443
1444    bt = elm_button_add(win);
1445    elm_button_label_set(bt, "Beg");
1446    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_beg, en);
1447    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1448    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1449    elm_box_pack_end(bx2, bt);
1450    evas_object_propagate_events_set(bt, 0);
1451    elm_object_focus_allow_set(bt, 0);
1452    evas_object_show(bt);
1453
1454    bt = elm_button_add(win);
1455    elm_button_label_set(bt, "End");
1456    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_end, en);
1457    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1458    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1459    elm_box_pack_end(bx2, bt);
1460    evas_object_propagate_events_set(bt, 0);
1461    elm_object_focus_allow_set(bt, 0);
1462    evas_object_show(bt);
1463
1464    elm_box_pack_end(bx, bx2);
1465    evas_object_show(bx2);
1466
1467    bx2 = elm_box_add(win);
1468    elm_box_horizontal_set(bx2, 1);
1469    evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
1470    evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
1471
1472    bt = elm_button_add(win);
1473    elm_button_label_set(bt, "LBe");
1474    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_lbe, en);
1475    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1476    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1477    elm_box_pack_end(bx2, bt);
1478    evas_object_propagate_events_set(bt, 0);
1479    elm_object_focus_allow_set(bt, 0);
1480    evas_object_show(bt);
1481
1482    bt = elm_button_add(win);
1483    elm_button_label_set(bt, "LEn");
1484    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_len, en);
1485    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1486    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1487    elm_box_pack_end(bx2, bt);
1488    evas_object_propagate_events_set(bt, 0);
1489    elm_object_focus_allow_set(bt, 0);
1490    evas_object_show(bt);
1491
1492    bt = elm_button_add(win);
1493    elm_button_label_set(bt, "SBe");
1494    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_sbe, en);
1495    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1496    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1497    elm_box_pack_end(bx2, bt);
1498    evas_object_propagate_events_set(bt, 0);
1499    elm_object_focus_allow_set(bt, 0);
1500    evas_object_show(bt);
1501
1502    bt = elm_button_add(win);
1503    elm_button_label_set(bt, "SEn");
1504    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_sen, en);
1505    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1506    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1507    elm_box_pack_end(bx2, bt);
1508    evas_object_propagate_events_set(bt, 0);
1509    elm_object_focus_allow_set(bt, 0);
1510    evas_object_show(bt);
1511
1512    bt = elm_button_add(win);
1513    elm_button_label_set(bt, "Fmt");
1514    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_fmt, en);
1515    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1516    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1517    elm_box_pack_end(bx2, bt);
1518    evas_object_propagate_events_set(bt, 0);
1519    elm_object_focus_allow_set(bt, 0);
1520    evas_object_show(bt);
1521
1522    bt = elm_button_add(win);
1523    elm_button_label_set(bt, "VFm");
1524    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_vfm, en);
1525    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1526    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1527    elm_box_pack_end(bx2, bt);
1528    evas_object_propagate_events_set(bt, 0);
1529    elm_object_focus_allow_set(bt, 0);
1530    evas_object_show(bt);
1531
1532    elm_box_pack_end(bx, bx2);
1533    evas_object_show(bx2);
1534
1535    bx2 = elm_box_add(win);
1536    elm_box_horizontal_set(bx2, 1);
1537    evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
1538    evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
1539
1540    bt = elm_button_add(win);
1541    elm_button_label_set(bt, "Chr");
1542    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_chr, en);
1543    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1544    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1545    elm_box_pack_end(bx2, bt);
1546    evas_object_propagate_events_set(bt, 0);
1547    elm_object_focus_allow_set(bt, 0);
1548    evas_object_show(bt);
1549
1550    bt = elm_button_add(win);
1551    elm_button_label_set(bt, "Cut");
1552    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_cut, en);
1553    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1554    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1555    elm_box_pack_end(bx2, bt);
1556    evas_object_propagate_events_set(bt, 0);
1557    elm_object_focus_allow_set(bt, 0);
1558    evas_object_show(bt);
1559
1560    bt = elm_button_add(win);
1561    elm_button_label_set(bt, "Cop");
1562    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_cop, en);
1563    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1564    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1565    elm_box_pack_end(bx2, bt);
1566    evas_object_propagate_events_set(bt, 0);
1567    elm_object_focus_allow_set(bt, 0);
1568    evas_object_show(bt);
1569
1570    bt = elm_button_add(win);
1571    elm_button_label_set(bt, "Pas");
1572    evas_object_smart_callback_add(bt, "clicked", my_ent_bt_pas, en);
1573    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1574    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1575    elm_box_pack_end(bx2, bt); 
1576    evas_object_propagate_events_set(bt, 0);
1577    elm_object_focus_allow_set(bt, 0);
1578    evas_object_show(bt);
1579
1580    elm_box_pack_end(bx, bx2);
1581    evas_object_show(bx2);
1582
1583    evas_object_resize(win, 320, 480);
1584
1585    elm_object_focus(win);
1586    evas_object_show(win);
1587 }
1588
1589 static void
1590 _scrolled_entry_clear(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1591 {
1592    Evas_Object *en = data;
1593    elm_scrolled_entry_entry_set(en, "");
1594 }
1595
1596 void
1597 test_entry_notepad(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1598 {
1599    Evas_Object *win, *bg, *bx, *bx2, *bt, *np;
1600
1601    win = elm_win_add(NULL, "entry-notepad", ELM_WIN_BASIC);
1602    elm_win_title_set(win, "Entry Notepad");
1603    elm_win_autodel_set(win, EINA_TRUE);
1604
1605    bg = elm_bg_add(win);
1606    elm_win_resize_object_add(win, bg);
1607    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1608    evas_object_show(bg);
1609
1610    bx = elm_box_add(win);
1611    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1612    elm_win_resize_object_add(win, bx);
1613    evas_object_show(bx);
1614
1615    np = elm_scrolled_entry_add(win);
1616    elm_scrolled_entry_file_set(np, "note.txt", ELM_TEXT_FORMAT_PLAIN_UTF8);
1617    evas_object_size_hint_weight_set(np, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1618    evas_object_size_hint_align_set(np, EVAS_HINT_FILL, EVAS_HINT_FILL);
1619    elm_box_pack_end(bx, np);
1620    evas_object_show(np);
1621
1622    bx2 = elm_box_add(win);
1623    elm_box_horizontal_set(bx2, EINA_TRUE);
1624    elm_box_homogenous_set(bx2, EINA_TRUE);
1625    evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
1626    evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
1627
1628    bt = elm_button_add(win);
1629    elm_button_label_set(bt, "Clear");
1630    evas_object_smart_callback_add(bt, "clicked", _scrolled_entry_clear, np);
1631    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1632    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1633    elm_box_pack_end(bx2, bt);
1634    evas_object_show(bt);
1635
1636    elm_box_pack_end(bx, bx2);
1637    evas_object_show(bx2);
1638
1639    evas_object_resize(win, 320, 300);
1640
1641    elm_object_focus(win);
1642    evas_object_show(win);
1643 }
1644 #endif