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