aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/elementary/src/examples/calendar_example_05.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-04-22 09:20:32 +1000
committerDavid Walter Seikel2012-04-22 09:20:32 +1000
commit3ad3455551be0d7859ecb02290376206d5e66498 (patch)
tree497917e12b4d7f458dff9765d9b53f64c4e03fc3 /libraries/elementary/src/examples/calendar_example_05.c
parentUpdate EFL to latest beta. (diff)
downloadSledjHamr-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/calendar_example_05.c')
-rw-r--r--libraries/elementary/src/examples/calendar_example_05.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/libraries/elementary/src/examples/calendar_example_05.c b/libraries/elementary/src/examples/calendar_example_05.c
new file mode 100644
index 0000000..6f752b1
--- /dev/null
+++ b/libraries/elementary/src/examples/calendar_example_05.c
@@ -0,0 +1,69 @@
1/**
2 * Elementary's <b>calendar widget</b> example, illustrating smart callback
3 * registry and getters usage.
4 *
5 * See stdout/stderr for output. Compile with:
6 *
7 * @verbatim
8 * gcc -o calendar_example_05 calendar_example_05.c -g `pkg-config --cflags --libs elementary`
9 * @endverbatim
10 */
11
12#include <Elementary.h>
13
14static void
15_print_cal_info_cb(void *data, Evas_Object *obj, void *event_info)
16{
17 int year_min, year_max;
18 Eina_Bool sel_enabled;
19 const char **wds;
20 struct tm sel_time;
21 double interval;
22
23 if (!elm_calendar_selected_time_get(obj, &sel_time))
24 return;
25
26 interval = elm_calendar_interval_get(obj);
27 elm_calendar_min_max_year_get(obj, &year_min, &year_max);
28 sel_enabled = !elm_calendar_day_selection_disabled_get(obj);
29 wds = elm_calendar_weekdays_names_get(obj);
30
31 printf("Day: %i, Mon: %i, Year %i, WeekDay: %i<br>\n"
32 "Interval: %0.2f, Year_Min: %i, Year_Max %i, Sel Enabled : %i<br>\n"
33 "Weekdays: %s, %s, %s, %s, %s, %s, %s<br>\n\n",
34 sel_time.tm_mday, sel_time.tm_mon, sel_time.tm_year + 1900, sel_time.tm_wday,
35 interval, year_min, year_max, sel_enabled,
36 wds[0], wds[1], wds[2], wds[3], wds[4], wds[5], wds[6]);
37}
38
39EAPI_MAIN int
40elm_main(int argc, char **argv)
41{
42 Evas_Object *win, *bg, *cal;
43
44 win = elm_win_add(NULL, "calendar", ELM_WIN_BASIC);
45 elm_win_title_set(win, "Calendar Getters Example");
46 elm_win_autodel_set(win, EINA_TRUE);
47 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
48
49 bg = elm_bg_add(win);
50 elm_win_resize_object_add(win, bg);
51 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
52 evas_object_show(bg);
53
54 cal = elm_calendar_add(win);
55 elm_win_resize_object_add(win, cal);
56 evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
57 /* Add callback to display calendar information every time user
58 * selects a new date */
59 evas_object_smart_callback_add(cal, "changed", _print_cal_info_cb, NULL);
60 evas_object_show(cal);
61
62 evas_object_show(win);
63
64 elm_run();
65 elm_shutdown();
66
67 return 0;
68}
69ELM_MAIN()