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  = GFilenameCompleter.html
27  * outPack = gio
28  * outFile = FilenameCompleter
29  * strct   = GFilenameCompleter
30  * realStrct=
31  * ctorStrct=
32  * clss    = FilenameCompleter
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_filename_completer_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * structWrap:
48  * module aliases:
49  * local aliases:
50  * overrides:
51  */
52 
53 module gio.FilenameCompleter;
54 
55 public  import gtkc.giotypes;
56 
57 private import gtkc.gio;
58 private import glib.ConstructionException;
59 private import gobject.ObjectG;
60 
61 private import gobject.Signals;
62 public  import gtkc.gdktypes;
63 
64 private import glib.Str;
65 
66 
67 
68 private import gobject.ObjectG;
69 
70 /**
71  * Completes partial file and directory names given a partial string by
72  * looking in the file system for clues. Can return a list of possible
73  * completion strings for widget implementations.
74  */
75 public class FilenameCompleter : ObjectG
76 {
77 	
78 	/** the main Gtk struct */
79 	protected GFilenameCompleter* gFilenameCompleter;
80 	
81 	
82 	public GFilenameCompleter* getFilenameCompleterStruct()
83 	{
84 		return gFilenameCompleter;
85 	}
86 	
87 	
88 	/** the main Gtk struct as a void* */
89 	protected override void* getStruct()
90 	{
91 		return cast(void*)gFilenameCompleter;
92 	}
93 	
94 	/**
95 	 * Sets our main struct and passes it to the parent class
96 	 */
97 	public this (GFilenameCompleter* gFilenameCompleter)
98 	{
99 		super(cast(GObject*)gFilenameCompleter);
100 		this.gFilenameCompleter = gFilenameCompleter;
101 	}
102 	
103 	protected override void setStruct(GObject* obj)
104 	{
105 		super.setStruct(obj);
106 		gFilenameCompleter = cast(GFilenameCompleter*)obj;
107 	}
108 	
109 	/**
110 	 */
111 	int[string] connectedSignals;
112 	
113 	void delegate(FilenameCompleter)[] onGotCompletionDataListeners;
114 	/**
115 	 * Emitted when the file name completion information comes available.
116 	 */
117 	void addOnGotCompletionData(void delegate(FilenameCompleter) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
118 	{
119 		if ( !("got-completion-data" in connectedSignals) )
120 		{
121 			Signals.connectData(
122 			getStruct(),
123 			"got-completion-data",
124 			cast(GCallback)&callBackGotCompletionData,
125 			cast(void*)this,
126 			null,
127 			connectFlags);
128 			connectedSignals["got-completion-data"] = 1;
129 		}
130 		onGotCompletionDataListeners ~= dlg;
131 	}
132 	extern(C) static void callBackGotCompletionData(GFilenameCompleter* arg0Struct, FilenameCompleter _filenameCompleter)
133 	{
134 		foreach ( void delegate(FilenameCompleter) dlg ; _filenameCompleter.onGotCompletionDataListeners )
135 		{
136 			dlg(_filenameCompleter);
137 		}
138 	}
139 	
140 	
141 	/**
142 	 * Creates a new filename completer.
143 	 * Throws: ConstructionException GTK+ fails to create the object.
144 	 */
145 	public this ()
146 	{
147 		// GFilenameCompleter * g_filename_completer_new (void);
148 		auto p = g_filename_completer_new();
149 		if(p is null)
150 		{
151 			throw new ConstructionException("null returned by g_filename_completer_new()");
152 		}
153 		this(cast(GFilenameCompleter*) p);
154 	}
155 	
156 	/**
157 	 * Obtains a completion for initial_text from completer.
158 	 * Params:
159 	 * initialText = text to be completed.
160 	 * Returns: a completed string, or NULL if no completion exists. This string is not owned by GIO, so remember to g_free() it when finished.
161 	 */
162 	public string getCompletionSuffix(string initialText)
163 	{
164 		// char * g_filename_completer_get_completion_suffix  (GFilenameCompleter *completer,  const char *initial_text);
165 		return Str.toString(g_filename_completer_get_completion_suffix(gFilenameCompleter, Str.toStringz(initialText)));
166 	}
167 	
168 	/**
169 	 * Gets an array of completion strings for a given initial text.
170 	 * Params:
171 	 * initialText = text to be completed.
172 	 * Returns: array of strings with possible completions for initial_text. This array must be freed by g_strfreev() when finished. [array zero-terminated=1][transfer full]
173 	 */
174 	public string[] getCompletions(string initialText)
175 	{
176 		// char ** g_filename_completer_get_completions  (GFilenameCompleter *completer,  const char *initial_text);
177 		return Str.toStringArray(g_filename_completer_get_completions(gFilenameCompleter, Str.toStringz(initialText)));
178 	}
179 	
180 	/**
181 	 * If dirs_only is TRUE, completer will only
182 	 * complete directory names, and not file names.
183 	 * Params:
184 	 * dirsOnly = a gboolean.
185 	 * Signal Details
186 	 * The "got-completion-data" signal
187 	 * void user_function (GFilenameCompleter *arg0,
188 	 *  gpointer user_data) : Run Last
189 	 * Emitted when the file name completion information comes available.
190 	 */
191 	public void setDirsOnly(int dirsOnly)
192 	{
193 		// void g_filename_completer_set_dirs_only (GFilenameCompleter *completer,  gboolean dirs_only);
194 		g_filename_completer_set_dirs_only(gFilenameCompleter, dirsOnly);
195 	}
196 }