SVN Merging for button, radio, check and toggle
[framework/uifw/elementary.git] / src / examples / conformant_example_01.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_01.c -o conformant_example_01
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, *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    bg = elm_bg_add(win);
29    elm_win_resize_object_add(win, bg);
30    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
31    evas_object_show(bg);
32
33    bx = elm_box_add(win);
34    elm_win_resize_object_add(win, bx);
35    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
36    evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
37
38    btn = elm_button_add(win);
39    elm_object_text_set(btn, "Test Conformant");
40    evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0);
41    evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0);
42    elm_box_pack_end(bx, btn);
43    evas_object_show(btn);
44
45    en = elm_entry_add(win);
46    elm_entry_scrollable_set(en, EINA_TRUE);
47    elm_object_text_set(en,
48                        "This is a multi-line entry at the bottom<br>"
49                        "This can contain more than 1 line of text and be "
50                        "scrolled around to allow for entering of lots of "
51                        "content. It is also to test to see that autoscroll "
52                        "moves to the right part of a larger multi-line "
53                        "text entry that is inside of a scroller than can be "
54                        "scrolled around, thus changing the expected position "
55                        "as well as cursor changes updating auto-scroll when "
56                        "it is enabled.");
57
58    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
59    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
60    evas_object_show(en);
61    elm_box_pack_end(bx, en);
62
63    btn = elm_button_add(win);
64    elm_object_text_set(btn, "Test Conformant");
65    evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0);
66    evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0);
67    elm_box_pack_end(bx, btn);
68    evas_object_show(btn);
69
70    evas_object_show(bx);
71
72    evas_object_resize(win, 240, 480);
73    evas_object_show(win);
74
75    elm_run();
76    return 0;
77 }
78 ELM_MAIN()