/* * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved * * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ //No event group here. group { "elm/calendar/base/template"; inherit_only: 1; mouse; //only event part can have mouse events. parts { rect { "base"; desc { "default"; } } /* Calendar has a lot of duplicated part inside. So we using macro to define duplicated parts. CAL_SPIN including Year, Month text and left, right arrow button. month_text will be name of part. spinner-base1 is spacer. (title area of calendar.) CH is showing name of the day. CIT is each part of the day. CAL_SPIN(,,month_text, spinner-base1) 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) */ } } #define CIT_STYLES\ style { name: "calendar_date_style";\ base: "font=Tizen:weight=Light font_size="CALENDAR_DATE_TEXT_SIZE" color=#FFF color_class=calendar/default/text_date align=center text_class=tizen";\ }\ style { name: "calendar_date_selected_style";\ base: "font=Tizen:weight=Light font_size="CALENDAR_DATE_TEXT_SIZE" color=#FFF color_class=calendar/default/text_date_selected align=center text_class=tizen";\ }\ style { name: "calendar_date_hilighted_style";\ base: "font=Tizen:weight=Light font_size="CALENDAR_DATE_TEXT_SIZE" color=#FFF color_class=calendar/default/text_date_pressed align=center text_class=tizen";\ }\ style { name: "calendar_date_disabled_style";\ base: "font=Tizen:weight=Light font_size="CALENDAR_DATE_TEXT_SIZE" color=#FFF color_class=calendar/default/text_date_disabled align=center text_class=tizen";\ }\ style { name: "calendar_date_holiday_style";\ base: "font=Tizen:weight=Light font_size="CALENDAR_DATE_TEXT_SIZE" color=#FFF color_class=calendar/default/text_sunday align=center text_class=tizen";\ }\ style { name: "calendar_date_holiday_disabled_style";\ base: "font=Tizen:weight=Light font_size="CALENDAR_DATE_TEXT_SIZE" color=#FFF color_class=calendar/default/text_sunday_disabled align=center text_class=tizen";\ }\ #define CAL_SPIN(_sufix, _signal_sufix, _text, _relative)\ swallow{ name: "elm,calendar,button"#_sufix",left";\ mouse;\ scale;\ desc { "default";\ fixed: 1 1;\ rel1.to: "left_bt"#_sufix;\ rel2.to: "left_bt"#_sufix;\ }\ desc { "rtl";\ inherit: "default";\ rel1.to: "right_bt"#_sufix;\ rel2.to: "right_bt"#_sufix;\ }\ }\ rect { "left_bt"#_sufix;\ mouse;\ repeat;\ scale;\ desc { "default";\ fixed: 1 1;\ rel1.to: #_relative;\ rel2.to: #_relative;\ align: 0.0 0.5;\ min: CALENDAR_DATE_PICKER_LEFT_RIGHT_ARROW_IMAGE_SIZE_INC;\ max: CALENDAR_DATE_PICKER_LEFT_RIGHT_ARROW_IMAGE_SIZE_INC;\ color: 0 0 0 0;\ }\ }\ swallow { "elm,calendar,button"#_sufix",right";\ mouse;\ scale;\ desc { "default";\ fixed: 1 1;\ rel1.to: "right_bt"#_sufix;\ rel2.to: "right_bt"#_sufix;\ }\ desc { "rtl";\ inherit: "default";\ rel1.to: "left_bt"#_sufix;\ rel2.to: "left_bt"#_sufix;\ }\ }\ rect { "right_bt"#_sufix;\ mouse;\ repeat;\ scale: 1;\ desc { "default";\ fixed: 1 1;\ rel1.to: #_relative;\ rel2.to: #_relative;\ align: 1.0 0.5;\ min: CALENDAR_DATE_PICKER_LEFT_RIGHT_ARROW_IMAGE_SIZE_INC;\ max: CALENDAR_DATE_PICKER_LEFT_RIGHT_ARROW_IMAGE_SIZE_INC;\ color: 0 0 0 0;\ }\ }\ text { #_text;\ scale;\ desc { "default";\ fixed: 1 1;\ rel1 { relative: 1.0 0.0;\ to: "left_bt"#_sufix;\ }\ rel2 { relative: 0.0 1.0;\ to: "right_bt"#_sufix;\ }\ color_class: "calendar/default/text_month"; \ text { font: "Tizen:width=Condensed:weight=Light"; size: CALENDAR_MONTH_TEXT_SIZE;\ text_class: "tizen"; \ min: 0 1;\ }\ }\ }\ rect { #_text".access";\ mouse;\ repeat;\ desc { "default";\ fixed: 1 1; \ rel1 { relative: 1.0 0.0;\ to_x: "left_bt"#_sufix;\ to_y: _relative;\ }\ rel2 { relative: 0.0 1.0;\ to_x: "right_bt"#_sufix;\ to_y: _relative;\ }\ color: 0 0 0 0; \ }\ }\ programs {\ program { "rtl"#_sufix;\ signal: "edje,state,rtl"; source: "edje";\ script {\ set_int(rtl, 1);\ set_state(PART:"elm,calendar,button"#_sufix",left", "rtl", 0.0);\ set_state(PART:"elm,calendar,button"#_sufix",right", "rtl", 0.0);\ }\ }\ program { "ltr"#_sufix;\ signal: "edje,state,ltr"; source: "edje";\ script {\ set_int(rtl, 0);\ set_state(PART:"elm,calendar,button"#_sufix",left", "default", 0.0);\ set_state(PART:"elm,calendar,button"#_sufix",right", "default", 0.0);\ }\ }\ program { \ name: "touch_sound"; \ action: RUN_PLUGIN "touch_sound"; \ } \ } #define CH(_pos) \ spacer { "ch_"#_pos".base"; \ desc { "default"; \ rel1 { \ relative: (_pos % 7 / 7) 0.0; \ to: "header"; \ } \ rel2 { \ relative: (_pos % 7 / 7 + 1 / 7) 1.0; \ to: "header"; \ } \ } \ } \ text { "ch_"#_pos".text"; \ scale; \ clip: "ch_"#_pos".clipper"; \ desc { "default"; \ fixed: 1 1; \ rel1.to: "ch_"#_pos".base"; \ rel2.to: "ch_"#_pos".base"; \ color_class: "calendar/default/text_day";\ text { font: "Tizen:weight=Light"; size: CALENDAR_DATE_TITLE_TEXT_SIZE; \ min: 1 1; \ ellipsis: -1; \ } \ } \ } \ rect { "ch_"#_pos".clipper"; \ desc { "default"; \ rel1.to: "ch_"#_pos".base"; \ rel2.to: "ch_"#_pos".base"; \ } \ } #define CIT_SCRIPT(_pos) \ public cit_##_pos##_disabled; #define CIT(_pos) \ spacer { "cit_"#_pos".rect"; \ desc { "default"; \ rel1 { \ relative: (_pos % 7 / 7) \ (_pos / 7 / 6 - _pos % 7 / 7 / 6); \ to: "bg_content"; \ } \ rel2 { \ relative: (_pos % 7 / 7 + 1 / 7) \ (_pos / 7 / 6 + 1 / 6 - _pos % 7 / 7 / 6); \ to: "bg_content"; \ } \ } \ } \ rect { "cit_"#_pos".event"; \ mouse; \ repeat; \ desc { "default"; \ fixed: 1 1; \ rel1.to: "cit_"#_pos".rect"; \ rel2.to: "cit_"#_pos".rect"; \ color: 0 0 0 0; \ } \ } \ vector { "cit_"#_pos".selected"; \ scale; \ desc { "default"; \ fixed: 1 1; \ min: CALENDAR_SELECTED_IMAGE_SIZE_INC; \ max: CALENDAR_SELECTED_IMAGE_SIZE_INC; \ rel1.to: "cit_"#_pos".rect"; \ rel2.to: "cit_"#_pos".rect"; \ image.normal: "core_date_picker_press.svg"; \ color_class: "calendar/default/icon_selected"; \ hid; \ } \ desc { "selected"; \ inherit: "default" 0.0; \ vis; \ } \ } \ vector { "cit_"#_pos".selected2"; \ scale; \ desc { "default"; \ fixed: 1 1; \ min: CALENDAR_SELECTED_IMAGE_SIZE_INC; \ max: CALENDAR_SELECTED_IMAGE_SIZE_INC; \ rel1.to: "cit_"#_pos".rect"; \ rel2.to: "cit_"#_pos".rect"; \ image.normal: "core_date_picker_press.svg"; \ color_class: "calendar/default/icon_selected"; \ hid; \ } \ desc { "hilighted"; \ inherit: "default" 0.0; \ vis; \ } \ } \ image { "cit_"#_pos".glow"; \ scale; \ desc { "default"; \ fixed: 1 1; \ rel1.to: "cit_"#_pos".rect"; \ rel2.to: "cit_"#_pos".rect"; \ image.normal: "core_focus_round.#.png"; \ color: 0 221 255 255; \ hid; \ } \ desc { "focused"; \ inherit: "default" 0.0; \ vis; \ } \ } \ textblock { "cit_"#_pos".text"; \ scale; \ desc { "default"; \ fixed: 1 1; \ rel1.to: "cit_"#_pos".rect"; \ rel2.to: "cit_"#_pos".rect"; \ text.style: "calendar_date_style"; \ text.min: 1 1; \ text.ellipsis: -1; \ } \ desc { "holiday"; \ inherit: "default"; \ text.style: "calendar_date_holiday_style"; \ } \ desc { "disabled"; \ inherit: "default"; \ text.style: "calendar_date_disabled_style"; \ } \ desc { "hilighted"; \ inherit: "default"; \ text.style: "calendar_date_hilighted_style"; \ } \ desc { "selected"; \ inherit: "default"; \ text.style: "calendar_date_selected_style"; \ } \ desc { "holiday_hilighted"; \ inherit: "default"; \ text.style: "calendar_date_hilighted_style"; \ } \ desc { "holiday_selected"; \ inherit: "default"; \ text.style: "calendar_date_selected_style"; \ } \ desc { "holiday_disabled"; \ inherit: "default"; \ text.style: "calendar_date_holiday_disabled_style"; \ } \ } \ rect { "cit_"#_pos".access"; \ mouse; \ repeat; \ desc { "default"; \ fixed: 1 1; \ rel1.to: "cit_"#_pos".event"; \ rel2.to: "cit_"#_pos".event"; \ color: 0 0 0 0; \ } \ } \ programs { \ program { "cit_"#_pos".go_active"; \ signal: "cit_"#_pos",selected"; \ source: "elm"; \ script { \ new st[31]; \ new Float:vl; \ get_state(PART:"cit_"#_pos".text", st, 30, vl); \ if (!strncmp(st, "holiday", 7)) \ set_state(PART:"cit_"#_pos".text", "holiday_selected", 0.0); \ else \ set_state(PART:"cit_"#_pos".text", "selected", 0.0); \ set_state(PART:"cit_"#_pos".selected", "selected", 0.0); \ } \ } \ program { "cit_"#_pos".go_passive"; \ signal: "cit_"#_pos",unselected"; \ source: "elm"; \ script { \ new st[31]; \ new Float:vl; \ get_state(PART:"cit_"#_pos".text", st, 30, vl); \ if (!strncmp(st, "holiday", 7)) \ set_state(PART:"cit_"#_pos".text", "holiday", 0.0); \ else if (!strncmp(st, "disabled", 8)) \ set_state(PART:"cit_"#_pos".text", "disabled", 0.0); \ else \ set_state(PART:"cit_"#_pos".text", "default", 0.0); \ set_state(PART:"cit_"#_pos".selected", "default", 0.0); \ } \ } \ program { "cit_"#_pos".focus_highlighted"; \ signal: "cit_"#_pos",focused"; \ source: "elm"; \ script { \ set_int(item_focus_enabled, 1); \ set_int(last_focused_item, _pos); \ if (get_int(win_focus_enabled) == 1) \ set_state(PART:"cit_"#_pos".glow", "focused", 0.0); \ } \ } \ program { "cit_"#_pos".focus_unhighlighed"; \ signal: "cit_"#_pos",unfocused"; \ source: "elm"; \ script { \ set_int(item_focus_enabled, 0); \ set_state(PART:"cit_"#_pos".glow", "default", 0.0); \ } \ } \ program { "cit_"#_pos".mouse.down"; \ signal: "mouse,down,1"; \ source: "cit_"#_pos".event"; \ script { \ new st[31]; \ new Float:vl; \ get_state(PART:"cit_"#_pos".text", st, 30, vl); \ if (strcmp(st, "disabled")) { \ if (strstr(st, "selected") == -1) { \ if (!strncmp(st, "holiday", 7)) \ set_state(PART:"cit_"#_pos".text", "holiday_hilighted", 0.0); \ else \ set_state(PART:"cit_"#_pos".text", "hilighted", 0.0); \ } \ set_state(PART:"cit_"#_pos".selected2", "hilighted", 0.0); \ } \ } \ } \ program { "cit_"#_pos".mouse.up"; \ signal: "mouse,up,1"; \ source: "cit_"#_pos".event"; \ script { \ new st[31]; \ new Float:vl; \ get_state(PART:"cit_"#_pos".text", st, 30, vl); \ if (strcmp(st, "disabled")) { \ if (strstr(st, "selected") == -1) { \ if (!strncmp(st, "holiday", 7)) \ set_state(PART:"cit_"#_pos".text", "holiday", 0.0); \ else \ set_state(PART:"cit_"#_pos".text", "default", 0.0); \ } \ set_state(PART:"cit_"#_pos".selected2", "default", 0.0); \ } \ } \ } \ program { "cit_"#_pos".enable"; \ signal: "cit_"#_pos",enable"; \ source: "elm"; \ script { \ new st[31]; \ new Float:vl; \ set_int(cit_##_pos##_disabled, 0); \ get_state(PART:"cit_"#_pos".text", st, 30, vl); \ if (!strncmp(st, "holiday", 7)) { \ if (!strcmp(st, "holiday_selected")) \ set_state(PART:"cit_"#_pos".text", "holiday_selected", 0.0); \ else \ set_state(PART:"cit_"#_pos".text", "holiday", 0.0); \ } else if (strcmp(st, "selected")) \ set_state(PART:"cit_"#_pos".text", "default", 0.0); \ } \ } \ program { "cit_"#_pos".disable"; \ signal: "cit_"#_pos",disable"; \ source: "elm"; \ script { \ new st[31]; \ new Float:vl; \ set_int(cit_##_pos##_disabled, 1); \ get_state(PART:"cit_"#_pos".text", st, 30, vl); \ if (!strncmp(st, "holiday", 7)) \ set_state(PART:"cit_"#_pos".text", "holiday_disabled", 0.0); \ else \ set_state(PART:"cit_"#_pos".text", "disabled", 0.0); \ } \ } \ program { "cit_"#_pos".clicked"; \ signal: "mouse,clicked,1"; \ source: "cit_"#_pos".event"; \ action: SIGNAL_EMIT "elm,action,selected" #_pos; \ after: "touch_snd_"#_pos; \ } \ program { "cit_"#_pos".clear"; \ signal: "cit_"#_pos",clear"; \ source: "elm"; \ after: "cit_"#_pos".holiday_clear"; \ } \ program { "cit_"#_pos".holiday_clear"; \ script { \ new st[31]; \ new Float:vl; \ get_state(PART:"cit_"#_pos".text", st, 30, vl); \ if (!strcmp(st, "holiday")) \ set_state(PART:"cit_"#_pos".text", "default", 0.0); \ else if (!strcmp(st, "holiday_disabled")) \ set_state(PART:"cit_"#_pos".text", "disabled", 0.0); \ else if (!strcmp(st, "holiday_selected")) \ set_state(PART:"cit_"#_pos".text", "selected", 0.0); \ } \ } \ program { "cit_"#_pos".holiday"; \ signal: "cit_"#_pos",holiday"; \ source: "elm"; \ script { \ new st[31]; \ new Float:vl; \ get_state(PART:"cit_"#_pos".text", st, 30, vl); \ if (!strcmp(st, "disabled")) \ set_state(PART:"cit_"#_pos".text", "holiday_disabled", 0.0); \ else if (!strcmp(st, "selected")) \ set_state(PART:"cit_"#_pos".text", "holiday_selected", 0.0); \ else \ set_state(PART:"cit_"#_pos".text", "holiday", 0.0); \ } \ } \ program { "touch_snd_"#_pos; \ script { \ if (!get_int(cit_##_pos##_disabled)) \ run_program(PROGRAM:"touch_sound"); \ } \ } \ } group { name: "elm/calendar/base/default"; nomouse; images.vector: "core_date_picker_press.svg"; images.image: "core_focus_round.#.png" COMP; data.item: "focus_highlight" "on"; script { public rtl; public win_focus_enabled; public item_focus_enabled; public last_focused_item; CIT_SCRIPT(0) CIT_SCRIPT(1) CIT_SCRIPT(2) CIT_SCRIPT(3) CIT_SCRIPT(4) CIT_SCRIPT(5) CIT_SCRIPT(6) CIT_SCRIPT(7) CIT_SCRIPT(8) CIT_SCRIPT(9) CIT_SCRIPT(10) CIT_SCRIPT(11) CIT_SCRIPT(12) CIT_SCRIPT(13) CIT_SCRIPT(14) CIT_SCRIPT(15) CIT_SCRIPT(16) CIT_SCRIPT(17) CIT_SCRIPT(18) CIT_SCRIPT(19) CIT_SCRIPT(20) CIT_SCRIPT(21) CIT_SCRIPT(22) CIT_SCRIPT(23) CIT_SCRIPT(24) CIT_SCRIPT(25) CIT_SCRIPT(26) CIT_SCRIPT(27) CIT_SCRIPT(28) CIT_SCRIPT(29) CIT_SCRIPT(30) CIT_SCRIPT(31) CIT_SCRIPT(32) CIT_SCRIPT(33) CIT_SCRIPT(34) CIT_SCRIPT(35) CIT_SCRIPT(36) CIT_SCRIPT(37) CIT_SCRIPT(38) CIT_SCRIPT(39) CIT_SCRIPT(40) CIT_SCRIPT(41) } styles { CIT_STYLES } parts { rect { "base"; scale; desc { "default"; min: CALENDAR_BG_MIN_SIZE_INC; max: CALENDAR_BG_MAX_SIZE_INC; color_class: "calendar/default/bg"; } } spacer { "padding_spinner_left"; scale; desc { "default"; fixed: 1 1; align: 0.0 0.5; min: CALENDAR_SPINNER_BASE_PADDING_MIN_SIZE_INC; rel1.to: "base"; rel2 { to: "base"; relative: 0.0 1.0; } } } spacer { "padding_spinner_right"; scale; desc { "default"; fixed: 1 1; align: 1.0 0.5; min: CALENDAR_SPINNER_BASE_PADDING_MIN_SIZE_INC; rel1 { to: "base"; relative: 1.0 0.0; } rel2.to: "base"; } } spacer { "bg_spinner"; scale; desc { "default"; min: CALENDAR_SPINNER_BASE_MIN_SIZE_INC; max: CALENDAR_SPINNER_BASE_MAX_SIZE_INC; rel1 { to_x: "padding_spinner_left"; to_y: "base"; relative: 1.0 0.0; } rel2 { to_x: "padding_spinner_right"; to_y: "base"; relative: 0.0 1.0; } align: 0.5 0.0; } } spacer { "bg_table"; scale; desc { "default"; min: CALENDAR_TABLE_BASE_MIN_SIZE_INC; max: CALENDAR_TABLE_BASE_MAX_SIZE_INC; rel1.to_x: "base"; rel1.to_y: "bg_spinner"; rel1.relative: 0.0 1.0; rel2.to: "base"; align: 0.5 0.0; } } spacer { "header"; scale; desc { "default"; min: CALENDAR_HEADER_MIN_SIZE_INC; max: CALENDAR_HEADER_MAX_SIZE_INC; rel1.to: "bg_table"; rel2.to: "bg_table"; align: 0.5 0.0; } } rect { "separator_header"; scale; desc { "default"; fixed: 1 1; min: CALENDAR_HEADER_SEPARATOR_SIZE_INC; rel1.to: "header"; rel1.relative: 0.0 1.0; rel2.to: "header"; color_class: "calendar/default/divider"; align: 0.5 0.0; } } spacer { "padding_top"; scale; desc { "default"; fixed: 0 1; min: CALENDAR_BASE_TOP_PADDING_SIZE_INC; rel1.to_x: "base"; rel1.to_y: "separator_header"; rel1.relative: 0.0 1.0; rel2.to_x: "base"; rel2.to_y: "separator_header"; align: 0.5 0.0; } } spacer { "bg_content"; scale; desc { "default"; fixed: 0 1; rel1.to_x: "bg_table"; rel1.to_y: "padding_top"; rel1.relative: 0.0 1.0; rel2.to_x: "bg_table"; rel2.to_y: "padding_bottom"; rel2.relative: 1.0 0.0; } } spacer { "padding_bottom"; scale; desc { "default"; fixed: 0 1; min: CALENDAR_BASE_BOTTOM_PADDING_SIZE_INC; rel1.to: "base"; rel1.relative: 0.0 1.0; rel2.to: "base"; align: 0.5 1.0; } } CAL_SPIN(,,month_text, bg_spinner) 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 { signal: "elm,action,focus_highlight,show"; source: "elm"; script { set_int(win_focus_enabled, 1); if (get_int(item_focus_enabled) == 1) { new value[32]; snprintf(value, 32, "cit_%d,focused", get_int(last_focused_item)); emit(value, "elm"); } } } program { signal: "elm,action,focus_highlight,hide"; source: "elm"; script { set_int(win_focus_enabled, 0); } } } } #undef CAL_SPIN #undef CIT #undef CH