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 import gtkc.gobject : g_object_ref; 131 g_object_ref(cast(GObject*)p); 132 133 return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p); 134 } 135 136 /** 137 * Populate context with proposals from provider added with the 138 * gtk_source_completion_context_add_proposals() function. 139 * Params: 140 * context = a GtkSourceCompletionContext. 141 */ 142 public void gtkSourceCompletionProviderPopulate(SourceCompletionContext context) 143 { 144 // void gtk_source_completion_provider_populate (GtkSourceCompletionProvider *provider, GtkSourceCompletionContext *context); 145 gtk_source_completion_provider_populate(getSourceCompletionProviderTStruct(), (context is null) ? null : context.getSourceCompletionContextStruct()); 146 } 147 148 /** 149 * Get with what kind of activation the provider should be activated. 150 * Returns: a combination of GtkSourceCompletionActivation. 151 */ 152 public GtkSourceCompletionActivation gtkSourceCompletionProviderGetActivation() 153 { 154 // GtkSourceCompletionActivation gtk_source_completion_provider_get_activation (GtkSourceCompletionProvider *provider); 155 return gtk_source_completion_provider_get_activation(getSourceCompletionProviderTStruct()); 156 } 157 158 /** 159 * Get whether the provider match the context of completion detailed in 160 * context. 161 * Params: 162 * context = a GtkSourceCompletionContext. 163 * Returns: TRUE if provider matches the completion context, FALSE otherwise. 164 */ 165 public int gtkSourceCompletionProviderMatch(SourceCompletionContext context) 166 { 167 // gboolean gtk_source_completion_provider_match (GtkSourceCompletionProvider *provider, GtkSourceCompletionContext *context); 168 return gtk_source_completion_provider_match(getSourceCompletionProviderTStruct(), (context is null) ? null : context.getSourceCompletionContextStruct()); 169 } 170 171 /** 172 * Get a customized info widget to show extra information of a proposal. 173 * This allows for customized widgets on a proposal basis, although in general 174 * providers will have the same custom widget for all their proposals and 175 * proposal can be ignored. The implementation of this function is optional. 176 * If this function is not implemented, the default widget is a GtkLabel. The 177 * return value of gtk_source_completion_proposal_get_info() is used as the 178 * content of the GtkLabel. 179 * Note 180 * If implemented, gtk_source_completion_provider_update_info() 181 * must also be implemented. 182 * Params: 183 * proposal = a currently selected GtkSourceCompletionProposal. 184 * Returns: a custom GtkWidget to show extra information about proposal. [transfer none] 185 */ 186 public Widget gtkSourceCompletionProviderGetInfoWidget(SourceCompletionProposalIF proposal) 187 { 188 // GtkWidget * gtk_source_completion_provider_get_info_widget (GtkSourceCompletionProvider *provider, GtkSourceCompletionProposal *proposal); 189 auto p = gtk_source_completion_provider_get_info_widget(getSourceCompletionProviderTStruct(), (proposal is null) ? null : proposal.getSourceCompletionProposalTStruct()); 190 191 if(p is null) 192 { 193 return null; 194 } 195 196 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 197 } 198 199 /** 200 * Update extra information shown in info for proposal. 201 * Note 202 * This function must be implemented when 203 * gtk_source_completion_provider_get_info_widget() is implemented. 204 * Params: 205 * proposal = a GtkSourceCompletionProposal. 206 * info = a GtkSourceCompletionInfo. 207 */ 208 public void gtkSourceCompletionProviderUpdateInfo(SourceCompletionProposalIF proposal, SourceCompletionInfo info) 209 { 210 // void gtk_source_completion_provider_update_info (GtkSourceCompletionProvider *provider, GtkSourceCompletionProposal *proposal, GtkSourceCompletionInfo *info); 211 gtk_source_completion_provider_update_info(getSourceCompletionProviderTStruct(), (proposal is null) ? null : proposal.getSourceCompletionProposalTStruct(), (info is null) ? null : info.getSourceCompletionInfoStruct()); 212 } 213 214 /** 215 * Get the GtkTextIter at which the completion for proposal starts. When 216 * implemented, this information is used to position the completion window 217 * accordingly when a proposal is selected in the completion window. The 218 * proposal text inside the completion window is aligned on iter. 219 * If this function is not implemented, the word boundary is taken to position 220 * the completion window. See gtk_source_completion_provider_activate_proposal() 221 * for an explanation on the word boundaries. 222 * When the proposal is activated, the default handler uses iter as the start 223 * of the word to replace. See 224 * gtk_source_completion_provider_activate_proposal() for more information. 225 * Params: 226 * context = a GtkSourceCompletionContext. 227 * proposal = a GtkSourceCompletionProposal. 228 * iter = a GtkTextIter. 229 * Returns: TRUE if iter was set for proposal, FALSE otherwise. 230 */ 231 public int gtkSourceCompletionProviderGetStartIter(SourceCompletionContext context, SourceCompletionProposalIF proposal, TextIter iter) 232 { 233 // gboolean gtk_source_completion_provider_get_start_iter (GtkSourceCompletionProvider *provider, GtkSourceCompletionContext *context, GtkSourceCompletionProposal *proposal, GtkTextIter *iter); 234 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()); 235 } 236 237 /** 238 * Activate proposal at iter. When this functions returns FALSE, the default 239 * activation of proposal will take place which replaces the word at iter 240 * with the text of proposal (see gtk_source_completion_proposal_get_text()). 241 * Here is how the default activation selects the boundaries of the word to 242 * replace. The end of the word is iter. For the start of the word, it depends 243 * on whether a start iter is defined for proposal (see 244 * gtk_source_completion_provider_get_start_iter()). If a start iter is defined, 245 * the start of the word is the start iter. Else, the word (as long as possible) 246 * will contain only alphanumerical and the "_" characters. 247 * Params: 248 * proposal = a GtkSourceCompletionProposal. 249 * iter = a GtkTextIter. 250 * Returns: TRUE to indicate that the proposal activation has been handled, FALSE otherwise. 251 */ 252 public int gtkSourceCompletionProviderActivateProposal(SourceCompletionProposalIF proposal, TextIter iter) 253 { 254 // gboolean gtk_source_completion_provider_activate_proposal (GtkSourceCompletionProvider *provider, GtkSourceCompletionProposal *proposal, GtkTextIter *iter); 255 return gtk_source_completion_provider_activate_proposal(getSourceCompletionProviderTStruct(), (proposal is null) ? null : proposal.getSourceCompletionProposalTStruct(), (iter is null) ? null : iter.getTextIterStruct()); 256 } 257 258 /** 259 * Get the delay in milliseconds before starting interactive completion for 260 * this provider. A value of -1 indicates to use the default value as set 261 * by the "auto-complete-delay" property. 262 * Returns: the interactive delay in milliseconds. 263 */ 264 public int gtkSourceCompletionProviderGetInteractiveDelay() 265 { 266 // gint gtk_source_completion_provider_get_interactive_delay (GtkSourceCompletionProvider *provider); 267 return gtk_source_completion_provider_get_interactive_delay(getSourceCompletionProviderTStruct()); 268 } 269 270 /** 271 * Get the provider priority. The priority determines the order in which 272 * proposals appear in the completion popup. Higher priorities are sorted 273 * before lower priorities. The default priority is 0. 274 * Returns: the provider priority. 275 */ 276 public int gtkSourceCompletionProviderGetPriority() 277 { 278 // gint gtk_source_completion_provider_get_priority (GtkSourceCompletionProvider *provider); 279 return gtk_source_completion_provider_get_priority(getSourceCompletionProviderTStruct()); 280 } 281 }