tizen 2.4 release
[framework/uifw/elementary.git] / src / examples / button_example_00.c
1 /*
2  * gcc -o button_example_00 button_example_00.c `pkg-config --cflags --libs elementary`
3  */
4 #include <Elementary.h>
5
6 static void
7 on_click(void *data, Evas_Object *obj, void *event_info)
8 {
9    elm_exit();
10 }
11
12 EAPI_MAIN int
13 elm_main(int argc, char **argv)
14 {
15    Evas_Object *win = NULL;
16    Evas_Object *btn = NULL;
17
18    elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
19
20    /* Create an win, associate it with a canvas and */
21    /* turn it visible on WM (Window Manager).       */
22    win = elm_win_util_standard_add("Greetings", "Hello, World!");
23    elm_win_autodel_set(win, EINA_TRUE);
24
25    /* Create a btn, associate to a function, associate */
26    /* to win,  give a dimension and position.          */
27    btn = elm_button_add(win);
28    elm_object_text_set(btn, "Good-Bye, World!");
29    evas_object_smart_callback_add(btn, "clicked", on_click, NULL);
30    evas_object_resize(btn, 120, 30);
31    evas_object_move(btn, 60, 15);
32    evas_object_show(btn);
33
34    evas_object_resize(win, 240, 60);
35    evas_object_show(win);
36
37    elm_run();
38
39    return 0;
40 }
41 ELM_MAIN()