Home | History | Annotate | Download | only in radio
      1 /*
      2     Copyright (C) 2008,2009 INdT - Instituto Nokia de Tecnologia
      3     Copyright (C) 2009,2010 ProFUSION embedded systems
      4     Copyright (C) 2009,2010 Samsung Electronics
      5 
      6     This file is free software; you can redistribute it and/or
      7     modify it under the terms of the GNU Library General Public
      8     License as published by the Free Software Foundation; either
      9     version 2 of the License, or (at your option) any later version.
     10 
     11     This file is distributed in the hope that it will be useful,
     12     but WITHOUT ANY WARRANTY; without even the implied warranty of
     13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     14     Library General Public License for more details.
     15 
     16     You should have received a copy of the GNU Library General Public License
     17     along with this library; see the file COPYING.LIB.  If not, write to
     18     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     19     Boston, MA 02110-1301, USA.
     20 */
     21 
     22    group {
     23       name: "webkit/widget/radio";
     24       min: 12 12;
     25 
     26       images {
     27          image: "widget/radio/img_radio_on.png" COMP;
     28          image: "widget/radio/img_radio_off.png" COMP;
     29          image: "widget/radio/img_radio_on_focus.png" COMP;
     30          image: "widget/radio/img_radio_off_focus.png" COMP;
     31          image: "widget/radio/img_radio_on_hover.png" COMP;
     32          image: "widget/radio/img_radio_off_hover.png" COMP;
     33       }
     34 
     35       script {
     36           public isEnabled;
     37           public isPressed;
     38           public isChecked;
     39           public isFocused;
     40           public isHovered;
     41 
     42           public show() {
     43               if (get_int(isEnabled) == 1) {
     44                   set_state(PART:"radio_button", "default", 0.0);
     45                   if (get_int(isChecked) == 1) {
     46                       set_state(PART:"radio_button", "enabled_checked", 0.0);
     47                       if (get_int(isFocused) == 1)
     48                           set_state(PART:"radio_button", "focus_checked", 0.0);
     49                       if (get_int(isHovered) == 1 && get_int(isFocused) == 0)
     50                           set_state(PART:"radio_button", "hovered_checked", 0.0);
     51                   }
     52                   else {
     53                       if (get_int(isFocused) == 1)
     54                           set_state(PART:"radio_button", "focused", 0.0);
     55                       if (get_int(isHovered) == 1 && get_int(isFocused) == 0)
     56                           set_state(PART:"radio_button", "hovered", 0.0);
     57                   }
     58               }
     59               else {
     60                   set_state(PART:"radio_button", "disabled", 0.0);
     61                   if (get_int(isChecked) == 1)
     62                       set_state(PART:"radio_button", "disabled_checked", 0.0);
     63               }
     64           }
     65       }
     66 
     67       parts {
     68          part {
     69             name: "radio_button";
     70             type: IMAGE;
     71             description {
     72                state: "default" 0.0;
     73                min: 12 12;
     74                max: 12 12;
     75                image {
     76                   normal: "widget/radio/img_radio_off.png";
     77                }
     78             }
     79             description {
     80                state: "enabled_checked" 0.0;
     81                inherit: "default" 0.0;
     82                image {
     83                   normal: "widget/radio/img_radio_on.png";
     84                }
     85             }
     86             description {
     87                state: "disabled_checked" 0.0;
     88                inherit: "enabled_checked" 0.0;
     89                color: 255 255 255 150;
     90             }
     91             description {
     92                state: "disabled" 0.0;
     93                inherit: "default" 0.0;
     94                color: 255 255 255 150;
     95             }
     96             description {
     97                state: "hovered_checked" 0.0;
     98                inherit: "default" 0.0;
     99                image {
    100                   normal: "widget/radio/img_radio_on_hover.png";
    101                }
    102             }
    103             description {
    104                state: "hovered" 0.0;
    105                inherit: "default" 0.0;
    106                image {
    107                   normal: "widget/radio/img_radio_off_hover.png";
    108                }
    109             }
    110             description {
    111                state: "focus_checked" 0.0;
    112                inherit: "default" 0.0;
    113                image {
    114                   normal: "widget/radio/img_radio_on_focus.png";
    115                }
    116             }
    117             description {
    118                state: "focused" 0.0;
    119                inherit: "default" 0.0;
    120                image {
    121                   normal: "widget/radio/img_radio_off_focus.png";
    122                }
    123             }
    124          }
    125       }
    126 
    127       programs {
    128          program {
    129             name: "enabled";
    130             signal: "enabled";
    131             script {
    132                set_int(isEnabled, 1);
    133                show();
    134             }
    135          }
    136          program {
    137             name: "pressed";
    138             signal: "pressed";
    139             script {
    140                set_int(isPressed, 1);
    141                show();
    142             }
    143          }
    144         program {
    145             name: "checked";
    146             signal: "checked";
    147             script {
    148                set_int(isChecked, 1);
    149                show();
    150             }
    151          }
    152          program {
    153             name: "focused";
    154             signal: "focused";
    155             script {
    156                set_int(isFocused, 1);
    157                show();
    158             }
    159          }
    160           program {
    161             name: "hovered";
    162             signal: "hovered";
    163             script {
    164                set_int(isHovered, 1);
    165                show();
    166             }
    167          }
    168         program {
    169             name: "reset";
    170             signal: "reset";
    171             script {
    172                set_int(isEnabled, 0);
    173                set_int(isPressed, 0);
    174                set_int(isChecked, 0);
    175                set_int(isFocused, 0);
    176                set_int(isHovered, 0);
    177                show();
    178             }
    179          }
    180       }
    181    }
    182