1/*
2 * Copyright (C) 2012, Intel Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU Lesser General Public License,
6 * version 2.1, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St
15 * - Fifth Floor, Boston, MA 02110-1301 USA
16 *
17 */
18
19group {
20    name: "webkit/widget/spinner";
21
22    images {
23       image: "widget/spinner/sp_bg.png" COMP;
24       image: "widget/spinner/sp_up_default.png" COMP;
25       image: "widget/spinner/sp_down_default.png" COMP;
26       image: "widget/spinner/sp_up_pressed.png" COMP;
27       image: "widget/spinner/sp_down_pressed.png" COMP;
28       image: "widget/spinner/sp_up_hover.png" COMP;
29       image: "widget/spinner/sp_down_hover.png" COMP;
30    }
31
32    script {
33        public isSpinup;
34        public isEnabled;
35        public isPressed;
36        public isHovered;
37
38        public show() {
39            if (get_int(isEnabled) == 1) {
40                set_state(PART:"up_bt", "default", 0.0);
41                set_state(PART:"down_bt", "default", 0.0);
42                if (get_int(isHovered) == 1) {
43                    if (get_int(isSpinup)) {
44                        set_state(PART:"up_bt", "hovered", 0.0);
45                        if (get_int(isPressed))
46                            set_state(PART:"up_bt", "pressed", 0.0);
47                    }
48                    else {
49                        set_state(PART:"down_bt", "hovered", 0.0);
50                        if (get_int(isPressed))
51                            set_state(PART:"down_bt", "pressed", 0.0);
52                    }
53                }
54            }
55            else {
56                set_state(PART:"up_bt", "disabled", 0.0);
57                set_state(PART:"down_bt", "disabled", 0.0);
58            }
59        }
60    }
61
62    parts {
63        part {
64            name: "bg";
65            type: IMAGE;
66            description {
67                state: "default" 0.0;
68                rel1 {
69                    relative: 0.0 0.0;
70                    offset: 0 6;
71                }
72                rel2 {
73                    relative: 1.0 1.0;
74                    offset: -2 -6;
75                }
76                image {
77                    normal: "widget/spinner/sp_bg.png";
78                    border: 1 0 0 0;
79                }
80            }
81        }
82
83        part {
84            name: "up_bt";
85            description {
86                state: "default" 0.0;
87                min: 9 7;
88                max: 9 7;
89                fixed: 1 1;
90                rel1 {
91                    relative: 0.0 0.0;
92                    offset: 0 16;
93                }
94                rel2 {
95                    relative: 1.0 0.0;
96                    offset: -1 -1;
97                }
98                image.normal: "widget/spinner/sp_up_default.png";
99            }
100            description {
101                state: "pressed" 0.0;
102                inherit: "default" 0.0;
103                image.normal: "widget/spinner/sp_up_pressed.png";
104            }
105            description {
106                state: "disabled" 0.0;
107                inherit: "default" 0.0;
108                color: 255 255 255 150;
109            }
110            description {
111                state: "hovered" 0.0;
112                inherit: "default" 0.0;
113                image.normal: "widget/spinner/sp_up_hover.png";
114            }
115        }
116
117        part {
118            name: "down_bt";
119            description {
120                state: "default" 0.0;
121                min: 9 7;
122                max: 9 7;
123                fixed: 1 1;
124                rel1 {
125                    relative: 0.0 1.0;
126                    offset: 0 0;
127                }
128                rel2 {
129                    relative: 1.0 1.0;
130                    offset: -1 -18;
131                }
132                image.normal: "widget/spinner/sp_down_default.png";
133            }
134            description {
135                state: "pressed" 0.0;
136                inherit: "default" 0.0;
137                image.normal: "widget/spinner/sp_down_pressed.png";
138            }
139            description {
140                state: "disabled" 0.0;
141                inherit: "default" 0.0;
142                color: 255 255 255 150;
143            }
144            description {
145                state: "hovered" 0.0;
146                inherit: "default" 0.0;
147                image.normal: "widget/spinner/sp_down_hover.png";
148            }
149        }
150
151        part {
152            name: "text_confinement";
153            type: RECT;
154            description {
155                state: "default" 0.0;
156                rel1 {
157                    relative: 0.0 0.0;
158                    offset: 0 0;
159                }
160                rel2 {
161                    relative: 1.0 1.0;
162                    offset: -18 0;
163                }
164            }
165        }
166    }
167
168    programs {
169        program {
170            name: "spinup";
171            signal: "spinup";
172            script {
173                set_int(isSpinup, 1);
174                show();
175            }
176        }
177
178        program {
179            name: "pressed";
180            signal: "pressed";
181            script {
182                set_int(isPressed, 1);
183                show();
184            }
185        }
186
187        program {
188            name: "enabled";
189            signal: "enabled";
190            script {
191                set_int(isEnabled, 1);
192                show();
193            }
194        }
195        program {
196            name: "hovered";
197            signal: "hovered";
198            script {
199                set_int(isHovered, 1);
200                show();
201            }
202        }
203        program {
204            name: "reset";
205            signal: "reset";
206            script {
207                set_int(isSpinup, 0);
208                set_int(isEnabled, 0);
209                set_int(isPressed, 0);
210                set_int(isHovered, 0);
211                show();
212            }
213        }
214    }
215}
216