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
24      name: "webkit/widget/checkbox";
25      min: 12 12;
26
27      images {
28         image: "widget/check/img_check_bg_enabled.png" COMP;
29         image: "widget/check/img_check_bg_disabled.png" COMP;
30         image: "widget/check/img_check_on.png" COMP;
31         image: "widget/check/img_check_off.png" COMP;
32         image: "widget/check/img_check_off_focus.png" COMP;
33         image: "widget/check/img_check_on_focus.png" COMP;
34         image: "widget/check/img_check_off_hover.png" COMP;
35         image: "widget/check/img_check_on_hover.png" COMP;
36      }
37
38      script {
39          public isEnabled;
40          public isPressed;
41          public isChecked;
42          public isFocused;
43          public isHovered;
44
45          public show() {
46              if (get_int(isEnabled) == 1) {
47                  set_state(PART:"check_button", "default", 0.0);
48                  set_state(PART:"bg", "enabled", 0.0);
49                  if (get_int(isChecked) == 1) {
50                      set_state(PART:"check_button", "enabled_checked", 0.0);
51                      if (get_int(isFocused) == 1)
52                          set_state(PART:"check_button", "focus_checked", 0.0);
53                      if (get_int(isHovered) == 1 && get_int(isFocused) == 0)
54                          set_state(PART:"check_button", "hovered_checked", 0.0);
55                  }
56                  else {
57                      if (get_int(isFocused) == 1)
58                          set_state(PART:"check_button", "focused", 0.0);
59                      if (get_int(isHovered) == 1 && get_int(isFocused) == 0)
60                          set_state(PART:"check_button", "hovered", 0.0);
61                  }
62              }
63              else {
64                  set_state(PART:"check_button", "disabled", 0.0);
65                  set_state(PART:"bg", "disabled", 0.0);
66                  if (get_int(isChecked) == 1)
67                      set_state(PART:"check_button", "disabled_checked", 0.0);
68              }
69          }
70      }
71
72      parts {
73         part {
74            name: "bg";
75            type: IMAGE;
76            description {
77               state: "default" 0.0;
78               min: 12 12;
79               max: 12 12;
80               image {
81                  normal: "widget/check/img_check_bg_enabled.png";
82               }
83            }
84            description {
85               state: "enabled" 0.0;
86               inherit: "default" 0.0;
87            }
88            description {
89               state: "disabled" 0.0;
90               inherit: "default" 0.0;
91               image {
92                  normal: "widget/check/img_check_bg_disabled.png";
93               }
94            }
95         }
96         part {
97            name: "check_button";
98            type: IMAGE;
99            description {
100               state: "default" 0.0;
101               min: 12 12;
102               max: 12 12;
103               image {
104                  normal: "widget/check/img_check_off.png";
105               }
106            }
107            description {
108               state: "enabled_checked" 0.0;
109               inherit: "default" 0.0;
110               image {
111                  normal: "widget/check/img_check_on.png";
112               }
113            }
114            description {
115               state: "disabled_checked" 0.0;
116               inherit: "enabled_checked" 0.0;
117               color: 255 255 255 150;
118            }
119            description {
120               state: "disabled" 0.0;
121               inherit: "default" 0.0;
122               color: 255 255 255 150;
123            }
124            description {
125               state: "hovered_checked" 0.0;
126               inherit: "default" 0.0;
127               image {
128                  normal: "widget/check/img_check_on_hover.png";
129               }
130            }
131            description {
132               state: "hovered" 0.0;
133               inherit: "default" 0.0;
134               image {
135                  normal: "widget/check/img_check_off_hover.png";
136               }
137            }
138            description {
139               state: "focus_checked" 0.0;
140               inherit: "default" 0.0;
141               image {
142                  normal: "widget/check/img_check_on_focus.png";
143               }
144            }
145            description {
146               state: "focused" 0.0;
147               inherit: "default" 0.0;
148               image {
149                  normal: "widget/check/img_check_off_focus.png";
150               }
151            }
152         }
153      }
154      programs {
155         program {
156            name: "enabled";
157            signal: "enabled";
158            script {
159               set_int(isEnabled, 1);
160               show();
161            }
162         }
163         program {
164            name: "pressed";
165            signal: "pressed";
166            script {
167               set_int(isPressed, 1);
168               show();
169            }
170         }
171        program {
172            name: "checked";
173            signal: "checked";
174            script {
175               set_int(isChecked, 1);
176               show();
177            }
178         }
179         program {
180            name: "focused";
181            signal: "focused";
182            script {
183               set_int(isFocused, 1);
184               show();
185            }
186         }
187          program {
188            name: "hovered";
189            signal: "hovered";
190            script {
191               set_int(isHovered, 1);
192               show();
193            }
194         }
195        program {
196            name: "reset";
197            signal: "reset";
198            script {
199               set_int(isEnabled, 0);
200               set_int(isPressed, 0);
201               set_int(isChecked, 0);
202               set_int(isFocused, 0);
203               set_int(isHovered, 0);
204               show();
205            }
206         }
207      }
208   }
209