Mercurial > projects > dynamin
comparison dynamin/gui/button.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 | aa4efef0f0b1 |
children | 60832e1eef04 |
comparison
equal
deleted
inserted
replaced
9:682fa50ab831 | 10:ccc108b25a0a |
---|---|
132 auto extents = g.getTextExtents(text); | 132 auto extents = g.getTextExtents(text); |
133 g.drawText(text, (width-extents.width)/2, (height-extents.height)/2); | 133 g.drawText(text, (width-extents.width)/2, (height-extents.height)/2); |
134 } | 134 } |
135 | 135 |
136 public: | 136 public: |
137 /// Override this method in a subclass to handle the Clicked event. | 137 /// Override this method in a subclass to handle the clicked event. |
138 protected void whenClicked(EventArgs e) { } | 138 protected void whenClicked(EventArgs e) { } |
139 /// This event occurs after the button has been clicked. | 139 /// This event occurs after the button has been clicked. |
140 Event!() clicked; | 140 Event!(whenClicked) clicked; |
141 | 141 |
142 this() { | 142 this() { |
143 clicked = new Event!()(&whenClicked); | 143 clicked.mainHandler = &whenClicked; |
144 _focusable = true; | 144 _focusable = true; |
145 } | 145 } |
146 this(string text) { | 146 this(string text) { |
147 this(); | 147 this(); |
148 this.text = text; | 148 this.text = text; |