2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = glib-Automatic-String-Completion.html
27 * outFile = StringCompletion
31 * clss = StringCompletion
52 module glib
.StringCompletion
;
58 import tango
.io
.Stdout
; // use the tango loging?
62 private import gtkc
.glibtypes
;
64 private import gtkc
.glib
;
67 private import glib
.ListG
;
68 private import glib
.Str
;
75 * GCompletion provides support for automatic completion of a string using
76 * any group of target strings. It is typically used for file name completion
77 * as is common in many UNIX shells.
78 * A GCompletion is created using g_completion_new().
79 * Target items are added and removed with
80 * g_completion_add_items(), g_completion_remove_items() and
81 * g_completion_clear_items().
82 * A completion attempt is requested with g_completion_complete() or
83 * g_completion_complete_utf8().
84 * When no longer needed, the GCompletion is freed with g_completion_free().
85 * Items in the completion can be simple strings (e.g. filenames),
86 * or pointers to arbitrary data structures. If data structures are used
87 * you must provide a GCompletionFunc in g_completion_new(),
88 * which retrieves the item's string from the data structure.
89 * You can change the way in which strings are compared by setting
90 * a different GCompletionStrncmpFunc in g_completion_set_compare().
92 public class StringCompletion
95 /** the main Gtk struct */
96 protected GCompletion
* gCompletion
;
99 public GCompletion
* getStringCompletionStruct()
105 /** the main Gtk struct as a void* */
106 protected void* getStruct()
108 return cast(void*)gCompletion
;
112 * Sets our main struct and passes it to the parent class
114 public this (GCompletion
* gCompletion
)
118 if ( gCompletion
is null )
123 Stdout("struct gCompletion is null on constructor").newline
;
127 printf("struct gCompletion is null on constructor");
134 assert(gCompletion
!is null, "struct gCompletion is null on constructor");
136 this.gCompletion
= gCompletion
;
144 * Creates a new GCompletion.
146 * the function to be called to return the string representing an item
147 * in the GCompletion, or NULL if strings are going to be used as the
150 * the new GCompletion.
152 public this (GCompletionFunc func
)
154 // GCompletion* g_completion_new (GCompletionFunc func);
155 this(cast(GCompletion
*)g_completion_new(func
) );
160 * Adds items to the GCompletion.
164 * the list of items to add.
166 public void addItems(ListG items
)
168 // void g_completion_add_items (GCompletion *cmp, GList *items);
169 g_completion_add_items(gCompletion
, (items
is null) ?
null : items
.getListGStruct());
173 * Removes items from a GCompletion.
177 * the items to remove.
179 public void removeItems(ListG items
)
181 // void g_completion_remove_items (GCompletion *cmp, GList *items);
182 g_completion_remove_items(gCompletion
, (items
is null) ?
null : items
.getListGStruct());
186 * Removes all items from the GCompletion.
190 public void clearItems()
192 // void g_completion_clear_items (GCompletion *cmp);
193 g_completion_clear_items(gCompletion
);
197 * Attempts to complete the string prefix using the GCompletion target items.
201 * the prefix string, typically typed by the user, which is compared
202 * with each of the items.
204 * if non-NULL, returns the longest prefix which is common to all
205 * items that matched prefix, or NULL if no items matched prefix.
206 * This string should be freed when no longer needed.
208 * the list of items whose strings begin with prefix. This should
211 public ListG
complete(char[] prefix
, char** newPrefix
)
213 // GList* g_completion_complete (GCompletion *cmp, const gchar *prefix, gchar **new_prefix);
214 return new ListG( g_completion_complete(gCompletion
, Str
.toStringz(prefix
), newPrefix
) );
218 * Attempts to complete the string prefix using the GCompletion target items.
219 * In contrast to g_completion_complete(), this function returns the largest common
220 * prefix that is a valid UTF-8 string, omitting a possible common partial
222 * You should use this function instead of g_completion_complete() if your
223 * items are UTF-8 strings.
227 * the prefix string, typically used by the user, which is compared
228 * with each of the items
230 * if non-NULL, returns the longest prefix which is common to all
231 * items that matched prefix, or NULL if no items matched prefix.
232 * This string should be freed when no longer needed.
234 * the list of items whose strings begin with prefix. This should
238 public ListG
completeUtf8(char[] prefix
, char** newPrefix
)
240 // GList* g_completion_complete_utf8 (GCompletion *cmp, const gchar *prefix, gchar **new_prefix);
241 return new ListG( g_completion_complete_utf8(gCompletion
, Str
.toStringz(prefix
), newPrefix
) );
245 * Sets the function to use for string comparisons. The default
246 * string comparison function is strncmp().
250 * the string comparison function.
252 public void setCompare(GCompletionStrncmpFunc strncmpFunc
)
254 // void g_completion_set_compare (GCompletion *cmp, GCompletionStrncmpFunc strncmp_func);
255 g_completion_set_compare(gCompletion
, strncmpFunc
);
260 * Frees all memory used by the GCompletion.
266 // void g_completion_free (GCompletion *cmp);
267 g_completion_free(gCompletion
);