changeset 45:4eebc294a3ac

Rename DirectoryDialog to FolderDialog.
author Jordan Miner <jminer7@gmail.com>
date Thu, 30 Jul 2009 18:10:49 -0500
parents ad551ec36b75
children 127b9d99c01c
files dynamin/all_gui.d dynamin/gui/directory_dialog.d dynamin/gui/folder_dialog.d dynamin/gui/windows_directory_dialog.d dynamin/gui/windows_folder_dialog.d dynamin/gui/x_directory_dialog.d dynamin/gui/x_folder_dialog.d dynamin/gui_backend.d
diffstat 8 files changed, 191 insertions(+), 191 deletions(-) [+]
line wrap: on
line diff
--- a/dynamin/all_gui.d	Thu Jul 30 18:05:50 2009 -0500
+++ b/dynamin/all_gui.d	Thu Jul 30 18:10:49 2009 -0500
@@ -36,8 +36,8 @@
 public import dynamin.gui.cursor;
 public import dynamin.gui.clipboard;
 public import dynamin.gui.screen;
-public import dynamin.gui.directory_dialog;
 public import dynamin.gui.file_dialog;
+public import dynamin.gui.folder_dialog;
 
 public import dynamin.gui.label;
 public import dynamin.gui.button;
--- a/dynamin/gui/directory_dialog.d	Thu Jul 30 18:05:50 2009 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-// Written in the D programming language
-// www.digitalmars.com/d/
-
-/*
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Dynamin library.
- *
- * The Initial Developer of the Original Code is Jordan Miner.
- * Portions created by the Initial Developer are Copyright (C) 2006-2009
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Jordan Miner <jminer7@gmail.com>
- *
- */
-
-module dynamin.gui.directory_dialog;
-
-import dynamin.all_core;
-import dynamin.gui_backend;
-
-/**
- *
- *
- * The appearance of a directory dialog with Windows Classic:
- *
- * $(IMAGE ../web/example_directory_dialog.png)
- */
-class DirectoryDialog { // TODO: rename to FolderDialog
-private:
-	mixin DirectoryDialogBackend;
-	string _text;
-	string _directory;
-public:
-	/// 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; }
-
-	/// Gets or sets the selected directory.
-	string directory() {
-		return _directory;
-	}
-	/// ditto
-	void directory(string str) {
-		_directory = str;
-	}
-
-	DialogResult showDialog() {
-		return backend_showDialog();
-	}
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dynamin/gui/folder_dialog.d	Thu Jul 30 18:10:49 2009 -0500
@@ -0,0 +1,61 @@
+// Written in the D programming language
+// www.digitalmars.com/d/
+
+/*
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Dynamin library.
+ *
+ * The Initial Developer of the Original Code is Jordan Miner.
+ * Portions created by the Initial Developer are Copyright (C) 2006-2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Jordan Miner <jminer7@gmail.com>
+ *
+ */
+
+module dynamin.gui.folder_dialog;
+
+import dynamin.all_core;
+import dynamin.gui_backend;
+
+/**
+ *
+ *
+ * The appearance of a directory dialog with Windows Classic:
+ *
+ * $(IMAGE ../web/example_directory_dialog.png)
+ */
+class FolderDialog {
+private:
+	mixin FolderDialogBackend;
+	string _text;
+	string _directory;
+public:
+	/// 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; }
+
+	/// Gets or sets the selected directory.
+	string directory() {
+		return _directory;
+	}
+	/// ditto
+	void directory(string str) {
+		_directory = str;
+	}
+
+	DialogResult showDialog() {
+		return backend_showDialog();
+	}
+}
--- a/dynamin/gui/windows_directory_dialog.d	Thu Jul 30 18:05:50 2009 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-// Written in the D programming language
-// www.digitalmars.com/d/
-
-/*
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Dynamin library.
- *
- * The Initial Developer of the Original Code is Jordan Miner.
- * Portions created by the Initial Developer are Copyright (C) 2006-2009
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Jordan Miner <jminer7@gmail.com>
- *
- */
-
-module dynamin.gui.windows_directory_dialog;
-
-public import Utf = tango.text.convert.Utf;
-
-template DirectoryDialogBackend() {
-	extern(Windows) static int setSelectedDirectory(HWND hwnd,
-			UINT uMsg, LPARAM lParam, LPARAM lpData) {
-		if(uMsg == BFFM_INITIALIZED)
-			SendMessage(hwnd, BFFM_SETSELECTION, true, lpData);
-		return 0;
-	}
-
-	DialogResult backend_showDialog() {
-		BROWSEINFO bi;
-		//bi.hwndOwner = ;
-		bi.lpszTitle = "Choose a folder:";
-		bi.ulFlags |= BIF_RETURNONLYFSDIRS;
-		bi.ulFlags |= BIF_USENEWUI;
-		if(directory) {
-			bi.lpfn = &setSelectedDirectory;
-			bi.lParam = cast(LPARAM)toWcharPtr(directory);
-		}
-
-		ITEMIDLIST* pidl = SHBrowseForFolder(&bi);
-		if(!pidl)
-			return DialogResult.Cancel;
-		wchar[MAX_PATH+1] dirBuffer; // MAX_PATH is 260
-		if(!SHGetPathFromIDList(pidl, dirBuffer.ptr)) {
-			Stdout("GetPathFromIDList() failed").newline;
-			return DialogResult.Cancel;
-		}
-		CoTaskMemFree(pidl);
-		int index = MAX_PATH;
-		foreach(i, c; dirBuffer)
-			if(c == 0) { // find first null
-				index = i;
-				if(dirBuffer[i-1] != '\\') {
-					dirBuffer[i] = '\\';
-					index++;
-				}
-				break;
-			}
-		_directory = Utf.toString(dirBuffer[0..index]);
-		return DialogResult.OK;
-	}
-}
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dynamin/gui/windows_folder_dialog.d	Thu Jul 30 18:10:49 2009 -0500
@@ -0,0 +1,72 @@
+// Written in the D programming language
+// www.digitalmars.com/d/
+
+/*
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Dynamin library.
+ *
+ * The Initial Developer of the Original Code is Jordan Miner.
+ * Portions created by the Initial Developer are Copyright (C) 2006-2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Jordan Miner <jminer7@gmail.com>
+ *
+ */
+
+module dynamin.gui.windows_folder_dialog;
+
+public import Utf = tango.text.convert.Utf;
+
+template FolderDialogBackend() {
+	extern(Windows) static int setSelectedDirectory(HWND hwnd,
+			UINT uMsg, LPARAM lParam, LPARAM lpData) {
+		if(uMsg == BFFM_INITIALIZED)
+			SendMessage(hwnd, BFFM_SETSELECTION, true, lpData);
+		return 0;
+	}
+
+	DialogResult backend_showDialog() {
+		BROWSEINFO bi;
+		//bi.hwndOwner = ;
+		bi.lpszTitle = "Choose a folder:";
+		bi.ulFlags |= BIF_RETURNONLYFSDIRS;
+		bi.ulFlags |= BIF_USENEWUI;
+		if(directory) {
+			bi.lpfn = &setSelectedDirectory;
+			bi.lParam = cast(LPARAM)toWcharPtr(directory);
+		}
+
+		ITEMIDLIST* pidl = SHBrowseForFolder(&bi);
+		if(!pidl)
+			return DialogResult.Cancel;
+		wchar[MAX_PATH+1] dirBuffer; // MAX_PATH is 260
+		if(!SHGetPathFromIDList(pidl, dirBuffer.ptr)) {
+			Stdout("GetPathFromIDList() failed").newline;
+			return DialogResult.Cancel;
+		}
+		CoTaskMemFree(pidl);
+		int index = MAX_PATH;
+		foreach(i, c; dirBuffer)
+			if(c == 0) { // find first null
+				index = i;
+				if(dirBuffer[i-1] != '\\') {
+					dirBuffer[i] = '\\';
+					index++;
+				}
+				break;
+			}
+		_directory = Utf.toString(dirBuffer[0..index]);
+		return DialogResult.OK;
+	}
+}
+
--- a/dynamin/gui/x_directory_dialog.d	Thu Jul 30 18:05:50 2009 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-// Written in the D programming language
-// www.digitalmars.com/d/
-
-/*
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Dynamin library.
- *
- * The Initial Developer of the Original Code is Jordan Miner.
- * Portions created by the Initial Developer are Copyright (C) 2009
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Jordan Miner <jminer7@gmail.com>
- *
- */
-
-module dynamin.gui.x_directory_dialog;
-
-public import Utf = tango.text.convert.Utf;
-public import dynamin.c.glib;
-public import dynamin.c.gtk;
-
-template DirectoryDialogBackend() {
-	DialogResult backend_showDialog() {
-		string title = text ? text : "Select Folder";
-		auto dialog = gtk_file_chooser_dialog_new(toCharPtr(title), null,
-			GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
-			GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-			GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, null);
-		if(_directory)
-			gtk_file_chooser_set_current_folder(dialog, toCharPtr(_directory));
-		scope(exit) {
-			gtk_widget_destroy(dialog);
-			while(gtk_events_pending())
-				gtk_main_iteration();
-		}
-		if(gtk_dialog_run(dialog) == GTK_RESPONSE_ACCEPT) {
-			char* folder = gtk_file_chooser_get_filename(dialog);
-			_directory = folder[0..strlen(folder)].dup;
-			g_free(folder);
-			return DialogResult.OK;
-		}
-		return DialogResult.Cancel;
-	}
-}
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dynamin/gui/x_folder_dialog.d	Thu Jul 30 18:10:49 2009 -0500
@@ -0,0 +1,55 @@
+// Written in the D programming language
+// www.digitalmars.com/d/
+
+/*
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Dynamin library.
+ *
+ * The Initial Developer of the Original Code is Jordan Miner.
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Jordan Miner <jminer7@gmail.com>
+ *
+ */
+
+module dynamin.gui.x_folder_dialog;
+
+public import Utf = tango.text.convert.Utf;
+public import dynamin.c.glib;
+public import dynamin.c.gtk;
+
+template FolderDialogBackend() {
+	DialogResult backend_showDialog() {
+		string title = text ? text : "Select Folder";
+		auto dialog = gtk_file_chooser_dialog_new(toCharPtr(title), null,
+			GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
+			GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+			GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, null);
+		if(_directory)
+			gtk_file_chooser_set_current_folder(dialog, toCharPtr(_directory));
+		scope(exit) {
+			gtk_widget_destroy(dialog);
+			while(gtk_events_pending())
+				gtk_main_iteration();
+		}
+		if(gtk_dialog_run(dialog) == GTK_RESPONSE_ACCEPT) {
+			char* folder = gtk_file_chooser_get_filename(dialog);
+			_directory = folder[0..strlen(folder)].dup;
+			g_free(folder);
+			return DialogResult.OK;
+		}
+		return DialogResult.Cancel;
+	}
+}
+
--- a/dynamin/gui_backend.d	Thu Jul 30 18:05:50 2009 -0500
+++ b/dynamin/gui_backend.d	Thu Jul 30 18:10:49 2009 -0500
@@ -28,15 +28,15 @@
 version(Windows) {
 	public import dynamin.gui.windows_clipboard;
 	public import dynamin.gui.windows_cursor;
-	public import dynamin.gui.windows_directory_dialog;
 	public import dynamin.gui.windows_file_dialog;
+	public import dynamin.gui.windows_folder_dialog;
 	//public import dynamin.gui.windows_screen;
 	public import dynamin.gui.windows_window;
 } else {
 	public import dynamin.gui.x_clipboard;
 	public import dynamin.gui.x_cursor;
-	public import dynamin.gui.x_directory_dialog;
 	public import dynamin.gui.x_file_dialog;
+	public import dynamin.gui.x_folder_dialog;
 	//public import dynamin.gui.x_screen;
 	public import dynamin.gui.x_window;
 }