Mercurial > projects > dynamin
comparison dynamin/gui/list_box.d @ 10:ccc108b25a0a
Convert to using a struct for events. Fix some comments too.
author | Jordan Miner <jminer7@gmail.com> |
---|---|
date | Wed, 15 Jul 2009 21:22:20 -0500 |
parents | b621b528823d |
children | c138461bf845 |
comparison
equal
deleted
inserted
replaced
9:682fa50ab831 | 10:ccc108b25a0a |
---|---|
76 focus(); | 76 focus(); |
77 selectedIndex = cast(int)e.y/13; | 77 selectedIndex = cast(int)e.y/13; |
78 } | 78 } |
79 public: | 79 public: |
80 | 80 |
81 /// Override this method in a subclass to handle the SelectionChanged event. | 81 /// Override this method in a subclass to handle the selectionChanged event. |
82 protected void whenSelectionChanged(EventArgs e) { } | 82 protected void whenSelectionChanged(EventArgs e) { } |
83 /// This event occurs after the selection has changed. | 83 /// This event occurs after the selection has changed. |
84 Event!() selectionChanged; | 84 Event!(whenSelectionChanged) selectionChanged; |
85 | 85 |
86 void listItemsChanged() { | 86 void listItemsChanged() { |
87 super.layout(); | 87 super.layout(); |
88 repaint(); | 88 repaint(); |
89 } | 89 } |
90 | 90 |
91 /// | 91 /// |
92 this() { | 92 this() { |
93 selectionChanged = new Event!()(&whenSelectionChanged); | 93 selectionChanged.mainHandler = &whenSelectionChanged; |
94 _items = new List!(string)(&listItemsChanged); | 94 _items = new List!(string)(&listItemsChanged); |
95 | 95 |
96 super(); | 96 super(); |
97 _focusable = true; | 97 _focusable = true; |
98 // TODO: hack | 98 // TODO: hack |