File: SourceCompletion.d

package info (click to toggle)
gtk-d 3.11.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,040 kB
  • sloc: javascript: 565; sh: 71; makefile: 23
file content (373 lines) | stat: -rw-r--r-- 11,967 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
/*
 * This file is part of gtkD.
 *
 * gtkD is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 3
 * of the License, or (at your option) any later version, with
 * some exceptions, please read the COPYING file.
 *
 * gtkD is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with gtkD; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
 */

// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage


module gsv.SourceCompletion;

private import glib.ErrorG;
private import glib.GException;
private import glib.ListG;
private import gobject.ObjectG;
private import gobject.Signals;
private import gsv.SourceCompletionContext;
private import gsv.SourceCompletionInfo;
private import gsv.SourceCompletionProviderIF;
private import gsv.SourceView;
private import gsv.c.functions;
public  import gsv.c.types;
public  import gsvc.gsvtypes;
private import gtk.BuildableIF;
private import gtk.BuildableT;
private import gtk.TextIter;
private import std.algorithm;


/** */
public class SourceCompletion : ObjectG, BuildableIF
{
	/** the main Gtk struct */
	protected GtkSourceCompletion* gtkSourceCompletion;

	/** Get the main Gtk struct */
	public GtkSourceCompletion* getSourceCompletionStruct(bool transferOwnership = false)
	{
		if (transferOwnership)
			ownedRef = false;
		return gtkSourceCompletion;
	}

	/** the main Gtk struct as a void* */
	protected override void* getStruct()
	{
		return cast(void*)gtkSourceCompletion;
	}

	/**
	 * Sets our main struct and passes it to the parent class.
	 */
	public this (GtkSourceCompletion* gtkSourceCompletion, bool ownedRef = false)
	{
		this.gtkSourceCompletion = gtkSourceCompletion;
		super(cast(GObject*)gtkSourceCompletion, ownedRef);
	}

	// add the Buildable capabilities
	mixin BuildableT!(GtkSourceCompletion);


	/** */
	public static GType getType()
	{
		return gtk_source_completion_get_type();
	}

	/**
	 * Add a new #GtkSourceCompletionProvider to the completion object. This will
	 * add a reference @provider, so make sure to unref your own copy when you
	 * no longer need it.
	 *
	 * Params:
	 *     provider = a #GtkSourceCompletionProvider.
	 *
	 * Returns: %TRUE if @provider was successfully added, otherwise if @error
	 *     is provided, it will be set with the error and %FALSE is returned.
	 *
	 * Throws: GException on failure.
	 */
	public bool addProvider(SourceCompletionProviderIF provider)
	{
		GError* err = null;

		auto __p = gtk_source_completion_add_provider(gtkSourceCompletion, (provider is null) ? null : provider.getSourceCompletionProviderStruct(), &err) != 0;

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		return __p;
	}

	/**
	 * Block interactive completion. This can be used to disable interactive
	 * completion when inserting or deleting text from the buffer associated with
	 * the completion. Use gtk_source_completion_unblock_interactive() to enable
	 * interactive completion again.
	 *
	 * This function may be called multiple times. It will continue to block
	 * interactive completion until gtk_source_completion_unblock_interactive()
	 * has been called the same number of times.
	 */
	public void blockInteractive()
	{
		gtk_source_completion_block_interactive(gtkSourceCompletion);
	}

	/**
	 * Create a new #GtkSourceCompletionContext for @completion. The position where
	 * the completion occurs can be specified by @position. If @position is %NULL,
	 * the current cursor position will be used.
	 *
	 * Params:
	 *     position = a #GtkTextIter, or %NULL.
	 *
	 * Returns: a new #GtkSourceCompletionContext.
	 *     The reference being returned is a 'floating' reference,
	 *     so if you invoke gtk_source_completion_start() with this context
	 *     you don't need to unref it.
	 */
	public SourceCompletionContext createContext(TextIter position)
	{
		auto __p = gtk_source_completion_create_context(gtkSourceCompletion, (position is null) ? null : position.getTextIterStruct());

		if(__p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(SourceCompletionContext)(cast(GtkSourceCompletionContext*) __p);
	}

	/**
	 * The info widget is the window where the completion displays optional extra
	 * information of the proposal.
	 *
	 * Returns: The #GtkSourceCompletionInfo window
	 *     associated with @completion.
	 */
	public SourceCompletionInfo getInfoWindow()
	{
		auto __p = gtk_source_completion_get_info_window(gtkSourceCompletion);

		if(__p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(SourceCompletionInfo)(cast(GtkSourceCompletionInfo*) __p);
	}

	/**
	 * Get list of providers registered on @completion. The returned list is owned
	 * by the completion and should not be freed.
	 *
	 * Returns: list of #GtkSourceCompletionProvider.
	 */
	public ListG getProviders()
	{
		auto __p = gtk_source_completion_get_providers(gtkSourceCompletion);

		if(__p is null)
		{
			return null;
		}

		return new ListG(cast(GList*) __p);
	}

	/**
	 * The #GtkSourceView associated with @completion, or %NULL if the view has been
	 * destroyed.
	 *
	 * Returns: The #GtkSourceView associated with
	 *     @completion, or %NULL.
	 */
	public SourceView getView()
	{
		auto __p = gtk_source_completion_get_view(gtkSourceCompletion);

		if(__p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(SourceView)(cast(GtkSourceView*) __p);
	}

	/**
	 * Hides the completion if it is active (visible).
	 */
	public void hide()
	{
		gtk_source_completion_hide(gtkSourceCompletion);
	}

	/**
	 * Remove @provider from the completion.
	 *
	 * Params:
	 *     provider = a #GtkSourceCompletionProvider.
	 *
	 * Returns: %TRUE if @provider was successfully removed, otherwise if @error
	 *     is provided, it will be set with the error and %FALSE is returned.
	 *
	 * Throws: GException on failure.
	 */
	public bool removeProvider(SourceCompletionProviderIF provider)
	{
		GError* err = null;

		auto __p = gtk_source_completion_remove_provider(gtkSourceCompletion, (provider is null) ? null : provider.getSourceCompletionProviderStruct(), &err) != 0;

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		return __p;
	}

	/**
	 * Starts a new completion with the specified #GtkSourceCompletionContext and
	 * a list of potential candidate providers for completion.
	 *
	 * It can be convenient for showing a completion on-the-fly, without the need to
	 * add or remove providers to the #GtkSourceCompletion.
	 *
	 * Another solution is to add providers with
	 * gtk_source_completion_add_provider(), and implement
	 * gtk_source_completion_provider_match() for each provider.
	 *
	 * Params:
	 *     providers = a list of #GtkSourceCompletionProvider, or %NULL.
	 *     context = The #GtkSourceCompletionContext
	 *         with which to start the completion.
	 *
	 * Returns: %TRUE if it was possible to the show completion window.
	 */
	public bool start(ListG providers, SourceCompletionContext context)
	{
		return gtk_source_completion_start(gtkSourceCompletion, (providers is null) ? null : providers.getListGStruct(), (context is null) ? null : context.getSourceCompletionContextStruct()) != 0;
	}

	/**
	 * Unblock interactive completion. This can be used after using
	 * gtk_source_completion_block_interactive() to enable interactive completion
	 * again.
	 */
	public void unblockInteractive()
	{
		gtk_source_completion_unblock_interactive(gtkSourceCompletion);
	}

	/**
	 * The #GtkSourceCompletion::activate-proposal signal is a
	 * keybinding signal which gets emitted when the user initiates
	 * a proposal activation.
	 *
	 * Applications should not connect to it, but may emit it with
	 * g_signal_emit_by_name() if they need to control the proposal
	 * activation programmatically.
	 */
	gulong addOnActivateProposal(void delegate(SourceCompletion) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		return Signals.connect(this, "activate-proposal", dlg, connectFlags ^ ConnectFlags.SWAPPED);
	}

	/**
	 * Emitted when the completion window is hidden. The default handler
	 * will actually hide the window.
	 */
	gulong addOnHide(void delegate(SourceCompletion) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		return Signals.connect(this, "hide", dlg, connectFlags ^ ConnectFlags.SWAPPED);
	}

	/**
	 * The #GtkSourceCompletion::move-cursor signal is a keybinding
	 * signal which gets emitted when the user initiates a cursor
	 * movement.
	 *
	 * The <keycap>Up</keycap>, <keycap>Down</keycap>,
	 * <keycap>PageUp</keycap>, <keycap>PageDown</keycap>,
	 * <keycap>Home</keycap> and <keycap>End</keycap> keys are bound to the
	 * normal behavior expected by those keys.
	 *
	 * When @step is equal to %GTK_SCROLL_PAGES, the page size is defined by
	 * the #GtkSourceCompletion:proposal-page-size property. It is used for
	 * the <keycap>PageDown</keycap> and <keycap>PageUp</keycap> keys.
	 *
	 * Applications should not connect to it, but may emit it with
	 * g_signal_emit_by_name() if they need to control the cursor
	 * programmatically.
	 *
	 * Params:
	 *     step = The #GtkScrollStep by which to move the cursor
	 *     num = The amount of steps to move the cursor
	 */
	gulong addOnMoveCursor(void delegate(GtkScrollStep, int, SourceCompletion) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		return Signals.connect(this, "move-cursor", dlg, connectFlags ^ ConnectFlags.SWAPPED);
	}

	/**
	 * The #GtkSourceCompletion::move-page signal is a keybinding
	 * signal which gets emitted when the user initiates a page
	 * movement (i.e. switches between provider pages).
	 *
	 * <keycombo><keycap>Control</keycap><keycap>Left</keycap></keycombo>
	 * is for going to the previous provider.
	 * <keycombo><keycap>Control</keycap><keycap>Right</keycap></keycombo>
	 * is for going to the next provider.
	 * <keycombo><keycap>Control</keycap><keycap>Home</keycap></keycombo>
	 * is for displaying all the providers.
	 * <keycombo><keycap>Control</keycap><keycap>End</keycap></keycombo>
	 * is for going to the last provider.
	 *
	 * When @step is equal to #GTK_SCROLL_PAGES, the page size is defined by
	 * the #GtkSourceCompletion:provider-page-size property.
	 *
	 * Applications should not connect to it, but may emit it with
	 * g_signal_emit_by_name() if they need to control the page selection
	 * programmatically.
	 *
	 * Params:
	 *     step = The #GtkScrollStep by which to move the page
	 *     num = The amount of steps to move the page
	 */
	gulong addOnMovePage(void delegate(GtkScrollStep, int, SourceCompletion) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		return Signals.connect(this, "move-page", dlg, connectFlags ^ ConnectFlags.SWAPPED);
	}

	/**
	 * Emitted just before starting to populate the completion with providers.
	 * You can use this signal to add additional attributes in the context.
	 *
	 * Params:
	 *     context = The #GtkSourceCompletionContext for the current completion
	 */
	gulong addOnPopulateContext(void delegate(SourceCompletionContext, SourceCompletion) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		return Signals.connect(this, "populate-context", dlg, connectFlags ^ ConnectFlags.SWAPPED);
	}

	/**
	 * Emitted when the completion window is shown. The default handler
	 * will actually show the window.
	 */
	gulong addOnShow(void delegate(SourceCompletion) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		return Signals.connect(this, "show", dlg, connectFlags ^ ConnectFlags.SWAPPED);
	}
}