diff options
author | David Walter Seikel | 2012-04-22 09:20:32 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-04-22 09:20:32 +1000 |
commit | 3ad3455551be0d7859ecb02290376206d5e66498 (patch) | |
tree | 497917e12b4d7f458dff9765d9b53f64c4e03fc3 /libraries/elementary/src/examples/thumb_example_01.c | |
parent | Update EFL to latest beta. (diff) | |
download | SledjHamr-3ad3455551be0d7859ecb02290376206d5e66498.zip SledjHamr-3ad3455551be0d7859ecb02290376206d5e66498.tar.gz SledjHamr-3ad3455551be0d7859ecb02290376206d5e66498.tar.bz2 SledjHamr-3ad3455551be0d7859ecb02290376206d5e66498.tar.xz |
And actually include new files, plus elementary libraries.
Diffstat (limited to 'libraries/elementary/src/examples/thumb_example_01.c')
-rw-r--r-- | libraries/elementary/src/examples/thumb_example_01.c | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/libraries/elementary/src/examples/thumb_example_01.c b/libraries/elementary/src/examples/thumb_example_01.c new file mode 100644 index 0000000..eaf0ec2 --- /dev/null +++ b/libraries/elementary/src/examples/thumb_example_01.c | |||
@@ -0,0 +1,83 @@ | |||
1 | //Compile with: | ||
2 | //gcc -g thumb_example_01.c -o thumb_example_01 `pkg-config --cflags --libs elementary` | ||
3 | |||
4 | #include <Elementary.h> | ||
5 | |||
6 | static void | ||
7 | _generation_started_cb(void *data, Evas_Object *o, void *event_info) | ||
8 | { | ||
9 | printf("thumbnail generation started.\n"); | ||
10 | } | ||
11 | |||
12 | static void | ||
13 | _generation_finished_cb(void *data, Evas_Object *o, void *event_info) | ||
14 | { | ||
15 | printf("thumbnail generation finished.\n"); | ||
16 | } | ||
17 | |||
18 | static void | ||
19 | _generation_error_cb(void *data, Evas_Object *o, void *event_info) | ||
20 | { | ||
21 | printf("thumbnail generation error.\n"); | ||
22 | } | ||
23 | |||
24 | EAPI_MAIN int | ||
25 | elm_main(int argc, char **argv) | ||
26 | { | ||
27 | Evas_Object *win, *bg; | ||
28 | Evas_Object *thumb; | ||
29 | char buf[PATH_MAX]; | ||
30 | #ifdef ELM_ETHUMB | ||
31 | Ethumb_Client *client; | ||
32 | #endif | ||
33 | |||
34 | elm_need_ethumb(); | ||
35 | |||
36 | elm_app_info_set(elm_main, "elementary", "images/plant_01.jpg"); | ||
37 | win = elm_win_add(NULL, "thumb", ELM_WIN_BASIC); | ||
38 | elm_win_title_set(win, "Thumbnailer"); | ||
39 | elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); | ||
40 | elm_win_autodel_set(win, EINA_TRUE); | ||
41 | |||
42 | bg = elm_bg_add(win); | ||
43 | evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
44 | elm_win_resize_object_add(win, bg); | ||
45 | evas_object_show(bg); | ||
46 | |||
47 | #ifdef ELM_ETHUMB | ||
48 | client = elm_thumb_ethumb_client_get(); | ||
49 | if (!client) | ||
50 | { | ||
51 | printf("error: could not get Ethumb client.\n"); | ||
52 | return 1; | ||
53 | } | ||
54 | ethumb_client_size_set(client, 160, 160); | ||
55 | #endif | ||
56 | |||
57 | thumb = elm_thumb_add(win); | ||
58 | |||
59 | evas_object_smart_callback_add(thumb, "generate,start", _generation_started_cb, NULL); | ||
60 | evas_object_smart_callback_add(thumb, "generate,stop", _generation_finished_cb, NULL); | ||
61 | evas_object_smart_callback_add(thumb, "generate,error", _generation_error_cb, NULL); | ||
62 | |||
63 | elm_thumb_editable_set(thumb, EINA_FALSE); | ||
64 | snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); | ||
65 | elm_thumb_file_set(thumb, buf, NULL); | ||
66 | elm_thumb_reload(thumb); | ||
67 | |||
68 | evas_object_size_hint_weight_set(thumb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
69 | elm_win_resize_object_add(win, thumb); | ||
70 | evas_object_show(thumb); | ||
71 | |||
72 | evas_object_size_hint_min_set(bg, 160, 160); | ||
73 | evas_object_size_hint_max_set(bg, 640, 640); | ||
74 | evas_object_resize(win, 320, 320); | ||
75 | evas_object_show(win); | ||
76 | |||
77 | elm_run(); /* and run the program now, starting to handle all | ||
78 | * events, etc. */ | ||
79 | elm_shutdown(); /* clean up and shut down */ | ||
80 | /* exit code */ | ||
81 | return 0; | ||
82 | } | ||
83 | ELM_MAIN() | ||