changeset 5:4029d5af7542

Add blank lines and rewrap some comments.
author Jordan Miner <jminer7@gmail.com>
date Sat, 20 Jun 2009 12:26:40 -0500
parents fc2420d39e3c
children c41eb8d907b2
files dynamin/gui/container.d dynamin/gui/control.d dynamin/gui/directory_dialog.d dynamin/gui/file_dialog.d dynamin/gui/notebook.d dynamin/gui/scrollable.d dynamin/gui/window.d
diffstat 7 files changed, 59 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/dynamin/gui/container.d	Sat Jun 20 10:23:31 2009 -0500
+++ b/dynamin/gui/container.d	Sat Jun 20 12:26:40 2009 -0500
@@ -114,6 +114,7 @@
 			super.dispatchMouseDragged(e);
 		}
 	}
+
 	/**
 	 * Gets the child control at the specified point. If there are
 	 * multiple child controls at the point, the topmost control is returned.
@@ -138,6 +139,7 @@
 		}
 		return null;
 	}
+
 	/**
 	 * Never returns null. If there is no descendant at the specified point,
 	 * this container will be returned.
@@ -167,6 +169,7 @@
 			}
 		}
 	}
+
 	/**
 	 * Gets or sets the minimum size of this window. A minimum width or
 	 * height of 0 means that there is no minimum width or height.
@@ -187,6 +190,7 @@
 	real minWidth() { return _minSize.width; }
 	///
 	real minHeight() { return _minSize.height; }
+
 	/**
 	 * Gets or sets the maximum size of this window. A maximum width or
 	 * height of 0 means that there is no maximum width or height.
@@ -207,6 +211,7 @@
 	real maxWidth() { return _maxSize.width; }
 	///
 	real maxHeight() { return _maxSize.height; }
+
 	/**
 	 * Causes this container to position its child controls. Called on every
 	 * resize. Usually, this function will get each child's best size, and
@@ -215,6 +220,7 @@
 	 */
 	void layout() {
 	}
+
 	protected void add(Control child) {
 		if(child.parent)
 			child.parent.remove(child);
@@ -223,12 +229,14 @@
 		repaint();
 		//ControlAdded(EventArgs e); // TODO: add event
 	}
+
 	protected void remove(Control child) {
 		_children.remove(child);
 		child.parent = null;
 		repaint();
 		//ControlRemoved(EventArgs e); // TODO: add event
 	}
+
 	protected int opApply(int delegate(inout Control item) dg) {
 		for(uint i = 0; i < _children.count; ++i) {
 			auto tmp = _children[i];
--- a/dynamin/gui/control.d	Sat Jun 20 10:23:31 2009 -0500
+++ b/dynamin/gui/control.d	Sat Jun 20 12:26:40 2009 -0500
@@ -181,6 +181,7 @@
 		painting.callHandlers(e);
 		e.graphics.restore();
 	}
+
 	this() {
 		moved = new Event!()(&whenMoved);
 		resized = new Event!()(&whenResized);
@@ -210,6 +211,7 @@
 		_foreColor = Color.Black;
 		_font = new Font("Tahoma", 11);
 	}
+
 	protected Graphics quickCreateGraphics() {
 		if(_parent is null)
 			return null;
@@ -217,6 +219,7 @@
 		g.translate(location);
 		return g;
 	}
+
 	/**
 	 * Sets the specified Graphics' font and source to this control's font
 	 * and foreground color. Also, clips to this control's rectangle.
@@ -227,6 +230,7 @@
 		g.font = font;
 		g.source = foreColor;
 	}
+
 	/**
 	 * Creates a Graphics, calls the specified delegate with it, and deletes
 	 * it to release resources.
@@ -237,12 +241,14 @@
 		dg(g);
 		delete g;
 	}
+
 	/**
 	 *
 	 */
 	bool focused() {
 		return _focused;
 	}
+
 	/**
 	 *
 	 */
@@ -262,6 +268,7 @@
 			repaint();
 		}
 	}
+
 	/**
 	 * Returns whether this control is on the screen. A control is
 	 * on screen if one of its ancestors is a top level window. Whether or
@@ -271,6 +278,7 @@
 	bool onScreen() {
 		return _parent && _parent.onScreen;
 	}
+
 	/**
 	 * Gets the location of this control in screen coordinates. An exception is
 	 * thrown if this control is not on the screen.
@@ -280,6 +288,7 @@
 			throw new Exception("control is not on screen");
 		return _parent.screenLocation + location;
 	}
+
 	/**
 	 * Converts the specified point in content coordinates into screen
 	 * coordinates. An exception is thrown if this control is not on the screen.
@@ -289,6 +298,7 @@
 			throw new Exception("control is not on screen");
 		return _parent.contentToScreen(pt + location);
 	}
+
 	/**
 	 * Converts the specified point in screen coordinates into content
 	 * coordinates. An exception is thrown if this control is not on the screen.
@@ -298,6 +308,7 @@
 			throw new Exception("control is not on screen");
 		return _parent.screenToContent(pt) - location; // TODO: borders
 	}
+
 	/**
 	 * Converts the specified point in this control's content coordinates
 	 * into the specified control's content coordinates. An exception is
@@ -306,6 +317,7 @@
 	Point contentToContent(Point pt, Control c) {
 		return c.screenToContent(contentToScreen(pt));
 	}
+
 	/**
 	 * Returns whether the specified point is inside this control.
 	 */
@@ -316,6 +328,7 @@
 	bool contains(real x, real y) {
 		return contains(Point(x, y));
 	}
+
 	bool topLevel() { return false; }
 	// TODO: return NativeControl/Window?
 	Control getTopLevel() {
@@ -324,6 +337,7 @@
 			c = c.parent;
 		return c.topLevel ? c : null;
 	}
+
 	/**
 	 * Gets this control's parent.
 	 */
@@ -332,8 +346,10 @@
 		_parent = c;
 		//ParentChanged(new EventArgs); // TODO: add event
 	}
+
 	/**
-	 * Gets or sets whether is control is visible. The default is true, except on top-level windows.
+	 * Gets or sets whether is control is visible. The default is true, except
+	 * on top-level windows.
 	 */
 	//void visible(bool b) { visible = b; }
 	bool visible() { return _visible; }
@@ -401,6 +417,7 @@
 	 * This property should be overridden in subclasses to return a best size.
 	 */
 	Size bestSize() { return Size(100, 100); }
+
 	/**
 	 * Gets the distance from the top of this control to the baseline of
 	 * the first line of this control's text. If this control does not have
@@ -429,6 +446,7 @@
 	bool elasticY() { return _elasticY; }
 	/// ditto
 	void elasticY(bool b) { _elasticY = b; }
+
 	/**
 	 * Gets or sets the text that this control shows.
 	 */
@@ -477,6 +495,7 @@
 		_font = f;
 		repaint();
 	}
+
 	Cursor cursor() {
 		return _cursor;
 	}
@@ -497,7 +516,8 @@
 	 * are no other system events to be processed, a painting event will called.
 	 */
 	void repaint(Rect rect) {
-		// TODO: make sure that parts clipped off by the parent are not invalidated
+		// TODO: make sure that parts clipped off by the parent are
+		//       not invalidated
 		if(_parent)
 			_parent.repaint(rect + location);
 	}
--- a/dynamin/gui/directory_dialog.d	Sat Jun 20 10:23:31 2009 -0500
+++ b/dynamin/gui/directory_dialog.d	Sat Jun 20 12:26:40 2009 -0500
@@ -50,6 +50,7 @@
 		throw new Exception("Sorry, DirectoryDialog.directory(string) not yet working");
 		_directory = str;
 	}
+
 	DialogResult showDialog() {
 		BROWSEINFO bi;
 		//bi.hwndOwner = ;
--- a/dynamin/gui/file_dialog.d	Sat Jun 20 10:23:31 2009 -0500
+++ b/dynamin/gui/file_dialog.d	Sat Jun 20 12:26:40 2009 -0500
@@ -103,10 +103,12 @@
 		_filters.length = _filters.length + 1;
 		_filters[_filters.length-1] = filter;
 	}
+
 	/// Gets or sets the selected filter. An index of 0 is the first one added.
 	int selectedFilter() { return _selectedFilter; }
 	/// ditto
 	void selectedFilter(int index) { _selectedFilter = index; }
+
 	/**
 	 * Gets or sets whether more than one file can be selected.
 	 * The default is true for an OpenFileDialog and false for SaveFileDialog.
@@ -114,10 +116,12 @@
 	bool multipleSelection() { return _multipleSelection; }
 	/// ditto
 	void multipleSelection(bool b) { _multipleSelection = b;	}
+
 	/// Gets or sets the text that is displayed in the dialog's title bar.
 	string text() { return _text; }
 	/// ditto
 	void text(string str) { _text = str; }
+
 	/**
 	 * Sets the text in the file name text box to the specified string.
 	 * Example:
@@ -129,6 +133,7 @@
 		// TODO: make sure str is not a path?
 		_initialFileName = str;
 	}
+
 	/**
 	 * Sets the directory that the FileDialog shows. If this is null,
 	 * the default directory is used when the dialog is first shown.
@@ -142,6 +147,7 @@
 	string directory() {
 		return _directory;
 	}
+
 	/**
 	 * Gets the files selected by the user.
 	 * If the user did not type a file name extension, the correct one
@@ -154,8 +160,8 @@
 	// TODO: parameters
 	// TODO: should showDialog take any parameters?
 	//       what should happen if no owner is set?
-	//       Windows Forms sets the owner to the currently active window in the application
-	//       do the same? or have no owner (really annoying, as window can get below)?
+	//       WinForms sets the owner to the currently active window in the app
+	//       do the same? or have no owner (annoying, as window can get below)?
 	DialogResult showDialog() {
 		return backend_showDialog();
 	}
--- a/dynamin/gui/notebook.d	Sat Jun 20 10:23:31 2009 -0500
+++ b/dynamin/gui/notebook.d	Sat Jun 20 12:26:40 2009 -0500
@@ -182,6 +182,7 @@
 		}
 		// if here, do nothing
 	}
+
 	bool multipleLines() { return _multipleLines; }
 	void multipleLines(bool b) {
 		if(b == false)
--- a/dynamin/gui/scrollable.d	Sat Jun 20 10:23:31 2009 -0500
+++ b/dynamin/gui/scrollable.d	Sat Jun 20 12:26:40 2009 -0500
@@ -231,6 +231,7 @@
 
 		whenValueChanged(null);
 	}
+
 	/**
 	 * Gets or sets which scroll bars are shown. The default is Each.
 	 */
@@ -239,6 +240,7 @@
 	void visibleScrollBars(VisibleScrollBars bars) { // TODO: rename? SBPolicy?
 		_scrollBars = bars;
 	}
+
 	/**
 	 * Gets whether the horizontal scroll bar is currently shown.
 	 */
@@ -281,6 +283,7 @@
 				_content.bestSize.width > _availableRect.width;
 		}
 	}
+
 	/**
 	 * Gets the combined width of all the controls docked on the left side of
 	 * this scrollable.
@@ -300,7 +303,9 @@
 	Rect contentVisibleRect() {
 		return _visibleRect;
 	}
+
 	Panel content() { return _content; }
+
 	BorderSize borderSize() {
 		return Theme.current.Scrollable_borderSize(this);
 	}
--- a/dynamin/gui/window.d	Sat Jun 20 10:23:31 2009 -0500
+++ b/dynamin/gui/window.d	Sat Jun 20 12:26:40 2009 -0500
@@ -211,6 +211,7 @@
 	Panel content() {
 		return _content;
 	}
+
 	/**
 	 * If the handle has not yet been created, calling this will cause it to be.
 	 * Under the Windows backend, returns a HWND.
@@ -225,10 +226,13 @@
 			"controls must be accessed and changed only on the event thread");
 		return _handle;
 	}
+
 	bool handleCreated() { return backend_handleCreated; }
+
 	void recreateHandle() {
 		backend_recreateHandle();
 	}
+
 	override protected Graphics quickCreateGraphics() {
 		if(!handleCreated)
 			return null;
@@ -248,8 +252,9 @@
 	}
 	override bool topLevel() { return true; }
 	override Container parent() { return null; }
-	// TODO: because you should always be able to click a window from the taskbar,
-	//       then show it on taskbar if window has an owner, but don't if it does not
+	// TODO: because you should always be able to click a window from
+	//       the taskbar, then show it on taskbar if window has an owner,
+	//       but don't if it does not
 	void owner(Window w) {
 		_owner = w;
 		if(!handleCreated)
@@ -262,6 +267,7 @@
 		_visible = b;
 		backend_visible = b;
 	}
+
 	/**
 	 * Gets or sets what border this window will have around its contents.
 	 * The default is WindowBorderStyle.Normal.
@@ -274,12 +280,14 @@
 		_borderStyle = border;
 		backend_borderStyle = border;
 	}
+
 	alias Control.repaint repaint;
 	void repaint(Rect rect) {
 		if(!handleCreated)
 			return;
 		backend_repaint(rect);
 	}
+
 	/**
 	 * An array of rectangles in screen coordinates that the window will be
 	 * snapped to.
@@ -292,11 +300,13 @@
 	void snapRect(Rect rect) {
 		snapRects = [rect];
 	}
+
 	/**
 	 * The SnapDistance specifies how close a window has to be to a
 	 * snap rectangle for the window to snap to it. The default is 10 pixels.
 	 */
 	uint snapDistance = 10;
+
 	/**
 	 * Gets or sets whether this window can be resized by the user.
 	 * The default is true.
@@ -309,6 +319,7 @@
 			return;
 		backend_resizable = b;
 	}
+
 	// TODO: 1.0  MinSize -> contentMinSize  MaxSize -> contentMaxSize
 	alias Control.location location;
 	void location(Point pt) {
@@ -338,6 +349,7 @@
 			return;
 		backend_text = str;
 	}
+
 	/**
 	 * Moves this window to the specified position relative to
 	 * the specified control. If no control is specified, the