PageRenderTime 67ms CodeModel.GetById 8ms RepoModel.GetById 0ms app.codeStats 1ms

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

https://bitbucket.org/kkszysiu/flashdevelop
ActionScript | 304 lines | 90 code | 4 blank | 210 comment | 0 complexity | b4f29be5116f50357576fdf3bc88db18 MD5 | raw file
  1. package fl.controls
  2. {
  3. import fl.controls.BaseButton;
  4. import fl.controls.LabelButton;
  5. import fl.controls.ScrollBarDirection;
  6. import fl.core.UIComponent;
  7. import fl.core.InvalidationType;
  8. import fl.events.ComponentEvent;
  9. import fl.events.ScrollEvent;
  10. import flash.display.Sprite;
  11. import flash.events.Event;
  12. import flash.events.MouseEvent;
  13. import flash.events.TimerEvent;
  14. import flash.text.TextField;
  15. import flash.text.TextFormat;
  16. import flash.utils.Timer;
  17. import fl.controls.TextInput;
  18. /**
  19. * Dispatched when the ScrollBar instance's <code>scrollPosition</code> property changes. * * @eventType fl.events.ScrollEvent.SCROLL * * @see #scrollPosition * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  20. */
  21. [Event(name="scroll", type="fl.events.ScrollEvent"))]
  22. /**
  23. * Name of the class to use as the skin for the down arrow button of the scroll bar * when it is disabled. If you change the skin, either graphically or programmatically, * you should ensure that the new skin is the same height (for horizontal scroll bars) * or width (for vertical scroll bars) as the track. * * @default ScrollArrowDown_disabledSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  24. */
  25. [Style(name="downArrowDisabledSkin", type="Class")]
  26. /**
  27. * Name of the class to use as the skin for the down arrow button of the scroll bar * when you click the arrow button. If you change the skin, either graphically or * programmatically, you should ensure that the new skin is the same height (for * horizontal scroll bars) or width (for vertical scroll bars) as the track. * * @default ScrollArrowDown_downSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  28. */
  29. [Style(name="downArrowDownSkin", type="Class")]
  30. /**
  31. * Name of the class to use as the skin for the down arrow button of the scroll bar * when the mouse pointer is over the arrow button. If you change the skin, either * graphically or programmatically, you should ensure that the new skin is the same * height (for horizontal scroll bars) or width (for vertical scroll bars) as the track. * * @default ScrollArrowDown_overSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  32. */
  33. [Style(name="downArrowOverSkin", type="Class")]
  34. /**
  35. * Name of the class to use as the skin for the down arrow button of the scroll bar. * If you change the skin, either graphically or programmatically, you should ensure * that the new skin is the same height (for horizontal scroll bars) or width (for * vertical scroll bars) as the track. * * @default ScrollArrowDown_upSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  36. */
  37. [Style(name="downArrowUpSkin", type="Class")]
  38. /**
  39. * The skin that is used to indicate the disabled state of the thumb. * * @default ScrollThumb_disabledSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  40. */
  41. [Style(name="thumbDisabledSkin", type="Class")]
  42. /**
  43. * Name of the class to use as the skin for the thumb of the scroll bar when you * click the thumb. * * @default ScrollThumb_downSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  44. */
  45. [Style(name="thumbDownSkin", type="Class")]
  46. /**
  47. * Name of the class to use as the skin for the thumb of the scroll bar when the * mouse pointer is over the thumb. * * @default ScrollThumb_overSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  48. */
  49. [Style(name="thumbOverSkin", type="Class")]
  50. /**
  51. * Name of the class to use as the skin used for the thumb of the scroll * bar. * * @default ScrollThumb_upSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  52. */
  53. [Style(name="thumbUpSkin", type="Class")]
  54. /**
  55. * The skin that is used to indicate a disabled track. * * @default ScrollTrack_Skin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  56. */
  57. [Style(name="trackDisabledSkin", type="Class")]
  58. /**
  59. * The skin that is used to indicate the down state of a disabled skin. * * @default ScrollTrack_Skin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  60. */
  61. [Style(name="trackDownSkin", type="Class")]
  62. /**
  63. * The skin that is used to indicate the mouseover state for the scroll track. * * @default ScrollTrack_Skin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  64. */
  65. [Style(name="trackOverSkin", type="Class")]
  66. /**
  67. * The skin used to indicate the mouse up state for the scroll track. * * @default ScrollTrack_Skin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  68. */
  69. [Style(name="trackUpSkin", type="Class")]
  70. /**
  71. * Name of the class to use as the skin for the up arrow button of the scroll bar * when it is disabled. If you change the skin, either graphically or programmatically, * you should ensure that the new skin is the same height (for horizontal scroll bars) * or width (for vertical scroll bars) as the track. * * @default ScrollArrowUp_disabledSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  72. */
  73. [Style(name="upArrowDisabledSkin", type="Class")]
  74. /**
  75. * Name of the class to use as the skin for the up arrow button of the scroll bar when * you click the arrow button. If you change the skin, either graphically or programmatically, * you should ensure that the new skin is the same height (for horizontal scroll bars) or width * (for vertical scroll bars) as the track. * * @default ScrollArrowUp_downSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  76. */
  77. [Style(name="upArrowDownSkin", type="Class")]
  78. /**
  79. * Name of the class to use as the skin for the up arrow button of the scroll bar when the * mouse pointer is over the arrow button. If you change the skin, either graphically or * programmatically, you should ensure that the new skin is the same height (for horizontal * scroll bars) or width (for vertical scroll bars) as the track. * * @default ScrollArrowUp_overSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  80. */
  81. [Style(name="upArrowOverSkin", type="Class")]
  82. /**
  83. * Name of the class to use as the skin for the up arrow button of the scroll bar. If you * change the skin, either graphically or programmatically, you should ensure that the new * skin is the same height (for horizontal scroll bars) or width (for vertical scroll bars) * as the track. * * @default ScrollArrowUp_upSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  84. */
  85. [Style(name="upArrowUpSkin", type="Class")]
  86. /**
  87. * Name of the class to use as the icon for the thumb of the scroll bar. * * @default ScrollBar_thumbIcon * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  88. */
  89. [Style(name="thumbIcon", type="Class")]
  90. /**
  91. * @copy fl.controls.BaseButton#style:repeatDelay * * @default 500 * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  92. */
  93. [Style(name="repeatDelay", type="Number", format="Time")]
  94. /**
  95. * @copy fl.controls.BaseButton#style:repeatInterval * * @default 35 * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  96. */
  97. [Style(name="repeatInterval", type="Number", format="Time")]
  98. /**
  99. * The ScrollBar component provides the end user with a way to control the * portion of data that is displayed when there is too much data to * fit in the display area. The scroll bar consists of four parts: * two arrow buttons, a track, and a thumb. The position of the * thumb and display of the buttons depends on the current state of * the scroll bar. The scroll bar uses four parameters to calculate * its display state: a minimum range value; a maximum range value; * a current position that must be within the range values; and a * viewport size that must be equal to or less than the range and * represents the number of items in the range that can be * displayed at the same time. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  100. */
  101. public class ScrollBar extends UIComponent
  102. {
  103. /**
  104. * @private (internal) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  105. */
  106. public static const WIDTH : Number = 15;
  107. /**
  108. * @private * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  109. */
  110. private var _pageSize : Number;
  111. /**
  112. * @private * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  113. */
  114. private var _pageScrollSize : Number;
  115. /**
  116. * @private * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  117. */
  118. private var _lineScrollSize : Number;
  119. /**
  120. * @private * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  121. */
  122. private var _minScrollPosition : Number;
  123. /**
  124. * @private * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  125. */
  126. private var _maxScrollPosition : Number;
  127. /**
  128. * @private * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  129. */
  130. private var _scrollPosition : Number;
  131. /**
  132. * @private * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  133. */
  134. private var _direction : String;
  135. /**
  136. * @private * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  137. */
  138. private var thumbScrollOffset : Number;
  139. /**
  140. * @private * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  141. */
  142. protected var inDrag : Boolean;
  143. /**
  144. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  145. */
  146. protected var upArrow : BaseButton;
  147. /**
  148. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  149. */
  150. protected var downArrow : BaseButton;
  151. /**
  152. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  153. */
  154. protected var thumb : LabelButton;
  155. /**
  156. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  157. */
  158. protected var track : BaseButton;
  159. /**
  160. * @private * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  161. */
  162. private static var defaultStyles : Object;
  163. /**
  164. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  165. */
  166. protected static const DOWN_ARROW_STYLES : Object;
  167. /**
  168. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  169. */
  170. protected const THUMB_STYLES : Object;
  171. /**
  172. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  173. */
  174. protected const TRACK_STYLES : Object;
  175. /**
  176. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  177. */
  178. protected const UP_ARROW_STYLES : Object;
  179. /**
  180. * @copy fl.core.UIComponent#width * * @see #height * @see #setSize() * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  181. */
  182. public function get width () : Number;
  183. /**
  184. * @copy fl.core.UIComponent#height * * @see #setSize() * @see #width * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  185. */
  186. public function get height () : Number;
  187. /**
  188. * Gets or sets a Boolean value that indicates whether the scroll bar is enabled. * A value of <code>true</code> indicates that the scroll bar is enabled; a value of * <code>false</code> indicates that it is not. * * @default true * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  189. */
  190. public function get enabled () : Boolean;
  191. /**
  192. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  193. */
  194. public function set enabled (value:Boolean) : void;
  195. /**
  196. * Gets or sets the current scroll position and updates the position * of the thumb. The <code>scrollPosition</code> value represents a relative position between * the <code>minScrollPosition</code> and <code>maxScrollPosition</code> values. * * @default 0 * * @see #setScrollProperties() * @see #minScrollPosition * @see #maxScrollPosition * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  197. */
  198. public function get scrollPosition () : Number;
  199. /**
  200. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  201. */
  202. public function set scrollPosition (newScrollPosition:Number) : void;
  203. /**
  204. * Gets or sets a number that represents the minimum scroll position. The * <code>scrollPosition</code> value represents a relative position between the * <code>minScrollPosition</code> and the <code>maxScrollPosition</code> values. * This property is set by the component that contains the scroll bar, * and is usually zero. * * @default 0 * * @see #setScrollProperties() * @see #maxScrollPosition * @see #scrollPosition * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  205. */
  206. public function get minScrollPosition () : Number;
  207. /**
  208. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  209. */
  210. public function set minScrollPosition (value:Number) : void;
  211. /**
  212. * Gets or sets a number that represents the maximum scroll position. The * <code>scrollPosition</code> value represents a relative position between the * <code>minScrollPosition</code> and the <code>maxScrollPosition</code> values. * This property is set by the component that contains the scroll bar, * and is the maximum value. Usually this property describes the number * of pixels between the bottom of the component and the bottom of * the content, but this property is often set to a different value to change the * behavior of the scrolling. For example, the TextArea component sets this * property to the <code>maxScrollH</code> value of the text field, so that the * scroll bar scrolls appropriately by line of text. * * @default 0 * * @see #setScrollProperties() * @see #minScrollPosition * @see #scrollPosition * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  213. */
  214. public function get maxScrollPosition () : Number;
  215. /**
  216. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  217. */
  218. public function set maxScrollPosition (value:Number) : void;
  219. /**
  220. * Gets or sets the number of lines that a page contains. The <code>lineScrollSize</code> * is measured in increments between the <code>minScrollPosition</code> and * the <code>maxScrollPosition</code>. If this property is 0, the scroll bar * will not scroll. * * @default 10 * * @see #maxScrollPosition * @see #minScrollPosition * @see #setScrollProperties() * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  221. */
  222. public function get pageSize () : Number;
  223. /**
  224. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  225. */
  226. public function set pageSize (value:Number) : void;
  227. /**
  228. * Gets or sets a value that represents the increment by which the page is scrolled * when the scroll bar track is pressed. The <code>pageScrollSize</code> value is * measured in increments between the <code>minScrollPosition</code> and the * <code>maxScrollPosition</code> values. If this value is set to 0, the value of the * <code>pageSize</code> property is used. * * @default 0 * * @see #maxScrollPosition * @see #minScrollPosition * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  229. */
  230. public function get pageScrollSize () : Number;
  231. /**
  232. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  233. */
  234. public function set pageScrollSize (value:Number) : void;
  235. /**
  236. * Gets or sets a value that represents the increment by which to scroll the page * when the scroll bar track is pressed. The <code>pageScrollSize</code> is measured * in increments between the <code>minScrollPosition</code> and the <code>maxScrollPosition</code> * values. If this value is set to 0, the value of the <code>pageSize</code> property is used. * * @default 0 * * @see #maxScrollPosition * @see #minScrollPosition * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  237. */
  238. public function get lineScrollSize () : Number;
  239. /**
  240. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  241. */
  242. public function set lineScrollSize (value:Number) : void;
  243. /**
  244. * Gets or sets a value that indicates whether the scroll bar scrolls horizontally or vertically. * Valid values are <code>ScrollBarDirection.HORIZONTAL</code> and * <code>ScrollBarDirection.VERTICAL</code>. * * @default ScrollBarDirection.VERTICAL * * @see fl.controls.ScrollBarDirection ScrollBarDirection * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  245. */
  246. public function get direction () : String;
  247. /**
  248. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  249. */
  250. public function set direction (value:String) : void;
  251. /**
  252. * @copy fl.core.UIComponent#getStyleDefinition() * * @see fl.core.UIComponent#getStyle() * @see fl.core.UIComponent#setStyle() * @see fl.managers.StyleManager * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  253. */
  254. public static function getStyleDefinition () : Object;
  255. /**
  256. * @copy fl.core.UIComponent#setSize() * * @see #height * @see #width * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  257. */
  258. public function setSize (width:Number, height:Number) : void;
  259. /**
  260. * Sets the range and viewport size of the ScrollBar component. The ScrollBar * component updates the state of the arrow buttons and size of the scroll * thumb accordingly. All of the scroll properties are relative to the * scale of the <code>minScrollPosition</code> and the <code>maxScrollPosition</code>. * Each number between the maximum and minumum values represents one scroll position. * * @param pageSize Size of one page. Determines the size of the thumb, and the increment by which the scroll bar moves when the arrows are clicked. * @param minScrollPosition Bottom of the scrolling range. * @param maxScrollPosition Top of the scrolling range. * @param pageScrollSize Increment to move when a track is pressed, in pixels. * * @see #maxScrollPosition * @see #minScrollPosition * @see #pageScrollSize * @see #pageSize * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  261. */
  262. public function setScrollProperties (pageSize:Number, minScrollPosition:Number, maxScrollPosition:Number, pageScrollSize:Number = 0) : void;
  263. /**
  264. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  265. */
  266. protected function configUI () : void;
  267. /**
  268. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  269. */
  270. protected function draw () : void;
  271. /**
  272. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  273. */
  274. protected function scrollPressHandler (event:ComponentEvent) : void;
  275. /**
  276. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  277. */
  278. protected function thumbPressHandler (event:MouseEvent) : void;
  279. /**
  280. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  281. */
  282. protected function handleThumbDrag (event:MouseEvent) : void;
  283. /**
  284. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  285. */
  286. protected function thumbReleaseHandler (event:MouseEvent) : void;
  287. /**
  288. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  289. */
  290. public function setScrollPosition (newScrollPosition:Number, fireEvent:Boolean = true) : void;
  291. /**
  292. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  293. */
  294. protected function setStyles () : void;
  295. /**
  296. * @private * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  297. */
  298. protected function updateThumb () : void;
  299. }
  300. }