PageRenderTime 57ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/FD3/FlashDevelop/Bin/Debug/Library/AS3/frameworks/FlashIDE/fl/containers/ScrollPane.as

https://bitbucket.org/kkszysiu/flashdevelop
ActionScript | 251 lines | 82 code | 4 blank | 165 comment | 0 complexity | 0d5450248bb15c97e977fb7865469c0c MD5 | raw file
  1. package fl.containers
  2. {
  3. import fl.containers.BaseScrollPane;
  4. import fl.controls.ScrollBar;
  5. import fl.controls.ScrollPolicy;
  6. import fl.core.InvalidationType;
  7. import fl.core.UIComponent;
  8. import fl.events.ScrollEvent;
  9. import fl.managers.IFocusManagerComponent;
  10. import flash.display.DisplayObject;
  11. import flash.display.Loader;
  12. import flash.display.Sprite;
  13. import flash.events.Event;
  14. import flash.events.KeyboardEvent;
  15. import flash.events.MouseEvent;
  16. import flash.events.ProgressEvent;
  17. import flash.events.SecurityErrorEvent;
  18. import flash.events.IOErrorEvent;
  19. import flash.events.HTTPStatusEvent;
  20. import flash.geom.Rectangle;
  21. import flash.net.URLRequest;
  22. import flash.system.ApplicationDomain;
  23. import flash.system.LoaderContext;
  24. import flash.ui.Keyboard;
  25. /**
  26. * @copy BaseScrollPane#event:scroll * * @includeExample examples/ScrollPane.scroll.1.as -noswf * * @eventType fl.events.ScrollEvent.SCROLL * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  27. */
  28. [Event(name="scroll", type="fl.events.ScrollEvent")]
  29. /**
  30. * Dispatched while content is loading. * * @eventType flash.events.ProgressEvent.PROGRESS * * @includeExample examples/ScrollPane.percentLoaded.1.as -noswf * * @see #event:complete * @see #bytesLoaded * @see #bytesTotal * @see #percentLoaded * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  31. */
  32. [Event(name="progress", type="flash.events.ProgressEvent")]
  33. /**
  34. * Dispatched when content has finished loading. * * @includeExample examples/ScrollPane.complete.1.as -noswf * * @eventType flash.events.Event.COMPLETE * * @see #event:progress * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  35. */
  36. [Event(name="complete", type="flash.events.Event")]
  37. /**
  38. * Dispatched when the properties and methods of a loaded SWF file are accessible. * The following conditions must exist for this event to be dispatched: * <ul> * <li>All the properties and methods that are associated with the loaded object, * as well as those that are associated with the component, must be accessible.</li> * <li>The constructors for all child objects must have completed.</li> * </ul> * * @eventType flash.events.Event.INIT * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  39. */
  40. [Event("init", type="flash.events.Event")]
  41. /**
  42. * Dispatched after an input or output error occurs. * * @includeExample examples/UILoader.ioError.1.as -noswf * * @eventType flash.events.IOErrorEvent.IO_ERROR * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  43. */
  44. [Event("ioError", type="flash.events.IOErrorEvent")]
  45. /**
  46. * Dispatched after a network operation starts. * * @eventType flash.events.Event.OPEN * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  47. */
  48. [Event("open", type="flash.events.Event")]
  49. /**
  50. * Dispatched after a security error occurs while content is loading. * * @eventType flash.events.SecurityErrorEvent.SECURITY_ERROR * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  51. */
  52. [Event("securityError", type="flash.events.SecurityErrorEvent")]
  53. /**
  54. * Dispatched when content is loading. This event is dispatched regardless of * whether the load operation was triggered by an auto-load process or an explicit call to the * <code>load()</code> method. * * @includeExample examples/UILoader.progress.1.as -noswf * * @eventType flash.events.ProgressEvent.PROGRESS * * @see #event:complete * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  55. */
  56. [Event("progress", type="flash.events.ProgressEvent")]
  57. /**
  58. * The skin that shows when the scroll pane is disabled. * * @default ScrollPane_disabledSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  59. */
  60. [Style(name="disabledSkin", type="Class")]
  61. /**
  62. * The default skin shown on the scroll pane. * * @default ScrollPane_upSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  63. */
  64. [Style(name="upSkin", type="Class")]
  65. /**
  66. * The amount of padding to put around the content in the scroll pane, in pixels. * * @default 0 * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  67. */
  68. [Style(name="contentPadding", type="Number", format="Length")]
  69. /**
  70. * The ScrollPane component displays display objects and JPEG, GIF, and PNG files, * as well as SWF files, in a scrollable area. You can use a scroll pane to * limit the screen area that is occupied by these media types. * The scroll pane can display content that is loaded from a local * disk or from the Internet. You can set this content while * authoring and, at run time, by using ActionScript. After the scroll * pane has focus, if its content has valid tab stops, those * markers receive focus. After the last tab stop in the content, * focus moves to the next component. The vertical and horizontal * scroll bars in the scroll pane do not receive focus. * * <p><strong>Note:</strong> When content is being loaded from a different * domain or <em>sandbox</em>, the properties of the content may be inaccessible * for security reasons. For more information about how domain security * affects the load process, see the Loader class.</p> * * <p><strong>Note:</strong> When loading very large image files into a ScrollPane object, * it may be necessary to listen for the <code>complete</code> event and then resize the * ScrollPane using the <code>setSize()</code> method. See the <code>complete</code> * event example.</p> * * @see flash.display.Loader Loader * * @includeExample examples/ScrollPaneExample.as -noswf * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  71. */
  72. public class ScrollPane extends BaseScrollPane implements IFocusManagerComponent
  73. {
  74. /**
  75. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  76. */
  77. protected var _source : Object;
  78. /**
  79. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  80. */
  81. protected var _scrollDrag : Boolean;
  82. /**
  83. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  84. */
  85. protected var contentClip : Sprite;
  86. /**
  87. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  88. */
  89. protected var loader : Loader;
  90. /**
  91. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  92. */
  93. protected var xOffset : Number;
  94. /**
  95. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  96. */
  97. protected var yOffset : Number;
  98. /**
  99. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  100. */
  101. protected var scrollDragHPos : Number;
  102. /**
  103. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  104. */
  105. protected var scrollDragVPos : Number;
  106. /**
  107. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  108. */
  109. protected var currentContent : Object;
  110. /**
  111. * @private * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  112. */
  113. private static var defaultStyles : Object;
  114. /**
  115. * Gets or sets a value that indicates whether scrolling occurs when a * user drags on content within the scroll pane. A value of <code>true</code> * indicates that scrolling occurs when a user drags on the content; a value * of <code>false</code> indicates that it does not. * * @default false * * @includeExample examples/ScrollPane.scrollDrag.1.as -noswf * * @see #event:scroll * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  116. */
  117. public function get scrollDrag () : Boolean;
  118. /**
  119. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  120. */
  121. public function set scrollDrag (value:Boolean) : void;
  122. /**
  123. * Gets a number between 0 and 100 indicating what percentage of the content is loaded. * If you are loading assets from your library, and not externally loaded content, * the <code>percentLoaded</code> property is set to 0. * * @default 0 * * @includeExample examples/ScrollPane.percentLoaded.1.as -noswf * * @see #bytesLoaded * @see #bytesTotal * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  124. */
  125. public function get percentLoaded () : Number;
  126. /**
  127. * Gets the count of bytes of content that have been loaded. * When this property equals the value of <code>bytesTotal</code>, * all the bytes are loaded. * * @default 0 * * @see #bytesTotal * @see #percentLoaded * * @includeExample examples/ScrollPane.bytesLoaded.1.as -noswf * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  128. */
  129. public function get bytesLoaded () : Number;
  130. /**
  131. * Gets the count of bytes of content to be loaded. * * @default 0 * * @includeExample examples/ScrollPane.percentLoaded.1.as -noswf * * @see #bytesLoaded * @see #percentLoaded * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  132. */
  133. public function get bytesTotal () : Number;
  134. /**
  135. * Gets a reference to the content loaded into the scroll pane. * * @default null * * @includeExample examples/ScrollPane.content.1.as -noswf * @includeExample examples/ScrollPane.content.2.as -noswf * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  136. */
  137. public function get content () : DisplayObject;
  138. /**
  139. * Gets or sets an absolute or relative URL that identifies the * location of the SWF or image file to load, the class name * of a movie clip in the library, a reference to a display object, * or a instance name of a movie clip on the same level as the component. * * <p>Valid image file formats include GIF, PNG, and JPEG. To load an * asset by using a URLRequest object, use the <code>load()</code> * method.</p> * * @default null * * @includeExample examples/ScrollPane.source.1.as -noswf * @includeExample examples/ScrollPane.source.2.as -noswf * * @see #load() * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  140. */
  141. public function get source () : Object;
  142. /**
  143. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  144. */
  145. public function set source (value:Object) : void;
  146. /**
  147. * @copy fl.core.UIComponent#getStyleDefinition() * * @includeExample ../core/examples/UIComponent.getStyleDefinition.1.as -noswf * * @see fl.core.UIComponent#getStyle() UIComponent.getStyle() * @see fl.core.UIComponent#setStyle() UIComponent.setStyle() * @see fl.managers.StyleManager StyleManager * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  148. */
  149. public static function getStyleDefinition () : Object;
  150. /**
  151. * Creates a new ScrollPane component instance. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  152. */
  153. public function ScrollPane ();
  154. /**
  155. * Reloads the contents of the scroll pane. * * <p> This method does not redraw the scroll bar. To reset the * scroll bar, use the <code>update()</code> method.</p> * * @includeExample examples/ScrollPane.refreshPane.1.as -noswf * * @see #update() * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  156. */
  157. public function refreshPane () : void;
  158. /**
  159. * Refreshes the scroll bar properties based on the width * and height of the content. This is useful if the content * of the ScrollPane changes during run time. * * @includeExample examples/ScrollPane.update.1.as -noswf * * @see #refreshPane() * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  160. */
  161. public function update () : void;
  162. /**
  163. * The request parameter of this method accepts only a URLRequest object * whose <code>source</code> property contains a string, a class, or a * URLRequest object. * * By default, the LoaderContext object uses the current domain as the * application domain. To specify a different application domain value, * to check a policy file, or to change the security domain, initialize * a new LoaderContext object and pass it to this method. * * @param request The URLRequest object to use to load an image into the scroll pane. * @param context The LoaderContext object that sets the context of the load operation. * * @see #source * @see fl.containers.UILoader#load() UILoader.load() * @see flash.net.URLRequest * @see flash.system.ApplicationDomain * @see flash.system.LoaderContext * * @includeExample examples/ScrollPane.load.1.as -noswf * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  164. */
  165. public function load (request:URLRequest, context:LoaderContext = null) : void;
  166. /**
  167. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  168. */
  169. protected function setVerticalScrollPosition (scrollPos:Number, fireEvent:Boolean = false) : void;
  170. /**
  171. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  172. */
  173. protected function setHorizontalScrollPosition (scrollPos:Number, fireEvent:Boolean = false) : void;
  174. /**
  175. * @private (protected)
  176. */
  177. protected function drawLayout () : void;
  178. /**
  179. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  180. */
  181. protected function onContentLoad (event:Event) : void;
  182. /**
  183. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  184. */
  185. protected function passEvent (event:Event) : void;
  186. /**
  187. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  188. */
  189. protected function initLoader () : void;
  190. /**
  191. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  192. */
  193. protected function handleScroll (event:ScrollEvent) : void;
  194. /**
  195. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  196. */
  197. protected function handleError (event:Event) : void;
  198. /**
  199. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  200. */
  201. protected function handleInit (event:Event) : void;
  202. /**
  203. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  204. */
  205. protected function clearLoadEvents () : void;
  206. /**
  207. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  208. */
  209. protected function doDrag (event:MouseEvent) : void;
  210. /**
  211. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  212. */
  213. protected function doStartDrag (event:MouseEvent) : void;
  214. /**
  215. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  216. */
  217. protected function endDrag (event:MouseEvent) : void;
  218. /**
  219. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  220. */
  221. protected function setScrollDrag () : void;
  222. /**
  223. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  224. */
  225. protected function draw () : void;
  226. /**
  227. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  228. */
  229. protected function drawBackground () : void;
  230. /**
  231. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  232. */
  233. protected function clearContent () : void;
  234. /**
  235. * @private * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  236. */
  237. protected function keyDownHandler (event:KeyboardEvent) : void;
  238. /**
  239. * @private
  240. */
  241. protected function calculateAvailableHeight () : Number;
  242. /**
  243. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  244. */
  245. protected function configUI () : void;
  246. }
  247. }