1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = GtkFileSelection.html
27  * outPack = gtk
28  * outFile = FileSelection
29  * strct   = GtkFileSelection
30  * realStrct=
31  * ctorStrct=
32  * clss    = FileSelection
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_file_selection_
41  * 	- gtk_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * structWrap:
49  * module aliases:
50  * local aliases:
51  * overrides:
52  */
53 
54 module gtk.FileSelection;
55 
56 public  import gtkc.gtktypes;
57 
58 private import gtkc.gtk;
59 private import glib.ConstructionException;
60 private import gobject.ObjectG;
61 
62 
63 private import glib.Str;
64 
65 
66 
67 private import gtk.Dialog;
68 
69 /**
70  * Description
71  * GtkFileSelection has been superseded by the newer GtkFileChooser family
72  * of widgets.
73  * GtkFileSelection should be used to retrieve file or directory names from
74  * the user. It will create a new dialog window containing a directory list,
75  * and a file list corresponding to the current working directory. The filesystem
76  * can be navigated using the directory list or the drop-down history menu.
77  * Alternatively, the TAB key can be used to navigate using filename
78  * completion - common in text based editors such as emacs and jed.
79  * File selection dialogs are created with a call to gtk_file_selection_new().
80  * The default filename can be set using gtk_file_selection_set_filename() and the selected filename retrieved using gtk_file_selection_get_filename().
81  * Use gtk_file_selection_complete() to display files and directories
82  * that match a given pattern. This can be used for example, to show only
83  * *.txt files, or only files beginning with gtk*.
84  * Simple file operations; create directory, delete file, and rename file, are available from buttons at the top of the dialog. These can be hidden using gtk_file_selection_hide_fileop_buttons() and shown again using gtk_file_selection_show_fileop_buttons().
85  * $(DDOC_COMMENT example)
86  */
87 public class FileSelection : Dialog
88 {
89 	
90 	/** the main Gtk struct */
91 	protected GtkFileSelection* gtkFileSelection;
92 	
93 	
94 	public GtkFileSelection* getFileSelectionStruct()
95 	{
96 		return gtkFileSelection;
97 	}
98 	
99 	
100 	/** the main Gtk struct as a void* */
101 	protected override void* getStruct()
102 	{
103 		return cast(void*)gtkFileSelection;
104 	}
105 	
106 	/**
107 	 * Sets our main struct and passes it to the parent class
108 	 */
109 	public this (GtkFileSelection* gtkFileSelection)
110 	{
111 		super(cast(GtkDialog*)gtkFileSelection);
112 		this.gtkFileSelection = gtkFileSelection;
113 	}
114 	
115 	protected override void setStruct(GObject* obj)
116 	{
117 		super.setStruct(obj);
118 		gtkFileSelection = cast(GtkFileSelection*)obj;
119 	}
120 	
121 	/**
122 	 */
123 	
124 	/**
125 	 * Warning
126 	 * gtk_file_selection_new is deprecated and should not be used in newly-written code. Use gtk_file_chooser_dialog_new() instead
127 	 * Creates a new file selection dialog box. By default it will contain a GtkTreeView of the application's current working directory, and a file listing. Operation buttons that allow the user to create a directory, delete files and rename files, are also present.
128 	 * Params:
129 	 * title = a message that will be placed in the file requestor's titlebar.
130 	 * Throws: ConstructionException GTK+ fails to create the object.
131 	 */
132 	public this (string title)
133 	{
134 		// GtkWidget* gtk_file_selection_new (const gchar *title);
135 		auto p = gtk_file_selection_new(Str.toStringz(title));
136 		if(p is null)
137 		{
138 			throw new ConstructionException("null returned by gtk_file_selection_new(Str.toStringz(title))");
139 		}
140 		this(cast(GtkFileSelection*) p);
141 	}
142 	
143 	/**
144 	 * Warning
145 	 * gtk_file_selection_set_filename is deprecated and should not be used in newly-written code.
146 	 * Sets a default path for the file requestor. If filename includes a
147 	 * directory path, then the requestor will open with that path as its
148 	 * current working directory.
149 	 * This has the consequence that in order to open the requestor with a
150 	 * working directory and an empty filename, filename must have a trailing
151 	 * directory separator.
152 	 * The encoding of filename is preferred GLib file name encoding, which
153 	 * may not be UTF-8. See g_filename_from_utf8().
154 	 * Params:
155 	 * filename = a string to set as the default file name.
156 	 */
157 	public void setFilename(string filename)
158 	{
159 		// void gtk_file_selection_set_filename (GtkFileSelection *filesel,  const gchar *filename);
160 		gtk_file_selection_set_filename(gtkFileSelection, Str.toStringz(filename));
161 	}
162 	
163 	/**
164 	 * Warning
165 	 * gtk_file_selection_get_filename is deprecated and should not be used in newly-written code.
166 	 * This function returns the selected filename in the GLib file name
167 	 * encoding. To convert to UTF-8, call g_filename_to_utf8(). The
168 	 * returned string points to a statically allocated buffer and should
169 	 * be copied if you plan to keep it around.
170 	 * If no file is selected then the selected directory path is returned.
171 	 * Returns: currently-selected filename in the on-disk encoding.
172 	 */
173 	public string getFilename()
174 	{
175 		// const gchar* gtk_file_selection_get_filename (GtkFileSelection *filesel);
176 		return Str.toString(gtk_file_selection_get_filename(gtkFileSelection));
177 	}
178 	
179 	/**
180 	 * Warning
181 	 * gtk_file_selection_complete is deprecated and should not be used in newly-written code.
182 	 * Will attempt to match pattern to a valid filenames or subdirectories in the current directory. If a match can be made, the matched filename will appear in the text entry field of the file selection dialog.
183 	 * If a partial match can be made, the "Files" list will contain those
184 	 * file names which have been partially matched, and the "Folders"
185 	 * list those directories which have been partially matched.
186 	 * Params:
187 	 * pattern = a string of characters which may or may not match any filenames in the current directory.
188 	 */
189 	public void complete(string pattern)
190 	{
191 		// void gtk_file_selection_complete (GtkFileSelection *filesel,  const gchar *pattern);
192 		gtk_file_selection_complete(gtkFileSelection, Str.toStringz(pattern));
193 	}
194 	
195 	/**
196 	 * Warning
197 	 * gtk_file_selection_show_fileop_buttons is deprecated and should not be used in newly-written code.
198 	 * Shows the file operation buttons, if they have previously been hidden. The rest of the widgets in the dialog will be resized accordingly.
199 	 */
200 	public void showFileopButtons()
201 	{
202 		// void gtk_file_selection_show_fileop_buttons  (GtkFileSelection *filesel);
203 		gtk_file_selection_show_fileop_buttons(gtkFileSelection);
204 	}
205 	
206 	/**
207 	 * Warning
208 	 * gtk_file_selection_hide_fileop_buttons is deprecated and should not be used in newly-written code.
209 	 * Hides the file operation buttons that normally appear at the top of the dialog. Useful if you wish to create a custom file selector, based on GtkFileSelection.
210 	 */
211 	public void hideFileopButtons()
212 	{
213 		// void gtk_file_selection_hide_fileop_buttons  (GtkFileSelection *filesel);
214 		gtk_file_selection_hide_fileop_buttons(gtkFileSelection);
215 	}
216 	
217 	/**
218 	 * Warning
219 	 * gtk_file_selection_get_selections is deprecated and should not be used in newly-written code.
220 	 * Retrieves the list of file selections the user has made in the dialog box.
221 	 * This function is intended for use when the user can select multiple files
222 	 * in the file list.
223 	 * The filenames are in the GLib file name encoding. To convert to
224 	 * UTF-8, call g_filename_to_utf8() on each string.
225 	 * Returns: a newly-allocated NULL-terminated array of strings. Use g_strfreev() to free it.
226 	 */
227 	public string[] getSelections()
228 	{
229 		// gchar** gtk_file_selection_get_selections (GtkFileSelection *filesel);
230 		return Str.toStringArray(gtk_file_selection_get_selections(gtkFileSelection));
231 	}
232 	
233 	/**
234 	 * Warning
235 	 * gtk_file_selection_set_select_multiple is deprecated and should not be used in newly-written code.
236 	 * Sets whether the user is allowed to select multiple files in the file list.
237 	 * Use gtk_file_selection_get_selections() to get the list of selected files.
238 	 * Params:
239 	 * selectMultiple = whether or not the user is allowed to select multiple
240 	 * files in the file list.
241 	 */
242 	public void setSelectMultiple(int selectMultiple)
243 	{
244 		// void gtk_file_selection_set_select_multiple  (GtkFileSelection *filesel,  gboolean select_multiple);
245 		gtk_file_selection_set_select_multiple(gtkFileSelection, selectMultiple);
246 	}
247 	
248 	/**
249 	 * Warning
250 	 * gtk_file_selection_get_select_multiple is deprecated and should not be used in newly-written code.
251 	 * Determines whether or not the user is allowed to select multiple files in
252 	 * the file list. See gtk_file_selection_set_select_multiple().
253 	 * Returns: TRUE if the user is allowed to select multiple files in the file list
254 	 */
255 	public int getSelectMultiple()
256 	{
257 		// gboolean gtk_file_selection_get_select_multiple  (GtkFileSelection *filesel);
258 		return gtk_file_selection_get_select_multiple(gtkFileSelection);
259 	}
260 }