Alarm / res / edje /

main.edc

/*
 * Copyright (c) 2016 Samsung Electronics Co., Ltd
 *
 * Licensed under the Flora License, Version 1.1 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://floralicense.org/license/
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "../../inc/view_defines.h"

/*
 * Alarm container is aligned in relation to the background
 */
#define ALARM_CONTAINER_HEIGHT 0.2


/*
 * Alarm caption is aligned in relation to alarm container
 */
#define ALARM_CAPTION_WIDTH 0.7
#define ALARM_CAPTION_HEIGHT 1.0


/*
 * Alarm image is aligned in relation to alarm image container
 */
#define ALARM_IMAGE_PADDING 0.2
#define ALARM_IMAGE "../res/images/alarm.png"

#define ALARM_FIRED_STATE "alarm_fired"

#define PART_BACKGROUND "background"
#define PART_RECURRING_ALARM_SPACER "recurring_alarm_spacer"
#define PART_ONTIME_ALARM_SPACER "ontime_alarm_spacer"
#define PART_ALARM_IMAGE_SPACER "alarm_image_spacer"

images {
	image: ALARM_IMAGE COMP;
}

collections {
	group {
		name: MAIN_GRP;

		parts {
			part {
				name: PART_BACKGROUND;
				type: RECT;
				description {
					state: "default" 0.0;
					color: 0 0 0 255;
					visible: 1;
				}
			}

			part {
				name: PART_RECURRING_ALARM_SPACER;
				type: SPACER;
				description {
					state: "default" 0.0;
					rel1 {
						relative: 0.0 0.0;
						to: PART_BACKGROUND;
					}
					rel2 {
						relative: 1.0 ALARM_CONTAINER_HEIGHT;
						to: PART_BACKGROUND;
					}
				}
			}

			part {
				name: "recurring_alarm_caption_text";
				type: TEXT;
				scale: 1;
				description {
					state: "default" 0.0;
					visible: 1;
					color: 255 255 255 255;
					text {
						align: 0.2 0.5;
						text:"Recurring alarm";
						size: 17;
					}
					rel1 {
						relative: 0.0 0.0;
						to: PART_RECURRING_ALARM_SPACER;
					}
					rel2 {
						relative: ALARM_CAPTION_WIDTH ALARM_CAPTION_HEIGHT;
						to: PART_RECURRING_ALARM_SPACER;
					}
				}
			}

			part {
				name: PART_RECURRING_ALARM_STATE_TEXT;
				type: TEXT;
				scale: 1;
				description {
					state: "default" 0.0;
					visible: 0;
					color: 255 0 0 255;
					text {
						align: 0.0 0.5;
						text:"FIRED";
						size: 17;
					}
					rel1 {
						relative: ALARM_CAPTION_WIDTH 0.0;
						to: PART_RECURRING_ALARM_SPACER;
					}
					rel2 {
						relative: 1.0 ALARM_CAPTION_HEIGHT;
						to: PART_RECURRING_ALARM_SPACER;
					}
				}
				description {
					state: ALARM_FIRED_STATE 0.0;
					inherit: "default" 0.0;
					visible: 1;
				}
			}

			part {
				name: PART_ALARM_IMAGE_SPACER;
				type: SPACER;
				description {
					state: "default" 0.0;
					rel1 {
						relative: 0.0 ALARM_CONTAINER_HEIGHT;
						to: PART_BACKGROUND;
					}
					rel2 {
						relative: 1.0 1.0-ALARM_CONTAINER_HEIGHT;
						to: PART_BACKGROUND;
					}
				}
			}

			part {
				name: PART_ALARM_INFO_LABEL;
				type: TEXT;
				scale: 1;
				description {
					state: "default" 0.0;
					visible: 1;
					color: 255 255 255 255;
					text {
						align: 0.5 0.5;
						text:"";
						size: 17;
					}
					rel1 {
						relative: 0.0 0.0;
						to: PART_ALARM_IMAGE_SPACER;
					}
					rel2 {
						relative: 1.0 1.0;
						to: PART_ALARM_IMAGE_SPACER;
					}
				}
			}

			part {
				name: PART_ALARM_IMAGE;
				type: IMAGE;
				description {
					state: "default" 0.0;
					visible: 0;
					rel1 {
						relative: ALARM_IMAGE_PADDING ALARM_IMAGE_PADDING;
						to: PART_ALARM_IMAGE_SPACER;
					}
					rel2 {
						relative: 1.0-ALARM_IMAGE_PADDING 1.0-ALARM_IMAGE_PADDING;
						to: PART_ALARM_IMAGE_SPACER;
					}
					image {
						normal: ALARM_IMAGE;
					}
				}
				description
				{
					state: ALARM_FIRED_STATE 0.0;
					inherit: "default" 0.0;
					visible: 1;
				}
			}

			part {
				name: PART_ONTIME_ALARM_SPACER;
				type: SPACER;
				description {
					state: "default" 0.0;
					rel1 {
						relative: 0.0 1.0-ALARM_CONTAINER_HEIGHT;
						to: PART_BACKGROUND;
					}
					rel2 {
						relative: 1.0 1.0;
						to: PART_BACKGROUND;
					}
				}
			}

			part {
				name: "ontime_alarm_caption_text";
				type: TEXT;
				scale: 1;
				description {
					state: "default" 0.0;
					visible: 1;
					color: 255 255 255 255;
					text {
						align: 0.2 0.5;
						text:"On-time alarm";
						size: 17;
					}
					rel1 {
						relative: 0.0 0.0;
						to: PART_ONTIME_ALARM_SPACER;
					}
					rel2 {
						relative: ALARM_CAPTION_WIDTH ALARM_CAPTION_HEIGHT;
						to: PART_ONTIME_ALARM_SPACER;
					}
				}
			}

			part {
				name: PART_ONTIME_ALARM_STATE_TEXT;
				type: TEXT;
				scale: 1;
				description {
					state: "default" 0.0;
					visible: 0;
					color: 255 0 0 255;
					text {
						align: 0.5 0.5;
						text:"FIRED";
						size: 17;
					}
					rel1 {
						relative: ALARM_CAPTION_WIDTH 0.0;
						to: PART_ONTIME_ALARM_SPACER;
					}
					rel2 {
						relative: 1.0 ALARM_CAPTION_HEIGHT;
						to: PART_ONTIME_ALARM_SPACER;
					}
				}
				description {
					state: ALARM_FIRED_STATE 0.0;
					inherit: "default" 0.0;
					visible: 1;
				}
			}
		}

		programs {
			program {
				name: "recurring_alarm_state_text_show";
				signal: SIGNAL_ALARM_ON;
				source: PART_RECURRING_ALARM_STATE_TEXT;
				action: STATE_SET ALARM_FIRED_STATE 0.0;
				target: PART_RECURRING_ALARM_STATE_TEXT;
			}

			program {
				name: "recurring_alarm_state_text_hide";
				signal: SIGNAL_ALARM_OFF;
				source: PART_RECURRING_ALARM_STATE_TEXT;
				action: STATE_SET "default" 0.0;
				target: PART_RECURRING_ALARM_STATE_TEXT;
			}

			program {
				name: "ontime_alarm_state_text_show";
				signal: SIGNAL_ALARM_ON;
				source: PART_ONTIME_ALARM_STATE_TEXT;
				action: STATE_SET ALARM_FIRED_STATE 0.0;
				target: PART_ONTIME_ALARM_STATE_TEXT;
			}

			program {
				name: "alarm_image_show";
				signal: SIGNAL_ALARM_ON;
				source: PART_ALARM_IMAGE;
				action: STATE_SET ALARM_FIRED_STATE 0.0;
				target: PART_ALARM_IMAGE;
			}

			program {
				name: "alarm_image_hide";
				signal: SIGNAL_ALARM_OFF;
				source: PART_ALARM_IMAGE;
				action: STATE_SET "default" 0.0;
				target: PART_ALARM_IMAGE;
			}
		}
	}
}