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/button";
24
25      images {
26         image: "widget/button/img_button_normal.png" COMP;
27         image: "widget/button/img_button_press.png" COMP;
28         image: "widget/button/img_button_hover.png" COMP;
29         image: "widget/button/img_button_focus.png" COMP;
30      }
31
32      script {
33          public isEnabled;
34          public isPressed;
35          public isChecked;
36          public isFocused;
37          public isHovered;
38
39          public show() {
40
41              if (get_int(isEnabled) == 1) {
42                  set_state(PART:"button", "default", 0.0);
43                  if (get_int(isFocused) == 1) {
44                      set_state(PART:"button", "focused", 0.0);
45                      if (get_int(isPressed) == 1)
46                          set_state(PART:"button", "pressed", 0.0);
47                      }
48                  else if (get_int(isHovered) == 1) {
49                      set_state(PART:"button", "hovered", 0.0);
50                      if (get_int(isPressed) == 1)
51                          set_state(PART:"button", "pressed", 0.0);
52
53                  }
54              }
55              else
56                  set_state(PART:"button", "disabled", 0.0);
57          }
58      }
59
60      parts {
61
62         part {
63            name: "button";
64            type: IMAGE;
65            description {
66               state: "default" 0.0;
67               min: 25 25;
68               image {
69                  normal: "widget/button/img_button_normal.png";
70                  border: 6 10 8 10;
71               }
72            }
73            description {
74               state: "pressed" 0.0;
75               inherit: "default" 0.0;
76               image {
77                  normal: "widget/button/img_button_press.png";
78                  border: 6 10 8 10;
79               }
80            }
81            description {
82               state: "disabled" 0.0;
83               inherit: "default" 0.0;
84               color: 255 255 255 150;
85            }
86            description {
87               state: "hovered" 0.0;
88               inherit: "default" 0.0;
89               image {
90                  normal: "widget/button/img_button_hover.png";
91                  border: 6 10 8 10;
92               }
93            }
94            description {
95               state: "focused" 0.0;
96               inherit: "default" 0.0;
97               image {
98                  normal: "widget/button/img_button_focus.png";
99                  border: 6 10 8 10;
100               }
101            }
102         }
103
104         part {
105            name: "text_confinement";
106            type: RECT;
107            description {
108               state: "default" 0.0;
109               color: 0 0 0 0;
110               rel1 {
111                  relative: 0.0 0.0;
112                  offset: 15 8;
113               }
114               rel2 {
115                  relative: 1.0 1.0;
116#ifdef BIG_BUTTON_THEME_FOR_TESTING
117                  offset: -285 -11;
118#else
119                  offset: -16 -11;
120#endif
121               }
122            }
123         }
124      }
125
126      programs {
127         program {
128            name: "enabled";
129            signal: "enabled";
130            script {
131               set_int(isEnabled, 1);
132               show();
133            }
134         }
135         program {
136            name: "pressed";
137            signal: "pressed";
138            script {
139               set_int(isPressed, 1);
140               show();
141            }
142         }
143        program {
144            name: "checked";
145            signal: "checked";
146            script {
147               set_int(isChecked, 1);
148               show();
149            }
150         }
151         program {
152            name: "focused";
153            signal: "focused";
154            script {
155               set_int(isFocused, 1);
156               show();
157            }
158         }
159          program {
160            name: "hovered";
161            signal: "hovered";
162            script {
163               set_int(isHovered, 1);
164               show();
165            }
166         }
167        program {
168            name: "reset";
169            signal: "reset";
170            script {
171               set_int(isEnabled, 0);
172               set_int(isPressed, 0);
173               set_int(isChecked, 0);
174               set_int(isFocused, 0);
175               set_int(isHovered, 0);
176               show();
177            }
178         }
179      }
180   }
181