Mercurial > projects > dynamin
diff dynamin/gui/control.d @ 8:b621b528823d
whenXX methods have to come before the event if switched to template mixins.
author | Jordan Miner <jminer7@gmail.com> |
---|---|
date | Wed, 15 Jul 2009 14:04:55 -0500 |
parents | 4029d5af7542 |
children | ccc108b25a0a |
line wrap: on
line diff
--- a/dynamin/gui/control.d Wed Jul 15 13:59:16 2009 -0500 +++ b/dynamin/gui/control.d Wed Jul 15 14:04:55 2009 -0500 @@ -73,74 +73,6 @@ Container _parent; bool _elasticX, _elasticY; public: - /// This event occurs after the control has been moved. - Event!() moved; - /// Override this method in a subclass to handle the Moved event. - protected void whenMoved(EventArgs e) { } - - /// This event occurs after the control has been resized. - Event!() resized; - /// Override this method in a subclass to handle the Resized event. - protected void whenResized(EventArgs e) { } - - /// This event occurs after the mouse has entered the control. - Event!() mouseEntered; - /// Override this method in a subclass to handle the MouseEntered event. - protected void whenMouseEntered(EventArgs e) { } - - /// This event occurs after the mouse has left the control. - Event!() mouseLeft; - /// Override this method in a subclass to handle the MouseLeft event. - protected void whenMouseLeft(EventArgs e) { } - - /// This event occurs after a mouse button is pressed. - Event!(MouseEventArgs) mouseDown; - /// Override this method in a subclass to handle the MouseDown event. - protected void whenMouseDown(MouseEventArgs e) { } - - /// This event occurs after a mouse button is released. - Event!(MouseEventArgs) mouseUp; - /// Override this method in a subclass to handle the MouseUp event. - protected void whenMouseUp(MouseEventArgs e) { } - - /// This event occurs after the mouse has been moved. - Event!(MouseEventArgs) mouseMoved; - /// Override this method in a subclass to handle the MouseMoved event. - protected void whenMouseMoved(MouseEventArgs e) { } - - /// This event occurs after the mouse has been moved. - Event!(MouseEventArgs) mouseDragged; - /// Override this method in a subclass to handle the MouseMoved event. - protected void whenMouseDragged(MouseEventArgs e) { } - - /// This event occurs after the mouse wheel has been turned. - Event!(MouseTurnedEventArgs) mouseTurned; - /// Override this method in a subclass to handle the MouseTurned event. - protected void whenMouseTurned(MouseTurnedEventArgs e) { } - - /// This event occurs after a key is pressed. - Event!(KeyEventArgs) keyDown; - /// Override this method in a subclass to handle the KeyDown event. - protected void whenKeyDown(KeyEventArgs e) { } - - /// This event occurs after a character key is pressed. - Event!(KeyTypedEventArgs) keyTyped; - /// Override this method in a subclass to handle the KeyTyped event. - protected void whenKeyTyped(KeyTypedEventArgs e) { } - - /// This event occurs after a key is released. - Event!(KeyEventArgs) keyUp; - /// Override this method in a subclass to handle the KeyUp event. - protected void whenKeyUp(KeyEventArgs e) { } - - /// This event occurs when the control needs to be painted. - Event!(PaintingEventArgs) painting; - /// Override this method in a subclass to handle the painting event. - protected void whenPainting(PaintingEventArgs e) { - e.graphics.source = backColor; - e.graphics.paint(); - } - protected void dispatchMouseEntered(EventArgs e) { Cursor.setCurrent(this, _cursor); mouseEntered.callHandlers(e); @@ -182,6 +114,74 @@ e.graphics.restore(); } + /// Override this method in a subclass to handle the Moved event. + protected void whenMoved(EventArgs e) { } + /// This event occurs after the control has been moved. + Event!() moved; + + /// Override this method in a subclass to handle the Resized event. + protected void whenResized(EventArgs e) { } + /// This event occurs after the control has been resized. + Event!() resized; + + /// Override this method in a subclass to handle the MouseEntered event. + protected void whenMouseEntered(EventArgs e) { } + /// This event occurs after the mouse has entered the control. + Event!() mouseEntered; + + /// Override this method in a subclass to handle the MouseLeft event. + protected void whenMouseLeft(EventArgs e) { } + /// This event occurs after the mouse has left the control. + Event!() mouseLeft; + + /// Override this method in a subclass to handle the MouseDown event. + protected void whenMouseDown(MouseEventArgs e) { } + /// This event occurs after a mouse button is pressed. + Event!(MouseEventArgs) mouseDown; + + /// Override this method in a subclass to handle the MouseUp event. + protected void whenMouseUp(MouseEventArgs e) { } + /// This event occurs after a mouse button is released. + Event!(MouseEventArgs) mouseUp; + + /// Override this method in a subclass to handle the MouseMoved event. + protected void whenMouseMoved(MouseEventArgs e) { } + /// This event occurs after the mouse has been moved. + Event!(MouseEventArgs) mouseMoved; + + /// Override this method in a subclass to handle the MouseMoved event. + protected void whenMouseDragged(MouseEventArgs e) { } + /// This event occurs after the mouse has been moved. + Event!(MouseEventArgs) mouseDragged; + + /// Override this method in a subclass to handle the MouseTurned event. + protected void whenMouseTurned(MouseTurnedEventArgs e) { } + /// This event occurs after the mouse wheel has been turned. + Event!(MouseTurnedEventArgs) mouseTurned; + + /// Override this method in a subclass to handle the KeyDown event. + protected void whenKeyDown(KeyEventArgs e) { } + /// This event occurs after a key is pressed. + Event!(KeyEventArgs) keyDown; + + /// Override this method in a subclass to handle the KeyTyped event. + protected void whenKeyTyped(KeyTypedEventArgs e) { } + /// This event occurs after a character key is pressed. + Event!(KeyTypedEventArgs) keyTyped; + + /// Override this method in a subclass to handle the KeyUp event. + protected void whenKeyUp(KeyEventArgs e) { } + /// This event occurs after a key is released. + Event!(KeyEventArgs) keyUp; + + /// Override this method in a subclass to handle the painting event. + protected void whenPainting(PaintingEventArgs e) { + e.graphics.source = backColor; + e.graphics.paint(); + } + /// This event occurs when the control needs to be painted. + Event!(PaintingEventArgs) painting; + this() { moved = new Event!()(&whenMoved); resized = new Event!()(&whenResized);