PageRenderTime 30ms CodeModel.GetById 17ms RepoModel.GetById 11ms app.codeStats 0ms

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

https://bitbucket.org/kkszysiu/flashdevelop
ActionScript | 314 lines | 100 code | 4 blank | 210 comment | 0 complexity | c62c0dc0b69ffeadda4c905bbacfacba MD5 | raw file
  1. package fl.controls
  2. {
  3. import fl.controls.listClasses.CellRenderer;
  4. import fl.controls.listClasses.ICellRenderer;
  5. import fl.controls.listClasses.ImageCell;
  6. import fl.controls.listClasses.ListData;
  7. import fl.controls.listClasses.TileListData;
  8. import fl.controls.ScrollBar;
  9. import fl.controls.ScrollBarDirection;
  10. import fl.controls.ScrollPolicy;
  11. import fl.controls.SelectableList;
  12. import fl.core.InvalidationType;
  13. import fl.core.UIComponent;
  14. import fl.data.DataProvider;
  15. import fl.data.TileListCollectionItem;
  16. import fl.events.DataChangeEvent;
  17. import fl.events.DataChangeType;
  18. import fl.events.ListEvent;
  19. import fl.events.ScrollEvent;
  20. import fl.managers.IFocusManagerComponent;
  21. import flash.display.DisplayObject;
  22. import flash.display.Sprite;
  23. import flash.events.MouseEvent;
  24. import flash.events.Event;
  25. import flash.events.KeyboardEvent;
  26. import flash.ui.Keyboard;
  27. import flash.utils.Dictionary;
  28. /**
  29. * The skin to be used as the background of the TileList component. * * @default TileList_skin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  30. */
  31. [Style(name="skin", type="Class")]
  32. /**
  33. * The cell renderer to be used to render each item in the TileList component. * * @default fl.contols.listClasses.ImageCell * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  34. */
  35. [Style(name="cellRenderer", type="Class")]
  36. /**
  37. * The TileList class provides a grid of rows and columns that is typically used * to format and display images in a "tiled" format. The default cell renderer for * this component is the ImageCell class. An ImageCell cell renderer displays a * thumbnail image and a single-line label. To render a list-based cell in a * TileList component, use the CellRenderer class. * * <p>To modify the padding that separates the cell border from the image, you * can globally set the <code>imagePadding</code> style, or set it on the ImageCell * class. Like other cell styles, the <code>imagePadding</code> style cannot be * set on the TileList component instance.</p> * * @see fl.controls.listClasses.CellRenderer * @see fl.controls.listClasses.ImageCell * * @includeExample examples/TileListExample.as * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  38. */
  39. public class TileList extends SelectableList implements IFocusManagerComponent
  40. {
  41. /**
  42. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  43. */
  44. protected var _rowHeight : Number;
  45. /**
  46. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  47. */
  48. protected var _columnWidth : Number;
  49. /**
  50. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  51. */
  52. protected var _scrollDirection : String;
  53. /**
  54. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  55. */
  56. protected var _scrollPolicy : String;
  57. /**
  58. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  59. */
  60. protected var _cellRenderer : Object;
  61. /**
  62. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  63. */
  64. protected var oldLength : uint;
  65. /**
  66. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  67. */
  68. protected var _labelField : String;
  69. /**
  70. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  71. */
  72. protected var _labelFunction : Function;
  73. /**
  74. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  75. */
  76. protected var _iconField : String;
  77. /**
  78. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  79. */
  80. protected var _iconFunction : Function;
  81. /**
  82. * @private (protected)
  83. */
  84. protected var _sourceField : String;
  85. /**
  86. * @private (protected)
  87. */
  88. protected var _sourceFunction : Function;
  89. /**
  90. * @private (protected)
  91. */
  92. protected var __rowCount : uint;
  93. /**
  94. * @private (protected)
  95. */
  96. protected var __columnCount : uint;
  97. /**
  98. * @private
  99. */
  100. private var collectionItemImport : TileListCollectionItem;
  101. /**
  102. * @private * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  103. */
  104. private static var defaultStyles : Object;
  105. /**
  106. * @private * Method for creating the Accessibility class. * This method is called from UIComponent. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  107. */
  108. public static var createAccessibilityImplementation : Function;
  109. /**
  110. * @copy fl.controls.SelectableList#dataProvider * * @includeExample examples/TileList.dataProvider.1.as -noswf * @includeExample examples/TileList.dataProvider.2.as -noswf * @includeExample examples/TileList.dataProvider.3.as -noswf * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  111. */
  112. public function get dataProvider () : DataProvider;
  113. /**
  114. * @private (setter)
  115. */
  116. public function set dataProvider (value:DataProvider) : void;
  117. /**
  118. * Gets or sets a field in each item that contains a label for each tile. * * <p><strong>Note:</strong> The <code>labelField</code> is not used if * the <code>labelFunction</code> property is set to a callback function.</p> * * @default "label" * * @includeExample examples/TileList.labelField.1.as -noswf * * @see #labelFunction * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  119. */
  120. public function get labelField () : String;
  121. /**
  122. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  123. */
  124. public function set labelField (value:String) : void;
  125. /**
  126. * Gets a function that indicates the fields of an item that provide the label text for a tile. * * <p><strong>Note:</strong> The <code>labelField</code> is not used if * the <code>labelFunction</code> property is set to a callback function.</p> * * @default null * * @includeExample examples/TileList.labelFunction.1.as -noswf * * @see #labelField * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  127. */
  128. public function get labelFunction () : Function;
  129. /**
  130. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  131. */
  132. public function set labelFunction (value:Function) : void;
  133. /**
  134. * Gets or sets the item field that provides the icon for the item. * * <p><strong>Note:</strong> The <code>iconField</code> is not used * if the <code>iconFunction</code> property is set to a callback function.</p> * * <p>Icons can be classes or they can be symbols from the library that have a class name.</p> * * @default null * * @includeExample examples/TileList.iconField.1.as -noswf * * @see #iconFunction * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  135. */
  136. public function get iconField () : String;
  137. /**
  138. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  139. */
  140. public function set iconField (value:String) : void;
  141. /**
  142. * Gets or sets the function to be used to obtain the icon for the item. * * <p><strong>Note:</strong> The <code>iconField</code> is not used if the * <code>iconFunction</code> property is set to a callback function.</p> * * <p>Icons can be classes, or they can be library items that have class names.</p> * * @default null * * @includeExample examples/TileList.iconFunction.1.as -noswf * * @see #iconField * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  143. */
  144. public function get iconFunction () : Function;
  145. /**
  146. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  147. */
  148. public function set iconFunction (value:Function) : void;
  149. /**
  150. * Gets or sets the item field that provides the source path for a tile. * * <p><strong>Note:</strong> The <code>sourceField</code> is not used if the * <code>sourceFunction</code> property is set to a callback function.</p> * * @default "source" * * @includeExample examples/TileList.sourceField.1.as -noswf * * @see #sourceFunction * * @langversion 3.0 * @playerversion Flash 9.0.28.0 *
  151. */
  152. public function get sourceField () : String;
  153. /**
  154. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  155. */
  156. public function set sourceField (value:String) : void;
  157. /**
  158. * Gets or sets the function to be used to obtain the source path for a tile. * * <p><strong>Note:</strong> The <code>sourceField</code> is not used if the * <code>sourceFunction</code> property is set to a callback function.</p> * * @default null * * @includeExample examples/TileList.sourceFunction.1.as -noswf * * @see #sourceField * * @internal [peter] Check with Metaliq that this is still accurate. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  159. */
  160. public function get sourceFunction () : Function;
  161. /**
  162. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  163. */
  164. public function set sourceFunction (value:Function) : void;
  165. /**
  166. * Gets or sets the number of rows that are at least partially visible * in the list. * * <p>Setting the <code>rowCount</code> property changes the height of the * list, but the TileList component does not maintain this value. It * is important to set the <code>rowCount</code> value <em>after</em> setting the * <code>dataProvider</code> and <code>rowHeight</code> values. The only * exception is if the <code>rowCount</code> is set with the Property * inspector; in this case, the property is maintained until the component * is first drawn.</p> * * @default 0 * * @includeExample examples/TileList.rowCount.1.as -noswf * * @see #columnCount * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  167. */
  168. public function get rowCount () : uint;
  169. /**
  170. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  171. */
  172. public function set rowCount (value:uint) : void;
  173. /**
  174. * Gets or sets the height that is applied to each row in the list, in pixels. * * @default 50 * * @includeExample examples/TileList.rowHeight.1.as -noswf * * @see #columnWidth * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  175. */
  176. public function get rowHeight () : Number;
  177. /**
  178. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  179. */
  180. public function set rowHeight (value:Number) : void;
  181. /**
  182. * Gets or sets the number of columns that are at least partially visible in the * list. Setting the <code>columnCount</code> property changes the width of the list, * but the TileList component does not maintain this value. It is important to set the * <code>columnCount</code> value <em>after</em> setting the <code>dataProvider</code> * and <code>rowHeight</code> values. The only exception is if the <code>rowCount</code> * is set with the Property inspector; in this case, the property is maintained until the * component is first drawn. * * @default 0 * * @includeExample examples/TileList.columnCount.1.as -noswf * * @see #rowCount * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  183. */
  184. public function get columnCount () : uint;
  185. /**
  186. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  187. */
  188. public function set columnCount (value:uint) : void;
  189. /**
  190. * Gets or sets the width that is applied to a column in the list, in pixels. * * @default 50 * * @includeExample examples/TileList.columnWidth.1.as -noswf * * @see #rowHeight * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  191. */
  192. public function get columnWidth () : Number;
  193. /**
  194. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  195. */
  196. public function set columnWidth (value:Number) : void;
  197. /**
  198. * Gets the width of the content area, in pixels. This value is the component width * minus the combined width of the <code>contentPadding</code> value and vertical scroll bar, * if the vertical scroll bar is visible. * * @includeExample examples/TileList.innerWidth.1.as -noswf * * @see #innerHeight * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  199. */
  200. public function get innerWidth () : Number;
  201. /**
  202. * Gets the height of the content area, in pixels. This value is the component height * minus the combined height of the <code>contentPadding</code> value and horizontal * scroll bar height, if the horizontal scroll bar is visible. * * @see #innerWidth * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  203. */
  204. public function get innerHeight () : Number;
  205. /**
  206. * Gets or sets a value that indicates whether the TileList component scrolls * horizontally or vertically. A value of <code>ScrollBarDirection.HORIZONTAL</code> * indicates that the TileList component scrolls horizontally; a value of * <code>ScrollBarDirection.VERTICAL</code> indicates that the TileList component scrolls vertically. * * @default ScrollBarDirection.VERTICAL * * @includeExample examples/TileList.direction.1.as -noswf * * @see ScrollBarDirection * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  207. */
  208. public function get direction () : String;
  209. /**
  210. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  211. */
  212. public function set direction (value:String) : void;
  213. /**
  214. * Gets or sets the scroll policy for the TileList component. This * value is used to specify the scroll policy for the scroll bar that * is set by the <code>direction</code> property. * * <p><strong>Note:</strong> The TileList component supports scrolling only in * one direction. Tiles are adjusted to fit into the viewable area of * the component, so that tiles are hidden in only one direction.</p> * * <p>The TileList component resizes to fit tiles only when the user * manually sets the size or when the user sets the <code>rowCount</code> * or <code>columnCount</code> properties.</p> * * <p>When this value is set to <code>ScrollPolicy.AUTO</code>, the * scroll bar is visible only when the TileList component must scroll * to show all the items.</p> * * @default ScrollPolicy.AUTO * * @includeExample examples/TileList.scrollPolicy.1.as -noswf * * @see #columnCount * @see #rowCount * @see ScrollPolicy * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  215. */
  216. public function get scrollPolicy () : String;
  217. /**
  218. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  219. */
  220. public function set scrollPolicy (value:String) : void;
  221. /**
  222. * @private (hidden) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  223. */
  224. public function get verticalScrollPolicy () : String;
  225. /**
  226. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  227. */
  228. public function set verticalScrollPolicy (value:String) : void;
  229. /**
  230. * @private (hidden) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  231. */
  232. public function get horizontalScrollPolicy () : String;
  233. /**
  234. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  235. */
  236. public function set horizontalScrollPolicy (value:String) : void;
  237. /**
  238. * Gets the maximum horizontal scroll position for the current content, in pixels. * * @see fl.containers.BaseScrollPane#horizontalScrollPosition * @see fl.containers.BaseScrollPane#maxVerticalScrollPosition * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  239. */
  240. public function get maxHorizontalScrollPosition () : Number;
  241. /**
  242. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  243. */
  244. public function set maxHorizontalScrollPosition (value:Number) : void;
  245. /**
  246. * @copy fl.core.UIComponent#getStyleDefinition() * * @includeExample ../core/examples/UIComponent.getStyleDefinition.1.as -noswf * * @see fl.core.UIComponent#getStyle() * @see fl.core.UIComponent#setStyle() * @see fl.managers.StyleManager * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  247. */
  248. public static function getStyleDefinition () : Object;
  249. /**
  250. * Creates a new List component instance. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  251. */
  252. public function TileList ();
  253. /**
  254. * @copy fl.controls.SelectableList#scrollToIndex() * * @includeExample examples/TileList.scrollToIndex.1.as -noswf * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  255. */
  256. public function scrollToIndex (newCaretIndex:int) : void;
  257. /**
  258. * Retrieves the string that the renderer displays for a given data object * based on the <code>labelField</code> and <code>labelFunction</code> properties. * * @param item The Object to be rendered. * * @return The string to be displayed based on the data. * * @internal <code>var label:String = myTileList.itemToLabel(data);</code> * * @see #labelField * @see #labelFunction * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  259. */
  260. public function itemToLabel (item:Object) : String;
  261. /**
  262. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  263. */
  264. protected function configUI () : void;
  265. /**
  266. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  267. */
  268. protected function setHorizontalScrollPosition (scroll:Number, fireEvent:Boolean = false) : void;
  269. /**
  270. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  271. */
  272. protected function setVerticalScrollPosition (scroll:Number, fireEvent:Boolean = false) : void;
  273. /**
  274. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  275. */
  276. protected function draw () : void;
  277. /**
  278. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  279. */
  280. protected function drawLayout () : void;
  281. /**
  282. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  283. */
  284. protected function drawList () : void;
  285. /**
  286. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  287. */
  288. protected function keyDownHandler (event:KeyboardEvent) : void;
  289. /**
  290. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  291. */
  292. protected function calculateAvailableHeight () : Number;
  293. /**
  294. * @private (protected) * Moves the selection in a vertical direction in response * to the user selecting items using the up-arrow or down-arrow * Keys and modifiers such as the Shift and Ctrl keys. * * @param code The key that was pressed (e.g. Keyboard.DOWN) * * @param shiftKey <code>true</code> if the shift key was held down when * the keyboard key was pressed. * * @param ctrlKey <code>true</code> if the ctrl key was held down when * the keyboard key was pressed * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  295. */
  296. protected function moveSelectionVertically (code:uint, shiftKey:Boolean, ctrlKey:Boolean) : void;
  297. /**
  298. * @private (protected) * Moves the selection in a horizontal direction in response * to the user selecting items using the left-arrow or right-arrow * keys and modifiers such as the Shift and Ctrl keys. * * <p>Not implemented in List because the default list * is single column and does not scroll horizontally.</p> * * @param code The key that was pressed (e.g. Keyboard.LEFT) * * @param shiftKey <code>true</code> if the shift key was held down when * the keyboard key was pressed. * * @param ctrlKey <code>true</code> if the ctrl key was held down when * the keyboard key was pressed * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  299. */
  300. protected function moveSelectionHorizontally (code:uint, shiftKey:Boolean, ctrlKey:Boolean) : void;
  301. /**
  302. * @private (protected) * Changes the selected index, or adds or subtracts the index and * all indices between when the shift key is used. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  303. */
  304. protected function doKeySelection (newCaretIndex:uint, shiftKey:Boolean, ctrlKey:Boolean) : void;
  305. /**
  306. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  307. */
  308. protected function initializeAccessibility () : void;
  309. }
  310. }