1 #include <Elementary.h>
3 # include "elementary_config.h"
5 #ifndef ELM_LIB_QUICKLAUNCH
8 fill(Evas_Object *win, Eina_Bool do_bg)
10 Evas_Object *bg, *sc, *bx, *ic, *bb, *av;
16 elm_win_resize_object_add(win, bg);
17 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
21 sc = elm_scroller_add(win);
22 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
23 elm_win_resize_object_add(win, sc);
25 bx = elm_box_add(win);
26 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
27 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
29 ic = elm_icon_add(win);
30 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
31 elm_icon_file_set(ic, buf, NULL);
32 elm_icon_scale_set(ic, 0, 0);
33 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
35 bb = elm_bubble_add(win);
36 elm_bubble_label_set(bb, "Message 3");
37 elm_bubble_info_set(bb, "10:32 4/11/2008");
38 elm_bubble_icon_set(bb, ic);
40 evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
41 evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
42 av = elm_anchorblock_add(win);
43 elm_anchorblock_hover_style_set(av, "popout");
44 elm_anchorblock_hover_parent_set(av, win);
45 elm_anchorblock_text_set(av,
46 "Hi there. This is the most recent message in the "
47 "list of messages. It has one <a href=tel:+614321234>+61 432 1234</a> "
48 "(phone number) to click on.");
49 elm_bubble_content_set(bb, av);
51 elm_box_pack_end(bx, bb);
54 ic = elm_icon_add(win);
55 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
56 elm_icon_file_set(ic, buf, NULL);
57 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
59 bb = elm_bubble_add(win);
60 elm_bubble_label_set(bb, "Message 2");
61 elm_bubble_info_set(bb, "7:16 27/10/2008");
62 elm_bubble_icon_set(bb, ic);
64 evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
65 evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
66 av = elm_anchorblock_add(win);
67 elm_anchorblock_hover_style_set(av, "popout");
68 elm_anchorblock_hover_parent_set(av, win);
69 elm_anchorblock_text_set(av,
70 "Hey what are you doing? This is the second last message "
71 "Hi there. This is the most recent message in the "
72 "list. It's a longer one so it can wrap more and "
73 "contains a <a href=contact:john>John</a> contact "
74 "link in it to test popups on links. The idea is that "
75 "all SMS's are scanned for things that look like phone "
76 "numbers or names that are in your contacts list, and "
77 "if they are, they become clickable links that pop up "
78 "a menus of obvious actions to perform on this piece "
79 "of information. This of course can be later explicitly "
80 "done by links maybe running local apps or even being "
81 "web URL's too that launch the web browser and point it "
82 "to that URL. <item relsize=16x16 vsize=full href=emoticon/omg></item>");
83 elm_bubble_content_set(bb, av);
85 elm_box_pack_end(bx, bb);
88 ic = elm_icon_add(win);
89 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
90 elm_icon_file_set(ic, buf, NULL);
91 elm_icon_scale_set(ic, 0, 0);
92 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
94 bb = elm_bubble_add(win);
95 elm_bubble_label_set(bb, "Message 1");
96 elm_bubble_info_set(bb, "20:47 18/6/2008");
97 elm_bubble_icon_set(bb, ic);
99 evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
100 evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
102 av = elm_anchorblock_add(win);
103 elm_anchorblock_hover_style_set(av, "popout");
104 elm_anchorblock_hover_parent_set(av, win);
105 elm_anchorblock_text_set(av, "This is a short message. <item relsize=16x16 vsize=full href=emoticon/haha></item>");
106 elm_bubble_content_set(bb, av);
107 evas_object_show(av);
108 elm_box_pack_end(bx, bb);
109 evas_object_show(bb);
111 elm_scroller_content_set(sc, bx);
112 evas_object_show(bx);
114 evas_object_show(sc);
118 cb_mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info)
120 Evas_Event_Mouse_Move *ev = event_info;
121 Evas_Object *orig = data;
126 if (!ev->buttons) return;
127 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
128 evas_object_move(obj,
129 x + (ev->cur.output.x - ev->prev.output.x),
130 y + (ev->cur.output.y - ev->prev.output.y));
131 evas_object_image_size_get(orig, &w, &h);
133 evas_object_map_enable_set(orig, EINA_TRUE);
134 evas_object_raise(orig);
135 for (i = 0; i < 4; i++)
140 snprintf(key, sizeof(key), "h-%i\n", i);
141 hand = evas_object_data_get(orig, key);
142 evas_object_raise(hand);
143 evas_object_geometry_get(hand, &x, &y, NULL, NULL);
146 evas_map_point_coord_set(p, i, x, y, 0);
147 if (i == 0) evas_map_point_image_uv_set(p, i, 0, 0);
148 else if (i == 1) evas_map_point_image_uv_set(p, i, w, 0);
149 else if (i == 2) evas_map_point_image_uv_set(p, i, w, h);
150 else if (i == 3) evas_map_point_image_uv_set(p, i, 0, h);
152 evas_object_map_set(orig, p);
157 create_handles(Evas_Object *obj)
160 Evas_Coord x, y, w, h;
162 evas_object_geometry_get(obj, &x, &y, &w, &h);
163 for (i = 0; i < 4; i++)
169 hand = evas_object_image_filled_add(evas_object_evas_get(obj));
170 evas_object_resize(hand, 31, 31);
171 snprintf(buf, sizeof(buf), "%s/images/pt.png", PACKAGE_DATA_DIR);
172 evas_object_image_file_set(hand, buf, NULL);
173 if (i == 0) evas_object_move(hand, x - 15, y - 15);
174 else if (i == 1) evas_object_move(hand, x + w - 15, y - 15);
175 else if (i == 2) evas_object_move(hand, x + w - 15, y + h - 15);
176 else if (i == 3) evas_object_move(hand, x - 15, y + h - 15);
177 evas_object_event_callback_add(hand, EVAS_CALLBACK_MOUSE_MOVE, cb_mouse_move, obj);
178 evas_object_show(hand);
179 snprintf(key, sizeof(key), "h-%i\n", i);
180 evas_object_data_set(obj, key, hand);
185 test_win_inline(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
187 Evas_Object *win, *bg, *win2, *win3;
190 win = elm_win_add(NULL, "window-inline", ELM_WIN_BASIC);
191 elm_win_title_set(win, "Window Inline");
192 elm_win_autodel_set(win, 1);
194 bg = elm_bg_add(win);
195 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
196 elm_bg_file_set(bg, buf, NULL);
197 elm_win_resize_object_add(win, bg);
198 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
199 evas_object_show(bg);
201 win2 = elm_win_add(win, "inlined", ELM_WIN_INLINED_IMAGE);
202 fill(win2, EINA_TRUE);
204 evas_object_move(win2, 20, 60);
205 evas_object_resize(win2, 300, 200);
206 // image object for win2 is unlinked to its pos/size - so manual control
207 // this allows also for using map and other things with it.
208 evas_object_move(elm_win_inlined_image_object_get(win2), 20, 40);
209 evas_object_resize(elm_win_inlined_image_object_get(win2), 200, 320);
210 evas_object_show(win2);
212 win3 = elm_win_add(win, "inlined", ELM_WIN_INLINED_IMAGE);
213 elm_win_alpha_set(win3, EINA_TRUE);
214 fill(win3, EINA_FALSE);
216 evas_object_resize(win3, 300, 200);
217 evas_object_move(elm_win_inlined_image_object_get(win3), 80, 180);
218 evas_object_resize(elm_win_inlined_image_object_get(win3), 300, 200);
219 evas_object_show(win3);
221 create_handles(elm_win_inlined_image_object_get(win3));
223 evas_object_resize(win, 400, 600);
224 evas_object_show(win);