
parts {
    SWALLOWCLIP()
    
	part {
		name: "label_description";
		type: TEXT;
		effect: SOFT_OUTLINE;
		mouse_events: 0;
		clip_to: "swallow_clip";
		description {
			state: "default" 0.0;
			rel1 {
			    relative: 0.0 0.0;
				offset: 0 0;
			}
			rel2 {
			    relative: 1.0 0.2;
				offset: -1 -1;
			}
			text {
				font: "Sans";
				size: 1;
				fit: 1 1;
    			align: 0.0 0.5;
			}
		}
	}
	part {
		name: "label_background";
		type: RECT;
		mouse_events: 0;
		clip_to: "swallow_clip";
		description {
			state: "default" 0.0;
			rel1 {
			    relative: 0.0 0.2;
				offset: 0 0;
				to: "background";
			}
			rel2 {
			    relative: 1.0 0.4;
				offset: -1 -1;
				to: "background";
			}
			color: 255 255 255 64;
		}
	}
	part {
		name: "label";
		type: TEXT;
		effect: SOFT_OUTLINE;
		mouse_events: 0;
		clip_to: "swallow_clip";
		description {
			state: "default" 0.0;
			rel1 {
			    relative: 0.0 0.0;
				offset: 0 0;
				to: "label_background";
			}
			rel2 {
			    relative: 1.0 1.0;
				offset: -1 -1;
				to: "label_background";
			}
			text {
				font: "Sans";
				size: 1;
				fit: 1 1;
    			align: 0.0 0.5;
			}
		}
	}
	part {
		name: "dialer_box";
		type: RECT;
		mouse_events: 0;
		clip_to: "swallow_clip";
		description {
			state: "default" 0.0;
			rel1 {
				relative: 0.0 0.42;
				offset: 0 0;
				to: "background";
			}
			rel2 {
				relative: 1.0 1.0;
				offset: -1 -1;
				to: "background";
			}
			color: 255 255 255 255;
		}
	}
	
	#define DIALER_ICON(part_name, xpos, ypos, label, label2)   		\
	part {																\
		name: "button_"part_name;										\
		type: IMAGE;													\
		mouse_events: 1;												\
		clip_to: "swallow_clip";                                		\
		description {													\
			state: "default" 0.0;										\
			rel1 {														\
				relative: 0.25*xpos 0.25*ypos;							\
				offset: 1 1;											\
				to: "dialer_box";					            		\
			}															\
			rel2 {														\
				relative: 0.25+(0.25*xpos) 0.25+(0.25*ypos);			\
				offset: -2 -2;											\
				to: "dialer_box";					            		\
			}															\
			image { normal: "button_background.png"; }	        		\
		}																\
		description {													\
			state: "active" 0.0;										\
			inherit: "default" 0.0;										\
			image { normal: "button_background_active.png"; }   		\
		}																\
	}																	\
	part {																\
		name: "label_"part_name;										\
		type: TEXT;														\
		effect: SOFT_OUTLINE;											\
		mouse_events: 0;												\
		clip_to: "swallow_clip";                                		\
		description {													\
			state: "default" 0.0;										\
			align: 0.5 0.5;												\
			rel1 {														\
				relative: 0.0 0.0;										\
				offset: 0 0;											\
				to: "button_"part_name;									\
			}															\
			rel2 {														\
				relative: 1.0 0.8;										\
				offset: -1 -1;											\
				to: "button_"part_name;									\
			}															\
			text {														\
				font: "Sans";											\
				text: label;											\
				size: 1;												\
				fit: 1 1;												\
			}															\
		}																\
	}																	\
	part {																\
		name: "label2_"part_name;										\
		type: TEXT;														\
		effect: SOFT_OUTLINE;											\
		mouse_events: 0;												\
		clip_to: "swallow_clip";                                		\
		description {													\
			state: "default" 0.0;										\
			align: 0.5 0.5;												\
			rel1 {														\
				relative: 0.0 0.7;										\
				offset: 0 0;											\
				to: "button_"part_name;									\
			}															\
			rel2 {														\
				relative: 1.0 1.0;										\
				offset: -1 -1;											\
				to: "button_"part_name;									\
			}															\
			text {														\
				font: "Sans";											\
				text: label2;											\
				size: 1;												\
				fit: 1 1;												\
			}															\
		}																\
	}
	DIALER_ICON("1", 0, 0, "1", "");
	DIALER_ICON("2", 1, 0, "2", "abc");
	DIALER_ICON("3", 2, 0, "3", "def");
	DIALER_ICON("4", 0, 1, "4", "ghi");
	DIALER_ICON("5", 1, 1, "5", "jkl");
	DIALER_ICON("6", 2, 1, "6", "mno");
	DIALER_ICON("7", 0, 2, "7", "pqrs");
	DIALER_ICON("8", 1, 2, "8", "tuv");
	DIALER_ICON("9", 2, 2, "9", "wxyz");
	DIALER_ICON("star", 0, 3, "*", "");
	DIALER_ICON("0", 1, 3, "0", "");
	DIALER_ICON("#", 2, 3, "#", "");
	
	
	part {
		name: "button_delete";
		type: IMAGE;
		mouse_events: 1;
		clip_to: "swallow_clip";
		description {
			state: "default" 0.0;
			rel1 {
				relative: 0.75 0.0;
				offset: 1 1;
				to: "dialer_box";
			}
			rel2 {
				relative: 1.0 0.25;
				offset: -2 -2;
				to: "dialer_box";
			}
			image { normal: "button_background.png"; }
		}
		description {
			state: "active" 0.0;
			inherit: "default" 0.0;
			image { normal: "button_background_active.png"; }
		}
	}
	part {
		name: "icon_delete";
		mouse_events: 0;
		type: IMAGE;
		clip_to: "swallow_clip";
		description {
			state: "default" 0.0;
	 		aspect: 1.0 1.0;
	 		aspect_preference: BOTH;
			rel1 {
				relative: 0.0 0.0;
				offset: 0 0;
				to: "button_delete";
			}
			rel2 {
				relative: 1.0 1.0;
				offset: -1 -1;
				to: "button_delete";
			}
			image { normal: "icon_left.png"; }
		}
	}
	part {
		name: "button_dial";
		type: IMAGE;
		mouse_events: 1;
		clip_to: "swallow_clip";
		description {
			state: "default" 0.0;
			rel1 {
				relative: 0.75 0.25;
				offset: 1 1;
				to: "dialer_box";
			}
			rel2 {
				relative: 1.0 0.75;
				offset: -2 -2;
				to: "dialer_box";
			}
			image { normal: "button_background.png"; }
		}
		description {
			state: "active" 0.0;
			inherit: "default" 0.0;
			image { normal: "button_background_active.png"; }
		}
	}
	part {
		name: "icon_dial";
		mouse_events: 0;
		type: IMAGE;
		clip_to: "swallow_clip";
		description {
			state: "default" 0.0;
	 		aspect: 1.0 1.0;
	 		aspect_preference: BOTH;
			rel1 {
				relative: 0.0 0.0;
				offset: 0 0;
				to: "button_dial";
			}
			rel2 {
				relative: 1.0 1.0;
				offset: -1 -1;
				to: "button_dial";
			}
			image { normal: "icon_accept.png"; }
		}
	}
	part {
		name: "button_left";
		type: IMAGE;
		mouse_events: 1;
		clip_to: "swallow_clip";
		description {
			state: "default" 0.0;
			rel1 {
				relative: 0.75 0.75;
				offset: 1 1;
				to: "dialer_box";
			}
			rel2 {
				relative: 0.875 1.0;
				offset: -2 -2;
				to: "dialer_box";
			}
			image { normal: "button_background.png"; }
		}
		description {
			state: "active" 0.0;
			inherit: "default" 0.0;
			image { normal: "button_background_active.png"; }
		}
    }
	part {
		name: "icon_left";
		mouse_events: 0;
		type: IMAGE;
		clip_to: "swallow_clip";
		description {
			state: "default" 0.0;
	 		aspect: 1.0 1.0;
	 		aspect_preference: BOTH;
			rel1 {
				relative: 0.0 0.0;
				offset: 0 0;
				to: "button_left";
			}
			rel2 {
				relative: 1.0 1.0;
				offset: -1 -1;
				to: "button_left";
			}
			image { normal: "icon_left.png"; }
		}
	}
	part {
		name: "button_right";
		type: IMAGE;
		mouse_events: 1;
		clip_to: "swallow_clip";
		description {
			state: "default" 0.0;
			rel1 {
				relative: 0.875 0.75;
				offset: 1 1;
				to: "dialer_box";
			}
			rel2 {
				relative: 1.0 1.0;
				offset: -2 -2;
				to: "dialer_box";
			}
			image { normal: "button_background.png"; }
		}
		description {
			state: "active" 0.0;
			inherit: "default" 0.0;
			image { normal: "button_background_active.png"; }
		}
	}
	part {
		name: "icon_right";
		mouse_events: 0;
		type: IMAGE;
		clip_to: "swallow_clip";
		description {
			state: "default" 0.0;
	 		aspect: 1.0 1.0;
	 		aspect_preference: BOTH;
			rel1 {
				relative: 0.0 0.0;
				offset: 0 0;
				to: "button_right";
			}
			rel2 {
				relative: 1.0 1.0;
				offset: -1 -1;
				to: "button_right";
			}
			image { normal: "icon_right.png"; }
		}
	}
	
	BUTTONS_BOTTOM();
	BUTTON_OPTIONS();
	BUTTON_MENU();
	BUTTON_CLOSE();
}
programs {
    EMIT_TRANSITION("button_bottom_right", "main");
    
	ACTIVATE("button_bottom_right");
    
	ACTIVATE("button_1");
	ACTIVATE("button_2");
	ACTIVATE("button_3");
	ACTIVATE("button_4");
	ACTIVATE("button_5");
	ACTIVATE("button_6");
	ACTIVATE("button_7");
	ACTIVATE("button_8");
	ACTIVATE("button_9");
	ACTIVATE("button_0");
	ACTIVATE("button_#");
	ACTIVATE("button_star");
	ACTIVATE("button_delete");
	ACTIVATE("button_dial");
	
	#define EMIT_DIALER_BUTTON_PRESSED(part_name)         				\
	program {								        					\
		name: "emit_dialer_button_pressed_"part_name;					\
		signal: "mouse,clicked,1";			        					\
		source: part_name;					                			\
		action: SIGNAL_EMIT "dialer_button_pressed" part_name;	        \
	}
	
	EMIT_DIALER_BUTTON_PRESSED("button_1");
	EMIT_DIALER_BUTTON_PRESSED("button_2");
	EMIT_DIALER_BUTTON_PRESSED("button_3");
	EMIT_DIALER_BUTTON_PRESSED("button_4");
	EMIT_DIALER_BUTTON_PRESSED("button_5");
	EMIT_DIALER_BUTTON_PRESSED("button_6");
	EMIT_DIALER_BUTTON_PRESSED("button_7");
	EMIT_DIALER_BUTTON_PRESSED("button_8");
	EMIT_DIALER_BUTTON_PRESSED("button_9");
	EMIT_DIALER_BUTTON_PRESSED("button_0");
	EMIT_DIALER_BUTTON_PRESSED("button_#");
	EMIT_DIALER_BUTTON_PRESSED("button_star");
	EMIT_DIALER_BUTTON_PRESSED("button_delete");
	EMIT_DIALER_BUTTON_PRESSED("button_dial");
	
    TRANSITION();
}
