summaryrefslogtreecommitdiff
path: root/src/examples/bubble_cxx_example_01.cc
blob: dd2284ae05f64b37e61d9f00598796c81af57886 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <Elementary.hh>
#include <Evas.hh>

EAPI_MAIN int
elm_main (int argc, char *argv[])
{
   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);

   ::elm::win_standard win;
   win.title_set("Bg Plain");
   win.autohide_set(true);

   ::elm::bg bg(efl::eo::parent = win);
   bg.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   win.resize_object_add(bg);
   bg.visible_set(true);

   ::elm::label label1(efl::eo::parent = win);
   label1.text_set(nullptr, "Bubble with no icon, info or label");
   label1.visible_set(true);

   evas::rectangle icon(efl::eo::parent = win);
   icon.color_set( 0, 0, 255, 255);
   icon.visible_set(true);

   ::elm::bubble bubble1(efl::eo::parent = win);
   bubble1.content_set("icon", icon);
   bubble1.text_set("info", "INFO");
   bubble1.text_set(nullptr, "LABEL");
   bubble1.content_set(nullptr, label1);
   bubble1.size_set(300, 100);
   bubble1.visible_set(true);

   auto on_click = std::bind([&] ()
                   {
                      static unsigned char corner = 0;
                      ++corner;
                      if (corner > 3)
                        bubble1.pos_set(ELM_BUBBLE_POS_TOP_LEFT);
                      else
                        bubble1.pos_set(static_cast<Elm_Bubble_Pos>(corner));
                   });

   bubble1.callback_clicked_add(on_click);

   ::elm::label label2(efl::eo::parent = win);
   label2.text_set(nullptr, "Bubble with no icon, info or label");
   label2.visible_set(true);

   ::elm::bubble bubble2(efl::eo::parent = win);
   bubble2.content_set(nullptr, label2);
   bubble2.size_set(200, 50);
   bubble2.position_set(0, 110);
   bubble2.visible_set(true);

   win.size_set(300, 200);
   win.visible_set(true);

   elm_run();
   return 0;
}
ELM_MAIN()