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
22group {
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/combo_normal_transparent.png" COMP;
35        image: "widget/combo/combo_normal_button_transparent.png" COMP;
36        image: "widget/combo/combo_hover_transparent.png" COMP;
37        image: "widget/combo/combo_hover_button_transparent.png" COMP;
38        image: "widget/combo/combo_focus_transparent.png" COMP;
39        image: "widget/combo/combo_focus_button_transparent.png" COMP;
40        image: "widget/combo/combo_press_transparent.png" COMP;
41        image: "widget/combo/combo_press_button_transparent.png" COMP;
42        image: "widget/combo/icon.png" COMP;
43    }
44
45    script {
46        public isEnabled;
47        public isPressed;
48        public isChecked;
49        public isFocused;
50        public isHovered;
51        public styled;
52
53        public show() {
54            if (get_int(isEnabled) == 1) {
55                set_state(PART:"combo", "default", 0.0);
56                set_state(PART:"combo_button", "default", 0.0);
57                set_state(PART:"combo_button_icon", "default", 0.0);
58                if (get_int(isFocused) == 1) {
59                    set_state(PART:"combo", "focused", 0.0);
60                    set_state(PART:"combo_button", "focused", 0.0);
61                    if (get_int(isPressed) == 1) {
62                        set_state(PART:"combo", "pressed", 0.0);
63                        set_state(PART:"combo_button", "pressed", 0.0);
64                    }
65                }
66                else if (get_int(isHovered) == 1) {
67                    set_state(PART:"combo", "hovered", 0.0);
68                    set_state(PART:"combo_button", "hovered", 0.0);
69                    if (get_int(isPressed) == 1) {
70                        set_state(PART:"combo", "pressed", 0.0);
71                        set_state(PART:"combo_button", "pressed", 0.0);
72                    }
73                }
74            }
75            else {
76                set_state(PART:"combo", "disabled", 0.0);
77                set_state(PART:"combo_button", "disabled", 0.0);
78                set_state(PART:"combo_button_icon", "disabled", 0.0);
79            }
80            if(get_int(styled) == 1) {
81                new state[24];
82                new Float:v;
83                get_state(PART:"combo", state, 24, v);
84                if(strcmp(state, "disabled")) {
85                    set_state(PART:"combo", "disabled_styled", 0.0);
86                    set_state(PART:"combo_button", "disabled_styled", 0.0);
87                }
88                else if (strcmp(state, "default")) {
89                    set_state(PART:"combo", "default_styled", 0.0);
90                    set_state(PART:"combo_button", "default_styled", 0.0);
91                }
92                else if(strcmp(state, "focused")) {
93                    set_state(PART:"combo", "focused_styled", 0.0);
94                    set_state(PART:"combo_button", "focused_styled", 0.0);
95                }
96                else if(strcmp(state, "hovered")) {
97                    set_state(PART:"combo", "hovered_styled", 0.0);
98                    set_state(PART:"combo_button", "hovered_styled", 0.0);
99                }
100                else if(strcmp(state, "pressed")) {
101                    set_state(PART:"combo", "pressed_styled", 0.0);
102                    set_state(PART:"combo_button", "pressed_styled", 0.0);
103                }
104            }
105        }
106    }
107
108    parts {
109        part {
110            name: "clipper";
111            type: RECT;
112            description {
113                min: 35 27;
114                state: "default" 0.0;
115            }
116        }
117
118        part {
119            name: "combo_clipper";
120            type: RECT;
121            clip_to: "clipper";
122            description {
123                state: "default" 0.0;
124                rel1.to: "clipper";
125                rel2 {
126                    to: "clipper";
127                    offset: -32 -1;
128                }
129            }
130        }
131
132        part {
133            name: "combo";
134            type: IMAGE;
135            clip_to: "combo_clipper";
136            description {
137                state: "default" 0.0;
138                min: 36 20;
139                image {
140                    normal: "widget/combo/combo_normal.png";
141                    border: 15 0 8 11;
142                }
143            }
144            description {
145                state: "default_styled" 0.0;
146                min: 36 20;
147                image {
148                    normal: "widget/combo/combo_normal_transparent.png";
149                    border: 15 0 8 11;
150                }
151            }
152            description {
153               state: "disabled" 0.0;
154               inherit: "default" 0.0;
155               color: 255 255 255 150;
156            }
157            description {
158               state: "disabled_styled" 0.0;
159               inherit: "default_styled" 0.0;
160               color: 255 255 255 150;
161            }
162            description {
163               state: "hovered" 0.0;
164               inherit: "default" 0.0;
165               image {
166                  normal: "widget/combo/combo_hover.png";
167                  border: 15 0 8 11;
168               }
169            }
170            description {
171               state: "hovered_styled" 0.0;
172               inherit: "default_styled" 0.0;
173               image {
174                  normal: "widget/combo/combo_hover_transparent.png";
175                  border: 15 0 8 11;
176               }
177            }
178            description {
179               state: "focused" 0.0;
180               inherit: "default" 0.0;
181               image {
182                  normal: "widget/combo/combo_focus.png";
183                  border: 15 0 8 11;
184               }
185            }
186            description {
187               state: "focused_styled" 0.0;
188               inherit: "default_styled" 0.0;
189               image {
190                  normal: "widget/combo/combo_focus_transparent.png";
191                  border: 15 0 8 11;
192               }
193            }
194            description {
195               state: "pressed" 0.0;
196               inherit: "default" 0.0;
197               image {
198                  normal: "widget/combo/combo_press.png";
199                  border: 15 0 8 11;
200               }
201            }
202            description {
203               state: "pressed_styled" 0.0;
204               inherit: "default_styled" 0.0;
205               image {
206                  normal: "widget/combo/combo_press_transparent.png";
207                  border: 15 0 8 11;
208               }
209            }
210        }
211
212        part {
213            name: "bt_combo_clipper";
214            type: RECT;
215            clip_to: "clipper";
216            description {
217                state: "default" 0.0;
218                rel1 {
219                    to: "combo_clipper";
220                    relative: 1.0 0.0;
221                }
222                rel2 {
223                    to: "clipper";
224                    relative: 1.0 1.0;
225                }
226            }
227        }
228
229        part {
230            name: "combo_button";
231            type: IMAGE;
232            clip_to: "bt_combo_clipper";
233            description {
234                state: "default" 0.0;
235                min: 18 20; // 3 + 5 + image width (10), 5 + 5 + image height (10)
236                rel1.to: "bt_combo_clipper";
237                image {
238                     normal: "widget/combo/combo_normal_button.png";
239                     border: 1 15 8 10;
240               }
241            }
242            description {
243                state: "default_styled" 0.0;
244                min: 18 20; // 3 + 5 + image width (10), 5 + 5 + image height (10)
245                rel1.to: "bt_combo_clipper";
246                image {
247                     normal: "widget/combo/combo_normal_button_transparent.png";
248                     border: 1 15 8 10;
249               }
250            }
251            description {
252                state: "disabled" 0.0;
253                inherit: "default" 0.0;
254                color: 255 255 255 150;
255                rel1.to: "bt_combo_clipper";
256            }
257            description {
258                state: "disabled_styled" 0.0;
259                inherit: "default_styled" 0.0;
260                color: 255 255 255 150;
261                rel1.to: "bt_combo_clipper";
262            }
263            description {
264                state: "hovered" 0.0;
265                inherit: "default" 0.0;
266                rel1.to: "bt_combo_clipper";
267                image {
268                    normal: "widget/combo/combo_hover_button.png";
269                    border: 1 15 8 10;
270                }
271            }
272            description {
273                state: "hovered_styled" 0.0;
274                inherit: "default_styled" 0.0;
275                rel1.to: "bt_combo_clipper";
276                image {
277                    normal: "widget/combo/combo_hover_button_transparent.png";
278                    border: 1 15 8 10;
279                }
280            }
281            description {
282                state: "focused" 0.0;
283                inherit: "default" 0.0;
284                rel1.to: "bt_combo_clipper";
285                image {
286                    normal: "widget/combo/combo_focus_button.png";
287                    border: 1 15 8 10;
288                }
289            }
290            description {
291                state: "focused_styled" 0.0;
292                inherit: "default_styled" 0.0;
293                rel1.to: "bt_combo_clipper";
294                image {
295                    normal: "widget/combo/combo_focus_button_transparent.png";
296                    border: 1 15 8 10;
297                }
298            }
299            description {
300                state: "pressed" 0.0;
301                inherit: "default" 0.0;
302                rel1.to: "bt_combo_clipper";
303                image {
304                    normal: "widget/combo/combo_press_button.png";
305                    border: 1 15 8 10;
306                }
307            }
308            description {
309                state: "pressed_styled" 0.0;
310                inherit: "default_styled" 0.0;
311                rel1.to: "bt_combo_clipper";
312                image {
313                    normal: "widget/combo/combo_press_button_transparent.png";
314                    border: 1 15 8 10;
315                }
316            }
317        }
318
319
320        part {
321            name: "combo_button_icon";
322            type: IMAGE;
323            clip_to: "bt_combo_clipper";
324            description {
325                state: "default" 0.0;
326                min: 12 10;
327                max: 12 10;
328                color: 255 255 255 150;
329                rel1 {
330                    to: "bt_combo_clipper";
331                    relative: 0.5 0.5;
332                    offset: 0 1;
333                }
334                rel2 {
335                    to: "bt_combo_clipper";
336                    relative: 0.5 0.5;
337                }
338                fixed: 1 1;
339                image {
340                     normal: "widget/combo/icon.png";
341                     border: 5 5 0 0;
342               }
343            }
344            description {
345                state: "disabled" 0.0;
346                inherit: "default" 0.0;
347                color: 255 255 255 50;
348                image {
349                     normal: "widget/combo/icon.png";
350                     border: 5 5 0 0;
351               }
352            }
353        }
354
355        part {
356            name: "text_confinement";
357            type: RECT;
358            description {
359               state: "default" 0.0;
360               color: 0 0 0 0;
361               rel1 {
362                  to: "combo_clipper";
363                  offset: 15 10;
364               }
365               rel2 {
366                  to: "combo_clipper";
367                  offset: -11 -11;
368               }
369            }
370         }
371    }
372
373    programs {
374        program {
375            name: "enabled";
376            signal: "enabled";
377            script {
378                set_int(isEnabled, 1);
379                show();
380            }
381        }
382        program {
383            name: "pressed";
384            signal: "pressed";
385            script {
386               set_int(isPressed, 1);
387               show();
388            }
389        }
390        program {
391            name: "focused";
392            signal: "focused";
393            script {
394                set_int(isFocused, 1);
395                show();
396            }
397        }
398        program {
399            name: "hovered";
400            signal: "hovered";
401            script {
402                set_int(isHovered, 1);
403                show();
404            }
405        }
406        program {
407            name: "styled";
408            signal: "styled";
409            script {
410                set_int(styled, 1);
411                show();
412            }
413        }
414        program {
415            name: "reset";
416            signal: "reset";
417            script {
418                set_int(isEnabled, 0);
419                set_int(isPressed, 0);
420                set_int(isChecked, 0);
421                set_int(isFocused, 0);
422                set_int(isHovered, 0);
423                set_int(styled, 0);
424                show();
425            }
426        }
427    }
428}
429