Merge branch 'master' into svn_merge
[framework/uifw/elementary.git] / src / bin / test_bubble.c
1 #include <Elementary.h>
2 #ifdef HAVE_CONFIG_H
3 # include "elementary_config.h"
4 #endif
5 #ifndef ELM_LIB_QUICKLAUNCH
6
7 static void
8 _print_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
9 {
10    printf("bubble clicked\n");
11 }
12
13 void
14 test_bubble(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
15 {
16    Evas_Object *win, *bg, *bx, *ic, *bb, *ct;
17    char buf[PATH_MAX];
18
19    win = elm_win_add(NULL, "box-vert", ELM_WIN_BASIC);
20    elm_win_title_set(win, "Bubble");
21    elm_win_autodel_set(win, 1);
22
23    bg = elm_bg_add(win);
24    elm_win_resize_object_add(win, bg);
25    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
26    evas_object_show(bg);
27
28    bx = elm_box_add(win);
29    elm_win_resize_object_add(win, bx);
30    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
31    evas_object_show(bx);
32
33    ic = elm_icon_add(win);
34    snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
35    elm_icon_file_set(ic, buf, NULL);
36    elm_icon_scale_set(ic, 0, 0);
37    evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
38
39    bb = elm_bubble_add(win);
40    elm_object_text_set(bb, "Message 1");
41    elm_object_text_part_set(bb, "info", "Corner: bottom_right");
42    elm_bubble_icon_set(bb, ic);
43    elm_bubble_corner_set(bb, "bottom_right");
44    evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL);
45    evas_object_show(ic);
46    evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
47    evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
48
49    ct = elm_label_add(win);
50    elm_object_text_set(ct,
51                        "\"The future of the art: R or G or B?\",  by Rusty");
52    elm_bubble_content_set(bb, ct);
53
54    elm_box_pack_end(bx, bb);
55    evas_object_show(bb);
56
57    bb = elm_bubble_add(win);
58    elm_object_text_set(bb, "Message 2");
59    elm_object_text_part_set(bb, "info", "10:32 4/11/2008");
60    evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL);
61    evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
62    evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
63
64    ct = elm_label_add(win);
65    elm_object_text_set(ct, "Corner: base (top-left) - no icon");
66    elm_bubble_content_set(bb, ct);
67
68    elm_box_pack_end(bx, bb);
69    evas_object_show(bb);
70
71    evas_object_show(win);
72 }
73 #endif