changeset 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 1311fae1ca9b
children 682fa50ab831
files dynamin/gui/check_box.d dynamin/gui/container.d dynamin/gui/control.d dynamin/gui/list_box.d dynamin/gui/notebook.d dynamin/gui/scroll_bar.d dynamin/gui/text_box.d
diffstat 7 files changed, 82 insertions(+), 82 deletions(-) [+]
line wrap: on
line diff
--- a/dynamin/gui/check_box.d	Wed Jul 15 13:59:16 2009 -0500
+++ b/dynamin/gui/check_box.d	Wed Jul 15 14:04:55 2009 -0500
@@ -58,10 +58,10 @@
 	}
 
 public:
+	/// Override this method in a subclass to handle the SelectedChanged event.
+	protected void whenCheckedChanged(EventArgs e) { }
 	/// This event occurs after .
 	Event!() checkedChanged;
-	/// Override this method in a subclass to handle the SelectedChanged event.
-	protected void whenCheckedChanged(EventArgs e) { }
 	this() {
 		checkedChanged = new Event!()(&whenCheckedChanged);
 		_focusable = true;
--- a/dynamin/gui/container.d	Wed Jul 15 13:59:16 2009 -0500
+++ b/dynamin/gui/container.d	Wed Jul 15 14:04:55 2009 -0500
@@ -45,15 +45,15 @@
 		layout();
 	}
 public:
-	/// This event occurs after the control's minimum size has been changed.
-	Event!() minSizeChanged;
 	/// Override this method in a subclass to handle the minSizeChanged event.
 	protected void whenMinSizeChanged(EventArgs e) { }
+	/// This event occurs after the control's minimum size has been changed.
+	Event!() minSizeChanged;
 
+	/// Override this method in a subclass to handle the maxSizeChanged event.
+	protected void whenMaxSizeChanged(EventArgs e) { }
 	/// This event occurs after the control's maximum size has been changed.
 	Event!() maxSizeChanged;
-	/// Override this method in a subclass to handle the maxSizeChanged event.
-	protected void whenMaxSizeChanged(EventArgs e) { }
 
 	this() {
 		minSizeChanged = new Event!()(&whenMinSizeChanged);
--- 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);
--- a/dynamin/gui/list_box.d	Wed Jul 15 13:59:16 2009 -0500
+++ b/dynamin/gui/list_box.d	Wed Jul 15 14:04:55 2009 -0500
@@ -78,10 +78,10 @@
 	}
 public:
 
+	/// Override this method in a subclass to handle the SelectionChanged event.
+	protected void whenSelectionChanged(EventArgs e) { }
 	/// This event occurs after the selection has changed.
 	Event!() selectionChanged;
-	/// Override this method in a subclass to handle the SelectionChanged event.
-	protected void whenSelectionChanged(EventArgs e) { }
 
 	void listItemsChanged() {
 		super.layout();
--- a/dynamin/gui/notebook.d	Wed Jul 15 13:59:16 2009 -0500
+++ b/dynamin/gui/notebook.d	Wed Jul 15 14:04:55 2009 -0500
@@ -99,10 +99,10 @@
 		layout();
 	}
 public:
+	/// Override this method in a subclass to handle the SelectionChanged event.
+	protected void whenSelectionChanged(EventArgs e) {
 	/// This event occurs after a different tab is selected.
 	Event!() selectionChanged;
-	/// Override this method in a subclass to handle the SelectionChanged event.
-	protected void whenSelectionChanged(EventArgs e) {
 		if(_content !is null)
 			_children.remove(_content);
 		_content = null;
--- a/dynamin/gui/scroll_bar.d	Wed Jul 15 13:59:16 2009 -0500
+++ b/dynamin/gui/scroll_bar.d	Wed Jul 15 14:04:55 2009 -0500
@@ -163,10 +163,10 @@
 		               [buttonSz, track1Sz, thumbSz, track2Sz, buttonSz]);
 	}
 public:
+	/// Override this method in a subclass to handle the ValueChanged event.
+	protected void whenValueChanged(EventArgs e) { }
 	/// This event occurs after Value has been changed.
 	Event!() valueChanged;
-	/// Override this method in a subclass to handle the ValueChanged event.
-	protected void whenValueChanged(EventArgs e) { }
 
 	override Size bestSize() {
 		if(cast(VScrollBar)this)
--- a/dynamin/gui/text_box.d	Wed Jul 15 13:59:16 2009 -0500
+++ b/dynamin/gui/text_box.d	Wed Jul 15 14:04:55 2009 -0500
@@ -107,10 +107,10 @@
 	}
 	override int baseline() { return 14; }
 
+	/// Override this method in a subclass to handle the SelectionChanged event.
+	protected void whenSelectionChanged(EventArgs e) { }
 	/// This event occurs after the selection has changed.
 	Event!() SelectionChanged;
-	/// Override this method in a subclass to handle the SelectionChanged event.
-	protected void whenSelectionChanged(EventArgs e) { }
 
 	this() {
 		SelectionChanged = new Event!()(&whenSelectionChanged);