Subversion Repositories Applications.papyrus

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1318 alexandre_ 1
/*
2
	Copyright (c) 2004-2006, The Dojo Foundation
3
	All Rights Reserved.
4
 
5
	Licensed under the Academic Free License version 2.1 or above OR the
6
	modified BSD license. For more information on Dojo licensing, see:
7
 
8
		http://dojotoolkit.org/community/licensing.shtml
9
*/
10
 
11
dojo.provide("dojo.widget.Slider");
12
dojo.require("dojo.event.*");
13
dojo.require("dojo.dnd.*");
14
dojo.require("dojo.dnd.HtmlDragMove");
15
dojo.require("dojo.widget.*");
16
dojo.require("dojo.html.layout");
17
dojo.widget.defineWidget("dojo.widget.Slider", dojo.widget.HtmlWidget, {minimumX:0, minimumY:0, maximumX:10, maximumY:10, snapValuesX:0, snapValuesY:0, _snapToGrid:true, isEnableX:true, isEnableY:true, _valueSizeX:0, _valueSizeY:0, _minX:0, _minY:0, _constraintWidth:0, _constraintHeight:0, _clipLeft:0, _clipRight:0, _clipTop:0, _clipBottom:0, _clipXdelta:0, _clipYdelta:0, initialValueX:0, initialValueY:0, flipX:false, flipY:false, clickSelect:true, activeDrag:false, templateCssString:".sliderMain {\n  border: 0px !important;\n  border-spacing: 0px !important;\n  line-height: 0px !important;\n  padding: 0px !important;\n  display: -moz-inline-table !important;\n  display: inline !important;\n  -moz-user-focus: normal !important;\n}\n\n.sliderComponent {\n  border: 0px;\n  padding: 0px;\n  margin: 0px;\n}\n\n.sliderHandle { \n  top: 0px;\n  left: 0px;\n  z-index: 1000;\n  position: absolute !important;\n}\n\n.sliderOutsetButton { \n  border-style: outset;\n  border-width: 0px 1px 1px 0px;\n  border-color: black;\n}\n\n.sliderInsetButton { \n  border-style: inset;\n  border-width: 1px 0px 0px 1px;\n  border-color: black;\n}\n\n.sliderButtonY {\n  margin: 0px;\n  padding: 0px;\n  z-index: 900;\n}\n\n.sliderButtonX {\n  margin: 0px;\n  padding: 0px;\n  z-index: 900;\n}\n\n.sliderBackground { \n  z-index: 0;\n  display: block !important;\n  position: relative !important;\n}\n\n.sliderProgressBackground { \n  z-index: 800;\n  position: absolute !important;\n  clip: rect(0px,0px,0px,0px);\n}\n\n.sliderBackgroundSizeOnly { \n}\n", templateCssPath:dojo.uri.moduleUri("dojo.widget", "templates/Slider.css"), templateString:"<table _=\"weird end tag formatting is to prevent whitespace from becoming &nbsp;\" \n\tclass=\"sliderMain\" \n\tdojoAttachPoint=\"focusNode\" \n\tdojoAttachEvent=\"onmousedown:_setFocus; onkey:_handleKeyEvents; onkeyup:_buttonReleased; onmouseup:_buttonReleased; onmousewheel:_mouseWheeled;\"\n\ttabindex=\"0\" cols=3 cellpadding=0 cellspacing=0 style=\"\">\n\t<tr valign=middle align=center>\n\t\t<td class=\"sliderComponent\" colspan=3 dojoAttachPoint=topBorderNode style=\"\"\n\t\t\t><img class=\"sliderOutsetButton sliderButtonY\"\n\t\t\t\tdojoAttachPoint=topButtonNode \n\t\t\t\tdojoAttachEvent=\"onmousedown:_topButtonPressed; onmousemove:_discardEvent; ondblclick:_topButtonDoubleClicked;\"\n\t\t\t\tsrc=\"${this.topButtonSrc}\" \n\t\t\t\tstyle=\"${this.buttonStyleY}\"\n\t\t></td>\n\t</tr>\n\t<tr valign=middle align=center>\n\t\t<td class=\"sliderComponent\" dojoAttachPoint=leftBorderNode style=\"\"\n\t\t\t><img class=\"sliderOutsetButton sliderButtonX\"\n\t\t\t\tdojoAttachPoint=leftButtonNode\n\t\t\t\tdojoAttachEvent=\"onmousedown:_leftButtonPressed; onmousemove:_discardEvent; ondblclick:_leftButtonDoubleClicked;\"\n\t\t\t\tsrc=\"${this.leftButtonSrc}\" \n\t\t\t\tstyle=\"${this.buttonStyleX}\"\n\t\t></td>\n\t\t<td dojoAttachPoint=constrainingContainerNode \n\t\t\tclass=\"sliderComponent sliderBackground\"\n\t\t\tstyle=\"${this.backgroundStyle}\"\n\t\t\t><img src=\"${this.handleSrc}\" \n\t\t\t\tclass=sliderHandle\n\t\t\t\tdojoAttachPoint=sliderHandleNode\n\t\t\t\tstyle=\"${this.handleStyle}\"\n\t\t\t><img src=\"${this.progressBackgroundSrc}\"\n\t\t\t\tclass=\"sliderBackgroundSizeOnly sliderProgressBackground\"\n\t\t\t\tdojoAttachPoint=progressBackgroundNode\n\t\t\t\tstyle=\"${this.backgroundSize}\"\n\t\t\t><img src=\"${this.backgroundSrc}\" \n\t\t\t\tclass=sliderBackgroundSizeOnly\n\t\t\t\tdojoAttachPoint=sliderBackgroundNode\n\t\t\t\tstyle=\"${this.backgroundSize}\"\n\t\t></td>\n\t\t<td class=\"sliderComponent\" dojoAttachPoint=rightBorderNode style=\"\"\n\t\t\t><img class=\"sliderOutsetButton sliderButtonX\"\n\t\t\t\tdojoAttachPoint=rightButtonNode\n\t\t\t\tdojoAttachEvent=\"onmousedown:_rightButtonPressed; onmousemove:_discardEvent; ondblclick:_rightButtonDoubleClicked;\"\n\t\t\t\tsrc=\"${this.rightButtonSrc}\" \n\t\t\t\tstyle=\"${this.buttonStyleX}\"\n\t\t></td>\n\t</tr>\n\t<tr valign=middle align=center>\n\t\t<td class=\"sliderComponent\" colspan=3 dojoAttachPoint=bottomBorderNode style=\"\"\n\t\t\t><img class=\"sliderOutsetButton sliderButtonY\"\n\t\t\t\tdojoAttachPoint=bottomButtonNode \n\t\t\t\tdojoAttachEvent=\"onmousedown:_bottomButtonPressed; onmousemove:_discardEvent; ondblclick:_bottomButtonDoubleClicked;\"\n\t\t\t\tsrc=\"${this.bottomButtonSrc}\" \n\t\t\t\tstyle=\"${this.buttonStyleY}\"\n\t\t></td>\n\t</tr>\n</table>\n", _isDragInProgress:false, bottomButtonSrc:dojo.uri.moduleUri("dojo.widget", "templates/images/slider_down_arrow.png"), topButtonSrc:dojo.uri.moduleUri("dojo.widget", "templates/images/slider_up_arrow.png"), leftButtonSrc:dojo.uri.moduleUri("dojo.widget", "templates/images/slider_left_arrow.png"), rightButtonSrc:dojo.uri.moduleUri("dojo.widget", "templates/images/slider_right_arrow.png"), backgroundSrc:dojo.uri.moduleUri("dojo.widget", "templates/images/blank.gif"), progressBackgroundSrc:dojo.uri.moduleUri("dojo.widget", "templates/images/blank.gif"), backgroundSize:"width:200px;height:200px;", backgroundStyle:"", buttonStyleX:"", buttonStyleY:"", handleStyle:"", handleSrc:dojo.uri.moduleUri("dojo.widget", "templates/images/slider-button.png"), showButtons:true, _eventCount:0, _typamaticTimer:null, _typamaticFunction:null, defaultTimeout:500, timeoutChangeRate:0.9, _currentTimeout:this.defaultTimeout, _handleKeyEvents:function (evt) {
18
	if (!evt.key) {
19
		return;
20
	}
21
	if (!evt.ctrlKey && !evt.altKey) {
22
		switch (evt.key) {
23
		  case evt.KEY_LEFT_ARROW:
24
			dojo.event.browser.stopEvent(evt);
25
			this._leftButtonPressed(evt);
26
			return;
27
		  case evt.KEY_RIGHT_ARROW:
28
			dojo.event.browser.stopEvent(evt);
29
			this._rightButtonPressed(evt);
30
			return;
31
		  case evt.KEY_DOWN_ARROW:
32
			dojo.event.browser.stopEvent(evt);
33
			this._bottomButtonPressed(evt);
34
			return;
35
		  case evt.KEY_UP_ARROW:
36
			dojo.event.browser.stopEvent(evt);
37
			this._topButtonPressed(evt);
38
			return;
39
		}
40
	}
41
	this._eventCount++;
42
}, _pressButton:function (buttonNode) {
43
	buttonNode.className = buttonNode.className.replace("Outset", "Inset");
44
}, _releaseButton:function (buttonNode) {
45
	buttonNode.className = buttonNode.className.replace("Inset", "Outset");
46
}, _buttonPressed:function (evt, buttonNode) {
47
	this._setFocus();
48
	if (typeof evt == "object") {
49
		if (this._typamaticTimer != null) {
50
			if (this._typamaticNode == buttonNode) {
51
				return;
52
			}
53
			clearTimeout(this._typamaticTimer);
54
		}
55
		this._buttonReleased(null);
56
		this._eventCount++;
57
		this._typamaticTimer = null;
58
		this._currentTimeout = this.defaultTimeout;
59
		dojo.event.browser.stopEvent(evt);
60
	} else {
61
		if (evt != this._eventCount) {
62
			this._buttonReleased(null);
63
			return false;
64
		}
65
	}
66
	if (buttonNode == this.leftButtonNode && this.isEnableX) {
67
		this._snapX(dojo.html.getPixelValue(this.sliderHandleNode, "left") - this._valueSizeX);
68
	} else {
69
		if (buttonNode == this.rightButtonNode && this.isEnableX) {
70
			this._snapX(dojo.html.getPixelValue(this.sliderHandleNode, "left") + this._valueSizeX);
71
		} else {
72
			if (buttonNode == this.topButtonNode && this.isEnableY) {
73
				this._snapY(dojo.html.getPixelValue(this.sliderHandleNode, "top") - this._valueSizeY);
74
			} else {
75
				if (buttonNode == this.bottomButtonNode && this.isEnableY) {
76
					this._snapY(dojo.html.getPixelValue(this.sliderHandleNode, "top") + this._valueSizeY);
77
				} else {
78
					return false;
79
				}
80
			}
81
		}
82
	}
83
	this._pressButton(buttonNode);
84
	this.notifyListeners();
85
	this._typamaticNode = buttonNode;
86
	this._typamaticTimer = dojo.lang.setTimeout(this, "_buttonPressed", this._currentTimeout, this._eventCount, buttonNode);
87
	this._currentTimeout = Math.round(this._currentTimeout * this.timeoutChangeRate);
88
	return false;
89
}, _bottomButtonPressed:function (evt) {
90
	return this._buttonPressed(evt, this.bottomButtonNode);
91
}, _bottomButtonDoubleClicked:function (evt) {
92
	var rc = this._bottomButtonPressed(evt);
93
	dojo.lang.setTimeout(this, "_buttonReleased", 50, null);
94
	return rc;
95
}, _topButtonPressed:function (evt) {
96
	return this._buttonPressed(evt, this.topButtonNode);
97
}, _topButtonDoubleClicked:function (evt) {
98
	var rc = this._topButtonPressed(evt);
99
	dojo.lang.setTimeout(this, "_buttonReleased", 50, null);
100
	return rc;
101
}, _leftButtonPressed:function (evt) {
102
	return this._buttonPressed(evt, this.leftButtonNode);
103
}, _leftButtonDoubleClicked:function (evt) {
104
	var rc = this._leftButtonPressed(evt);
105
	dojo.lang.setTimeout(this, "_buttonReleased", 50, null);
106
	return rc;
107
}, _rightButtonPressed:function (evt) {
108
	return this._buttonPressed(evt, this.rightButtonNode);
109
}, _rightButtonDoubleClicked:function (evt) {
110
	var rc = this._rightButtonPressed(evt);
111
	dojo.lang.setTimeout(this, "_buttonReleased", 50, null);
112
	return rc;
113
}, _buttonReleased:function (evt) {
114
	if (typeof evt == "object" && evt != null && typeof evt.keyCode != "undefined" && evt.keyCode != null) {
115
		var keyCode = evt.keyCode;
116
		switch (keyCode) {
117
		  case evt.KEY_LEFT_ARROW:
118
		  case evt.KEY_RIGHT_ARROW:
119
		  case evt.KEY_DOWN_ARROW:
120
		  case evt.KEY_UP_ARROW:
121
			dojo.event.browser.stopEvent(evt);
122
			break;
123
		}
124
	}
125
	this._releaseButton(this.topButtonNode);
126
	this._releaseButton(this.bottomButtonNode);
127
	this._releaseButton(this.leftButtonNode);
128
	this._releaseButton(this.rightButtonNode);
129
	this._eventCount++;
130
	if (this._typamaticTimer != null) {
131
		clearTimeout(this._typamaticTimer);
132
	}
133
	this._typamaticTimer = null;
134
	this._currentTimeout = this.defaultTimeout;
135
}, _mouseWheeled:function (evt) {
136
	var scrollAmount = 0;
137
	if (typeof evt.wheelDelta == "number") {
138
		scrollAmount = evt.wheelDelta;
139
	} else {
140
		if (typeof evt.detail == "number") {
141
			scrollAmount = -evt.detail;
142
		}
143
	}
144
	if (this.isEnableY) {
145
		if (scrollAmount > 0) {
146
			this._topButtonPressed(evt);
147
			this._buttonReleased(evt);
148
		} else {
149
			if (scrollAmount < 0) {
150
				this._bottomButtonPressed(evt);
151
				this._buttonReleased(evt);
152
			}
153
		}
154
	} else {
155
		if (this.isEnableX) {
156
			if (scrollAmount > 0) {
157
				this._rightButtonPressed(evt);
158
				this._buttonReleased(evt);
159
			} else {
160
				if (scrollAmount < 0) {
161
					this._leftButtonPressed(evt);
162
					this._buttonReleased(evt);
163
				}
164
			}
165
		}
166
	}
167
}, _discardEvent:function (evt) {
168
	dojo.event.browser.stopEvent(evt);
169
}, _setFocus:function () {
170
	if (this.focusNode.focus) {
171
		this.focusNode.focus();
172
	}
173
}, fillInTemplate:function (args, frag) {
174
	var source = this.getFragNodeRef(frag);
175
	dojo.html.copyStyle(this.domNode, source);
176
	var padding = this.domNode.style.padding;
177
	if (dojo.lang.isString(padding) && padding != "" && padding != "0px" && padding != "0px 0px 0px 0px") {
178
		this.topBorderNode.style.padding = this.bottomBorderNode.style.padding = padding;
179
		this.topBorderNode.style.paddingBottom = "0px";
180
		this.bottomBorderNode.style.paddingTop = "0px";
181
		this.rightBorderNode.style.paddingRight = this.domNode.style.paddingRight;
182
		this.leftBorderNode.style.paddingLeft = this.domNode.style.paddingLeft;
183
		this.domNode.style.padding = "0px 0px 0px 0px";
184
	}
185
	var borderWidth = this.domNode.style.borderWidth;
186
	if (dojo.lang.isString(borderWidth) && borderWidth != "" && borderWidth != "0px" && borderWidth != "0px 0px 0px 0px") {
187
		this.topBorderNode.style.borderStyle = this.rightBorderNode.style.borderStyle = this.bottomBorderNode.style.borderStyle = this.leftBorderNode.style.borderStyle = this.domNode.style.borderStyle;
188
		this.topBorderNode.style.borderColor = this.rightBorderNode.style.borderColor = this.bottomBorderNode.style.borderColor = this.leftBorderNode.style.borderColor = this.domNode.style.borderColor;
189
		this.topBorderNode.style.borderWidth = this.bottomBorderNode.style.borderWidth = borderWidth;
190
		this.topBorderNode.style.borderBottomWidth = "0px";
191
		this.bottomBorderNode.style.borderTopWidth = "0px";
192
		this.rightBorderNode.style.borderRightWidth = this.domNode.style.borderRightWidth;
193
		this.leftBorderNode.style.borderLeftWidth = this.domNode.style.borderLeftWidth;
194
		this.domNode.style.borderWidth = "0px 0px 0px 0px";
195
	}
196
	this._handleMove = new dojo.widget._SliderDragMoveSource(this.sliderHandleNode);
197
	this._handleMove.setParent(this);
198
	if (this.clickSelect) {
199
		dojo.event.connect(this.constrainingContainerNode, "onmousedown", this, "_onClick");
200
	}
201
	if (this.isEnableX) {
202
		this.setValueX(!isNaN(this.initialValueX) ? this.initialValueX : (!isNaN(this.minimumX) ? this.minimumX : 0));
203
	}
204
	if (!this.isEnableX || !this.showButtons) {
205
		this.rightButtonNode.style.width = "1px";
206
		this.rightButtonNode.style.visibility = "hidden";
207
		this.leftButtonNode.style.width = "1px";
208
		this.leftButtonNode.style.visibility = "hidden";
209
	}
210
	if (this.isEnableY) {
211
		this.setValueY(!isNaN(this.initialValueY) ? this.initialValueY : (!isNaN(this.minimumY) ? this.minimumY : 0));
212
	}
213
	if (!this.isEnableY || !this.showButtons) {
214
		this.bottomButtonNode.style.width = "1px";
215
		this.bottomButtonNode.style.visibility = "hidden";
216
		this.topButtonNode.style.width = "1px";
217
		this.topButtonNode.style.visibility = "hidden";
218
	}
219
	if (this.focusNode.addEventListener) {
220
		this.focusNode.addEventListener("DOMMouseScroll", dojo.lang.hitch(this, "_mouseWheeled"), false);
221
	}
222
}, _snapX:function (x) {
223
	if (x < 0) {
224
		x = 0;
225
	} else {
226
		if (x > this._constraintWidth) {
227
			x = this._constraintWidth;
228
		} else {
229
			var selectedValue = Math.round(x / this._valueSizeX);
230
			x = Math.round(selectedValue * this._valueSizeX);
231
		}
232
	}
233
	this.sliderHandleNode.style.left = x + "px";
234
	if (this.flipX) {
235
		this._clipLeft = x + this._clipXdelta;
236
	} else {
237
		this._clipRight = x + this._clipXdelta;
238
	}
239
	this.progressBackgroundNode.style.clip = "rect(" + this._clipTop + "px," + this._clipRight + "px," + this._clipBottom + "px," + this._clipLeft + "px)";
240
}, _calc_valueSizeX:function () {
241
	var constrainingCtrBox = dojo.html.getContentBox(this.constrainingContainerNode);
242
	var sliderHandleBox = dojo.html.getContentBox(this.sliderHandleNode);
243
	if (isNaN(constrainingCtrBox.width) || isNaN(sliderHandleBox.width) || constrainingCtrBox.width <= 0 || sliderHandleBox.width <= 0) {
244
		return false;
245
	}
246
	this._constraintWidth = constrainingCtrBox.width + dojo.html.getPadding(this.constrainingContainerNode).width - sliderHandleBox.width;
247
	if (this.flipX) {
248
		this._clipLeft = this._clipRight = constrainingCtrBox.width;
249
	} else {
250
		this._clipLeft = this._clipRight = 0;
251
	}
252
	this._clipXdelta = sliderHandleBox.width >> 1;
253
	if (!this.isEnableY) {
254
		this._clipTop = 0;
255
		this._clipBottom = constrainingCtrBox.height;
256
	}
257
	if (this._constraintWidth <= 0) {
258
		return false;
259
	}
260
	if (this.snapValuesX == 0) {
261
		this.snapValuesX = this._constraintWidth + 1;
262
	}
263
	this._valueSizeX = this._constraintWidth / (this.snapValuesX - 1);
264
	return true;
265
}, setValueX:function (value) {
266
	if (0 == this._valueSizeX) {
267
		if (this._calc_valueSizeX() == false) {
268
			dojo.lang.setTimeout(this, "setValueX", 100, value);
269
			return;
270
		}
271
	}
272
	if (isNaN(value)) {
273
		value = 0;
274
	}
275
	if (value > this.maximumX) {
276
		value = this.maximumX;
277
	} else {
278
		if (value < this.minimumX) {
279
			value = this.minimumX;
280
		}
281
	}
282
	var pixelPercent = (value - this.minimumX) / (this.maximumX - this.minimumX);
283
	if (this.flipX) {
284
		pixelPercent = 1 - pixelPercent;
285
	}
286
	this._snapX(pixelPercent * this._constraintWidth);
287
	this.notifyListeners();
288
}, getValueX:function () {
289
	var pixelPercent = dojo.html.getPixelValue(this.sliderHandleNode, "left") / this._constraintWidth;
290
	if (this.flipX) {
291
		pixelPercent = 1 - pixelPercent;
292
	}
293
	return Math.round(pixelPercent * (this.snapValuesX - 1)) * ((this.maximumX - this.minimumX) / (this.snapValuesX - 1)) + this.minimumX;
294
}, _snapY:function (y) {
295
	if (y < 0) {
296
		y = 0;
297
	} else {
298
		if (y > this._constraintHeight) {
299
			y = this._constraintHeight;
300
		} else {
301
			var selectedValue = Math.round(y / this._valueSizeY);
302
			y = Math.round(selectedValue * this._valueSizeY);
303
		}
304
	}
305
	this.sliderHandleNode.style.top = y + "px";
306
	if (this.flipY) {
307
		this._clipTop = y + this._clipYdelta;
308
	} else {
309
		this._clipBottom = y + this._clipYdelta;
310
	}
311
	this.progressBackgroundNode.style.clip = "rect(" + this._clipTop + "px," + this._clipRight + "px," + this._clipBottom + "px," + this._clipLeft + "px)";
312
}, _calc_valueSizeY:function () {
313
	var constrainingCtrBox = dojo.html.getContentBox(this.constrainingContainerNode);
314
	var sliderHandleBox = dojo.html.getContentBox(this.sliderHandleNode);
315
	if (isNaN(constrainingCtrBox.height) || isNaN(sliderHandleBox.height) || constrainingCtrBox.height <= 0 || sliderHandleBox.height <= 0) {
316
		return false;
317
	}
318
	this._constraintHeight = constrainingCtrBox.height + dojo.html.getPadding(this.constrainingContainerNode).height - sliderHandleBox.height;
319
	if (this.flipY) {
320
		this._clipTop = this._clipBottom = constrainingCtrBox.height;
321
	} else {
322
		this._clipTop = this._clipBottom = 0;
323
	}
324
	this._clipYdelta = sliderHandleBox.height >> 1;
325
	if (!this.isEnableX) {
326
		this._clipLeft = 0;
327
		this._clipRight = constrainingCtrBox.width;
328
	}
329
	if (this._constraintHeight <= 0) {
330
		return false;
331
	}
332
	if (this.snapValuesY == 0) {
333
		this.snapValuesY = this._constraintHeight + 1;
334
	}
335
	this._valueSizeY = this._constraintHeight / (this.snapValuesY - 1);
336
	return true;
337
}, setValueY:function (value) {
338
	if (0 == this._valueSizeY) {
339
		if (this._calc_valueSizeY() == false) {
340
			dojo.lang.setTimeout(this, "setValueY", 100, value);
341
			return;
342
		}
343
	}
344
	if (isNaN(value)) {
345
		value = 0;
346
	}
347
	if (value > this.maximumY) {
348
		value = this.maximumY;
349
	} else {
350
		if (value < this.minimumY) {
351
			value = this.minimumY;
352
		}
353
	}
354
	var pixelPercent = (value - this.minimumY) / (this.maximumY - this.minimumY);
355
	if (this.flipY) {
356
		pixelPercent = 1 - pixelPercent;
357
	}
358
	this._snapY(pixelPercent * this._constraintHeight);
359
	this.notifyListeners();
360
}, getValueY:function () {
361
	var pixelPercent = dojo.html.getPixelValue(this.sliderHandleNode, "top") / this._constraintHeight;
362
	if (this.flipY) {
363
		pixelPercent = 1 - pixelPercent;
364
	}
365
	return Math.round(pixelPercent * (this.snapValuesY - 1)) * ((this.maximumY - this.minimumY) / (this.snapValuesY - 1)) + this.minimumY;
366
}, _onClick:function (evt) {
367
	if (this._isDragInProgress) {
368
		return;
369
	}
370
	var parent = dojo.html.getAbsolutePosition(this.constrainingContainerNode, true, dojo.html.boxSizing.MARGIN_BOX);
371
	var content = dojo.html.getContentBox(this._handleMove.domNode);
372
	if (this.isEnableX) {
373
		var x = evt.pageX - parent.x - (content.width >> 1);
374
		this._snapX(x);
375
	}
376
	if (this.isEnableY) {
377
		var y = evt.pageY - parent.y - (content.height >> 1);
378
		this._snapY(y);
379
	}
380
	this.notifyListeners();
381
}, notifyListeners:function () {
382
	this.onValueChanged(this.getValueX(), this.getValueY());
383
}, onValueChanged:function (x, y) {
384
}});
385
dojo.widget.defineWidget("dojo.widget.SliderHorizontal", dojo.widget.Slider, {isEnableX:true, isEnableY:false, initialValue:"", snapValues:"", minimum:"", maximum:"", buttonStyle:"", backgroundSize:"height:10px;width:200px;", backgroundSrc:dojo.uri.moduleUri("dojo.widget", "templates/images/slider-bg.gif"), flip:false, postMixInProperties:function () {
386
	dojo.widget.SliderHorizontal.superclass.postMixInProperties.apply(this, arguments);
387
	if (!isNaN(parseFloat(this.initialValue))) {
388
		this.initialValueX = parseFloat(this.initialValue);
389
	}
390
	if (!isNaN(parseFloat(this.minimum))) {
391
		this.minimumX = parseFloat(this.minimum);
392
	}
393
	if (!isNaN(parseFloat(this.maximum))) {
394
		this.maximumX = parseFloat(this.maximum);
395
	}
396
	if (!isNaN(parseInt(this.snapValues))) {
397
		this.snapValuesX = parseInt(this.snapValues);
398
	}
399
	if (dojo.lang.isString(this.buttonStyle) && this.buttonStyle != "") {
400
		this.buttonStyleX = this.buttonStyle;
401
	}
402
	if (dojo.lang.isBoolean(this.flip)) {
403
		this.flipX = this.flip;
404
	}
405
}, notifyListeners:function () {
406
	this.onValueChanged(this.getValueX());
407
}, getValue:function () {
408
	return this.getValueX();
409
}, setValue:function (value) {
410
	this.setValueX(value);
411
}, onValueChanged:function (value) {
412
}});
413
dojo.widget.defineWidget("dojo.widget.SliderVertical", dojo.widget.Slider, {isEnableX:false, isEnableY:true, initialValue:"", snapValues:"", minimum:"", maximum:"", buttonStyle:"", backgroundSize:"width:10px;height:200px;", backgroundSrc:dojo.uri.moduleUri("dojo.widget", "templates/images/slider-bg-vert.gif"), flip:false, postMixInProperties:function () {
414
	dojo.widget.SliderVertical.superclass.postMixInProperties.apply(this, arguments);
415
	if (!isNaN(parseFloat(this.initialValue))) {
416
		this.initialValueY = parseFloat(this.initialValue);
417
	}
418
	if (!isNaN(parseFloat(this.minimum))) {
419
		this.minimumY = parseFloat(this.minimum);
420
	}
421
	if (!isNaN(parseFloat(this.maximum))) {
422
		this.maximumY = parseFloat(this.maximum);
423
	}
424
	if (!isNaN(parseInt(this.snapValues))) {
425
		this.snapValuesY = parseInt(this.snapValues);
426
	}
427
	if (dojo.lang.isString(this.buttonStyle) && this.buttonStyle != "") {
428
		this.buttonStyleY = this.buttonStyle;
429
	}
430
	if (dojo.lang.isBoolean(this.flip)) {
431
		this.flipY = this.flip;
432
	}
433
}, notifyListeners:function () {
434
	this.onValueChanged(this.getValueY());
435
}, getValue:function () {
436
	return this.getValueY();
437
}, setValue:function (value) {
438
	this.setValueY(value);
439
}, onValueChanged:function (value) {
440
}});
441
dojo.declare("dojo.widget._SliderDragMoveSource", dojo.dnd.HtmlDragMoveSource, {slider:null, onDragStart:function (evt) {
442
	this.slider._isDragInProgress = true;
443
	var dragObj = this.createDragMoveObject();
444
	this.slider.notifyListeners();
445
	return dragObj;
446
}, onDragEnd:function (evt) {
447
	this.slider._isDragInProgress = false;
448
	this.slider.notifyListeners();
449
}, createDragMoveObject:function () {
450
	var dragObj = new dojo.widget._SliderDragMoveObject(this.dragObject, this.type);
451
	dragObj.slider = this.slider;
452
	if (this.dragClass) {
453
		dragObj.dragClass = this.dragClass;
454
	}
455
	return dragObj;
456
}, setParent:function (slider) {
457
	this.slider = slider;
458
}});
459
dojo.declare("dojo.widget._SliderDragMoveObject", dojo.dnd.HtmlDragMoveObject, {slider:null, onDragMove:function (evt) {
460
	this.updateDragOffset();
461
	if (this.slider.isEnableX) {
462
		var x = this.dragOffset.x + evt.pageX;
463
		this.slider._snapX(x);
464
	}
465
	if (this.slider.isEnableY) {
466
		var y = this.dragOffset.y + evt.pageY;
467
		this.slider._snapY(y);
468
	}
469
	if (this.slider.activeDrag) {
470
		this.slider.notifyListeners();
471
	}
472
}});
473