SVN Merging for button, radio, check and toggle
[framework/uifw/elementary.git] / src / examples / conformant_example_02.c
1 /**
2  * Simple Elementary's <b>conformant widget</b> example, illustrating its
3  * usage and API.
4  *
5  * See stdout/stderr for output. Compile with:
6  *
7  * @verbatim
8  * gcc -g `pkg-config --cflags --libs elementary` conformant_example_02.c -o conformant_example_02
9  * @endverbatim
10  */
11
12 #include <Elementary.h>
13 #ifdef HAVE_CONFIG_H
14 # include "elementary_config.h"
15 #else
16 # define __UNUSED__
17 #endif
18
19 EAPI_MAIN int
20 elm_main(int argc __UNUSED__, char **argv __UNUSED__)
21 {
22    Evas_Object *win, *bg, *conform, *btn, *bx, *en;
23
24    win = elm_win_add(NULL, "conformant", ELM_WIN_BASIC);
25    elm_win_title_set(win, "Conformant Example");
26    elm_win_autodel_set(win, EINA_TRUE);
27
28    elm_win_conformant_set(win, EINA_TRUE);
29
30    bg = elm_bg_add(win);
31    elm_win_resize_object_add(win, bg);
32    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
33    evas_object_show(bg);
34
35    conform = elm_conformant_add(win);
36    elm_win_resize_object_add(win, conform);
37    evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
38    evas_object_show(conform);
39
40    bx = elm_box_add(win);
41    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
42    evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
43
44    btn = elm_button_add(win);
45    elm_object_text_set(btn, "Test Conformant");
46    evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0);
47    evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0);
48    elm_box_pack_end(bx, btn);
49    evas_object_show(btn);
50
51    en = elm_entry_add(win);
52    elm_entry_scrollable_set(en, EINA_TRUE);
53    elm_object_text_set(en,
54                        "This is a multi-line entry at the bottom<br>"
55                        "This can contain more than 1 line of text and be "
56                        "scrolled around to allow for entering of lots of "
57                        "content. It is also to test to see that autoscroll "
58                        "moves to the right part of a larger multi-line "
59                        "text entry that is inside of a scroller than can be "
60                        "scrolled around, thus changing the expected position "
61                        "as well as cursor changes updating auto-scroll when "
62                        "it is enabled.");
63
64    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
65    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
66    evas_object_show(en);
67    elm_box_pack_end(bx, en);
68
69    btn = elm_button_add(win);
70    elm_object_text_set(btn, "Test Conformant");
71    evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0);
72    evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0);
73    elm_box_pack_end(bx, btn);
74    evas_object_show(btn);
75
76    elm_object_content_set(conform, bx);
77    evas_object_show(bx);
78
79    evas_object_resize(win, 240, 480);
80    evas_object_show(win);
81
82    elm_run();
83    return 0;
84 }
85 ELM_MAIN()