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