2 # include "elementary_config.h"
4 #include <Elementary.h>
5 #ifndef ELM_LIB_QUICKLAUNCH
8 _print_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
10 printf("bubble clicked\n");
14 my_entry_anchor_bt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
16 Evas_Object *av = data;
17 elm_entry_anchor_hover_end(av);
21 my_entry_anchor(void *data, Evas_Object *obj, void *event_info)
23 Evas_Object *av = data;
24 Elm_Entry_Anchor_Hover_Info *ei = event_info;
27 bt = elm_button_add(obj);
28 elm_object_text_set(bt, ei->anchor_info->name);
29 elm_object_part_content_set(ei->hover, "middle", bt);
32 // hints as to where we probably should put hover contents (buttons etc.).
35 bx = elm_box_add(obj);
36 bt = elm_button_add(obj);
37 elm_object_text_set(bt, "Top 1");
38 elm_box_pack_end(bx, bt);
39 evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
41 bt = elm_button_add(obj);
42 elm_object_text_set(bt, "Top 2");
43 elm_box_pack_end(bx, bt);
44 evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
46 bt = elm_button_add(obj);
47 elm_object_text_set(bt, "Top 3");
48 elm_box_pack_end(bx, bt);
49 evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
51 elm_object_part_content_set(ei->hover, "top", bx);
56 bt = elm_button_add(obj);
57 elm_object_text_set(bt, "Bot");
58 elm_object_part_content_set(ei->hover, "bottom", bt);
59 evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
64 bt = elm_button_add(obj);
65 elm_object_text_set(bt, "Left");
66 elm_object_part_content_set(ei->hover, "left", bt);
67 evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
72 bt = elm_button_add(obj);
73 elm_object_text_set(bt, "Right");
74 elm_object_part_content_set(ei->hover, "right", bt);
75 evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
81 my_entry_anchor_edge_left(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
87 my_entry_anchor_edge_right(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
93 my_entry_anchor_edge_top(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
99 my_entry_anchor_edge_bottom(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
105 my_entry_anchor_scroll(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
107 Evas_Coord x, y, w, h, vw, vh;
109 elm_scroller_region_get(obj, &x, &y, &w, &h);
110 elm_scroller_child_size_get(obj, &vw, &vh);
111 printf("scroll %ix%i +%i+%i in %ix%i\n", w, h, x, y, vw, vh);
115 test_entry_anchor(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
117 Evas_Object *win, *av, *sc, *bx, *bb, *ic;
120 win = elm_win_util_standard_add("entry_anchor", "Anchorblock");
121 elm_win_autodel_set(win, EINA_TRUE);
123 sc = elm_scroller_add(win);
124 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
125 elm_win_resize_object_add(win, sc);
127 evas_object_smart_callback_add(sc, "edge_left", my_entry_anchor_edge_left, NULL);
128 evas_object_smart_callback_add(sc, "edge_right", my_entry_anchor_edge_right, NULL);
129 evas_object_smart_callback_add(sc, "edge_top", my_entry_anchor_edge_top, NULL);
130 evas_object_smart_callback_add(sc, "edge_bottom", my_entry_anchor_edge_bottom, NULL);
131 evas_object_smart_callback_add(sc, "scroll", my_entry_anchor_scroll, NULL);
133 bx = elm_box_add(win);
134 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
135 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
137 ic = elm_icon_add(win);
138 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
139 elm_icon_file_set(ic, buf, NULL);
140 elm_icon_resizable_set(ic, 0, 0);
141 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
143 bb = elm_bubble_add(win);
144 elm_object_text_set(bb, "Message 3");
145 elm_object_part_text_set(bb, "info", "10:32 4/11/2008");
146 elm_object_part_content_set(bb, "icon", ic);
147 evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL);
148 evas_object_show(ic);
149 evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
150 evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
151 av = elm_entry_add(win);
152 elm_entry_anchor_hover_style_set(av, "popout");
153 elm_entry_anchor_hover_parent_set(av, win);
154 elm_object_text_set(av,
155 "Hi there. This is the most recent message in the "
156 "list of messages. It has one <a href=tel:+614321234>+61 432 1234</a> "
157 "(phone number) to click on.");
158 evas_object_smart_callback_add(av, "anchor,hover,opened",
159 my_entry_anchor, av);
160 elm_object_content_set(bb, av);
161 evas_object_show(av);
162 elm_box_pack_end(bx, bb);
163 evas_object_show(bb);
165 ic = elm_icon_add(win);
166 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
167 elm_icon_file_set(ic, buf, NULL);
168 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
170 bb = elm_bubble_add(win);
171 elm_object_text_set(bb, "Message 2");
172 elm_object_part_text_set(bb, "info", "7:16 27/10/2008");
173 elm_object_part_content_set(bb, "icon", ic);
174 evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL);
175 evas_object_show(ic);
176 evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
177 evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
178 av = elm_entry_add(win);
179 elm_entry_anchor_hover_style_set(av, "popout");
180 elm_entry_anchor_hover_parent_set(av, win);
181 elm_object_text_set(av,
182 "Hey what are you doing? This is the second last message "
183 "Hi there. This is the most recent message in the "
184 "list. It's a longer one so it can wrap more and "
185 "contains a <a href=contact:john>John</a> contact "
186 "link in it to test popups on links. The idea is that "
187 "all SMS's are scanned for things that look like phone "
188 "numbers or names that are in your contacts list, and "
189 "if they are, they become clickable links that pop up "
190 "a menus of obvious actions to perform on this piece "
191 "of information. This of course can be later explicitly "
192 "done by links maybe running local apps or even being "
193 "web URL's too that launch the web browser and point it "
194 "to that URL. <item relsize=16x16 vsize=full href=emoticon/omg></item>");
195 evas_object_smart_callback_add(av, "anchor,hover,opened", my_entry_anchor, av);
196 elm_object_content_set(bb, av);
197 evas_object_show(av);
198 elm_box_pack_end(bx, bb);
199 evas_object_show(bb);
201 ic = elm_icon_add(win);
202 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
203 elm_icon_file_set(ic, buf, NULL);
204 elm_icon_resizable_set(ic, 0, 0);
205 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
207 bb = elm_bubble_add(win);
208 elm_object_text_set(bb, "Message 1");
209 elm_object_part_text_set(bb, "info", "20:47 18/6/2008");
210 elm_object_part_content_set(bb, "icon", ic);
211 evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL);
212 evas_object_show(ic);
213 evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
214 evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
216 av = elm_entry_add(win);
217 elm_entry_anchor_hover_style_set(av, "popout");
218 elm_entry_anchor_hover_parent_set(av, win);
219 elm_object_text_set(av, "This is a short message. <item relsize=16x16 vsize=full href=emoticon/haha></item>");
220 evas_object_smart_callback_add(av, "anchor,hover,opened",
221 my_entry_anchor, av);
222 elm_object_content_set(bb, av);
223 evas_object_show(av);
224 elm_box_pack_end(bx, bb);
225 evas_object_show(bb);
227 elm_object_content_set(sc, bx);
228 evas_object_show(bx);
230 evas_object_show(sc);
232 evas_object_resize(win, 320, 300);
234 elm_object_focus_set(win, EINA_TRUE);
235 evas_object_show(win);