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    Copyright (c) 2012 Intel Corporation. All rights reserved.
6
7    This file is free software; you can redistribute it and/or
8    modify it under the terms of the GNU Library General Public
9    License as published by the Free Software Foundation; either
10    version 2 of the License, or (at your option) any later version.
11
12    This file is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    Library General Public License for more details.
16
17    You should have received a copy of the GNU Library General Public License
18    along with this library; see the file COPYING.LIB.  If not, write to
19    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20    Boston, MA 02110-1301, USA.
21*/
22
23group {
24   name: "webkit/widget/slider/thumb_vertical";
25
26   min: 11 29;
27   max: 11 29;
28
29   images {
30      image: "widget/slider/slider_thumb_v.png" COMP;
31      image: "widget/slider/slider_thumb_press_v.png" COMP;
32   }
33
34   script {
35      public isEnabled;
36      public isPressed;
37      public isFocused;
38      public isHovered;
39
40      public show() {
41         if (get_int(isEnabled) == 1) {
42            set_state(PART:"img.thumb", "default", 0.0);
43            if (get_int(isFocused) == 1) {
44               set_state(PART:"img.thumb", "pressed", 0.0);
45               if (get_int(isPressed) == 1)
46                  set_state(PART:"img.thumb", "pressed", 0.0);
47            } else if (get_int(isHovered) == 1) {
48               set_state(PART:"img.thumb", "pressed", 0.0);
49               if (get_int(isPressed) == 1)
50                  set_state(PART:"img.thumb", "pressed", 0.0);
51            }
52         } else
53            set_state(PART:"img.thumb", "default", 0.0);
54      }
55   }
56
57   parts {
58      part {
59         name: "img.thumb";
60         type: IMAGE;
61         mouse_events: 0;
62         description {
63            state: "default" 0.0;
64            min: 11 29;
65            image {
66               normal: "widget/slider/slider_thumb_v.png";
67               border: 6 6 0 0;
68            }
69         }
70         description {
71            state: "pressed" 0.0;
72            inherit: "default" 0.0;
73            image.normal: "widget/slider/slider_thumb_press_v.png";
74         }
75      }
76   }
77
78   programs {
79      program {
80         name: "enabled";
81         signal: "enabled";
82         script {
83            set_int(isEnabled, 1);
84            show();
85         }
86      }
87
88      program {
89         name: "pressed";
90         signal: "pressed";
91         script {
92            set_int(isPressed, 1);
93            show();
94         }
95      }
96
97      program {
98         name: "focused";
99         signal: "focused";
100         script {
101            set_int(isFocused, 1);
102            show();
103         }
104      }
105
106      program {
107         name: "hovered";
108         signal: "hovered";
109         script {
110            set_int(isHovered, 1);
111            show();
112         }
113      }
114
115      program {
116         name: "reset";
117         signal: "reset";
118         script {
119            set_int(isEnabled, 0);
120            set_int(isPressed, 0);
121            set_int(isFocused, 0);
122            set_int(isHovered, 0);
123            show();
124         }
125      }
126   }
127}
128
129group {
130   name: "webkit/widget/slider/vertical";
131
132   min: 11 0; /* if > 0, this is the minimum size that will be allocated.
133               * If wants to draw on top, just overflow usign edje's rel1/rel2
134               */
135   max: 11 999999;
136
137   script {
138      public message(Msg_Type:type, id, ...) {
139         if ((id == 0) && (type == MSG_FLOAT_SET)) {
140            new Float:y, Float:sy;
141            y = getfarg(2);
142            sy = getfarg(3);
143
144            if (sy >= 0.0) {
145               set_drag(PART:"img.slider_fill", 1.0, y);
146               set_drag_size(PART:"img.slider_fill", 1.0, sy);
147            }
148         }
149      }
150   }
151
152   images {
153      image: "widget/slider/slider_v.png" COMP;
154      image: "widget/slider/slider_fill_v.png" COMP;
155   }
156
157   parts {
158      part {
159         name: "rect.base";
160         type: RECT;
161         description {
162            min: 11 29;
163            max: 11 999999;
164            state: "default" 0.0;
165            color: 255 255 255 0;
166         }
167      }
168
169      part {
170         name: "rect.clipper";
171         type: RECT;
172         description {
173            state: "default" 0.0;
174            color: 255 255 255 255;
175         }
176         description {
177            state: "hidden" 0.0;
178            color: 255 255 255 128;
179         }
180      }
181
182      part {
183         name: "img.slider";
184         type: IMAGE;
185         mouse_events: 0;
186         clip_to: "rect.clipper";
187         description {
188            state: "default" 0.0;
189            min: 5 29;
190            max: 5 999999;
191            rel1.to: "rect.base";
192            rel2.to: "rect.base";
193            image {
194               normal: "widget/slider/slider_v.png";
195               border: 0 0 5 5;
196            }
197        }
198      }
199
200      part {
201         name: "img.slider_fill";
202         type: IMAGE;
203         mouse_events: 0;
204         clip_to: "rect.clipper";
205         dragable {
206            x: 0 0 0;
207            y: 1 1 0;
208            confine: "rect.base";
209         }
210         description {
211            state: "default" 0.0;
212            min: 5 0;
213            max: 5 999999;
214            align: 0.5 0.5;
215            image {
216               normal: "widget/slider/slider_fill_v.png";
217               border: 0 0 5 5;
218            }
219         }
220      }
221   }
222}
223
224group {
225   name: "webkit/widget/slider/thumb_horizontal";
226
227   min: 29 11;
228   max: 29 11;
229
230   images {
231      image: "widget/slider/slider_thumb_h.png" COMP;
232      image: "widget/slider/slider_thumb_press_h.png" COMP;
233   }
234
235   script {
236      public isEnabled;
237      public isPressed;
238      public isFocused;
239      public isHovered;
240
241      public show() {
242         if (get_int(isEnabled) == 1) {
243            set_state(PART:"img.thumb", "default", 0.0);
244            if (get_int(isFocused) == 1) {
245               set_state(PART:"img.thumb", "pressed", 0.0);
246               if (get_int(isPressed) == 1)
247                  set_state(PART:"img.thumb", "pressed", 0.0);
248            } else if (get_int(isHovered) == 1) {
249               set_state(PART:"img.thumb", "pressed", 0.0);
250               if (get_int(isPressed) == 1)
251                  set_state(PART:"img.thumb", "pressed", 0.0);
252            }
253         } else
254            set_state(PART:"img.thumb", "default", 0.0);
255      }
256   }
257
258   parts {
259      part {
260         name: "img.thumb";
261         type: IMAGE;
262         mouse_events: 0;
263         description {
264            state: "default" 0.0;
265            min: 29 11;
266            image {
267               normal: "widget/slider/slider_thumb_h.png";
268               border: 6 6 0 0;
269            }
270         }
271         description {
272            state: "pressed" 0.0;
273            inherit: "default" 0.0;
274            image.normal: "widget/slider/slider_thumb_press_h.png";
275         }
276      }
277   }
278
279   programs {
280      program {
281         name: "enabled";
282         signal: "enabled";
283         script {
284            set_int(isEnabled, 1);
285            show();
286         }
287      }
288
289      program {
290         name: "pressed";
291         signal: "pressed";
292         script {
293            set_int(isPressed, 1);
294            show();
295         }
296      }
297
298      program {
299         name: "focused";
300         signal: "focused";
301         script {
302            set_int(isFocused, 1);
303            show();
304         }
305      }
306
307      program {
308         name: "hovered";
309         signal: "hovered";
310         script {
311            set_int(isHovered, 1);
312            show();
313         }
314      }
315
316      program {
317         name: "reset";
318         signal: "reset";
319         script {
320            set_int(isEnabled, 0);
321            set_int(isPressed, 0);
322            set_int(isFocused, 0);
323            set_int(isHovered, 0);
324            show();
325         }
326      }
327   }
328}
329
330group {
331   name: "webkit/widget/slider/horizontal";
332
333   min: 0 11; /* if > 0, this is the minimum size that will be allocated.
334               * If wants to draw on top, just overflow usign edje's rel1/rel2
335               */
336   max: 999999 11;
337
338   images {
339      image: "widget/slider/slider_h.png" COMP;
340      image: "widget/slider/slider_fill_h.png" COMP;
341   }
342
343   script {
344      public message(Msg_Type:type, id, ...) {
345         if ((id == 0) && (type == MSG_FLOAT_SET)) {
346            new Float:x, Float:sx;
347            x = getfarg(2);
348            sx = getfarg(3);
349
350            if (sx >= 0.0) {
351               set_drag(PART:"img.slider_fill", x, 0.0);
352               set_drag_size(PART:"img.slider_fill", sx, 1.0);
353            }
354         }
355      }
356   }
357
358   parts {
359      part {
360         name: "rect.base";
361         type: RECT;
362         description {
363            state: "default" 0.0;
364            min: 29 11;
365            max: 999999 11;
366            color: 255 255 255 0;
367         }
368      }
369
370      part {
371         name: "rect.clipper";
372         type: RECT;
373         description {
374            state: "default" 0.0;
375            color: 255 255 255 255;
376         }
377         description {
378            state: "hidden" 0.0;
379            color: 255 255 255 128;
380         }
381      }
382
383      part {
384         name: "img.slider";
385         type: IMAGE;
386         mouse_events: 0;
387         clip_to: "rect.clipper";
388         description {
389            state: "default" 0.0;
390            min: 29 5;
391            max: 999999 5;
392            rel1.to: "rect.base";
393            rel2.to: "rect.base";
394            align: 0.5 0.5;
395            image {
396               normal: "widget/slider/slider_h.png";
397               border: 5 5 0 0;
398            }
399         }
400      }
401
402      part {
403         name: "img.slider_fill";
404         type: IMAGE;
405         mouse_events: 0;
406         clip_to: "rect.clipper";
407         dragable {
408            x: 1 1 0;
409            y: 0 0 0;
410            confine: "rect.base";
411         }
412         description {
413            state: "default" 0.0;
414            min: 0 5;
415            max: 999999 5;
416            align: 0.5 0.5;
417            image {
418               normal: "widget/slider/slider_fill_h.png";
419               border: 5 5 0 0;
420            }
421         }
422      }
423   }
424}
425