Mercurial > projects > dynamin
annotate dynamin/gui/directory_dialog.d @ 18:836a064828e8
Implement FileDialog/DirectoryDialog with GTK
and start a glib/gdk/gtk binding. Add invoke/invokeNow stubs to fix build on X.
author | Jordan Miner <jminer7@gmail.com> |
---|---|
date | Fri, 24 Jul 2009 00:35:42 -0500 |
parents | 4029d5af7542 |
children |
rev | line source |
---|---|
0 | 1 // Written in the D programming language |
2 // www.digitalmars.com/d/ | |
3 | |
4 /* | |
5 * The contents of this file are subject to the Mozilla Public License Version | |
6 * 1.1 (the "License"); you may not use this file except in compliance with | |
7 * the License. You may obtain a copy of the License at | |
8 * http://www.mozilla.org/MPL/ | |
9 * | |
10 * Software distributed under the License is distributed on an "AS IS" basis, | |
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | |
12 * for the specific language governing rights and limitations under the | |
13 * License. | |
14 * | |
15 * The Original Code is the Dynamin library. | |
16 * | |
17 * The Initial Developer of the Original Code is Jordan Miner. | |
18 * Portions created by the Initial Developer are Copyright (C) 2006-2009 | |
19 * the Initial Developer. All Rights Reserved. | |
20 * | |
21 * Contributor(s): | |
22 * Jordan Miner <jminer7@gmail.com> | |
23 * | |
24 */ | |
25 | |
26 module dynamin.gui.directory_dialog; | |
27 | |
28 import dynamin.all_core; | |
18
836a064828e8
Implement FileDialog/DirectoryDialog with GTK
Jordan Miner <jminer7@gmail.com>
parents:
5
diff
changeset
|
29 import dynamin.gui_backend; |
0 | 30 |
31 /** | |
32 * | |
33 * | |
34 * The appearance of a directory dialog with Windows Classic: | |
35 * | |
36 * $(IMAGE ../web/example_directory_dialog.png) | |
37 */ | |
18
836a064828e8
Implement FileDialog/DirectoryDialog with GTK
Jordan Miner <jminer7@gmail.com>
parents:
5
diff
changeset
|
38 class DirectoryDialog { // TODO: rename to FolderDialog |
0 | 39 private: |
18
836a064828e8
Implement FileDialog/DirectoryDialog with GTK
Jordan Miner <jminer7@gmail.com>
parents:
5
diff
changeset
|
40 mixin DirectoryDialogBackend; |
836a064828e8
Implement FileDialog/DirectoryDialog with GTK
Jordan Miner <jminer7@gmail.com>
parents:
5
diff
changeset
|
41 string _text; |
0 | 42 string _directory; |
43 public: | |
18
836a064828e8
Implement FileDialog/DirectoryDialog with GTK
Jordan Miner <jminer7@gmail.com>
parents:
5
diff
changeset
|
44 /// Gets or sets the text that is displayed in the dialog's title bar. |
836a064828e8
Implement FileDialog/DirectoryDialog with GTK
Jordan Miner <jminer7@gmail.com>
parents:
5
diff
changeset
|
45 string text() { return _text; } |
836a064828e8
Implement FileDialog/DirectoryDialog with GTK
Jordan Miner <jminer7@gmail.com>
parents:
5
diff
changeset
|
46 /// ditto |
836a064828e8
Implement FileDialog/DirectoryDialog with GTK
Jordan Miner <jminer7@gmail.com>
parents:
5
diff
changeset
|
47 void text(string str) { _text = str; } |
836a064828e8
Implement FileDialog/DirectoryDialog with GTK
Jordan Miner <jminer7@gmail.com>
parents:
5
diff
changeset
|
48 |
836a064828e8
Implement FileDialog/DirectoryDialog with GTK
Jordan Miner <jminer7@gmail.com>
parents:
5
diff
changeset
|
49 /// Gets or sets the selected directory. |
0 | 50 string directory() { |
51 return _directory; | |
52 } | |
18
836a064828e8
Implement FileDialog/DirectoryDialog with GTK
Jordan Miner <jminer7@gmail.com>
parents:
5
diff
changeset
|
53 /// ditto |
0 | 54 void directory(string str) { |
55 _directory = str; | |
56 } | |
5
4029d5af7542
Add blank lines and rewrap some comments.
Jordan Miner <jminer7@gmail.com>
parents:
0
diff
changeset
|
57 |
0 | 58 DialogResult showDialog() { |
18
836a064828e8
Implement FileDialog/DirectoryDialog with GTK
Jordan Miner <jminer7@gmail.com>
parents:
5
diff
changeset
|
59 return backend_showDialog(); |
0 | 60 } |
61 } |