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, *en;
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 en = elm_entry_add(win);
30 elm_entry_scrollable_set(en, EINA_TRUE);
31 evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
32 evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
33 elm_entry_entry_set(en, "This is a single line");
34 elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
35 elm_entry_single_line_set(en, 1);
37 elm_box_pack_end(bx, en);
39 en = elm_entry_add(win);
40 elm_entry_scrollable_set(en, EINA_TRUE);
41 evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
42 evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
43 elm_entry_entry_set(en, "Entry 2");
44 elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
45 elm_entry_single_line_set(en, 1);
47 elm_box_pack_end(bx, en);
49 ic = elm_icon_add(win);
50 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
51 elm_icon_file_set(ic, buf, NULL);
52 elm_icon_scale_set(ic, 0, 0);
53 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
55 bb = elm_bubble_add(win);
56 elm_object_text_set(bb, "Message 3");
57 elm_object_text_part_set(bb, "info", "10:32 4/11/2008");
58 elm_bubble_icon_set(bb, ic);
60 evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
61 evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
62 av = elm_anchorblock_add(win);
63 elm_anchorblock_hover_style_set(av, "popout");
64 elm_anchorblock_hover_parent_set(av, win);
65 elm_anchorblock_text_set(av,
66 "Hi there. This is the most recent message in the "
67 "list of messages. It has one <a href=tel:+614321234>+61 432 1234</a> "
68 "(phone number) to click on.");
69 elm_bubble_content_set(bb, av);
71 elm_box_pack_end(bx, bb);
74 ic = elm_icon_add(win);
75 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
76 elm_icon_file_set(ic, buf, NULL);
77 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
79 bb = elm_bubble_add(win);
80 elm_object_text_set(bb, "Message 2");
81 elm_object_text_part_set(bb, "info", "7:16 27/10/2008");
82 elm_bubble_icon_set(bb, ic);
84 evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
85 evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
86 av = elm_anchorblock_add(win);
87 elm_anchorblock_hover_style_set(av, "popout");
88 elm_anchorblock_hover_parent_set(av, win);
89 elm_anchorblock_text_set(av,
90 "Hey what are you doing? This is the second last message "
91 "Hi there. This is the most recent message in the "
92 "list. It's a longer one so it can wrap more and "
93 "contains a <a href=contact:john>John</a> contact "
94 "link in it to test popups on links. The idea is that "
95 "all SMS's are scanned for things that look like phone "
96 "numbers or names that are in your contacts list, and "
97 "if they are, they become clickable links that pop up "
98 "a menus of obvious actions to perform on this piece "
99 "of information. This of course can be later explicitly "
100 "done by links maybe running local apps or even being "
101 "web URL's too that launch the web browser and point it "
102 "to that URL. <item relsize=16x16 vsize=full href=emoticon/omg></item>");
103 elm_bubble_content_set(bb, av);
104 evas_object_show(av);
105 elm_box_pack_end(bx, bb);
106 evas_object_show(bb);
108 ic = elm_icon_add(win);
109 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
110 elm_icon_file_set(ic, buf, NULL);
111 elm_icon_scale_set(ic, 0, 0);
112 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
114 bb = elm_bubble_add(win);
115 elm_object_text_set(bb, "Message 1");
116 elm_object_text_part_set(bb, "info", "20:47 18/6/2008");
117 elm_bubble_icon_set(bb, ic);
118 evas_object_show(ic);
119 evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
120 evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
122 av = elm_anchorblock_add(win);
123 elm_anchorblock_hover_style_set(av, "popout");
124 elm_anchorblock_hover_parent_set(av, win);
125 elm_anchorblock_text_set(av, "This is a short message. <item relsize=16x16 vsize=full href=emoticon/haha></item>");
126 elm_bubble_content_set(bb, av);
127 evas_object_show(av);
128 elm_box_pack_end(bx, bb);
129 evas_object_show(bb);
131 elm_scroller_content_set(sc, bx);
132 evas_object_show(bx);
134 evas_object_show(sc);
138 cb_mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info)
140 Evas_Event_Mouse_Move *ev = event_info;
141 Evas_Object *orig = data;
146 if (!ev->buttons) return;
147 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
148 evas_object_move(obj,
149 x + (ev->cur.canvas.x - ev->prev.output.x),
150 y + (ev->cur.canvas.y - ev->prev.output.y));
151 evas_object_image_size_get(orig, &w, &h);
153 evas_object_map_enable_set(orig, EINA_TRUE);
154 evas_object_raise(orig);
155 for (i = 0; i < 4; i++)
160 snprintf(key, sizeof(key), "h-%i\n", i);
161 hand = evas_object_data_get(orig, key);
162 evas_object_raise(hand);
163 evas_object_geometry_get(hand, &x, &y, NULL, NULL);
166 evas_map_point_coord_set(p, i, x, y, 0);
167 if (i == 0) evas_map_point_image_uv_set(p, i, 0, 0);
168 else if (i == 1) evas_map_point_image_uv_set(p, i, w, 0);
169 else if (i == 2) evas_map_point_image_uv_set(p, i, w, h);
170 else if (i == 3) evas_map_point_image_uv_set(p, i, 0, h);
172 evas_object_map_set(orig, p);
177 create_handles(Evas_Object *obj)
180 Evas_Coord x, y, w, h;
182 evas_object_geometry_get(obj, &x, &y, &w, &h);
183 for (i = 0; i < 4; i++)
189 hand = evas_object_image_filled_add(evas_object_evas_get(obj));
190 evas_object_resize(hand, 31, 31);
191 snprintf(buf, sizeof(buf), "%s/images/pt.png", PACKAGE_DATA_DIR);
192 evas_object_image_file_set(hand, buf, NULL);
193 if (i == 0) evas_object_move(hand, x - 15, y - 15);
194 else if (i == 1) evas_object_move(hand, x + w - 15, y - 15);
195 else if (i == 2) evas_object_move(hand, x + w - 15, y + h - 15);
196 else if (i == 3) evas_object_move(hand, x - 15, y + h - 15);
197 evas_object_event_callback_add(hand, EVAS_CALLBACK_MOUSE_MOVE, cb_mouse_move, obj);
198 evas_object_show(hand);
199 snprintf(key, sizeof(key), "h-%i\n", i);
200 evas_object_data_set(obj, key, hand);
205 test_win_inline(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
207 Evas_Object *win, *bg, *win2, *win3;
210 win = elm_win_add(NULL, "window-inline", ELM_WIN_BASIC);
211 elm_win_title_set(win, "Window Inline");
212 elm_win_autodel_set(win, 1);
214 bg = elm_bg_add(win);
215 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
216 elm_bg_file_set(bg, buf, NULL);
217 elm_win_resize_object_add(win, bg);
218 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
219 evas_object_show(bg);
221 win2 = elm_win_add(win, "inlined", ELM_WIN_INLINED_IMAGE);
222 fill(win2, EINA_TRUE);
224 evas_object_move(win2, 20, 60);
225 evas_object_resize(win2, 300, 200);
226 // image object for win2 is unlinked to its pos/size - so manual control
227 // this allows also for using map and other things with it.
228 evas_object_move(elm_win_inlined_image_object_get(win2), 20, 40);
229 evas_object_resize(elm_win_inlined_image_object_get(win2), 200, 320);
230 evas_object_show(win2);
232 win3 = elm_win_add(win, "inlined", ELM_WIN_INLINED_IMAGE);
233 elm_win_alpha_set(win3, EINA_TRUE);
234 fill(win3, EINA_FALSE);
236 evas_object_resize(win3, 300, 200);
237 evas_object_move(elm_win_inlined_image_object_get(win3), 80, 180);
238 evas_object_resize(elm_win_inlined_image_object_get(win3), 300, 200);
239 evas_object_show(win3);
241 create_handles(elm_win_inlined_image_object_get(win3));
243 evas_object_resize(win, 400, 600);
244 evas_object_show(win);