]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | /**\r |
2 | * Creates a visual theme for a {@link Ext.layout.container.boxOverflow.Scroller Box Scroller}\r | |
3 | *\r | |
4 | * @param {string} $ui\r | |
5 | * The name of the UI being created. Can not included spaces or special punctuation\r | |
6 | * (used in CSS class names).\r | |
7 | *\r | |
8 | * @param {string} $type\r | |
9 | * The type of component that this box scroller will be used with. For example 'toolbar'\r | |
10 | * or 'tab-bar'\r | |
11 | *\r | |
12 | * @param {number} [$horizontal-width=16px]\r | |
13 | * The width of horizontal scroller buttons\r | |
14 | *\r | |
15 | * @param {Number} [$horizontal-height=16px]\r | |
16 | * The height of horizontal scroller buttons\r | |
17 | *\r | |
18 | * @param {number} [$vertical-width=16px]\r | |
19 | * The width of vertical scroller buttons\r | |
20 | *\r | |
21 | * @param {Number} [$vertical-height=16px]\r | |
22 | * The height of vertical scroller buttons\r | |
23 | *\r | |
24 | * @param {number/list} [$top-margin=0]\r | |
25 | * The margin of the "top" scroller button\r | |
26 | *\r | |
27 | * @param {number/list} [$right-margin=0]\r | |
28 | * The margin of the "right" scroller button\r | |
29 | *\r | |
30 | * @param {number/list} [$bottom-margin=0]\r | |
31 | * The margin of the "bottom" scroller button\r | |
32 | *\r | |
33 | * @param {number/list} [$left-margin=0]\r | |
34 | * The margin of the "left" scroller button\r | |
35 | *\r | |
36 | * @param {number/list} $top-background-image\r | |
37 | * The background-image of the "top" scroller button\r | |
38 | *\r | |
39 | * @param {number/list} $right-background-image\r | |
40 | * The background-image of the "right" scroller button\r | |
41 | *\r | |
42 | * @param {number/list} $bottom-background-image\r | |
43 | * The background-image of the "bottom" scroller button\r | |
44 | *\r | |
45 | * @param {number/list} $left-background-image\r | |
46 | * The background-image of the "left" scroller button\r | |
47 | *\r | |
48 | * @param {color} $glyph-color\r | |
49 | * The color of the scroller button icons\r | |
50 | *\r | |
51 | * @param {number/list} $top-glyph\r | |
52 | * The glyph for the "top" scroller button\r | |
53 | *\r | |
54 | * @param {number/list} $right-glyph\r | |
55 | * The glyph for the "right" scroller button\r | |
56 | *\r | |
57 | * @param {number/list} $bottom-glyph\r | |
58 | * The glyph for the "bottom" scroller button\r | |
59 | *\r | |
60 | * @param {number/list} $left-glyph\r | |
61 | * The glyph for the "left" scroller button\r | |
62 | *\r | |
63 | * @param {color} [$border-color=$base-color]\r | |
64 | * The border-color of the scroller buttons\r | |
65 | *\r | |
66 | * @param {number} [$horizontal-border-width=0]\r | |
67 | * The border-width of the scroller buttons\r | |
68 | *\r | |
69 | * @param {number} [$vertical-border-width=0]\r | |
70 | * The border-width of the scroller buttons\r | |
71 | *\r | |
72 | * @param {number/list} [$container-padding=0]\r | |
73 | * The padding of the container that these scroller buttons will be used in. Used for\r | |
74 | * setting margin offsets of the inner layout element to reserve space for the scrollers.\r | |
75 | *\r | |
76 | * @param {string} [$cursor=pointer]\r | |
77 | * The type of cursor to display when the mouse is over a scroller button\r | |
78 | *\r | |
79 | * @param {string} [$cursor-disabled=default]\r | |
80 | * The type of cursor to display when the mouse is over a disabled scroller button\r | |
81 | *\r | |
82 | * @param {string} [$align=middle]\r | |
83 | * Vertical alignment of the scroller buttons, or horizontal align of vertically oriented\r | |
84 | * scroller buttons. Can be one of the following values:\r | |
85 | *\r | |
86 | * - `begin`\r | |
87 | * - `middle`\r | |
88 | * - `end`\r | |
89 | * - `stretch`\r | |
90 | *\r | |
91 | * @param {string} [$align-offset=0]\r | |
92 | * Number of pixels to offset the alignment of the scroller.\r | |
93 | * Only applicable when {@link #align} is `middle`.\r | |
94 | *\r | |
95 | * @param {number} [$opacity=0.6]\r | |
96 | * The opacity of the scroller buttons. Only applicable when `$classic` is `false`.\r | |
97 | *\r | |
98 | * @param {number} [$opacity-over=0.8]\r | |
99 | * The opacity of hovered scroller buttons. Only applicable when `$classic` is `false`.\r | |
100 | *\r | |
101 | * @param {number} [$opacity-pressed=1]\r | |
102 | * The opacity of pressed scroller buttons. Only applicable when `$classic` is `false`.\r | |
103 | *\r | |
104 | * @param {number} [$opacity-disabled=0.25]\r | |
105 | * The opacity of disabled scroller buttons. Only applicable when `$classic` is `false`.\r | |
106 | *\r | |
107 | * @param {boolean} [$classic=false]\r | |
108 | * `true` to use classic-style scroller buttons. When `true` scroller buttons are given\r | |
109 | * their hover state by changing their background-position, When `false` scroller buttons\r | |
110 | * are given their hover state by applying opacity.\r | |
111 | *\r | |
112 | * @member Ext.layout.container.Box\r | |
113 | * @private\r | |
114 | */\r | |
115 | @mixin extjs-box-scroller-ui(\r | |
116 | $ui: null,\r | |
117 | $type: null,\r | |
118 | $horizontal-width: 16px,\r | |
119 | $horizontal-height: 16px,\r | |
120 | $vertical-width: 16px,\r | |
121 | $vertical-height: 16px,\r | |
122 | $top-margin: 0,\r | |
123 | $right-margin: 0,\r | |
124 | $bottom-margin: 0,\r | |
125 | $left-margin: 0,\r | |
126 | $top-background-image: null,\r | |
127 | $right-background-image: null,\r | |
128 | $bottom-background-image: null,\r | |
129 | $left-background-image: null,\r | |
130 | $glyph-color: null,\r | |
131 | $top-glyph: null,\r | |
132 | $right-glyph: null,\r | |
133 | $bottom-glyph: null,\r | |
134 | $left-glyph: null,\r | |
135 | $horizontal-border-color: $base-color,\r | |
136 | $horizontal-border-width: 0,\r | |
137 | $vertical-border-color: $base-color,\r | |
138 | $vertical-border-width: 0,\r | |
139 | $container-padding: 0,\r | |
140 | $cursor: pointer,\r | |
141 | $cursor-disabled: default,\r | |
142 | $align: middle,\r | |
143 | $align-offset: 0,\r | |
144 | $opacity: 0.5,\r | |
145 | $opacity-over: 0.8,\r | |
146 | $opacity-pressed: 1,\r | |
147 | $opacity-disabled: 0.25,\r | |
148 | $classic: false,\r | |
149 | $include-horizontal: true,\r | |
150 | $include-vertical: true,\r | |
151 | $include-background-images: true\r | |
152 | ) {\r | |
153 | @if is-null($top-background-image) {\r | |
154 | $top-background-image: #{$type}/#{$ui}-scroll-top;\r | |
155 | }\r | |
156 | \r | |
157 | @if is-null($right-background-image) {\r | |
158 | $right-background-image: #{$type}/#{$ui}-scroll-right;\r | |
159 | }\r | |
160 | \r | |
161 | @if is-null($bottom-background-image) {\r | |
162 | $bottom-background-image: #{$type}/#{$ui}-scroll-bottom;\r | |
163 | }\r | |
164 | \r | |
165 | @if is-null($left-background-image) {\r | |
166 | $left-background-image: #{$type}/#{$ui}-scroll-left;\r | |
167 | }\r | |
168 | \r | |
169 | .#{$prefix}#{$type}-#{$ui}-scroller {\r | |
170 | .#{$prefix}box-scroller-body-horizontal {\r | |
171 | margin-left: max($horizontal-width + horizontal($left-margin) - left($container-padding), 0);\r | |
172 | }\r | |
173 | }\r | |
174 | \r | |
175 | .#{$prefix}#{$type}-#{$ui}-vertical-scroller {\r | |
176 | .#{$prefix}box-scroller-body-vertical {\r | |
177 | margin-top: max($vertical-height + vertical($top-margin) - top($container-padding), 0);\r | |
178 | }\r | |
179 | }\r | |
180 | \r | |
181 | .#{$prefix}box-scroller-#{$type}-#{$ui} {\r | |
182 | cursor: $cursor;\r | |
183 | color: $glyph-color;\r | |
184 | \r | |
185 | @if not $classic {\r | |
186 | @if $opacity != 1 {\r | |
187 | @include opacity($opacity);\r | |
188 | }\r | |
189 | \r | |
190 | @if $opacity != 1 or $opacity-over != 1 {\r | |
191 | &.#{$prefix}box-scroller-hover {\r | |
192 | @include opacity($opacity-over);\r | |
193 | }\r | |
194 | }\r | |
195 | \r | |
196 | @if $opacity != 1 or $opacity-pressed != 1 {\r | |
197 | &.#{$prefix}box-scroller-pressed {\r | |
198 | @include opacity($opacity-pressed);\r | |
199 | }\r | |
200 | }\r | |
201 | }\r | |
202 | \r | |
203 | &.#{$prefix}box-scroller-disabled {\r | |
204 | @if $opacity-disabled != 1 {\r | |
205 | @include opacity($opacity-disabled);\r | |
206 | }\r | |
207 | @if not is-null($cursor-disabled) {\r | |
208 | cursor: $cursor-disabled;\r | |
209 | }\r | |
210 | }\r | |
211 | \r | |
212 | @if $include-horizontal {\r | |
213 | &.#{$prefix}box-scroller-left,\r | |
214 | &.#{$prefix}box-scroller-right {\r | |
215 | width: $horizontal-width;\r | |
216 | \r | |
217 | @if $align != stretch {\r | |
218 | height: $horizontal-height;\r | |
219 | }\r | |
220 | \r | |
221 | @if $horizontal-border-width != 0 {\r | |
222 | border-style: solid;\r | |
223 | border-color: $horizontal-border-color;\r | |
224 | border-width: $horizontal-border-width;\r | |
225 | }\r | |
226 | \r | |
227 | @if $align == begin {\r | |
228 | top: 0;\r | |
229 | } @else if $align == middle {\r | |
230 | top: 50%;\r | |
231 | margin-top: -(floor($horizontal-height / 2)) + $align-offset;\r | |
232 | } @else if $align == end {\r | |
233 | bottom: 0;\r | |
234 | } @else if $align == stretch {\r | |
235 | top: 0;\r | |
236 | bottom: 0;\r | |
237 | }\r | |
238 | }\r | |
239 | \r | |
240 | &.#{$prefix}box-scroller-left {\r | |
241 | @if $align == middle {\r | |
242 | // set all but margin-top to avoid overriding centering margin above\r | |
243 | margin-left: left($left-margin);\r | |
244 | margin-right: right($left-margin);\r | |
245 | margin-bottom: bottom($left-margin);\r | |
246 | } @else {\r | |
247 | margin: $left-margin;\r | |
248 | }\r | |
249 | \r | |
250 | @if $enable-font-icons and ($left-glyph != null) {\r | |
251 | @include font-icon($left-glyph, $line-height: $horizontal-height);\r | |
252 | } @else if $include-background-images {\r | |
253 | background-image: theme-background-image($left-background-image);\r | |
254 | }\r | |
255 | \r | |
256 | @if $classic {\r | |
257 | background-position: -$horizontal-width 0;\r | |
258 | \r | |
259 | &.#{$prefix}box-scroller-hover {\r | |
260 | background-position: 0 0;\r | |
261 | }\r | |
262 | }\r | |
263 | }\r | |
264 | \r | |
265 | &.#{$prefix}box-scroller-right {\r | |
266 | @if $align == middle {\r | |
267 | // set all but margin-top to avoid overriding centering margin above\r | |
268 | margin-left: left($right-margin);\r | |
269 | margin-right: right($right-margin);\r | |
270 | margin-bottom: bottom($right-margin);\r | |
271 | } @else {\r | |
272 | margin: $right-margin;\r | |
273 | }\r | |
274 | \r | |
275 | @if $enable-font-icons and ($right-glyph != null) {\r | |
276 | @include font-icon($right-glyph, $line-height: $horizontal-height);\r | |
277 | } @else if $include-background-images {\r | |
278 | background-image: theme-background-image($right-background-image);\r | |
279 | }\r | |
280 | \r | |
281 | @if $classic {\r | |
282 | background-position: 0 0;\r | |
283 | \r | |
284 | &.#{$prefix}box-scroller-hover {\r | |
285 | background-position: -$horizontal-width 0;\r | |
286 | }\r | |
287 | }\r | |
288 | }\r | |
289 | }\r | |
290 | \r | |
291 | @if $include-vertical {\r | |
292 | &.#{$prefix}box-scroller-top,\r | |
293 | &.#{$prefix}box-scroller-bottom {\r | |
294 | height: $vertical-height;\r | |
295 | \r | |
296 | @if $align != stretch {\r | |
297 | width: $vertical-width;\r | |
298 | }\r | |
299 | \r | |
300 | @if $vertical-border-width != 0 {\r | |
301 | border-style: solid;\r | |
302 | border-color: $vertical-border-color;\r | |
303 | border-width: $vertical-border-width;\r | |
304 | }\r | |
305 | \r | |
306 | @if $align == begin {\r | |
307 | left: 0;\r | |
308 | } @else if $align == middle {\r | |
309 | left: 50%;\r | |
310 | margin-left: -(floor($vertical-width / 2)) + $align-offset;\r | |
311 | } @else if $align == end {\r | |
312 | right: 0;\r | |
313 | } @else if $align == stretch {\r | |
314 | left: 0;\r | |
315 | right: 0;\r | |
316 | }\r | |
317 | }\r | |
318 | \r | |
319 | &.#{$prefix}box-scroller-top {\r | |
320 | @if $align == middle {\r | |
321 | // set all but margin-left to avoid overriding centering margin above\r | |
322 | margin-top: top($top-margin);\r | |
323 | margin-right: right($top-margin);\r | |
324 | margin-bottom: bottom($top-margin);\r | |
325 | } @else {\r | |
326 | margin: $top-margin;\r | |
327 | }\r | |
328 | \r | |
329 | @if $enable-font-icons and ($top-glyph != null) {\r | |
330 | @include font-icon($top-glyph, $line-height: $vertical-height);\r | |
331 | } @else if $include-background-images {\r | |
332 | background-image: theme-background-image($top-background-image);\r | |
333 | }\r | |
334 | \r | |
335 | @if $classic {\r | |
336 | background-position: 0 (-$vertical-height);\r | |
337 | \r | |
338 | &.#{$prefix}box-scroller-hover {\r | |
339 | background-position: 0 0;\r | |
340 | }\r | |
341 | }\r | |
342 | }\r | |
343 | \r | |
344 | &.#{$prefix}box-scroller-bottom {\r | |
345 | @if $align == middle {\r | |
346 | // set all but margin-left to avoid overriding centering margin above\r | |
347 | margin-top: top($bottom-margin);\r | |
348 | margin-right: right($bottom-margin);\r | |
349 | margin-bottom: bottom($bottom-margin);\r | |
350 | } @else {\r | |
351 | margin: $bottom-margin;\r | |
352 | }\r | |
353 | \r | |
354 | @if $enable-font-icons and ($bottom-glyph != null) {\r | |
355 | @include font-icon($bottom-glyph, $line-height: $vertical-height);\r | |
356 | } @else if $include-background-images {\r | |
357 | background-image: theme-background-image($bottom-background-image);\r | |
358 | }\r | |
359 | \r | |
360 | @if $classic {\r | |
361 | background-position: 0 0;\r | |
362 | \r | |
363 | &.#{$prefix}box-scroller-hover {\r | |
364 | background-position: 0 (-$vertical-height);\r | |
365 | }\r | |
366 | }\r | |
367 | }\r | |
368 | }\r | |
369 | }\r | |
370 | } |