PageRenderTime 3790ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/client/lib/haxegui/controls/UiList.hx

http://github.com/ericmuyser/mmo
Haxe | 773 lines | 393 code | 165 blank | 215 comment | 31 complexity | 2ffae5916e261497ae09262e095732f2 MD5 | raw file
  1. // Copyright (c) 2009 The haxegui developers
  2. //
  3. // Permission is hereby granted, free of charge, to any person obtaining a copy of
  4. // this software and associated documentation files (the "Software"), to deal in
  5. // the Software without restriction, including without limitation the rights to
  6. // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  7. // the Software, and to permit persons to whom the Software is furnished to do so,
  8. // subject to the following conditions:
  9. //
  10. // The above copyright notice and this permission notice shall be included in all
  11. // copies or substantial portions of the Software.
  12. //
  13. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  15. // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  16. // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  17. // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  18. // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  19. package haxegui.controls;
  20. //{{{ imports
  21. import flash.display.DisplayObject;
  22. import flash.display.DisplayObjectContainer;
  23. import flash.display.Sprite;
  24. import flash.events.Event;
  25. import flash.events.MouseEvent;
  26. import flash.geom.Rectangle;
  27. import flash.text.TextField;
  28. import flash.text.TextFormat;
  29. import haxegui.DataSource;
  30. import haxegui.XmlParser;
  31. import haxegui.controls.Component;
  32. import haxegui.controls.IData;
  33. import haxegui.controls.Seperator;
  34. import haxegui.events.DataEvent;
  35. import haxegui.events.DragEvent;
  36. import haxegui.events.ListEvent;
  37. import haxegui.events.MoveEvent;
  38. import haxegui.events.ResizeEvent;
  39. import haxegui.managers.CursorManager;
  40. import haxegui.managers.DragManager;
  41. import haxegui.managers.StyleManager;
  42. import haxegui.toys.Arrow;
  43. import haxegui.utils.Color;
  44. import haxegui.utils.Opts;
  45. import haxegui.utils.Size;
  46. //}}}
  47. using haxegui.controls.Component;
  48. using haxegui.utils.Color;
  49. //{{{ ListSelectionMode
  50. enum ListSelectionMode {
  51. SINGLE;
  52. MULTI;
  53. }
  54. //}}}
  55. //{{{ ListHeader
  56. /**
  57. * List header with labels, seperators and an arrow to show the sort direction.<br/>
  58. *
  59. * @todo Sharing single header among multiple lists, to create a multi-column datagrid like widget...
  60. *
  61. * @version 0.1
  62. * @author Omer Goshen <gershon@goosemoose.com>
  63. * @author Russell Weir'
  64. *
  65. */
  66. class ListHeader extends AbstractButton, implements IComposite {
  67. public var labels : Array<Label>;
  68. public var seperators : Array<Seperator>;
  69. public var arrow : Arrow;
  70. static var xml = Xml.parse('
  71. <haxegui:Layout name="ListHeader">
  72. <haxegui:controls:Label x="4" y="2" text="{parent.parent.description}"/>
  73. <haxegui:toys:Arrow
  74. x="this.prevSibling().x + this.prevSibling().width + 12"
  75. y="12"
  76. width="8"
  77. height="8"
  78. color="{Color.darken(parent.color, 20)}"
  79. rotation="{parent.parent.sortReverse ? -90 : 90}"
  80. mouseEnabled="false"
  81. />
  82. <haxegui:controls:Seperator
  83. x="this.prevSibling().x + this.prevSibling().width + 18"
  84. y="12"
  85. />
  86. </haxegui:Layout>
  87. ').firstElement();
  88. //{{{ init
  89. /**
  90. * @throws String when not parented to a [UiList]
  91. */
  92. override public function init(opts:Dynamic=null) {if(!Std.is(parent, UiList)) throw parent+" not a UiList";
  93. if(!Std.is(parent, UiList)) throw parent+" not a UiList";
  94. box = new Size(140, 24).toRect();
  95. color = DefaultStyle.BACKGROUND;
  96. super.init(opts);
  97. xml.set("name", name);
  98. XmlParser.apply(ListHeader.xml, this);
  99. arrow = cast firstChild().asComponent().nextSibling();
  100. labels = [cast firstChild()];
  101. seperators = [cast arrow.nextSibling()];
  102. parent.addEventListener(ResizeEvent.RESIZE, onParentResize, false, 0, true);
  103. } //}}}
  104. //{{{ onMouseDown
  105. override public function onMouseDown(e:MouseEvent) : Void {
  106. // if(Std.is(e.target, Label)) {
  107. // e.target.startDrag(false, new Rectangle(0, e.target.y, box.width - e.target.box.width, 0));
  108. // CursorManager.getInstance().lock = true;
  109. // return;
  110. // }
  111. super.onMouseDown(e);
  112. }
  113. //}}}
  114. //{{{ onMouseUp
  115. override public function onMouseUp(e:MouseEvent) : Void {
  116. if(Std.is(e.target, Label)) {
  117. e.target.stopDrag();
  118. //~ e.stopImmediatePropagation();
  119. CursorManager.getInstance().lock = false;
  120. return;
  121. }
  122. super.onMouseUp(e);
  123. }
  124. //}}}
  125. //{{{ onParentResize
  126. public function onParentResize(e:ResizeEvent) {
  127. box.width = parent.asComponent().box.width;
  128. dirty = true;
  129. }
  130. //}}}
  131. ///{{{ destroy
  132. public override function destroy() {
  133. removeEventListener(MoveEvent.MOVE, (cast parent).onHeaderMoved);
  134. parent.removeEventListener(ResizeEvent.RESIZE, onParentResize);
  135. super.destroy();
  136. }
  137. //}}}
  138. //{{{ __init__
  139. static function __init__() {
  140. haxegui.Haxegui.register(ListHeader);
  141. }
  142. //}}}
  143. }
  144. //}}}
  145. //{{{ ListItem
  146. /**
  147. *
  148. * ListItem Class
  149. *
  150. * @todo Add an ICellRenderer interface maybe?
  151. *
  152. * @version 0.1
  153. * @author Omer Goshen <gershon@goosemoose.com>
  154. * @author Russell Weir'
  155. *
  156. */
  157. class ListItem extends AbstractButton, implements IData, implements IRubberBand, implements IAggregate {
  158. public var label : Label;
  159. public var selected (__getSelected, __setSelected): Bool;
  160. public var data : Dynamic;
  161. var oldPos : flash.geom.Point;
  162. var oldParent : flash.display.DisplayObjectContainer;
  163. static var layoutXml = Xml.parse('
  164. <haxegui:Layout name="ListItem">
  165. <haxegui:controls:Label x="4" y="2" height="{parent.box.height}" color="0xFF0000"/>
  166. </haxegui:Layout>
  167. ').firstElement();
  168. static var styleXml = Xml.parse('
  169. <haxegui:Style name="ListItem">
  170. <haxegui:controls:ListItem>
  171. <events>
  172. <script type="text/hscript" action="mouseClick">
  173. <![CDATA[
  174. this.toggleSelection();
  175. parent.rowData = [this.data];
  176. // if(!Std.is(parent, controls.PopupMenu)) return;
  177. var i = parent.getChildIndex(this);
  178. if(i>0) {
  179. var o = parent.prevSibling();
  180. while(o!=null && Std.is(o, controls.UiList)) {
  181. if(o.numChildren>=i) {
  182. var item = o.getChildAt(i);
  183. item.__setSelected(this.__getSelected());
  184. parent.rowData.push(item.data);
  185. }
  186. o = o.prevSibling();
  187. }}
  188. parent.rowData.push(this.data);
  189. var o = parent.nextSibling();
  190. while(o!=null && Std.is(o, controls.UiList)) {
  191. if(o.numChildren>=i) {
  192. var item = o.getChildAt(i);
  193. item.__setSelected(this.__getSelected());
  194. parent.rowData.push(item.data);
  195. }
  196. o = o.nextSibling();
  197. }
  198. ]]>
  199. </script>
  200. </events>
  201. </haxegui:controls:ListItem>
  202. </haxegui:Style>
  203. ').firstElement();
  204. //{{{ init
  205. override public function init(opts:Dynamic=null) {
  206. if(!Std.is(parent, UiList) && !Std.is(parent, PopupMenu)) throw parent+" not a UiList";
  207. haxegui.Profiler.begin(here.className.split(".").pop()+"."+here.methodName);
  208. box = new Size(140, 24).toRect();
  209. color = DefaultStyle.INPUT_BACK;
  210. oldParent = parent;
  211. data = name;
  212. super.init(opts);
  213. mouseChildren = false;
  214. // xml.set("name", name);
  215. XmlParser.apply(ListItem.styleXml, true);
  216. XmlParser.apply(ListItem.layoutXml, this);
  217. description = null;
  218. label = cast firstChild();
  219. label.setText(Opts.optString(opts, "label", name));
  220. // label.mouseEnabled = false;
  221. try {
  222. data = Opts.classInstance(opts, "data", untyped [String, Float, Int, Bool, Dynamic]);
  223. }
  224. catch(e:Dynamic) {
  225. data = name;
  226. }
  227. parent.addEventListener(ResizeEvent.RESIZE, onParentResize, false, 0, true);
  228. haxegui.Profiler.end();
  229. }
  230. //}}}
  231. //{{{ onParentResize
  232. /**
  233. * @todo when inside a grid, being a DataGrid no need to redraw all listitems...
  234. */
  235. public function onParentResize(e:ResizeEvent) {
  236. haxegui.Profiler.begin(here.className.split(".").pop()+"."+here.methodName);
  237. box.width = Std.int((cast parent).box.width);
  238. for(i in this) {
  239. if(Std.is(i, Component)) {
  240. if(!Math.isNaN((cast i).left)) {
  241. i.x = Std.int((cast i).left);
  242. }
  243. else
  244. if(!Math.isNaN((cast i).right)) {
  245. i.x = Std.int(box.width - (cast i).box.width - (cast i).right);
  246. }
  247. if(!Math.isNaN((cast i).left) && !Math.isNaN((cast i).right)) {
  248. i.x = Std.int((cast i).left);
  249. (cast i).box.width = Std.int(box.width - (cast i).right - i.x);
  250. (cast i).dispatchEvent(new ResizeEvent(ResizeEvent.RESIZE));
  251. }
  252. if(!Math.isNaN((cast i).top)) {
  253. i.y = Std.int((cast i).top);
  254. }
  255. else
  256. if(!Math.isNaN((cast i).bottom)) {
  257. i.y = Std.int(box.height - (cast i).box.height - (cast i).bottom);
  258. }
  259. if(!Math.isNaN((cast i).top) && !Math.isNaN((cast i).bottom)) {
  260. i.y = Std.int((cast i).top);
  261. (cast i).box.height = Std.int(box.height - (cast i).bottom - i.y);
  262. (cast i).dispatchEvent(new ResizeEvent(ResizeEvent.RESIZE));
  263. }
  264. }
  265. }
  266. // label.dispatchEvent(new ResizeEvent(ResizeEvent.RESIZE));
  267. // label.redraw();
  268. // dirty = true;
  269. var self = this;
  270. haxe.Timer.delay(function() self.dirty=true, 20);
  271. // dispatchEvent(new ResizeEvent(ResizeEvent.RESIZE));
  272. haxegui.Profiler.end();
  273. }
  274. //}}}
  275. private function __getSelected() : Bool {
  276. return selected;
  277. }
  278. private function __setSelected(b:Bool) : Bool {
  279. selected = b;
  280. color = selected ? DefaultStyle.FOCUS : DefaultStyle.INPUT_BACK;
  281. color = (parent.getChildIndex(this)&1==0)? color : color.darken(10);
  282. redraw();
  283. return selected;
  284. }
  285. public function select() {
  286. selected = true;
  287. }
  288. public function deselect() {
  289. selected = false;
  290. }
  291. public function toggleSelection() : Bool {
  292. return (selected = !selected);
  293. }
  294. //{{{ destroy
  295. public override function destroy() {
  296. parent.removeEventListener(ResizeEvent.RESIZE, onParentResize);
  297. super.destroy();
  298. }
  299. //}}}
  300. //{{{ onChanged
  301. public function onChanged(e:Event) {
  302. }
  303. //}}}
  304. //{{{ __init__
  305. static function __init__() {
  306. haxegui.Haxegui.register(ListItem);
  307. }
  308. //}}}
  309. }
  310. //}}}
  311. //{{{ UiList
  312. /**
  313. *
  314. * Sortable List Class.<br/>
  315. *
  316. * The list will follow it's header if moved.
  317. *
  318. * @todo implements ArrayAccess<ListItem>
  319. *
  320. * @version 0.1
  321. * @author Omer Goshen <gershon@goosemoose.com>
  322. * @author Russell Weir'
  323. *
  324. */
  325. class UiList extends Component, implements IDataSource, implements ArrayAccess<ListItem> {
  326. //{{{ Members
  327. /** Header for this list **/
  328. public var header : ListHeader;
  329. /** [Array] of items **/
  330. public var items : List<ListItem>;
  331. // public var selectedIndex (default, null) : Null<Int>;
  332. // public var selectedIndexes (default, null) : Array<Null<Int>>;
  333. // public var selectedItem (default, null) : ListItem;
  334. // public var selectedItems (default, null) : Array<ListItem>;
  335. public var selectionMode : ListSelectionMode;
  336. /** DataSource **/
  337. public var dataSource(default, setDataSource) : DataSource;
  338. /** sort direction, default (false) is ascending **/
  339. public var sortReverse : Bool;
  340. /** true to enable dragging of items **/
  341. public var dragEnabled : Bool;
  342. /** true to enable dropping of items **/
  343. public var dropEnabled : Bool;
  344. public var lastSelected : ListItem;
  345. public var rowData : Array<Dynamic>;
  346. static var layoutXml = Xml.parse('
  347. <haxegui:Layout name="UiList">
  348. <haxegui:controls:ListHeader width="{parent.box.width}" color="{parent.color}"/>
  349. </haxegui:Layout>
  350. ').firstElement();
  351. static var styleXml = Xml.parse('
  352. <haxegui:Style name="UiList">
  353. <haxegui:controls:UiList>
  354. <events>
  355. <script type="text/hscript" action="mouseClick">
  356. <![CDATA[
  357. ]]>
  358. </script>
  359. <script type="text/hscript" action="redraw">
  360. <![CDATA[
  361. this.graphics.clear();
  362. this.graphics.lineStyle(1, Color.darken(DefaultStyle.BACKGROUND, 20), 1);
  363. this.graphics.beginFill(this.empty() ? DefaultStyle.INPUT_BACK : Color.darken(DefaultStyle.BACKGROUND, 10) );
  364. this.graphics.drawRect(-1,-1, this.box.width+1, this.box.height+1);
  365. this.graphics.endFill();
  366. ]]>
  367. </script>
  368. </events>
  369. </haxegui:controls:UiList>
  370. </haxegui:Style>
  371. ').firstElement();
  372. //}}}
  373. //{{{ init
  374. public override function init(opts : Dynamic=null) {
  375. box = new Size(140, 100).toRect();
  376. color = DefaultStyle.BACKGROUND;
  377. items = new List<ListItem>();
  378. minSize = new Size(60,24);
  379. sortReverse = false;
  380. // dataSource = new DataSource();
  381. // dataSource.data = ["1", "2", "3", "4"];
  382. super.init(opts);
  383. // xml.set("name", name);
  384. haxegui.XmlParser.apply(UiList.styleXml, true);
  385. haxegui.XmlParser.apply(UiList.layoutXml, this);
  386. // if(opts == null) opts = {}
  387. // if(opts.innerData!=null)
  388. // data = opts.innerData.split(",");
  389. // if(opts.data!=null)
  390. // data = opts.data;
  391. header = cast firstChild();
  392. parent.addEventListener(ResizeEvent.RESIZE, onParentResize, false, 0, true);
  393. header.addEventListener(ResizeEvent.RESIZE, onHeaderResize, false, 0, true);
  394. header.addEventListener(MoveEvent.MOVE, onHeaderMoved, false, 0, true);
  395. // addEventListener(ListEvent.CHANGE, onData, false, 0, true);
  396. if(dataSource==null) return;
  397. dataSource.addEventListener(DataEvent.CHANGE, onData, false, 0, true);
  398. dataSource.dispatchEvent(new DataEvent(DataEvent.CHANGE));
  399. addEventListener(ListEvent.CHANGE, onData, false, 0, true);
  400. }
  401. //}}}
  402. // public function clearSelection() {}
  403. // public function setSelected(i:ListItem) : ListItem {}
  404. // public function setSelectedIndex(i:Int) : Int {}
  405. // public function getSelected() : ListItem {}
  406. // public function getSelectedIndex() : Int {}
  407. // public function getSelectedItems() : Array<ListItem> {}
  408. // public function getSelectedIndices() : Array<Int> {}
  409. // public function setSelectedItems(l:Array<ListItem>) : Array<ListItem> {}
  410. // public function setSelectedIndices(i:Array<Int>) : Array<Int> {}
  411. public function empty() : Bool {
  412. return getElementsByClass(ListItem).hasNext();
  413. }
  414. //{{{ onHeaderResized
  415. public function onHeaderResize(e:ResizeEvent) {
  416. // box = header.box.clone();
  417. // dirty = true;
  418. // dispatchEvent(new ResizeEvent(ResizeEvent.RESIZE));
  419. }
  420. // }}}
  421. //{{{ setDataSource
  422. public function setDataSource(d:DataSource) : DataSource {
  423. dataSource = d;
  424. dataSource.addEventListener(DataEvent.CHANGE, onData, false, 0, true);
  425. var l = 0;
  426. if(Std.is(dataSource.data, Array) || Std.is(dataSource.data, List))
  427. l = dataSource.data.length;
  428. dataSource.dispatchEvent(new DataEvent(DataEvent.CHANGE, 0, l));
  429. // dispatchEvent(new ListEvent(ListEvent.CHANGE));
  430. return dataSource;
  431. }
  432. //}}}
  433. //{{{ onHeaderMoved
  434. public function onHeaderMoved(e:MoveEvent) {
  435. this.move(header.x, header.y);
  436. // x = header.x;
  437. // y = header.y;
  438. header.x = header.y = 0;
  439. }
  440. //}}}
  441. //{{{ addChild
  442. override function addChild(child : DisplayObject) : DisplayObject {
  443. if(Std.is(child, ListItem)) items.push(cast child);
  444. return super.addChild(child);
  445. }
  446. //}}}
  447. //{{{ onParentResize
  448. private function onParentResize(e:ResizeEvent) : Void {
  449. // if(Std.is(parent, haxegui.containers.Divider) || Std.is(parent, haxegui.containers.Grid)) return;
  450. dispatchEvent(new ResizeEvent(ResizeEvent.RESIZE));
  451. }
  452. //}}}
  453. //{{{ onResize
  454. public override function onResize(e:ResizeEvent) : Void {
  455. // header.box.width = box.width;
  456. // header.dirty = true;
  457. // dirty = true;
  458. // header.redraw();
  459. super.onResize(e);
  460. }
  461. //}}}
  462. //{{{ onMouseDown
  463. public override function onMouseDown(e:MouseEvent) {
  464. //addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove, false, 0, true);
  465. super.onMouseDown(e);
  466. }
  467. //}}}
  468. //{{{ onMouseDown
  469. public override function onMouseUp(e:MouseEvent) {
  470. //removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
  471. super.onMouseUp(e);
  472. }
  473. //}}}
  474. //{{{ onMouseMove
  475. public function onMouseMove(e:MouseEvent) {
  476. // if(!e.buttonDown) return;
  477. // if(!Std.is(e.target, ListItem)) return;
  478. // if(lastSelected==e.target) return;
  479. // e.target.toggleSelection();
  480. // if(e.target.selected) lastSelected = e.target;
  481. }
  482. //}}}
  483. //{{{ onItemMouseUp
  484. public function onItemMouseUp(e:MouseEvent) : Void {
  485. e.target.dispatchEvent (new DragEvent (DragEvent.DRAG_COMPLETE));
  486. e.target.x = 0;
  487. // e.target.y = dragItem * 20;
  488. // setChildIndex(e.target, dragItem);
  489. }
  490. //}}}
  491. //{{{ removeItems
  492. public function removeItems() {
  493. for(i in getElementsByClass(ListItem))
  494. i.destroy();
  495. }
  496. //}}}
  497. //{{{ redraw
  498. override public function redraw(opts:Dynamic=null) {
  499. // this.graphics.clear();
  500. // this.graphics.beginFill(this.color);
  501. // this.graphics.drawRect(0, 0, box.width, box.height);
  502. // this.graphics.endFill();
  503. // for(i in 0...Std.int(box.height/20)) {
  504. // this.graphics.beginFill( (i&1==0) ? this.color : Color.darken(this.color, 10));
  505. // this.graphics.drawRect(0, 24*i, box.width, 24);
  506. // this.graphics.endFill();
  507. // }
  508. super.redraw(opts);
  509. }
  510. //}}}
  511. //{{{ destroy
  512. public override function destroy() {
  513. parent.removeEventListener(ResizeEvent.RESIZE, onParentResize);
  514. super.destroy();
  515. }
  516. //}}}
  517. //{{{ onData
  518. /**
  519. * @todo Xml
  520. */
  521. public function onData(?e:DataEvent) {
  522. // if(dataSource==null) return;
  523. haxegui.Profiler.begin(here.className.split(".").pop()+"."+here.methodName);
  524. if(Std.is(dataSource.data, Array)) {
  525. var data = cast(dataSource.data, Array<Dynamic>);
  526. for (i in e.startIndex...e.endIndex-1) {
  527. if(i<numChildren) {
  528. var item = cast getChildAt(i);
  529. if(Std.is(item, ListItem)) {
  530. item.label.setText(data[i]);
  531. box.width = Math.max( box.width, item.label.tf.width + 8 );
  532. }
  533. }
  534. else {
  535. var item = new ListItem(this, 0, 24*i+1);
  536. item.init({
  537. // width: box.width,
  538. color: (i&1==0) ? DefaultStyle.INPUT_BACK : DefaultStyle.INPUT_BACK.darken(10),
  539. label: data[i],
  540. data: data[i]
  541. });
  542. // box.width = Math.max( box.width, item.label.tf.width + 8 );
  543. }
  544. }
  545. }
  546. else
  547. if(Std.is(dataSource.data, List)) {
  548. var j=0;
  549. var data = cast(dataSource.data, List<Dynamic>);
  550. var items : Iterator<Dynamic> = data.iterator();
  551. for(i in items) {
  552. var item = new ListItem(this, 0, 24+24*j+1);
  553. item.init({
  554. color: (j&1==0) ? DefaultStyle.INPUT_BACK : DefaultStyle.INPUT_BACK.darken(10),
  555. label: i,
  556. data: i
  557. });
  558. // box.width = Math.max( box.width, item.label.tf.width + 8 );
  559. j++;
  560. }
  561. }
  562. dispatchEvent(new ResizeEvent(ResizeEvent.RESIZE));
  563. haxegui.Profiler.end();
  564. }
  565. //}}}
  566. //{{{ __init__
  567. static function __init__() {
  568. haxegui.Haxegui.register(UiList);
  569. }
  570. //}}}
  571. }
  572. //}}}
  573. //{{{ ListBox
  574. /**
  575. * Alias for a [UiList] with a [ScrollBar]
  576. * @todo
  577. */
  578. class ListBox extends UiList {
  579. public var scrollbar : ScrollBar;
  580. //{{{ init
  581. public override function init(opts:Dynamic=null) {
  582. super.init(opts);
  583. scrollbar = new ScrollBar(this);
  584. scrollbar.init({target: null, height: box.height});
  585. scrollbar.addEventListener(Event.CHANGE, onScroll, false, 0, true);
  586. scrollRect = box.clone();
  587. }
  588. //}}}
  589. //{{{ onScroll
  590. public function onScroll(e:Event) {
  591. // trace(e);
  592. }
  593. //}}}
  594. //{{{ onResize
  595. public override function onResize(e:ResizeEvent) {
  596. scrollbar.moveTo(0, 24);
  597. scrollbar.toFront();
  598. scrollRect = box.clone();
  599. super.onResize(e);
  600. }
  601. //}}}
  602. //{{{ __init__
  603. static function __init__() {
  604. haxegui.Haxegui.register(ListBox);
  605. }
  606. //}}}
  607. }
  608. //}}}