aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/elementary/src/bin/test_entry_anchor2.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/elementary/src/bin/test_entry_anchor2.c')
-rw-r--r--libraries/elementary/src/bin/test_entry_anchor2.c102
1 files changed, 102 insertions, 0 deletions
diff --git a/libraries/elementary/src/bin/test_entry_anchor2.c b/libraries/elementary/src/bin/test_entry_anchor2.c
new file mode 100644
index 0000000..eb1762b
--- /dev/null
+++ b/libraries/elementary/src/bin/test_entry_anchor2.c
@@ -0,0 +1,102 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4#include <Elementary.h>
5#ifndef ELM_LIB_QUICKLAUNCH
6static void
7my_entry_anchor_bt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
8{
9 Evas_Object *av = data;
10 elm_entry_anchor_hover_end(av);
11}
12
13static void
14my_anchorview_anchor(void *data, Evas_Object *obj, void *event_info)
15{
16 Evas_Object *av = data;
17 Elm_Entry_Anchor_Hover_Info *ei = event_info;
18 Evas_Object *bt, *bx;
19
20 bt = elm_button_add(obj);
21 elm_object_text_set(bt, ei->anchor_info->name);
22 elm_object_part_content_set(ei->hover, "middle", bt);
23 evas_object_show(bt);
24
25 // hints as to where we probably should put hover contents (buttons etc.).
26 if (ei->hover_top)
27 {
28 bx = elm_box_add(obj);
29 bt = elm_button_add(obj);
30 elm_object_text_set(bt, "Top 1");
31 elm_box_pack_end(bx, bt);
32 evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
33 evas_object_show(bt);
34 bt = elm_button_add(obj);
35 elm_object_text_set(bt, "Top 2");
36 elm_box_pack_end(bx, bt);
37 evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
38 evas_object_show(bt);
39 bt = elm_button_add(obj);
40 elm_object_text_set(bt, "Top 3");
41 elm_box_pack_end(bx, bt);
42 evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
43 evas_object_show(bt);
44 elm_object_part_content_set(ei->hover, "top", bx);
45 evas_object_show(bx);
46 }
47 if (ei->hover_bottom)
48 {
49 bt = elm_button_add(obj);
50 elm_object_text_set(bt, "Bot");
51 elm_object_part_content_set(ei->hover, "bottom", bt);
52 evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
53 evas_object_show(bt);
54 }
55 if (ei->hover_left)
56 {
57 bt = elm_button_add(obj);
58 elm_object_text_set(bt, "Left");
59 elm_object_part_content_set(ei->hover, "left", bt);
60 evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
61 evas_object_show(bt);
62 }
63 if (ei->hover_right)
64 {
65 bt = elm_button_add(obj);
66 elm_object_text_set(bt, "Right");
67 elm_object_part_content_set(ei->hover, "right", bt);
68 evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
69 evas_object_show(bt);
70 }
71}
72
73void
74test_entry_anchor2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
75{
76 Evas_Object *win, *av;
77
78 win = elm_win_util_standard_add("entry_anchor", "Anchorview");
79 elm_win_autodel_set(win, EINA_TRUE);
80
81 av = elm_entry_add(win);
82 elm_entry_anchor_hover_style_set(av, "popout");
83 elm_entry_anchor_hover_parent_set(av, win);
84 elm_object_text_set(av,
85 "This is an entry widget in this window that<br/>"
86 "uses markup <b>like this</> for styling and<br/>"
87 "formatting <em>like this</>, as well as<br/>"
88 "<a href=X><link>links in the text</></a>, so enter text<br/>"
89 "in here to edit it. By the way, links are<br/>"
90 "called <a href=anc-02>Anchors</a> so you will need<br/>"
91 "to refer to them this way. <item relsize=16x16 vsize=full href=emoticon/guilty-smile></item>");
92 evas_object_size_hint_weight_set(av, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
93 evas_object_smart_callback_add(av, "anchor,hover,opened", my_anchorview_anchor, av);
94 elm_win_resize_object_add(win, av);
95 evas_object_show(av);
96
97 evas_object_resize(win, 320, 300);
98
99 elm_object_focus_set(win, EINA_TRUE);
100 evas_object_show(win);
101}
102#endif