Home | History | Annotate | Download | only in button
      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/button";
     24 
     25       images {
     26          image: "widget/button/img_button_normal.png" COMP;
     27          image: "widget/button/img_button_press.png" COMP;
     28          image: "widget/button/img_button_hover.png" COMP;
     29          image: "widget/button/img_button_focus.png" COMP;
     30       }
     31 
     32       script {
     33           public isEnabled;
     34           public isPressed;
     35           public isChecked;
     36           public isFocused;
     37           public isHovered;
     38 
     39           public show() {
     40 
     41               if (get_int(isEnabled) == 1) {
     42                   set_state(PART:"button", "default", 0.0);
     43                   if (get_int(isFocused) == 1) {
     44                       set_state(PART:"button", "focused", 0.0);
     45                       if (get_int(isPressed) == 1)
     46                           set_state(PART:"button", "pressed", 0.0);
     47                       }
     48                   else if (get_int(isHovered) == 1) {
     49                       set_state(PART:"button", "hovered", 0.0);
     50                       if (get_int(isPressed) == 1)
     51                           set_state(PART:"button", "pressed", 0.0);
     52 
     53                   }
     54               }
     55               else
     56                   set_state(PART:"button", "disabled", 0.0);
     57           }
     58       }
     59 
     60       parts {
     61 
     62          part {
     63             name: "button";
     64             type: IMAGE;
     65             description {
     66                state: "default" 0.0;
     67                min: 25 25;
     68                image {
     69                   normal: "widget/button/img_button_normal.png";
     70                   border: 6 10 8 10;
     71                }
     72             }
     73             description {
     74                state: "pressed" 0.0;
     75                inherit: "default" 0.0;
     76                image {
     77                   normal: "widget/button/img_button_press.png";
     78                   border: 6 10 8 10;
     79                }
     80             }
     81             description {
     82                state: "disabled" 0.0;
     83                inherit: "default" 0.0;
     84                color: 255 255 255 150;
     85             }
     86             description {
     87                state: "hovered" 0.0;
     88                inherit: "default" 0.0;
     89                image {
     90                   normal: "widget/button/img_button_hover.png";
     91                   border: 6 10 8 10;
     92                }
     93             }
     94             description {
     95                state: "focused" 0.0;
     96                inherit: "default" 0.0;
     97                image {
     98                   normal: "widget/button/img_button_focus.png";
     99                   border: 6 10 8 10;
    100                }
    101             }
    102          }
    103 
    104          part {
    105             name: "text_confinement";
    106             type: RECT;
    107             description {
    108                state: "default" 0.0;
    109                color: 0 0 0 0;
    110                rel1 {
    111                   relative: 0.0 0.0;
    112                   offset: 15 8;
    113                }
    114                rel2 {
    115                   relative: 1.0 1.0;
    116                   offset: -16 -11;
    117                }
    118             }
    119          }
    120       }
    121 
    122       programs {
    123          program {
    124             name: "enabled";
    125             signal: "enabled";
    126             script {
    127                set_int(isEnabled, 1);
    128                show();
    129             }
    130          }
    131          program {
    132             name: "pressed";
    133             signal: "pressed";
    134             script {
    135                set_int(isPressed, 1);
    136                show();
    137             }
    138          }
    139         program {
    140             name: "checked";
    141             signal: "checked";
    142             script {
    143                set_int(isChecked, 1);
    144                show();
    145             }
    146          }
    147          program {
    148             name: "focused";
    149             signal: "focused";
    150             script {
    151                set_int(isFocused, 1);
    152                show();
    153             }
    154          }
    155           program {
    156             name: "hovered";
    157             signal: "hovered";
    158             script {
    159                set_int(isHovered, 1);
    160                show();
    161             }
    162          }
    163         program {
    164             name: "reset";
    165             signal: "reset";
    166             script {
    167                set_int(isEnabled, 0);
    168                set_int(isPressed, 0);
    169                set_int(isChecked, 0);
    170                set_int(isFocused, 0);
    171                set_int(isHovered, 0);
    172                show();
    173             }
    174          }
    175       }
    176    }
    177