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