/* * Copyright 2012 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 "../include/edc_string.h" // background #define BACKGROUND_IMAGE(part_name, x, y, w, h, img) \ part { \ name: part_name; \ type: IMAGE; \ description { \ state: "default" 0.0;\ rel1 { relative: (x)/MAIN_W (y)/MAIN_H; } \ rel2 { relative: (x+w)/MAIN_W (y+h)/MAIN_H; } \ image { normal: img; } \ } \ } #define BACKGROUND_IMAGE_WITH_ALPHA(part_name, x, y, w, h, img, alpha) \ part { \ name: part_name; \ type: IMAGE; \ description { \ state: "default" 0.0;\ rel1 { relative: (x)/MAIN_W (y)/MAIN_H; } \ rel2 { relative: (x+w)/MAIN_W (y+h)/MAIN_H; } \ image { normal: img; }\ color: 255 255 255 alpha; \ } \ } #define VER_BACKGROUND_IMAGE(part_name, x, y, w, h, img) \ part { \ name: part_name; \ type: IMAGE; \ description { \ state: "default" 0.0;\ rel1 { relative: (x)/VER_MAIN_W (y)/VER_MAIN_H; } \ rel2 { relative: (x+w)/VER_MAIN_W (y+h)/VER_MAIN_H; } \ image { normal: img; } \ } \ } #define GENERAL_BUTTON(part_name, x, y, w, h, img_dim, img, img_p, img_s) \ part { \ name: part_name; \ type: IMAGE; \ mouse_events: 1;\ description { \ state: "default" 0.0;\ rel1 { relative: (x)/MAIN_W (y)/MAIN_H; } \ rel2 { relative: (x+w)/MAIN_W (y+h)/MAIN_H; } \ image { normal: img; } \ } \ description { \ state: "press" 0.0; \ inherit: "default" 0.0; \ image { normal: img_p; }\ } \ description { \ state: "selected" 0.0; \ inherit: "default" 0.0; \ image { normal: img_s; }\ } \ description { \ state: "dim" 0.0; \ inherit: "default" 0.0; \ image { normal: img_dim;} \ } \ description { \ state: "invisible" 0.0; \ inherit: "default" 0.0; \ visible: 0; \ } \ } #define VER_GENERAL_BUTTON(part_name, x, y, w, h, img_dim, img, img_p, img_s) \ part { \ name: part_name; \ type: IMAGE; \ mouse_events: 1;\ description { \ state: "default" 0.0;\ rel1 { relative: (x)/VER_MAIN_W (y)/VER_MAIN_H; } \ rel2 { relative: (x+w)/VER_MAIN_W (y+h)/VER_MAIN_H; } \ image { normal: img; } \ } \ description { \ state: "press" 0.0; \ inherit: "default" 0.0; \ image { normal: img_p; }\ } \ description { \ state: "selected" 0.0; \ inherit: "default" 0.0; \ image { normal: img_s; }\ } \ description { \ state: "dim" 0.0; \ inherit: "default" 0.0; \ image { normal: img_dim;} \ } \ description { \ state: "invisible" 0.0; \ inherit: "default" 0.0; \ visible: 0; \ } \ } #define GENERAL_BUTTON_PROGRAMS(part_name, signal_name, source_name) \ program { \ name: "lbutton_down_"part_name; \ signal: "mouse,down,1"; \ source: part_name; \ script {\ new st[31];\ new Float:vl;\ get_state(PART:part_name, st, 30, vl);\ if (strcmp(st, "dim") != 0) \ { \ set_state(PART:part_name, "press", 0.0);\ emit( HAPTIC_SIG, HAPTIC_SIG_SRC );\ } \ }\ } \ program { \ name: "lbutton_send_event_"part_name; \ signal: "mouse,clicked,1"; \ source: part_name; \ script {\ new st[31];\ new Float:vl;\ get_state(PART:part_name, st, 30, vl);\ if (strcmp(st, "dim") != 0) \ emit( signal_name, source_name );\ }\ } \ program { \ name: "lbutton_up_"part_name; \ signal: "mouse,up,1"; \ source: part_name; \ script {\ new st[31];\ new Float:vl;\ get_state(PART:part_name, st, 30, vl);\ if (strcmp(st, "dim") != 0) \ set_state(PART:part_name, "default", 0.0);\ }\ }