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  * Description
72  * Completes partial file and directory names given a partial string by
73  * looking in the file system for clues. Can return a list of possible
74  * completion strings for widget implementations.
75  */
76 public class FilenameCompleter : ObjectG
77 {
78 	
79 	/** the main Gtk struct */
80 	protected GFilenameCompleter* gFilenameCompleter;
81 	
82 	
83 	public GFilenameCompleter* getFilenameCompleterStruct()
84 	{
85 		return gFilenameCompleter;
86 	}
87 	
88 	
89 	/** the main Gtk struct as a void* */
90 	protected override void* getStruct()
91 	{
92 		return cast(void*)gFilenameCompleter;
93 	}
94 	
95 	/**
96 	 * Sets our main struct and passes it to the parent class
97 	 */
98 	public this (GFilenameCompleter* gFilenameCompleter)
99 	{
100 		super(cast(GObject*)gFilenameCompleter);
101 		this.gFilenameCompleter = gFilenameCompleter;
102 	}
103 	
104 	protected override void setStruct(GObject* obj)
105 	{
106 		super.setStruct(obj);
107 		gFilenameCompleter = cast(GFilenameCompleter*)obj;
108 	}
109 	
110 	/**
111 	 */
112 	int[string] connectedSignals;
113 	
114 	void delegate(FilenameCompleter)[] onGotCompletionDataListeners;
115 	/**
116 	 * Emitted when the file name completion information comes available.
117 	 */
118 	void addOnGotCompletionData(void delegate(FilenameCompleter) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
119 	{
120 		if ( !("got-completion-data" in connectedSignals) )
121 		{
122 			Signals.connectData(
123 			getStruct(),
124 			"got-completion-data",
125 			cast(GCallback)&callBackGotCompletionData,
126 			cast(void*)this,
127 			null,
128 			connectFlags);
129 			connectedSignals["got-completion-data"] = 1;
130 		}
131 		onGotCompletionDataListeners ~= dlg;
132 	}
133 	extern(C) static void callBackGotCompletionData(GFilenameCompleter* arg0Struct, FilenameCompleter _filenameCompleter)
134 	{
135 		foreach ( void delegate(FilenameCompleter) dlg ; _filenameCompleter.onGotCompletionDataListeners )
136 		{
137 			dlg(_filenameCompleter);
138 		}
139 	}
140 	
141 	
142 	/**
143 	 * Creates a new filename completer.
144 	 * Throws: ConstructionException GTK+ fails to create the object.
145 	 */
146 	public this ()
147 	{
148 		// GFilenameCompleter * g_filename_completer_new (void);
149 		auto p = g_filename_completer_new();
150 		if(p is null)
151 		{
152 			throw new ConstructionException("null returned by g_filename_completer_new()");
153 		}
154 		this(cast(GFilenameCompleter*) p);
155 	}
156 	
157 	/**
158 	 * Obtains a completion for initial_text from completer.
159 	 * Params:
160 	 * initialText = text to be completed.
161 	 * 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.
162 	 */
163 	public string getCompletionSuffix(string initialText)
164 	{
165 		// char * g_filename_completer_get_completion_suffix  (GFilenameCompleter *completer,  const char *initial_text);
166 		return Str.toString(g_filename_completer_get_completion_suffix(gFilenameCompleter, Str.toStringz(initialText)));
167 	}
168 	
169 	/**
170 	 * Gets an array of completion strings for a given initial text.
171 	 * Params:
172 	 * initialText = text to be completed.
173 	 * 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]
174 	 */
175 	public string[] getCompletions(string initialText)
176 	{
177 		// char ** g_filename_completer_get_completions  (GFilenameCompleter *completer,  const char *initial_text);
178 		return Str.toStringArray(g_filename_completer_get_completions(gFilenameCompleter, Str.toStringz(initialText)));
179 	}
180 	
181 	/**
182 	 * If dirs_only is TRUE, completer will only
183 	 * complete directory names, and not file names.
184 	 * Params:
185 	 * dirsOnly = a gboolean.
186 	 * Signal Details
187 	 * The "got-completion-data" signal
188 	 * void user_function (GFilenameCompleter *arg0,
189 	 *  gpointer user_data) : Run Last
190 	 * Emitted when the file name completion information comes available.
191 	 */
192 	public void setDirsOnly(int dirsOnly)
193 	{
194 		// void g_filename_completer_set_dirs_only (GFilenameCompleter *completer,  gboolean dirs_only);
195 		g_filename_completer_set_dirs_only(gFilenameCompleter, dirsOnly);
196 	}
197 }