Home | History | Annotate | Download | only in field
      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/field";
     24 
     25       images {
     26          image: "widget/search/field/field_normal.png" COMP;
     27          image: "widget/search/field/field_focused.png" COMP;
     28          image: "widget/search/field/field_hovered.png" COMP;
     29       }
     30 
     31       script {
     32           public isEnabled;
     33           public isPressed;
     34           public isChecked;
     35           public isFocused;
     36           public isHovered;
     37 
     38           public show() {
     39                if (get_int(isEnabled) == 1) {
     40                   set_state(PART:"search_field", "default", 0.0);
     41                   if (get_int(isFocused) == 1)
     42                      set_state(PART:"search_field", "focused", 0.0);
     43                   if (get_int(isPressed) == 1)
     44                      set_state(PART:"search_field", "pressed", 0.0);
     45                   if (get_int(isFocused) == 0 && get_int(isHovered) == 1)
     46                       set_state(PART:"search_field", "hovered", 0.0);
     47                }
     48                else
     49                   set_state(PART:"search_field", "disabled", 0.0);
     50           }
     51       }
     52 
     53       parts {
     54          part {
     55             name: "search_field";
     56             type: IMAGE;
     57             description {
     58                state: "default" 0.0;
     59                min: 89 20;
     60                image {
     61                   normal: "widget/search/field/field_normal.png";
     62                   border: 8 8 8 8;
     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: "focused" 0.0;
     72                inherit: "default" 0.0;
     73                image {
     74                   normal: "widget/search/field/field_focused.png";
     75                   border: 8 8 8 8;
     76                }
     77             }
     78             description {
     79                state: "hovered" 0.0;
     80                inherit: "focused" 0.0;
     81                image {
     82                   normal: "widget/search/field/field_hovered.png";
     83                   border: 8 8 8 8;
     84                }
     85             }
     86             description {
     87                state: "pressed" 0.0;
     88                inherit: "focused" 0.0;
     89             }
     90          }
     91 
     92          part {
     93             name: "text_confinement";
     94             type: RECT;
     95             description {
     96                state: "default" 0.0;
     97                color: 0 0 0 0;
     98                rel1.offset: 4 6;   // <- 6 because of the blink cursor
     99                rel2.offset: -4 -5; // <- due to the image
    100             }
    101          }
    102 
    103       }
    104 
    105       programs {
    106          program {
    107             name: "enabled";
    108             signal: "enabled";
    109             script {
    110                set_int(isEnabled, 1);
    111                show();
    112             }
    113          }
    114          program {
    115             name: "pressed";
    116             signal: "pressed";
    117             script {
    118                set_int(isPressed, 1);
    119                show();
    120             }
    121          }
    122          program {
    123             name: "focused";
    124             signal: "focused";
    125             script {
    126                set_int(isFocused, 1);
    127                show();
    128             }
    129          }
    130           program {
    131             name: "hovered";
    132             signal: "hovered";
    133             script {
    134                set_int(isHovered, 1);
    135                show();
    136             }
    137          }
    138         program {
    139             name: "reset";
    140             signal: "reset";
    141             script {
    142                set_int(isEnabled, 0);
    143                set_int(isPressed, 0);
    144                set_int(isChecked, 0);
    145                set_int(isFocused, 0);
    146                set_int(isHovered, 0);
    147                show();
    148             }
    149          }
    150       }
    151    }
    152