cxx: Added examples and tutorial for C++ binding
[platform/upstream/elementary.git] / src / examples / icon_cxx_example_01.cc
1 #include <Elementary.hh>
2
3 EAPI_MAIN int
4 elm_main (int argc, char *argv[])
5 {
6    elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
7
8    ::elm::win win(elm_win_util_standard_add("icon", "Icon"));
9    win.autohide_set(true);
10
11    ::elm::icon icon(efl::eo::parent = win);
12    icon.order_lookup_set(ELM_ICON_LOOKUP_THEME_FDO);
13    icon.standard_set("home");
14
15    const char *path, *group;
16    icon.file_get(&path, &group);
17    std::cout << "path = " << path << ", group = "<< group;
18
19    efl::eina::optional<std::string> name;
20    name = icon.standard_get();
21    std::cout << ", name = " << *name << std::endl;
22
23    icon.no_scale_set(true);
24    icon.resizable_set(false, true);
25    icon.smooth_set(false);
26    icon.fill_outside_set(true);
27
28    icon.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
29    win.resize_object_add(icon);
30    icon.visible_set(true);
31
32    win.size_set(320, 320);
33    win.visible_set(true);
34
35    elm_run();
36    return 0;
37 }
38 ELM_MAIN()