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  = gtksourceview-2.0-completioncontext.html
27  * outPack = gsv
28  * outFile = SourceCompletionContext
29  * strct   = GtkSourceCompletionContext
30  * realStrct=
31  * ctorStrct=
32  * clss    = SourceCompletionContext
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_source_completion_context_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * 	- gtk_source_completion_context_add_proposals
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- glib.ListG
49  * 	- gtk.TextIter
50  * 	- gsv.SourceCompletionProviderIF
51  * structWrap:
52  * 	- GList* -> ListG
53  * 	- GtkSourceCompletionProvider* -> SourceCompletionProviderIF
54  * 	- GtkTextIter* -> TextIter
55  * module aliases:
56  * local aliases:
57  * overrides:
58  */
59 
60 module gsv.SourceCompletionContext;
61 
62 public  import gsvc.gsvtypes;
63 
64 private import gsvc.gsv;
65 private import glib.ConstructionException;
66 private import gobject.ObjectG;
67 
68 private import gobject.Signals;
69 public  import gtkc.gdktypes;
70 
71 private import glib.Str;
72 private import glib.ListG;
73 private import gtk.TextIter;
74 private import gsv.SourceCompletionProviderIF;
75 
76 
77 
78 private import gobject.ObjectG;
79 
80 /**
81  * Description
82  */
83 public class SourceCompletionContext : ObjectG
84 {
85 	
86 	/** the main Gtk struct */
87 	protected GtkSourceCompletionContext* gtkSourceCompletionContext;
88 	
89 	
90 	public GtkSourceCompletionContext* getSourceCompletionContextStruct()
91 	{
92 		return gtkSourceCompletionContext;
93 	}
94 	
95 	
96 	/** the main Gtk struct as a void* */
97 	protected override void* getStruct()
98 	{
99 		return cast(void*)gtkSourceCompletionContext;
100 	}
101 	
102 	/**
103 	 * Sets our main struct and passes it to the parent class
104 	 */
105 	public this (GtkSourceCompletionContext* gtkSourceCompletionContext)
106 	{
107 		super(cast(GObject*)gtkSourceCompletionContext);
108 		this.gtkSourceCompletionContext = gtkSourceCompletionContext;
109 	}
110 	
111 	protected override void setStruct(GObject* obj)
112 	{
113 		super.setStruct(obj);
114 		gtkSourceCompletionContext = cast(GtkSourceCompletionContext*)obj;
115 	}
116 	
117 	/**
118 	 * Providers can use this function to add proposals to the completion. They
119 	 * can do so asynchronously by means of the finished argument. Providers must
120 	 * ensure that they always call this function with finished set to TRUE
121 	 * once each population (even if no proposals need to be added).
122 	 * Params:
123 	 * provider = A GtkSourceCompletionProvider
124 	 * proposals = The list of proposals to add
125 	 * finished = Whether the provider is finished adding proposals
126 	 */
127 	public void addProposals(SourceCompletionProviderIF provider, ListG proposals, int finished)
128 	{
129 		// void gtk_source_completion_context_add_proposals  (GtkSourceCompletionContext *context,  struct _GtkSourceCompletionProvider *provider,  GList *proposals,  gboolean finished);
130 		gtk_source_completion_context_add_proposals(gtkSourceCompletionContext, (provider is null) ? null : provider.getSourceCompletionProviderTStruct(), (proposals is null) ? null : proposals.getListGStruct(), finished);
131 	}
132 	
133 	/**
134 	 */
135 	int[string] connectedSignals;
136 	
137 	void delegate(SourceCompletionContext)[] onCancelledListeners;
138 	/**
139 	 * Emitted when the current population of proposals has been cancelled.
140 	 * Providers adding proposals asynchronously should connect to this signal
141 	 * to know when to cancel running proposal queries.
142 	 */
143 	void addOnCancelled(void delegate(SourceCompletionContext) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
144 	{
145 		if ( !("cancelled" in connectedSignals) )
146 		{
147 			Signals.connectData(
148 			getStruct(),
149 			"cancelled",
150 			cast(GCallback)&callBackCancelled,
151 			cast(void*)this,
152 			null,
153 			connectFlags);
154 			connectedSignals["cancelled"] = 1;
155 		}
156 		onCancelledListeners ~= dlg;
157 	}
158 	extern(C) static void callBackCancelled(GtkSourceCompletionContext* arg0Struct, SourceCompletionContext _sourceCompletionContext)
159 	{
160 		foreach ( void delegate(SourceCompletionContext) dlg ; _sourceCompletionContext.onCancelledListeners )
161 		{
162 			dlg(_sourceCompletionContext);
163 		}
164 	}
165 	
166 	
167 	/**
168 	 * Get the iter at which the completion was invoked. Providers can use this
169 	 * to determine how and if to match proposals.
170 	 * Params:
171 	 * iter = A GtkTextIter
172 	 */
173 	public void getIter(TextIter iter)
174 	{
175 		// void gtk_source_completion_context_get_iter  (GtkSourceCompletionContext *context,  GtkTextIter *iter);
176 		gtk_source_completion_context_get_iter(gtkSourceCompletionContext, (iter is null) ? null : iter.getTextIterStruct());
177 	}
178 	
179 	/**
180 	 */
181 	public GtkSourceCompletionActivation getActivation()
182 	{
183 		// GtkSourceCompletionActivation gtk_source_completion_context_get_activation  (GtkSourceCompletionContext *context);
184 		return gtk_source_completion_context_get_activation(gtkSourceCompletionContext);
185 	}
186 }