comparison dynamin/gui/file_dialog.d @ 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 e6e201c3a439
comparison
equal deleted inserted replaced
4:fc2420d39e3c 5:4029d5af7542
101 filter.shouldShow = shouldShow; 101 filter.shouldShow = shouldShow;
102 102
103 _filters.length = _filters.length + 1; 103 _filters.length = _filters.length + 1;
104 _filters[_filters.length-1] = filter; 104 _filters[_filters.length-1] = filter;
105 } 105 }
106
106 /// Gets or sets the selected filter. An index of 0 is the first one added. 107 /// Gets or sets the selected filter. An index of 0 is the first one added.
107 int selectedFilter() { return _selectedFilter; } 108 int selectedFilter() { return _selectedFilter; }
108 /// ditto 109 /// ditto
109 void selectedFilter(int index) { _selectedFilter = index; } 110 void selectedFilter(int index) { _selectedFilter = index; }
111
110 /** 112 /**
111 * Gets or sets whether more than one file can be selected. 113 * Gets or sets whether more than one file can be selected.
112 * The default is true for an OpenFileDialog and false for SaveFileDialog. 114 * The default is true for an OpenFileDialog and false for SaveFileDialog.
113 */ 115 */
114 bool multipleSelection() { return _multipleSelection; } 116 bool multipleSelection() { return _multipleSelection; }
115 /// ditto 117 /// ditto
116 void multipleSelection(bool b) { _multipleSelection = b; } 118 void multipleSelection(bool b) { _multipleSelection = b; }
119
117 /// Gets or sets the text that is displayed in the dialog's title bar. 120 /// Gets or sets the text that is displayed in the dialog's title bar.
118 string text() { return _text; } 121 string text() { return _text; }
119 /// ditto 122 /// ditto
120 void text(string str) { _text = str; } 123 void text(string str) { _text = str; }
124
121 /** 125 /**
122 * Sets the text in the file name text box to the specified string. 126 * Sets the text in the file name text box to the specified string.
123 * Example: 127 * Example:
124 * ----- 128 * -----
125 * dialog.initialFileName = "Untitled"; 129 * dialog.initialFileName = "Untitled";
127 */ 131 */
128 void initialFileName(string str) { 132 void initialFileName(string str) {
129 // TODO: make sure str is not a path? 133 // TODO: make sure str is not a path?
130 _initialFileName = str; 134 _initialFileName = str;
131 } 135 }
136
132 /** 137 /**
133 * Sets the directory that the FileDialog shows. If this is null, 138 * Sets the directory that the FileDialog shows. If this is null,
134 * the default directory is used when the dialog is first shown. 139 * the default directory is used when the dialog is first shown.
135 * After the dialog has been shown, this is set to the directory 140 * After the dialog has been shown, this is set to the directory
136 * the user was last looking at. 141 * the user was last looking at.
140 } 145 }
141 /// TODO: Should this be SelectedDirectory ? 146 /// TODO: Should this be SelectedDirectory ?
142 string directory() { 147 string directory() {
143 return _directory; 148 return _directory;
144 } 149 }
150
145 /** 151 /**
146 * Gets the files selected by the user. 152 * Gets the files selected by the user.
147 * If the user did not type a file name extension, the correct one 153 * If the user did not type a file name extension, the correct one
148 * will be added according to the selected filter. 154 * will be added according to the selected filter.
149 */ 155 */
152 string file() { return _files[0]; } 158 string file() { return _files[0]; }
153 159
154 // TODO: parameters 160 // TODO: parameters
155 // TODO: should showDialog take any parameters? 161 // TODO: should showDialog take any parameters?
156 // what should happen if no owner is set? 162 // what should happen if no owner is set?
157 // Windows Forms sets the owner to the currently active window in the application 163 // WinForms sets the owner to the currently active window in the app
158 // do the same? or have no owner (really annoying, as window can get below)? 164 // do the same? or have no owner (annoying, as window can get below)?
159 DialogResult showDialog() { 165 DialogResult showDialog() {
160 return backend_showDialog(); 166 return backend_showDialog();
161 } 167 }
162 } 168 }
163 169