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