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  = GtkSourceCompletionProvider.html
27  * outPack = gsv
28  * outFile = SourceCompletionProviderT
29  * strct   = GtkSourceCompletionProvider
30  * realStrct=
31  * ctorStrct=
32  * clss    = SourceCompletionProviderT
33  * interf  = SourceCompletionProviderIF
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * 	- TStruct
38  * extend  = 
39  * implements:
40  * prefixes:
41  * 	- gtk_source_completion_proposal_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- gdk.Pixbuf
49  * 	- gsv.SourceCompletionContext
50  * 	- gsv.SourceCompletionInfo
51  * 	- gsv.SourceCompletionProposalIF
52  * 	- gtk.TextIter
53  * 	- gtk.Widget
54  * structWrap:
55  * 	- GdkPixbuf* -> Pixbuf
56  * 	- GtkSourceCompletionContext* -> SourceCompletionContext
57  * 	- GtkSourceCompletionInfo* -> SourceCompletionInfo
58  * 	- GtkSourceCompletionProposal* -> SourceCompletionProposalIF
59  * 	- GtkTextIter* -> TextIter
60  * 	- GtkWidget* -> Widget
61  * module aliases:
62  * local aliases:
63  * overrides:
64  */
65 
66 module gsv.SourceCompletionProviderT;
67 
68 public  import gsvc.gsvtypes;
69 
70 public import gsvc.gsv;
71 public import glib.ConstructionException;
72 public import gobject.ObjectG;
73 
74 public import glib.Str;
75 public import gdk.Pixbuf;
76 public import gsv.SourceCompletionContext;
77 public import gsv.SourceCompletionInfo;
78 public import gsv.SourceCompletionProposalIF;
79 public import gtk.TextIter;
80 public import gtk.Widget;
81 
82 
83 
84 /**
85  * You must implement this interface to provide proposals to GtkSourceCompletion
86  */
87 public template SourceCompletionProviderT(TStruct)
88 {
89 	
90 	/** the main Gtk struct */
91 	protected GtkSourceCompletionProvider* gtkSourceCompletionProvider;
92 	
93 	
94 	/** Get the main Gtk struct */
95 	public GtkSourceCompletionProvider* getSourceCompletionProviderTStruct()
96 	{
97 		return cast(GtkSourceCompletionProvider*)getStruct();
98 	}
99 	
100 	
101 	/**
102 	 */
103 	
104 	/**
105 	 * Get the name of the provider. This should be a translatable name for
106 	 * display to the user. For example: _("Document word completion provider"). The
107 	 * returned string must be freed with g_free().
108 	 * Returns: a new string containing the name of the provider.
109 	 */
110 	public string gtkSourceCompletionProviderGetName()
111 	{
112 		// gchar * gtk_source_completion_provider_get_name  (GtkSourceCompletionProvider *provider);
113 		return Str.toString(gtk_source_completion_provider_get_name(getSourceCompletionProviderTStruct()));
114 	}
115 	
116 	/**
117 	 * Get the icon of the provider.
118 	 * Returns: The icon to be used for the provider, or NULL if the provider does not have a special icon. [transfer none]
119 	 */
120 	public Pixbuf gtkSourceCompletionProviderGetIcon()
121 	{
122 		// GdkPixbuf * gtk_source_completion_provider_get_icon  (GtkSourceCompletionProvider *provider);
123 		auto p = gtk_source_completion_provider_get_icon(getSourceCompletionProviderTStruct());
124 		
125 		if(p is null)
126 		{
127 			return null;
128 		}
129 		
130 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p);
131 	}
132 	
133 	/**
134 	 * Populate context with proposals from provider added with the
135 	 * gtk_source_completion_context_add_proposals() function.
136 	 * Params:
137 	 * context = a GtkSourceCompletionContext.
138 	 */
139 	public void gtkSourceCompletionProviderPopulate(SourceCompletionContext context)
140 	{
141 		// void gtk_source_completion_provider_populate  (GtkSourceCompletionProvider *provider,  GtkSourceCompletionContext *context);
142 		gtk_source_completion_provider_populate(getSourceCompletionProviderTStruct(), (context is null) ? null : context.getSourceCompletionContextStruct());
143 	}
144 	
145 	/**
146 	 * Get with what kind of activation the provider should be activated.
147 	 * Returns: a combination of GtkSourceCompletionActivation.
148 	 */
149 	public GtkSourceCompletionActivation gtkSourceCompletionProviderGetActivation()
150 	{
151 		// GtkSourceCompletionActivation gtk_source_completion_provider_get_activation  (GtkSourceCompletionProvider *provider);
152 		return gtk_source_completion_provider_get_activation(getSourceCompletionProviderTStruct());
153 	}
154 	
155 	/**
156 	 * Get whether the provider match the context of completion detailed in
157 	 * context.
158 	 * Params:
159 	 * context = a GtkSourceCompletionContext.
160 	 * Returns: TRUE if provider matches the completion context, FALSE otherwise.
161 	 */
162 	public int gtkSourceCompletionProviderMatch(SourceCompletionContext context)
163 	{
164 		// gboolean gtk_source_completion_provider_match  (GtkSourceCompletionProvider *provider,  GtkSourceCompletionContext *context);
165 		return gtk_source_completion_provider_match(getSourceCompletionProviderTStruct(), (context is null) ? null : context.getSourceCompletionContextStruct());
166 	}
167 	
168 	/**
169 	 * Get a customized info widget to show extra information of a proposal.
170 	 * This allows for customized widgets on a proposal basis, although in general
171 	 * providers will have the same custom widget for all their proposals and
172 	 * proposal can be ignored. The implementation of this function is optional.
173 	 * If this function is not implemented, the default widget is a GtkLabel. The
174 	 * return value of gtk_source_completion_proposal_get_info() is used as the
175 	 * content of the GtkLabel.
176 	 * Note
177 	 *  If implemented, gtk_source_completion_provider_update_info()
178 	 *  must also be implemented.
179 	 * Params:
180 	 * proposal = a currently selected GtkSourceCompletionProposal.
181 	 * Returns: a custom GtkWidget to show extra information about proposal. [transfer none]
182 	 */
183 	public Widget gtkSourceCompletionProviderGetInfoWidget(SourceCompletionProposalIF proposal)
184 	{
185 		// GtkWidget * gtk_source_completion_provider_get_info_widget  (GtkSourceCompletionProvider *provider,  GtkSourceCompletionProposal *proposal);
186 		auto p = gtk_source_completion_provider_get_info_widget(getSourceCompletionProviderTStruct(), (proposal is null) ? null : proposal.getSourceCompletionProposalTStruct());
187 		
188 		if(p is null)
189 		{
190 			return null;
191 		}
192 		
193 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
194 	}
195 	
196 	/**
197 	 * Update extra information shown in info for proposal.
198 	 * Note
199 	 *  This function must be implemented when
200 	 *  gtk_source_completion_provider_get_info_widget() is implemented.
201 	 * Params:
202 	 * proposal = a GtkSourceCompletionProposal.
203 	 * info = a GtkSourceCompletionInfo.
204 	 */
205 	public void gtkSourceCompletionProviderUpdateInfo(SourceCompletionProposalIF proposal, SourceCompletionInfo info)
206 	{
207 		// void gtk_source_completion_provider_update_info  (GtkSourceCompletionProvider *provider,  GtkSourceCompletionProposal *proposal,  GtkSourceCompletionInfo *info);
208 		gtk_source_completion_provider_update_info(getSourceCompletionProviderTStruct(), (proposal is null) ? null : proposal.getSourceCompletionProposalTStruct(), (info is null) ? null : info.getSourceCompletionInfoStruct());
209 	}
210 	
211 	/**
212 	 * Get the GtkTextIter at which the completion for proposal starts. When
213 	 * implemented, this information is used to position the completion window
214 	 * accordingly when a proposal is selected in the completion window. The
215 	 * proposal text inside the completion window is aligned on iter.
216 	 * If this function is not implemented, the word boundary is taken to position
217 	 * the completion window. See gtk_source_completion_provider_activate_proposal()
218 	 * for an explanation on the word boundaries.
219 	 * When the proposal is activated, the default handler uses iter as the start
220 	 * of the word to replace. See
221 	 * gtk_source_completion_provider_activate_proposal() for more information.
222 	 * Params:
223 	 * context = a GtkSourceCompletionContext.
224 	 * proposal = a GtkSourceCompletionProposal.
225 	 * iter = a GtkTextIter.
226 	 * Returns: TRUE if iter was set for proposal, FALSE otherwise.
227 	 */
228 	public int gtkSourceCompletionProviderGetStartIter(SourceCompletionContext context, SourceCompletionProposalIF proposal, TextIter iter)
229 	{
230 		// gboolean gtk_source_completion_provider_get_start_iter  (GtkSourceCompletionProvider *provider,  GtkSourceCompletionContext *context,  GtkSourceCompletionProposal *proposal,  GtkTextIter *iter);
231 		return gtk_source_completion_provider_get_start_iter(getSourceCompletionProviderTStruct(), (context is null) ? null : context.getSourceCompletionContextStruct(), (proposal is null) ? null : proposal.getSourceCompletionProposalTStruct(), (iter is null) ? null : iter.getTextIterStruct());
232 	}
233 	
234 	/**
235 	 * Activate proposal at iter. When this functions returns FALSE, the default
236 	 * activation of proposal will take place which replaces the word at iter
237 	 * with the text of proposal (see gtk_source_completion_proposal_get_text()).
238 	 * Here is how the default activation selects the boundaries of the word to
239 	 * replace. The end of the word is iter. For the start of the word, it depends
240 	 * on whether a start iter is defined for proposal (see
241 	 * gtk_source_completion_provider_get_start_iter()). If a start iter is defined,
242 	 * the start of the word is the start iter. Else, the word (as long as possible)
243 	 * will contain only alphanumerical and the "_" characters.
244 	 * Params:
245 	 * proposal = a GtkSourceCompletionProposal.
246 	 * iter = a GtkTextIter.
247 	 * Returns: TRUE to indicate that the proposal activation has been handled, FALSE otherwise.
248 	 */
249 	public int gtkSourceCompletionProviderActivateProposal(SourceCompletionProposalIF proposal, TextIter iter)
250 	{
251 		// gboolean gtk_source_completion_provider_activate_proposal  (GtkSourceCompletionProvider *provider,  GtkSourceCompletionProposal *proposal,  GtkTextIter *iter);
252 		return gtk_source_completion_provider_activate_proposal(getSourceCompletionProviderTStruct(), (proposal is null) ? null : proposal.getSourceCompletionProposalTStruct(), (iter is null) ? null : iter.getTextIterStruct());
253 	}
254 	
255 	/**
256 	 * Get the delay in milliseconds before starting interactive completion for
257 	 * this provider. A value of -1 indicates to use the default value as set
258 	 * by the "auto-complete-delay" property.
259 	 * Returns: the interactive delay in milliseconds.
260 	 */
261 	public int gtkSourceCompletionProviderGetInteractiveDelay()
262 	{
263 		// gint gtk_source_completion_provider_get_interactive_delay  (GtkSourceCompletionProvider *provider);
264 		return gtk_source_completion_provider_get_interactive_delay(getSourceCompletionProviderTStruct());
265 	}
266 	
267 	/**
268 	 * Get the provider priority. The priority determines the order in which
269 	 * proposals appear in the completion popup. Higher priorities are sorted
270 	 * before lower priorities. The default priority is 0.
271 	 * Returns: the provider priority.
272 	 */
273 	public int gtkSourceCompletionProviderGetPriority()
274 	{
275 		// gint gtk_source_completion_provider_get_priority  (GtkSourceCompletionProvider *provider);
276 		return gtk_source_completion_provider_get_priority(getSourceCompletionProviderTStruct());
277 	}
278 }