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 align: 0.5 0; 91 rel1.to: "bg"; 92 rel2 { 93 to: "bg"; 94 relative: 1.0 0.0; 95 } 96 image.normal: "widget/spinner/sp_up_default.png"; 97 } 98 description { 99 state: "pressed" 0.0; 100 inherit: "default" 0.0; 101 image.normal: "widget/spinner/sp_up_pressed.png"; 102 } 103 description { 104 state: "disabled" 0.0; 105 inherit: "default" 0.0; 106 color: 255 255 255 150; 107 } 108 description { 109 state: "hovered" 0.0; 110 inherit: "default" 0.0; 111 image.normal: "widget/spinner/sp_up_hover.png"; 112 } 113 } 114 115 part { 116 name: "down_bt"; 117 description { 118 state: "default" 0.0; 119 min: 9 7; 120 max: 9 7; 121 fixed: 1 1; 122 align: 0.5 1; 123 rel1 { 124 to: "bg"; 125 relative: 0.0 1.0; 126 } 127 rel2.to: "bg"; 128 image.normal: "widget/spinner/sp_down_default.png"; 129 } 130 description { 131 state: "pressed" 0.0; 132 inherit: "default" 0.0; 133 image.normal: "widget/spinner/sp_down_pressed.png"; 134 } 135 description { 136 state: "disabled" 0.0; 137 inherit: "default" 0.0; 138 color: 255 255 255 150; 139 } 140 description { 141 state: "hovered" 0.0; 142 inherit: "default" 0.0; 143 image.normal: "widget/spinner/sp_down_hover.png"; 144 } 145 } 146 147 part { 148 name: "text_confinement"; 149 type: RECT; 150 description { 151 state: "default" 0.0; 152 rel1 { 153 relative: 0.0 0.0; 154 offset: 0 0; 155 } 156 rel2 { 157 relative: 1.0 1.0; 158 offset: -18 0; 159 } 160 } 161 } 162 } 163 164 programs { 165 program { 166 name: "spinup"; 167 signal: "spinup"; 168 script { 169 set_int(isSpinup, 1); 170 show(); 171 } 172 } 173 174 program { 175 name: "pressed"; 176 signal: "pressed"; 177 script { 178 set_int(isPressed, 1); 179 show(); 180 } 181 } 182 183 program { 184 name: "enabled"; 185 signal: "enabled"; 186 script { 187 set_int(isEnabled, 1); 188 show(); 189 } 190 } 191 program { 192 name: "hovered"; 193 signal: "hovered"; 194 script { 195 set_int(isHovered, 1); 196 show(); 197 } 198 } 199 program { 200 name: "reset"; 201 signal: "reset"; 202 script { 203 set_int(isSpinup, 0); 204 set_int(isEnabled, 0); 205 set_int(isPressed, 0); 206 set_int(isHovered, 0); 207 show(); 208 } 209 } 210 } 211} 212