3 # include "elementary_config.h"
5 #include <Elementary.h>
6 #ifndef ELM_LIB_QUICKLAUNCH
9 _print_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
11 printf("bubble clicked\n");
16 unsigned int state; /* What state we are testing */
17 Evas_Object *win; /* Parent Window of widgets */
18 void *box; /* Use this to get box content */
20 typedef struct _api_data api_data;
26 BUBBLE_SET_ICON_CONTENT,
29 typedef enum _api_state api_state;
32 set_api_state(api_data *api)
34 const Eina_List *items = elm_box_children_get(api->box);
35 if (!eina_list_count(items))
39 { /* Put all api-changes under switch */
40 case BUBBLE_SET_CORNER_1:
41 elm_bubble_pos_set(eina_list_nth(items, 0), ELM_BUBBLE_POS_BOTTOM_LEFT);
42 elm_object_text_set(elm_object_content_get(eina_list_nth(items, 0)),
43 "Corner: base (bottom-left) - with icon");
44 elm_bubble_pos_set(eina_list_nth(items, 1), ELM_BUBBLE_POS_TOP_RIGHT);
45 elm_object_text_set(elm_object_content_get(eina_list_nth(items, 1)),
46 "Corner: base (top-right) - no icon");
49 case BUBBLE_SET_CORNER_2:
50 elm_bubble_pos_set(eina_list_nth(items, 0), ELM_BUBBLE_POS_TOP_RIGHT);
51 elm_object_text_set(elm_object_content_get(eina_list_nth(items, 0)),
52 "Corner: base (top-right) - with icon");
53 elm_bubble_pos_set(eina_list_nth(items, 1), ELM_BUBBLE_POS_BOTTOM_LEFT);
54 elm_object_text_set(elm_object_content_get(eina_list_nth(items, 1)),
55 "Corner: base (bottom-left) - no icon");
58 case BUBBLE_SET_ICON_CONTENT:
61 Evas_Object *ct, *ic = elm_icon_add(api->win);
63 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
64 elm_image_file_set(ic, buf, NULL);
65 elm_image_resizable_set(ic, 0, 0);
66 elm_object_content_set(eina_list_nth(items, 0), ic);
67 ct = elm_label_add(api->win);
68 elm_object_text_set(ct, "Using icon as top-bubble content");
69 elm_object_content_set(eina_list_nth(items, 1), ct);
70 evas_object_size_hint_align_set(ic, 0.5, 0.5);
84 _api_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__)
85 { /* Will add here a SWITCH command containing code to modify test-object */
86 /* in accordance a->state value. */
90 printf("clicked event on API Button: api_state=<%d>\n", a->state);
93 sprintf(str, "Next API function (%u)", a->state);
94 elm_object_text_set(obj, str);
95 elm_object_disabled_set(obj, a->state == API_STATE_LAST);
99 _cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
106 test_bubble(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
108 Evas_Object *win, *bx, *ic, *bb, *ct, *bxx, *bt;
110 api_data *api = calloc(1, sizeof(api_data));
112 win = elm_win_util_standard_add("bubble", "Bubble");
114 elm_win_autodel_set(win, EINA_TRUE);
115 evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api);
117 bxx = elm_box_add(win);
118 elm_win_resize_object_add(win, bxx);
119 evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
120 evas_object_show(bxx);
122 bx = elm_box_add(win);
123 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
125 evas_object_show(bx);
127 bt = elm_button_add(win);
128 elm_object_text_set(bt, "Next API function");
129 evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api);
130 elm_box_pack_end(bxx, bt);
131 elm_object_disabled_set(bt, api->state == API_STATE_LAST);
132 evas_object_show(bt);
134 elm_box_pack_end(bxx, bx);
136 ic = elm_icon_add(win);
137 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
138 elm_image_file_set(ic, buf, NULL);
139 elm_image_resizable_set(ic, 0, 0);
140 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
142 bb = elm_bubble_add(win);
143 elm_object_text_set(bb, "Message 1");
144 elm_object_part_text_set(bb, "info", "Corner: bottom_right");
145 elm_object_part_content_set(bb, "icon", ic);
146 elm_bubble_pos_set(bb, ELM_BUBBLE_POS_BOTTOM_RIGHT);
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);
152 ct = elm_label_add(win);
153 elm_object_text_set(ct,
154 "\"The future of the art: R or G or B?\", by Rusty");
155 elm_object_content_set(bb, ct);
157 elm_box_pack_end(bx, bb);
158 evas_object_show(bb);
160 bb = elm_bubble_add(win);
161 elm_object_text_set(bb, "Message 2");
162 elm_object_part_text_set(bb, "info", "10:32 4/11/2008");
163 evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL);
164 evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
165 evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
167 ct = elm_label_add(win);
168 elm_object_text_set(ct, "Corner: base (top-left) - no icon");
169 elm_object_content_set(bb, ct);
171 elm_box_pack_end(bx, bb);
172 evas_object_show(bb);
174 evas_object_show(win);