PageRenderTime 31ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/FD3/FlashDevelop/Bin/Debug/Library/AS3/frameworks/FlashIDE/fl/controls/Slider.as

https://bitbucket.org/kkszysiu/flashdevelop
ActionScript | 543 lines | 77 code | 4 blank | 462 comment | 0 complexity | fea379035123d7159225f91e560ed288 MD5 | raw file
  1. package fl.controls
  2. {
  3. import fl.controls.BaseButton;
  4. import fl.controls.SliderDirection;
  5. import fl.controls.ScrollBar;
  6. import fl.core.InvalidationType;
  7. import fl.core.UIComponent;
  8. import fl.events.SliderEvent;
  9. import fl.events.InteractionInputType;
  10. import fl.events.SliderEventClickTarget;
  11. import fl.managers.IFocusManagerComponent;
  12. import flash.display.DisplayObject;
  13. import flash.display.Sprite;
  14. import flash.events.KeyboardEvent;
  15. import flash.events.MouseEvent;
  16. import flash.ui.Keyboard;
  17. /**
  18. * Dispatched when the slider thumb is pressed.
  19. *
  20. * @eventType fl.events.SliderEvent.THUMB_PRESS
  21. *
  22. * @see #event:thumbDrag
  23. * @see #event:thumbRelease
  24. *
  25. * @langversion 3.0
  26. * @playerversion Flash 9.0.28.0
  27. */
  28. [Event(name="thumbPress", type="fl.events.SliderEvent")]
  29. /**
  30. * Dispatched when the slider thumb is pressed and released.
  31. *
  32. * @eventType fl.events.SliderEvent.THUMB_RELEASE
  33. *
  34. * @includeExample examples/Slider.thumbRelease.1.as -noswf
  35. *
  36. * @see #event:thumbDrag
  37. * @see #event:thumbPress
  38. *
  39. * @langversion 3.0
  40. * @playerversion Flash 9.0.28.0
  41. */
  42. [Event(name="thumbRelease", type="fl.events.SliderEvent")]
  43. /**
  44. * Dispatched when the slider thumb is pressed and
  45. * then moved by the mouse. This event is always preceded by a
  46. * <code>thumbPress</code> event.
  47. *
  48. * @eventType fl.events.SliderEvent.THUMB_DRAG
  49. *
  50. * @includeExample examples/Slider.thumbDrag.1.as -noswf
  51. *
  52. * @see #event:thumbPress
  53. * @see #event:thumbRelease
  54. *
  55. * @langversion 3.0
  56. * @playerversion Flash 9.0.28.0
  57. */
  58. [Event(name="thumbDrag", type="fl.events.SliderEvent")]
  59. /**
  60. * Dispatched when the value of the Slider component changes as a result of mouse or keyboard
  61. * interaction. If the <code>liveDragging</code> property is <code>true</code>, the event is
  62. * dispatched continuously as the user moves the thumb. If
  63. * <code>liveDragging</code> is <code>false</code>, the event is dispatched when the user
  64. * releases the slider thumb.
  65. *
  66. * @eventType fl.events.SliderEvent.CHANGE
  67. *
  68. * @see #liveDragging
  69. *
  70. * @langversion 3.0
  71. * @playerversion Flash 9.0.28.0
  72. */
  73. [Event(name="change", type="fl.events.SliderEvent")]
  74. /**
  75. * @copy fl.controls.ScrollBar#style:thumbUpSkin
  76. *
  77. * @default SliderThumb_upSkin
  78. *
  79. * @langversion 3.0
  80. * @playerversion Flash 9.0.28.0
  81. */
  82. [Style(name="thumbUpSkin", type="Class")]
  83. /**
  84. * @copy fl.controls.ScrollBar#style:thumbOverSkin
  85. *
  86. * @default SliderThumb_overSkin
  87. *
  88. * @langversion 3.0
  89. * @playerversion Flash 9.0.28.0
  90. */
  91. [Style(name="thumbOverSkin", type="Class")]
  92. /**
  93. * @copy fl.controls.ScrollBar#style:thumbDownSkin
  94. *
  95. * @default SliderThumb_downSkin
  96. *
  97. * @langversion 3.0
  98. * @playerversion Flash 9.0.28.0
  99. */
  100. [Style(name="thumbDownSkin", type="Class")]
  101. /**
  102. * @copy fl.controls.ScrollBar#style:thumbDisabledSkin
  103. *
  104. * @default SliderThumb_disabledSkin
  105. *
  106. * @langversion 3.0
  107. * @playerversion Flash 9.0.28.0
  108. */
  109. [Style(name="thumbDisabledSkin", type="Class")]
  110. /**
  111. * The skin for the track in a Slider component.
  112. *
  113. * @default SliderTrack_skin
  114. *
  115. * @langversion 3.0
  116. * @playerversion Flash 9.0.28.0
  117. */
  118. [Style(name="sliderTrackSkin", type="Class")]
  119. /**
  120. * The skin for the track in a Slider component that is disabled.
  121. *
  122. * @default SliderTrack_disabledSkin
  123. *
  124. * @langversion 3.0
  125. * @playerversion Flash 9.0.28.0
  126. */
  127. [Style(name="sliderTrackDisabledSkin", type="Class")]
  128. /**
  129. * The skin for the ticks in a Slider component.
  130. *
  131. * @default SliderTick_skin
  132. *
  133. * @langversion 3.0
  134. * @playerversion Flash 9.0.28.0
  135. */
  136. [Style(name="tickSkin", type="Class")]
  137. /**
  138. * The Slider component lets users select a value by moving a slider
  139. * thumb between the end points of the slider track. The current
  140. * value of the Slider component is determined by the relative location of
  141. * the thumb between the end points of the slider, corresponding to
  142. * the <code>minimum</code> and <code>maximum</code> values of the Slider
  143. * component.
  144. *
  145. * @includeExample examples/SliderExample.as
  146. *
  147. * @see fl.events.SliderEvent SliderEvent
  148. *
  149. * @langversion 3.0
  150. * @playerversion Flash 9.0.28.0
  151. */
  152. public class Slider extends UIComponent implements IFocusManagerComponent
  153. {
  154. /**
  155. * @private (protected)
  156. *
  157. * @langversion 3.0
  158. * @playerversion Flash 9.0.28.0
  159. */
  160. protected var _direction : String;
  161. /**
  162. * @private (protected)
  163. *
  164. * @langversion 3.0
  165. * @playerversion Flash 9.0.28.0
  166. */
  167. protected var _minimum : Number;
  168. /**
  169. * @private (protected)
  170. *
  171. * @langversion 3.0
  172. * @playerversion Flash 9.0.28.0
  173. */
  174. protected var _maximum : Number;
  175. /**
  176. * @private (protected)
  177. *
  178. * @langversion 3.0
  179. * @playerversion Flash 9.0.28.0
  180. */
  181. protected var _value : Number;
  182. /**
  183. * @private (protected)
  184. *
  185. * @langversion 3.0
  186. * @playerversion Flash 9.0.28.0
  187. */
  188. protected var _tickInterval : Number;
  189. /**
  190. * @private (protected)
  191. *
  192. * @langversion 3.0
  193. * @playerversion Flash 9.0.28.0
  194. */
  195. protected var _snapInterval : Number;
  196. /**
  197. * @private (protected)
  198. *
  199. * @langversion 3.0
  200. * @playerversion Flash 9.0.28.0
  201. */
  202. protected var _liveDragging : Boolean;
  203. /**
  204. * @private (protected)
  205. *
  206. * @langversion 3.0
  207. * @playerversion Flash 9.0.28.0
  208. */
  209. protected var tickContainer : Sprite;
  210. /**
  211. * @private (protected)
  212. *
  213. * @langversion 3.0
  214. * @playerversion Flash 9.0.28.0
  215. */
  216. protected var thumb : BaseButton;
  217. /**
  218. * @private (protected)
  219. *
  220. * @langversion 3.0
  221. * @playerversion Flash 9.0.28.0
  222. */
  223. protected var track : BaseButton;
  224. /**
  225. * @private (protected)
  226. *
  227. * @langversion 3.0
  228. * @playerversion Flash 9.0.28.0
  229. */
  230. protected static var defaultStyles : Object;
  231. /**
  232. * @private (protected)
  233. *
  234. * @langversion 3.0
  235. * @playerversion Flash 9.0.28.0
  236. */
  237. protected static const TRACK_STYLES : Object;
  238. /**
  239. * @private (protected)
  240. *
  241. * @langversion 3.0
  242. * @playerversion Flash 9.0.28.0
  243. */
  244. protected const THUMB_STYLES : Object;
  245. /**
  246. * @private (protected)
  247. *
  248. * @langversion 3.0
  249. * @playerversion Flash 9.0.28.0
  250. */
  251. protected const TICK_STYLES : Object;
  252. /**
  253. * Sets the direction of the slider. Acceptable values are <code>SliderDirection.HORIZONTAL</code> and
  254. * <code>SliderDirection.VERTICAL</code>.
  255. *
  256. * @default SliderDirection.HORIZONTAL
  257. *
  258. * @includeExample examples/Slider.direction.1.as -noswf
  259. *
  260. * @see SliderDirection
  261. *
  262. * @langversion 3.0
  263. * @playerversion Flash 9.0.28.0
  264. */
  265. public function get direction () : String;
  266. /**
  267. * @private (setter)
  268. *
  269. * @langversion 3.0
  270. * @playerversion Flash 9.0.28.0
  271. */
  272. public function set direction (value:String) : void;
  273. /**
  274. * The minimum value allowed on the Slider component instance.
  275. *
  276. * @default 0
  277. *
  278. * @see #maximum
  279. * @see #value
  280. *
  281. * @langversion 3.0
  282. * @playerversion Flash 9.0.28.0
  283. */
  284. public function get minimum () : Number;
  285. /**
  286. * @private (setter)
  287. *
  288. * @langversion 3.0
  289. * @playerversion Flash 9.0.28.0
  290. */
  291. public function set minimum (value:Number) : void;
  292. /**
  293. * The maximum allowed value on the Slider component instance.
  294. *
  295. * @default 10
  296. *
  297. * @see #minimum
  298. * @see #value
  299. *
  300. * @langversion 3.0
  301. * @playerversion Flash 9.0.28.0
  302. */
  303. public function get maximum () : Number;
  304. /**
  305. * @private (setter)
  306. *
  307. * @langversion 3.0
  308. * @playerversion Flash 9.0.28.0
  309. */
  310. public function set maximum (value:Number) : void;
  311. /**
  312. * The spacing of the tick marks relative to the maximum value
  313. * of the component. The Slider component displays tick marks whenever
  314. * you set the <code>tickInterval</code> property to a nonzero value.
  315. *
  316. * @default 0
  317. *
  318. * @see #snapInterval
  319. *
  320. * @includeExample examples/Slider.tickInterval.1.as -noswf
  321. *
  322. * @langversion 3.0
  323. * @playerversion Flash 9.0.28.0
  324. */
  325. public function get tickInterval () : Number;
  326. /**
  327. * @private (setter)
  328. *
  329. * @langversion 3.0
  330. * @playerversion Flash 9.0.28.0
  331. */
  332. public function set tickInterval (value:Number) : void;
  333. /**
  334. * Gets or sets the increment by which the value is increased or decreased
  335. * as the user moves the slider thumb.
  336. *
  337. * <p>For example, this property is set to 2, the <code>minimum</code> value is 0,
  338. * and the <code>maximum</code> value is 10, the position of the thumb will always
  339. * be at 0, 2, 4, 6, 8, or 10. If this property is set to 0, the slider
  340. * moves continuously between the <code>minimum</code> and <code>maximum</code> values.</p>
  341. *
  342. * @default 0
  343. *
  344. * @includeExample examples/Slider.snapInterval.2.as -noswf
  345. * @includeExample examples/Slider.snapInterval.1.as -noswf
  346. *
  347. * @see #tickInterval
  348. *
  349. * @langversion 3.0
  350. * @playerversion Flash 9.0.28.0
  351. */
  352. public function get snapInterval () : Number;
  353. /**
  354. * @private (setter)
  355. *
  356. * @includeExample examples/Slider.snapInterval.1.as -noswf
  357. *
  358. * @langversion 3.0
  359. * @playerversion Flash 9.0.28.0
  360. */
  361. public function set snapInterval (value:Number) : void;
  362. /**
  363. * Gets or sets a Boolean value that indicates whether the <code>SliderEvent.CHANGE</code>
  364. * event is dispatched continuously as the user moves the slider thumb. If the
  365. * <code>liveDragging</code> property is <code>false</code>, the <code>SliderEvent.CHANGE</code>
  366. * event is dispatched when the user releases the slider thumb.
  367. *
  368. * @default false
  369. *
  370. * @includeExample examples/Slider.liveDragging.1.as -noswf
  371. *
  372. * @langversion 3.0
  373. * @playerversion Flash 9.0.28.0
  374. */
  375. public function set liveDragging (value:Boolean) : void;
  376. /**
  377. * @private (setter)
  378. *
  379. * @langversion 3.0
  380. * @playerversion Flash 9.0.28.0
  381. */
  382. public function get liveDragging () : Boolean;
  383. /**
  384. * @copy fl.core.UIComponent#enabled
  385. *
  386. * @default true
  387. *
  388. * @langversion 3.0
  389. * @playerversion Flash 9.0.28.0
  390. */
  391. public function get enabled () : Boolean;
  392. /**
  393. * @private (setter)
  394. *
  395. * @langversion 3.0
  396. * @playerversion Flash 9.0.28.0
  397. */
  398. public function set enabled (value:Boolean) : void;
  399. /**
  400. * Gets or sets the current value of the Slider component. This value is
  401. * determined by the position of the slider thumb between the minimum and
  402. * maximum values.
  403. *
  404. * @default 0
  405. *
  406. * @see #maximum
  407. * @see #minimum
  408. *
  409. * @langversion 3.0
  410. * @playerversion Flash 9.0.28.0
  411. */
  412. public function get value () : Number;
  413. /**
  414. * @private (setter)
  415. *
  416. * @langversion 3.0
  417. * @playerversion Flash 9.0.28.0
  418. */
  419. public function set value (value:Number) : void;
  420. /**
  421. * @copy fl.core.UIComponent#getStyleDefinition()
  422. *
  423. * @includeExample ../core/examples/UIComponent.getStyleDefinition.1.as -noswf
  424. *
  425. * @see fl.core.UIComponent#getStyle() UIComponent.getStyle()
  426. * @see fl.core.UIComponent#setStyle() UIComponent.setStyle()
  427. * @see fl.managers.StyleManager StyleManager
  428. *
  429. * @langversion 3.0
  430. * @playerversion Flash 9.0.28.0
  431. */
  432. public static function getStyleDefinition () : Object;
  433. /**
  434. * @copy fl.core.UIComponent#setSize()
  435. *
  436. * @langversion 3.0
  437. * @playerversion Flash 9.0.28.0
  438. */
  439. public function setSize (w:Number, h:Number) : void;
  440. /**
  441. * @private (protected)
  442. *
  443. * @langversion 3.0
  444. * @playerversion Flash 9.0.28.0
  445. */
  446. protected function doSetValue (val:Number, interactionType:String = null, clickTarget:String = null, keyCode:int = undefined) : void;
  447. /**
  448. * @private (protected)
  449. *
  450. * @langversion 3.0
  451. * @playerversion Flash 9.0.28.0
  452. */
  453. protected function setStyles () : void;
  454. /**
  455. * @private (protected)
  456. *
  457. * @langversion 3.0
  458. * @playerversion Flash 9.0.28.0
  459. */
  460. protected function draw () : void;
  461. /**
  462. * @private (protected)
  463. *
  464. * @langversion 3.0
  465. * @playerversion Flash 9.0.28.0
  466. */
  467. protected function positionThumb () : void;
  468. /**
  469. * @private (protected)
  470. *
  471. * @langversion 3.0
  472. * @playerversion Flash 9.0.28.0
  473. */
  474. protected function drawTicks () : void;
  475. /**
  476. * @private (protected)
  477. *
  478. * @langversion 3.0
  479. * @playerversion Flash 9.0.28.0
  480. */
  481. protected function clearTicks () : void;
  482. /**
  483. * @private (protected)
  484. *
  485. * @langversion 3.0
  486. * @playerversion Flash 9.0.28.0
  487. */
  488. protected function calculateValue (pos:Number, interactionType:String, clickTarget:String, keyCode:int = undefined) : void;
  489. /**
  490. * @private (protected)
  491. *
  492. * @langversion 3.0
  493. * @playerversion Flash 9.0.28.0
  494. */
  495. protected function doDrag (event:MouseEvent) : void;
  496. /**
  497. * @private (protected)
  498. *
  499. * @langversion 3.0
  500. * @playerversion Flash 9.0.28.0
  501. */
  502. protected function thumbPressHandler (event:MouseEvent) : void;
  503. /**
  504. * @private (protected)
  505. *
  506. * @langversion 3.0
  507. * @playerversion Flash 9.0.28.0
  508. */
  509. protected function thumbReleaseHandler (event:MouseEvent) : void;
  510. /**
  511. * @private (protected)
  512. *
  513. * @langversion 3.0
  514. * @playerversion Flash 9.0.28.0
  515. */
  516. protected function onTrackClick (event:MouseEvent) : void;
  517. /**
  518. * @private (protected)
  519. *
  520. * @langversion 3.0
  521. * @playerversion Flash 9.0.28.0
  522. */
  523. protected function keyDownHandler (event:KeyboardEvent) : void;
  524. /**
  525. * @private (protected)
  526. *
  527. * @langversion 3.0
  528. * @playerversion Flash 9.0.28.0
  529. */
  530. protected function configUI () : void;
  531. /**
  532. * @private (protected)
  533. *
  534. * @langversion 3.0
  535. * @playerversion Flash 9.0.28.0
  536. */
  537. protected function getPrecision (num:Number) : Number;
  538. }
  539. }