tizen 2.4 release
[framework/uifw/elementary.git] / src / examples / web_example_01.c
1 /*
2  * gcc -o web_example_01 web_example_01.c `pkg-config --cflags --libs elementary ewebkit` -D_GNU_SOURCE
3  */
4
5 #define _GNU_SOURCE
6 #include <Elementary.h>
7 #ifdef HAVE_ELEMENTARY_WEB
8 #include <EWebKit.h>
9 #endif
10
11 #define URL "http://www.enlightenment.org"
12
13 EAPI_MAIN int
14 elm_main(int argc, char *argv[])
15 {
16    Evas_Object *win, *web;
17
18    /* The program will proceed only if Ewebkit library is available. */
19    if (elm_need_web() == EINA_FALSE)
20      return -1;
21
22    elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
23
24    /* Window */
25    win = elm_win_add(NULL, "Elementary Webkit Widget", ELM_WIN_BASIC);
26    elm_win_autodel_set(win, EINA_TRUE);
27
28    /* Web */
29    web = elm_web_add(win);
30    evas_object_size_hint_weight_set(web, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
31    elm_web_window_create_hook_set(web, NULL, NULL);
32    elm_win_resize_object_add(win, web);
33    elm_web_history_enabled_set(web, EINA_FALSE);
34
35    if (!elm_web_url_set(web, URL))
36      {
37         printf("URL NOT LOADED");
38         return -1;
39      }
40    evas_object_show(web);
41
42    evas_object_resize(win, 720, 600);
43    evas_object_show(win);
44
45    elm_run();
46
47    return 0;
48 }
49 ELM_MAIN()