From: sumanth.m Date: Mon, 4 Oct 2010 10:12:47 +0000 (+0530) Subject: elm_calendar :- svn code merged (version 51584-51586) X-Git-Tag: origin~99 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1888109fc05d6d3c586a75b15c63493040d8bc06;p=framework%2Fuifw%2Felementary.git elm_calendar :- svn code merged (version 51584-51586) --- diff --git a/data/themes/default.edc b/data/themes/default.edc index b4056ff..617092a 100644 --- a/data/themes/default.edc +++ b/data/themes/default.edc @@ -25063,4 +25063,723 @@ collections { } } } -} + + +///////////////////////////////////////////////////////////////////////////// +// CALENDAR +///////////////////////////////////////////////////////////////////////////// +#define CH(_pos) \ + part { name: "ch_"#_pos".base"; \ + type: RECT; \ + description { state: "default" 0.0; \ + rel1 { \ + relative: (_pos % 7 * 7 / 8 / 6) 0; \ + to: "header"; \ + } \ + rel2 { \ + relative: (_pos % 7 * 7 / 8 / 6 + 1 / 8) 1; \ + to: "header"; \ + } \ + color: 0 0 0 0; \ + visible: 0; \ + } \ + } \ + part { name: "ch_"#_pos".text"; \ + type: TEXT; \ + effect: SOFT_SHADOW; \ + mouse_events: 0; \ + scale: 1; \ + clip_to: "ch_"#_pos".clipper"; \ + description { \ + state: "default" 0.0; \ + rel1.to: "ch_"#_pos".base"; \ + rel2.to: "ch_"#_pos".base"; \ + color: 0 0 0 255; \ + color3: 0 0 0 0; \ + text { \ + font: "Sans"; \ + size: 10; \ + min: 1 1; \ + align: 0.5 0.5; \ + } \ + } \ + } \ + part { name: "ch_"#_pos".clipper"; \ + type: RECT; \ + description { state: "default" 0.0; \ + rel1.to: "ch_"#_pos".base"; \ + rel2.to: "ch_"#_pos".base"; \ + } \ + } + +#define CIT(_pos) \ + part { name: "cit_"#_pos".rect"; \ + type: RECT; \ + description { state: "default" 0.0; \ + rel1 { \ + relative: (_pos % 7 * 7 / 8 / 6) \ + (_pos / 8 / 5 - _pos % 7 / 8 / 5); \ + to: "base"; \ + } \ + rel2 { \ + relative: (_pos % 7 * 7 / 8 / 6 + 1 / 8) \ + (_pos / 8 / 5 - _pos % 7 / 8 / 5 + 1 / 8); \ + to: "base"; \ + } \ + color: 0 0 0 0; \ + visible: 0; \ + } \ + } \ + part { \ + name: "cit_"#_pos".event"; \ + type: RECT; \ + repeat_events: 1; \ + description { \ + rel1.to: "cit_"#_pos".rect"; \ + rel2.to: "cit_"#_pos".rect"; \ + state: "default" 0.0; \ + color: 0 0 0 0; \ + } \ + } \ + part { name: "cit_"#_pos".shelf"; \ + type: RECT; \ + mouse_events: 0; \ + description { state: "default" 0.0; \ + rel1 { \ + to: "cit_"#_pos".bg"; \ + offset: -1 -1; \ + } \ + rel2 { \ + to: "cit_"#_pos".bg"; \ + } \ + color: 200 200 200 255; \ + } \ + } \ + part { name: "cit_"#_pos".hd"; \ + type: RECT; \ + mouse_events: 0; \ + description { state: "default" 0.0; \ + rel1 { \ + to: "cit_"#_pos".bg"; \ + offset: -1 -1; \ + } \ + rel2 { \ + to: "cit_"#_pos".bg"; \ + } \ + visible: 0; \ + color: 160 0 0 255; \ + } \ + description { state: "visible" 0.0; \ + inherit: "default" 0.0; \ + visible: 1; \ + } \ + } \ + part { \ + name: "cit_"#_pos".base_sh"; \ + mouse_events: 0; \ + description { \ + state: "default" 0.0; \ + align: 0.0 0.0; \ + min: 0 1; \ + rel1 { \ + to: "cit_"#_pos".base"; \ + relative: 0.0 1.0; \ + offset: 0 0; \ + } \ + rel2 { \ + to: "cit_"#_pos".base"; \ + relative: 1.0 1.05; \ + offset: -1 0; \ + } \ + image { \ + normal: "ilist_item_shadow.png"; \ + } \ + fill.smooth: 0; \ + } \ + } \ + part { \ + name: "cit_"#_pos".base"; \ + mouse_events: 0; \ + description { \ + state: "default" 0.0; \ + rel1.to: "cit_"#_pos".rect"; \ + rel2.to: "cit_"#_pos".rect"; \ + rel2.offset: -1 -1; \ + image { \ + normal: "ilist_1.png"; \ + border: 2 2 2 2; \ + } \ + fill.smooth: 0; \ + } \ + description { \ + state: "today" 0.0; \ + inherit: "default" 0.0; \ + image.normal: "ilist_2.png"; \ + color: 240 240 240 255; \ + } \ + } \ + part { name: "cit_"#_pos".bg"; \ + mouse_events: 0; \ + description { state: "default" 0.0; \ + visible: 0; \ + color: 255 255 255 0; \ + rel1 { \ + to: "cit_"#_pos".rect"; \ + relative: 0.0 0.0; \ + } \ + rel2 { \ + to: "cit_"#_pos".rect"; \ + relative: 1.0 1.0; \ + offset: -1 -1; \ + } \ + image { \ + normal: "bt_sm_base1.png"; \ + border: 6 6 6 6; \ + } \ + image.middle: SOLID; \ + } \ + description { state: "selected" 0.0; \ + inherit: "default" 0.0; \ + visible: 1; \ + color: 255 255 255 255; \ + } \ + } \ + part { name: "cit_"#_pos".text"; \ + type: TEXT; \ + effect: SOFT_SHADOW; \ + mouse_events: 0; \ + scale: 1; \ + description { \ + state: "default" 0.0; \ + rel1.to: "cit_"#_pos".bg"; \ + rel2.to: "cit_"#_pos".bg"; \ + color: 0 0 0 255; \ + color3: 0 0 0 0; \ + text { \ + font: "Sans"; \ + size: 10; \ + min: 1 1; \ + align: 0.5 0.5; \ + } \ + } \ + description { state: "selected" 0.0; \ + inherit: "default" 0.0; \ + color: 224 224 224 255; \ + color3: 0 0 0 64; \ + } \ + } \ + part { name: "cit_"#_pos".fg1"; \ + mouse_events: 0; \ + description { state: "default" 0.0; \ + visible: 0; \ + color: 255 255 255 0; \ + rel1.to: "cit_"#_pos".bg"; \ + rel2.relative: 1.0 0.5; \ + rel2.to: "cit_"#_pos".bg"; \ + image { \ + normal: "bt_sm_hilight.png"; \ + border: 6 6 6 0; \ + } \ + } \ + description { state: "selected" 0.0; \ + inherit: "default" 0.0; \ + visible: 1; \ + color: 255 255 255 255; \ + } \ + } \ + part { name: "cit_"#_pos".fg2"; \ + mouse_events: 0; \ + description { state: "default" 0.0; \ + visible: 0; \ + color: 255 255 255 0; \ + rel1.to: "cit_"#_pos".bg"; \ + rel2.to: "cit_"#_pos".bg"; \ + image { \ + normal: "bt_sm_shine.png"; \ + border: 6 6 6 0; \ + } \ + } \ + description { state: "selected" 0.0; \ + inherit: "default" 0.0; \ + visible: 1; \ + color: 255 255 255 255; \ + } \ + } \ + part { name: "cit_"#_pos".check"; \ + mouse_events: 0; \ + description { state: "default" 0.0; \ + rel1 { \ + to: "cit_"#_pos".bg"; \ + relative: 0.7 0.6; \ + offset: 1 1; \ + } \ + rel2 { \ + to: "cit_"#_pos".bg"; \ + relative: 1.1 1.2; \ + offset: -2 -2; \ + } \ + aspect: 1 1; \ + visible: 0; \ + color: 255 0 0 255; \ + image.normal: "check.png"; \ + } \ + description { state: "visible" 0.0; \ + inherit: "default" 0.0; \ + visible: 1; \ + } \ + } \ + programs { \ + program { \ + name: "cit_"#_pos".go_active"; \ + signal: "cit_"#_pos",selected"; \ + source: "elm"; \ + action: STATE_SET "selected" 0.0; \ + target: "cit_"#_pos".bg"; \ + target: "cit_"#_pos".fg1"; \ + target: "cit_"#_pos".fg2"; \ + target: "cit_"#_pos".text"; \ + } \ + program { \ + name: "cit_"#_pos".go_passive"; \ + signal: "cit_"#_pos",unselected"; \ + source: "elm"; \ + action: STATE_SET "default" 0.0; \ + target: "cit_"#_pos".bg"; \ + target: "cit_"#_pos".fg1"; \ + target: "cit_"#_pos".fg2"; \ + target: "cit_"#_pos".text"; \ + } \ + program { \ + name: "cit_"#_pos".is_today"; \ + signal: "cit_"#_pos",today"; \ + source: "elm"; \ + action: STATE_SET "today" 0.0; \ + target: "cit_"#_pos".base"; \ + } \ + program { \ + name: "cit_"#_pos".not_today"; \ + signal: "cit_"#_pos",not_today"; \ + source: "elm"; \ + action: STATE_SET "default" 0.0; \ + target: "cit_"#_pos".base"; \ + } \ + program { \ + source: "cit_"#_pos".clicked"; \ + signal: "mouse,clicked,1"; \ + source: "cit_"#_pos".event"; \ + action: SIGNAL_EMIT "elm,action,selected" #_pos; \ + } \ + program { \ + name: "cit_"#_pos".clear"; \ + signal: "cit_"#_pos",clear"; \ + source: "elm"; \ + action: STATE_SET "default" 0.0; \ + target: "cit_"#_pos".check"; \ + target: "cit_"#_pos".hd"; \ + } \ + program { \ + name: "cit_"#_pos".checked"; \ + signal: "cit_"#_pos",checked"; \ + source: "elm"; \ + action: STATE_SET "visible" 0.0; \ + target: "cit_"#_pos".check"; \ + } \ + program { \ + name: "cit_"#_pos".holiday"; \ + signal: "cit_"#_pos",holiday"; \ + source: "elm"; \ + action: STATE_SET "visible" 0.0; \ + target: "cit_"#_pos".hd"; \ + } \ + } + + group { name: "elm/calendar/base/default"; + images { + image: "shelf_inset.png" COMP; + image: "bt_base1.png" COMP; + image: "bt_hilight.png" COMP; + image: "bt_shine.png" COMP; + image: "bt_glow.png" COMP; + image: "bt_dis_base.png" COMP; + image: "bt_dis_hilight.png" COMP; + image: "sp_bt_l.png" COMP; + image: "sp_bt_r.png" COMP; + image: "bt_sm_base1.png" COMP; + image: "bt_sm_shine.png" COMP; + image: "bt_sm_hilight.png" COMP; + image: "ilist_1.png" COMP; + image: "ilist_2.png" COMP; + image: "ilist_item_shadow.png" COMP; + image: "check.png" COMP; + } + parts { + part { name: "bg"; + type: RECT; + description { state: "default" 0.0; + min: 0 30; + rel1.offset: 1 1; + rel2.offset: -2 -2; + color: 255 255 255 0; + align: 0.0 0.5; + } + } + part { name: "spinner-base"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + min: 24 24; + max: 999999 24; + rel1.to: "bg"; + rel1.offset: 6 6; + rel2.to: "bg"; + rel2.offset: -7 -7; + color: 255 255 255 0; + align: 0.0 0.0; + } + } + part { name: "conf_over_spinner"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "spinner-base"; + rel1.offset: -3 -3; + rel2.to: "spinner-base"; + rel2.offset: 2 2; + image { + normal: "shelf_inset.png"; + border: 7 7 7 7; + middle: 0; + } + fill.smooth : 0; + } + } + part { name: "table-base"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + min: 256 220; + rel1.to_x: "bg"; + rel1.to_y: "spinner-base"; + rel1.offset: 6 6; + rel1.relative: 0 1; + rel2.to: "bg"; + rel2.offset: -7 -7; + color: 255 255 255 0; + } + } + part { name: "conf_over_table"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "table-base"; + rel1.offset: -3 -3; + rel2.to: "table-base"; + rel2.offset: 2 2; + image { + normal: "shelf_inset.png"; + border: 7 7 7 7; + middle: 0; + } + fill.smooth : 0; + } + } + part { name: "header"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "table-base"; + rel1.relative: 0 0; + rel2.to: "table-base"; + rel2.relative: 1 0.1; + color: 255 255 255 0; + } + } + part { name: "base"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to_x: "table-base"; + rel1.to_y: "header"; + rel1.relative: 0 1; + rel1.offset: 3 0; + rel2.to: "table-base"; + rel2.offset: -3 0; + color: 255 255 255 0; + } + } + part { name: "left_bt"; + mouse_events: 1; + description { state: "default" 0.0; + rel1 { to: "spinner-base"; + offset: 2 2; + } + rel2 { to: "spinner-base"; + offset: -3 -3; + } + align: 0.0 0.5; + min: 24 24; + max: 24 24; + fixed: 1 1; + image { + normal: "bt_base1.png"; + border: 6 6 6 6; + } + fill.smooth : 0; + } + description { state: "clicked" 0.0; + inherit: "default" 0.0; + image.normal: "bt_base1.png"; + image.middle: SOLID; + } + } + part { name: "left_over1"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "left_bt"; + rel2 { to: "left_bt"; + relative: 1.0 0.5; + } + image { + normal: "bt_hilight.png"; + border: 7 7 7 0; + } + } + } + part { name: "left_over2"; + mouse_events: 1; + repeat_events: 1; + description { state: "default" 0.0; + rel1.to: "left_bt"; + rel2.to: "left_bt"; + image { + normal: "bt_shine.png"; + border: 7 7 7 7; + } + } + } + part { name: "left_over3"; + mouse_events: 1; + repeat_events: 1; + description { state: "default" 0.0; + color: 255 255 255 0; + rel1.to: "left_bt"; + rel2.to: "left_bt"; + image { + normal: "bt_glow.png"; + border: 12 12 12 12; + } + fill.smooth : 0; + } + description { state: "clicked" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 255; + } + } + part { name: "right_bt"; + mouse_events: 1; + description { state: "default" 0.0; + rel1 { to: "spinner-base"; + offset: -27 3; + } + rel2 { to: "spinner-base"; + offset: -3 -3; + } + align: 1.0 0.5; + min: 24 24; + max: 24 24; + fixed: 1 1; + image { + normal: "bt_base1.png"; + border: 5 5 4 12; + } + fill.smooth : 0; + } + description { state: "clicked" 0.0; + inherit: "default" 0.0; + image.normal: "bt_base1.png"; + image.middle: SOLID; + } + } + part { name: "right_over1"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "right_bt"; + rel2 { to: "right_bt"; + relative: 1.0 0.5; + } + image { + normal: "bt_hilight.png"; + border: 7 7 7 0; + } + } + } + part { name: "right_over2"; + mouse_events: 1; + repeat_events: 1; + description { state: "default" 0.0; + rel1.to: "right_bt"; + rel2.to: "right_bt"; + image { + normal: "bt_shine.png"; + border: 7 7 7 7; + } + } + } + part { name: "right_over3"; + mouse_events: 1; + repeat_events: 1; + description { state: "default" 0.0; + color: 255 255 255 0; + rel1.to: "right_bt"; + rel2.to: "right_bt"; + image { + normal: "bt_glow.png"; + border: 12 12 12 12; + } + fill.smooth : 0; + } + description { state: "clicked" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 255; + } + } + part { name: "left_bt_icon"; + repeat_events: 1; + description { state: "default" 0.0; + rel1.to: "left_bt"; + rel2.to: "left_bt"; + align: 0.5 0.5; + min: 16 16; + max: 16 16; + image.normal: "sp_bt_l.png"; + } + } + part { name: "right_bt_icon"; + repeat_events: 1; + description { state: "default" 0.0; + rel1.to: "right_bt"; + rel2.to: "right_bt"; + align: 0.5 0.5; + min: 16 16; + max: 16 16; + image.normal: "sp_bt_r.png"; + } + } + part { name: "month_text"; + type: TEXT; + mouse_events: 0; + scale: 1; + description { state: "default" 0.0; + align: 0 0.5; + fixed: 1 1; + rel1 { relative: 1.0 0.0; + offset: 3 2; + to: "left_bt"; + to_y: "spinner-base"; + } + rel2 { relative: 0.0 1.0; + offset: -3 -2; + to_x: "right_bt"; + to_y: "spinner-base"; + } + color: 0 0 0 255; + text { + font: "Sans,Edje-Vera"; + size: 12; + min: 1 1; + align: 0.5 0.5; + } + } + } + CH(0) CH(1) CH(2) CH(3) CH(4) CH(5) CH(6) + CIT(0) CIT(1) CIT(2) CIT(3) CIT(4) CIT(5) CIT(6) + CIT(7) CIT(8) CIT(9) CIT(10) CIT(11) CIT(12) CIT(13) + CIT(14) CIT(15) CIT(16) CIT(17) CIT(18) CIT(19) CIT(20) + CIT(21) CIT(22) CIT(23) CIT(24) CIT(25) CIT(26) CIT(27) + CIT(28) CIT(29) CIT(30) CIT(31) CIT(32) CIT(33) CIT(34) + CIT(35) CIT(36) CIT(37) CIT(38) CIT(39) CIT(40) CIT(41) + } + programs { + program { name: "dec_start"; + signal: "mouse,down,1"; + source: "left_bt"; + action: SIGNAL_EMIT "elm,action,decrement,start" ""; + } + program { name: "dec_stop"; + signal: "mouse,up,1"; + source: "left_bt"; + action: SIGNAL_EMIT "elm,action,stop" ""; + } + program { name: "inc_start"; + signal: "mouse,down,1"; + source: "right_bt"; + action: SIGNAL_EMIT "elm,action,increment,start" ""; + } + program { name: "inc_stop"; + signal: "mouse,up,1"; + source: "right_bt"; + action: SIGNAL_EMIT "elm,action,stop" ""; + } + program { + name: "left_bt_click"; + signal: "mouse,down,1"; + source: "left_over2"; + action: STATE_SET "clicked" 0.0; + target: "left_bt"; + } + program { + name: "left_bt_unclick"; + signal: "mouse,up,1"; + source: "left_over2"; + action: STATE_SET "default" 0.0; + target: "left_bt"; + } + program { + name: "left_bt_click2"; + signal: "mouse,down,1"; + source: "left_over3"; + action: STATE_SET "clicked" 0.0; + target: "left_over3"; + } + program { + name: "left_bt_unclick2"; + signal: "mouse,up,1"; + source: "left_over3"; + action: STATE_SET "default" 0.0; + transition: DECELERATE 0.5; + target: "left_over3"; + } + program { + name: "right_bt_click"; + signal: "mouse,down,1"; + source: "right_over2"; + action: STATE_SET "clicked" 0.0; + target: "right_bt"; + } + program { + name: "right_bt_unclick"; + signal: "mouse,up,1"; + source: "right_over2"; + action: STATE_SET "default" 0.0; + target: "right_bt"; + } + program { + name: "right_bt_click2"; + signal: "mouse,down,1"; + source: "right_over3"; + action: STATE_SET "clicked" 0.0; + target: "right_over3"; + } + program { + name: "right_bt_unclick2"; + signal: "mouse,up,1"; + source: "right_over3"; + action: STATE_SET "default" 0.0; + transition: DECELERATE 0.5; + target: "right_over3"; + } + } + } + +#undef CIT +#undef CH diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index da9ec3b..1fac038 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -79,7 +79,8 @@ test_conform.c \ test_multi.c \ test_floating.c \ test_launcher.c \ -test_anim.c +test_anim.c \ +test_calendar.c elementary_test_LDADD = $(top_builddir)/src/lib/libelementary.la @ELEMENTARY_EWEATHER_LIBS@ elementary_test_LDFLAGS = diff --git a/src/bin/test.c b/src/bin/test.c index e49c7e5..2110ddd 100644 --- a/src/bin/test.c +++ b/src/bin/test.c @@ -65,7 +65,8 @@ void test_slideshow(void *data, Evas_Object *obj, void *event_info); void test_menu(void *data, Evas_Object *obj, void *event_info); void test_panel(void *data, Evas_Object *obj, void *event_info); void test_panes(void *data, Evas_Object *obj, void *event_info); - +void test_calendar(void *data, Evas_Object *obj, void *event_info); +void test_calendar2(void *data, Evas_Object *obj, void *event_info); void test_map(void *data, Evas_Object *obj, void *event_info); void test_weather(void *data, Evas_Object *obj, void *event_info); void test_flip(void *data, Evas_Object *obj, void *event_info); @@ -275,6 +276,8 @@ my_win_main(void) ADD_TEST("Launcher", test_launcher); ADD_TEST("Launcher 2", test_launcher2); ADD_TEST("Animation", test_anim); + ADD_TEST("Calendar", test_calendar); + ADD_TEST("Calendar 2", test_calendar2); #undef ADD_TEST if (tests) diff --git a/src/bin/test_calendar.c b/src/bin/test_calendar.c new file mode 100644 index 0000000..8897b95 --- /dev/null +++ b/src/bin/test_calendar.c @@ -0,0 +1,178 @@ +#include +#ifndef ELM_LIB_QUICKLAUNCH + +/* A simple test, just displaying calendar in it's default state */ +void +test_calendar(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *win, *bg, *cal; + + win = elm_win_add(NULL, "calendar", ELM_WIN_BASIC); + elm_win_title_set(win, "Calendar"); + elm_win_autodel_set(win, 1); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + cal = elm_calendar_add(win); + elm_win_resize_object_add(win, cal); + evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(cal); + + evas_object_show(win); +} + +void +_print_cal_info(Evas_Object *cal, Evas_Object *en) +{ + char info[1024]; + double interval; + int year_min, year_max; + Eina_Bool sel_enabled; + const char **wds; + struct tm stime; + + if (!elm_calendar_selected_time_get(cal, &stime)) + return; + + interval = elm_calendar_interval_get(cal); + elm_calendar_min_max_year_get(cal, &year_min, &year_max); + sel_enabled = elm_calendar_day_selection_enabled_get(cal); + wds = elm_calendar_weekdays_names_get(cal); + + snprintf(info, sizeof(info), + " Day: %i, Mon: %i, Year %i, WeekDay: %i
" + " Interval: %0.2f, Year_Min: %i, Year_Max %i, Sel Enabled : %i
" + " Weekdays: %s, %s, %s, %s, %s, %s, %s
", + stime.tm_mday, stime.tm_mon, stime.tm_year + 1900, stime.tm_wday, + interval, year_min, year_max, sel_enabled, + wds[0], wds[1], wds[2], wds[3], wds[4], wds[5], wds[6]); + + elm_entry_entry_set(en, info); +} + +static void +_print_cal_info_cb(void *data, Evas_Object *obj, void *event_info) +{ + _print_cal_info(obj, data); +} + +static char * +_format_month_year(struct tm *stime) +{ + char buf[32]; + if (!strftime(buf, sizeof(buf), "%b %y", stime)) return NULL; + return strdup(buf); +} + +/* A test intended to cover all the calendar api and much use cases as + possible */ +void +test_calendar2(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *win, *bg, *bx, *bxh, *cal, *cal2, *cal3, *en; + Elm_Calendar_Mark *mark; + struct tm selected_time; + time_t current_time; + const char *weekdays[] = + { + "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday" + }; + + win = elm_win_add(NULL, "calendar", ELM_WIN_BASIC); + elm_win_title_set(win, "Calendar"); + elm_win_autodel_set(win, 1); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + bxh = elm_box_add(win); + elm_box_horizontal_set(bxh, EINA_TRUE); + evas_object_size_hint_weight_set(bxh, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bxh, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bxh); + elm_box_pack_end(bx, bxh); + + cal = elm_calendar_add(win); + evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(cal, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(cal); + elm_box_pack_end(bx, cal); + + cal2 = elm_calendar_add(win); + evas_object_size_hint_weight_set(cal2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(cal2, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_calendar_day_selection_enabled_set(cal2, EINA_FALSE); + evas_object_show(cal2); + elm_box_pack_end(bxh, cal2); + + cal3 = elm_calendar_add(win); + evas_object_size_hint_weight_set(cal3, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(cal3, EVAS_HINT_FILL, EVAS_HINT_FILL); + current_time = time(NULL) + 34 * 84600; + localtime_r(¤t_time, &selected_time); + elm_calendar_selected_time_set(cal3, &selected_time); + current_time = time(NULL) + 1 * 84600; + localtime_r(¤t_time, &selected_time); + elm_calendar_mark_add(cal3, "checked", &selected_time, ELM_CALENDAR_UNIQUE); + elm_calendar_marks_clear(cal3); + current_time = time(NULL); + localtime_r(¤t_time, &selected_time); + elm_calendar_mark_add(cal3, "checked", &selected_time, ELM_CALENDAR_DAILY); + elm_calendar_mark_add(cal3, "holiday", &selected_time, ELM_CALENDAR_DAILY); + elm_calendar_marks_draw(cal3); + evas_object_show(cal3); + elm_box_pack_end(bxh, cal3); + + en = elm_entry_add(win); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(en); + elm_box_pack_end(bx, en); + elm_entry_editable_set(en, EINA_FALSE); + evas_object_show(win); + + elm_calendar_weekdays_names_set(cal, weekdays); + elm_calendar_interval_set(cal, 0.4); + elm_calendar_format_function_set(cal, _format_month_year); + elm_calendar_min_max_year_set(cal, 2010, 2020); + + current_time = time(NULL) + 4 * 84600; + localtime_r(¤t_time, &selected_time); + elm_calendar_mark_add(cal, "holiday", &selected_time, ELM_CALENDAR_ANNUALLY); + + current_time = time(NULL) + 1 * 84600; + localtime_r(¤t_time, &selected_time); + elm_calendar_mark_add(cal, "checked", &selected_time, ELM_CALENDAR_UNIQUE); + + current_time = time(NULL) - 363 * 84600; + localtime_r(¤t_time, &selected_time); + elm_calendar_mark_add(cal, "checked", &selected_time, ELM_CALENDAR_MONTHLY); + + current_time = time(NULL) - 5 * 84600; + localtime_r(¤t_time, &selected_time); + mark = elm_calendar_mark_add(cal, "holiday", &selected_time, + ELM_CALENDAR_WEEKLY); + + current_time = time(NULL) + 1 * 84600; + localtime_r(¤t_time, &selected_time); + elm_calendar_mark_add(cal, "holiday", &selected_time, ELM_CALENDAR_WEEKLY); + + elm_calendar_mark_del(mark); + elm_calendar_marks_draw(cal); + + _print_cal_info(cal, en); + evas_object_smart_callback_add(cal, "changed", _print_cal_info_cb, en); +} + +#endif