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