Home | History | Annotate | Download | only in cancel
      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/search/cancel_button";
     24     alias: "webkit/widget/search/results_button"; // TODO
     25 
     26     images {
     27         image: "widget/search/cancel/cancel_normal_button2.png" COMP;
     28     }
     29 
     30     script {
     31         public isEnabled;
     32         public isPressed;
     33         public isChecked;
     34         public isFocused;
     35         public isHovered;
     36 
     37         public show() {
     38            if (get_int(isEnabled) == 1) {
     39               set_state(PART:"cancel_button", "default", 0.0);
     40               if (get_int(isFocused) == 1)
     41                  set_state(PART:"cancel_button", "focused", 0.0);
     42               if (get_int(isPressed) == 1)
     43                  set_state(PART:"cancel_button", "pressed", 0.0);
     44               if (get_int(isHovered) == 1)
     45                  set_state(PART:"cancel_button", "hovered", 0.0);
     46            }
     47            else
     48               set_state(PART:"cancel_button", "disabled", 0.0);
     49         }
     50     }
     51 
     52     parts {
     53         part {
     54             name: "cancel_button";
     55             type: IMAGE;
     56             description {
     57                 state: "default" 0.0;
     58                 min: 21 20;
     59                 rel1.offset: 0 -6;
     60                 rel2.offset: -1 0;
     61                 image {
     62                     normal: "widget/search/cancel/cancel_normal_button2.png";
     63                 }
     64             }
     65             description {
     66                 state: "disabled" 0.0;
     67                 inherit: "default" 0.0;
     68                 color: 255 255 255 150;
     69             }
     70             description {
     71                 state: "hovered" 0.0;
     72                 inherit: "default" 0.0;
     73             }
     74             description {
     75                 state: "focused" 0.0;
     76                 inherit: "default" 0.0;
     77             }
     78             description {
     79                 state: "pressed" 0.0;
     80                 inherit: "default" 0.0;
     81             }
     82         }
     83     }
     84 
     85     programs {
     86         program {
     87             name: "enabled";
     88             signal: "enabled";
     89             script {
     90                 set_int(isEnabled, 1);
     91                 show();
     92             }
     93         }
     94         program {
     95             name: "pressed";
     96             signal: "pressed";
     97             script {
     98                 set_int(isPressed, 1);
     99                 show();
    100             }
    101         }
    102         program {
    103             name: "focused";
    104             signal: "focused";
    105             script {
    106                 set_int(isFocused, 1);
    107                 show();
    108             }
    109         }
    110         program {
    111             name: "hovered";
    112             signal: "hovered";
    113             script {
    114                 set_int(isHovered, 1);
    115                 show();
    116             }
    117         }
    118         program {
    119             name: "reset";
    120             signal: "reset";
    121             script {
    122                 set_int(isEnabled, 0);
    123                 set_int(isPressed, 0);
    124                 set_int(isChecked, 0);
    125                 set_int(isFocused, 0);
    126                 set_int(isHovered, 0);
    127                 show();
    128             }
    129         }
    130     }
    131 }
    132