Home | History | Annotate | Download | only in combo
      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/combo";
     24 
     25     images {
     26         image: "widget/combo/combo_normal.png" COMP;
     27         image: "widget/combo/combo_normal_button.png" COMP;
     28         image: "widget/combo/combo_hover.png" COMP;
     29         image: "widget/combo/combo_hover_button.png" COMP;
     30         image: "widget/combo/combo_focus.png" COMP;
     31         image: "widget/combo/combo_focus_button.png" COMP;
     32         image: "widget/combo/combo_press.png" COMP;
     33         image: "widget/combo/combo_press_button.png" COMP;
     34         image: "widget/combo/icon.png" COMP;
     35     }
     36 
     37     script {
     38         public isEnabled;
     39         public isPressed;
     40         public isChecked;
     41         public isFocused;
     42         public isHovered;
     43 
     44         public show() {
     45             if (get_int(isEnabled) == 1) {
     46                 set_state(PART:"combo", "default", 0.0);
     47                 set_state(PART:"combo_button", "default", 0.0);
     48                 set_state(PART:"combo_button_icon", "default", 0.0);
     49                 if (get_int(isFocused) == 1) {
     50                     set_state(PART:"combo", "focused", 0.0);
     51                     set_state(PART:"combo_button", "focused", 0.0);
     52                     if (get_int(isPressed) == 1) {
     53                         set_state(PART:"combo", "pressed", 0.0);
     54                         set_state(PART:"combo_button", "pressed", 0.0);
     55                     }
     56                 }
     57                 else if (get_int(isHovered) == 1) {
     58                     set_state(PART:"combo", "hovered", 0.0);
     59                     set_state(PART:"combo_button", "hovered", 0.0);
     60                     if (get_int(isPressed) == 1) {
     61                         set_state(PART:"combo", "pressed", 0.0);
     62                         set_state(PART:"combo_button", "pressed", 0.0);
     63                     }
     64                 }
     65             }
     66             else {
     67                 set_state(PART:"combo", "disabled", 0.0);
     68                 set_state(PART:"combo_button", "disabled", 0.0);
     69                 set_state(PART:"combo_button_icon", "disabled", 0.0);
     70             }
     71         }
     72     }
     73 
     74     parts {
     75         part {
     76             name: "clipper";
     77             type: RECT;
     78             description {
     79                 min: 35 27;
     80                 state: "default" 0.0;
     81             }
     82         }
     83 
     84         part {
     85             name: "combo_clipper";
     86             type: RECT;
     87             clip_to: "clipper";
     88             description {
     89                 state: "default" 0.0;
     90                 rel1.to: "clipper";
     91                 rel2 {
     92                     to: "clipper";
     93                     offset: -32 -1;
     94                 }
     95             }
     96         }
     97 
     98         part {
     99             name: "combo";
    100             type: IMAGE;
    101             clip_to: "combo_clipper";
    102             description {
    103                 state: "default" 0.0;
    104                 min: 36 20;
    105                 image {
    106                     normal: "widget/combo/combo_normal.png";
    107                     border: 15 0 8 11;
    108                 }
    109             }
    110             description {
    111                state: "disabled" 0.0;
    112                inherit: "default" 0.0;
    113                color: 255 255 255 150;
    114             }
    115             description {
    116                state: "hovered" 0.0;
    117                inherit: "default" 0.0;
    118                image {
    119                   normal: "widget/combo/combo_hover.png";
    120                   border: 15 0 8 11;
    121                }
    122             }
    123             description {
    124                state: "focused" 0.0;
    125                inherit: "default" 0.0;
    126                image {
    127                   normal: "widget/combo/combo_focus.png";
    128                   border: 15 0 8 11;
    129                }
    130             }
    131             description {
    132                state: "pressed" 0.0;
    133                inherit: "default" 0.0;
    134                image {
    135                   normal: "widget/combo/combo_press.png";
    136                   border: 15 0 8 11;
    137                }
    138             }
    139         }
    140 
    141         part {
    142             name: "bt_combo_clipper";
    143             type: RECT;
    144             clip_to: "clipper";
    145             description {
    146                 state: "default" 0.0;
    147                 rel1 {
    148                     to: "combo_clipper";
    149                     relative: 1.0 0.0;
    150                 }
    151                 rel2 {
    152                     to: "clipper";
    153                     relative: 1.0 1.0;
    154                 }
    155             }
    156         }
    157 
    158         part {
    159             name: "combo_button";
    160             type: IMAGE;
    161             clip_to: "bt_combo_clipper";
    162             description {
    163                 state: "default" 0.0;
    164                 min: 18 20; // 3 + 5 + image width (10), 5 + 5 + image height (10)
    165                 rel1.to: "bt_combo_clipper";
    166                 image {
    167                      normal: "widget/combo/combo_normal_button.png";
    168                      border: 1 15 8 10;
    169                }
    170             }
    171             description {
    172                 state: "disabled" 0.0;
    173                 inherit: "default" 0.0;
    174                 color: 255 255 255 150;
    175                 rel1.to: "bt_combo_clipper";
    176             }
    177             description {
    178                 state: "hovered" 0.0;
    179                 inherit: "default" 0.0;
    180                 rel1.to: "bt_combo_clipper";
    181                 image {
    182                     normal: "widget/combo/combo_hover_button.png";
    183                     border: 1 15 8 10;
    184                 }
    185             }
    186             description {
    187                 state: "focused" 0.0;
    188                 inherit: "default" 0.0;
    189                 rel1.to: "bt_combo_clipper";
    190                 image {
    191                     normal: "widget/combo/combo_focus_button.png";
    192                     border: 1 15 8 10;
    193                 }
    194             }
    195             description {
    196                 state: "pressed" 0.0;
    197                 inherit: "default" 0.0;
    198                 rel1.to: "bt_combo_clipper";
    199                 image {
    200                     normal: "widget/combo/combo_press_button.png";
    201                     border: 1 15 8 10;
    202                 }
    203             }
    204         }
    205 
    206 
    207         part {
    208             name: "combo_button_icon";
    209             type: IMAGE;
    210             clip_to: "bt_combo_clipper";
    211             description {
    212                 state: "default" 0.0;
    213                 min: 12 10;
    214                 max: 12 10;
    215                 color: 255 255 255 150;
    216                 rel1 {
    217                     to: "bt_combo_clipper";
    218                     relative: 0.5 0.5;
    219                     offset: 0 1;
    220                 }
    221                 rel2 {
    222                     to: "bt_combo_clipper";
    223                     relative: 0.5 0.5;
    224                 }
    225                 fixed: 1 1;
    226                 image {
    227                      normal: "widget/combo/icon.png";
    228                      border: 5 5 0 0;
    229                }
    230             }
    231             description {
    232                 state: "disabled" 0.0;
    233                 inherit: "default" 0.0;
    234                 color: 255 255 255 50;
    235                 image {
    236                      normal: "widget/combo/icon.png";
    237                      border: 5 5 0 0;
    238                }
    239             }
    240         }
    241 
    242         part {
    243             name: "text_confinement";
    244             type: RECT;
    245             description {
    246                state: "default" 0.0;
    247                color: 0 0 0 0;
    248                rel1 {
    249                   to: "combo_clipper";
    250                   offset: 15 10;
    251                }
    252                rel2 {
    253                   to: "combo_clipper";
    254                   offset: -11 -11;
    255                }
    256             }
    257          }
    258     }
    259 
    260     programs {
    261         program {
    262             name: "enabled";
    263             signal: "enabled";
    264             script {
    265                 set_int(isEnabled, 1);
    266                 show();
    267             }
    268         }
    269         program {
    270             name: "pressed";
    271             signal: "pressed";
    272             script {
    273                set_int(isPressed, 1);
    274                show();
    275             }
    276         }
    277         program {
    278             name: "focused";
    279             signal: "focused";
    280             script {
    281                 set_int(isFocused, 1);
    282                 show();
    283             }
    284         }
    285         program {
    286             name: "hovered";
    287             signal: "hovered";
    288             script {
    289                 set_int(isHovered, 1);
    290                 show();
    291             }
    292         }
    293         program {
    294             name: "reset";
    295             signal: "reset";
    296             script {
    297                 set_int(isEnabled, 0);
    298                 set_int(isPressed, 0);
    299                 set_int(isChecked, 0);
    300                 set_int(isFocused, 0);
    301                 set_int(isHovered, 0);
    302                 show();
    303             }
    304         }
    305     }
    306 }
    307