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 = GtkSourceCompletion.html 27 * outPack = gsv 28 * outFile = SourceCompletion 29 * strct = GtkSourceCompletion 30 * realStrct= 31 * ctorStrct= 32 * clss = SourceCompletion 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_source_completion_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.ErrorG 47 * - glib.GException 48 * - glib.ListG 49 * - gtk.TextIter 50 * - gsv.SourceCompletionInfo 51 * - gsv.SourceView 52 * - gsv.SourceCompletionContext 53 * - gsv.SourceCompletionProviderIF 54 * structWrap: 55 * - GList* -> ListG 56 * - GtkSourceCompletionContext* -> SourceCompletionContext 57 * - GtkSourceCompletionInfo* -> SourceCompletionInfo 58 * - GtkSourceCompletionProvider* -> SourceCompletionProviderIF 59 * - GtkSourceView* -> SourceView 60 * - GtkTextIter* -> TextIter 61 * module aliases: 62 * local aliases: 63 * overrides: 64 */ 65 66 module gsv.SourceCompletion; 67 68 public import gsvc.gsvtypes; 69 70 private import gsvc.gsv; 71 private import glib.ConstructionException; 72 private import gobject.ObjectG; 73 74 private import gobject.Signals; 75 public import gtkc.gdktypes; 76 77 private import glib.ErrorG; 78 private import glib.GException; 79 private import glib.ListG; 80 private import gtk.TextIter; 81 private import gsv.SourceCompletionInfo; 82 private import gsv.SourceView; 83 private import gsv.SourceCompletionContext; 84 private import gsv.SourceCompletionProviderIF; 85 86 87 88 private import gtk.ObjectGtk; 89 90 /** 91 * Description 92 */ 93 public class SourceCompletion : ObjectGtk 94 { 95 96 /** the main Gtk struct */ 97 protected GtkSourceCompletion* gtkSourceCompletion; 98 99 100 public GtkSourceCompletion* getSourceCompletionStruct() 101 { 102 return gtkSourceCompletion; 103 } 104 105 106 /** the main Gtk struct as a void* */ 107 protected override void* getStruct() 108 { 109 return cast(void*)gtkSourceCompletion; 110 } 111 112 /** 113 * Sets our main struct and passes it to the parent class 114 */ 115 public this (GtkSourceCompletion* gtkSourceCompletion) 116 { 117 super(cast(GtkObject*)gtkSourceCompletion); 118 this.gtkSourceCompletion = gtkSourceCompletion; 119 } 120 121 protected override void setStruct(GObject* obj) 122 { 123 super.setStruct(obj); 124 gtkSourceCompletion = cast(GtkSourceCompletion*)obj; 125 } 126 127 /** 128 */ 129 int[string] connectedSignals; 130 131 void delegate(SourceCompletion)[] onActivateProposalListeners; 132 /** 133 * The ::activate-proposal signal is a keybinding signal which gets 134 * emitted when the user initiates a proposal activation. 135 * Applications should not connect to it, but may emit it with 136 * g_signal_emit_by_name if they need to control the proposal activation 137 * programmatically. 138 */ 139 void addOnActivateProposal(void delegate(SourceCompletion) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 140 { 141 if ( !("activate-proposal" in connectedSignals) ) 142 { 143 Signals.connectData( 144 getStruct(), 145 "activate-proposal", 146 cast(GCallback)&callBackActivateProposal, 147 cast(void*)this, 148 null, 149 connectFlags); 150 connectedSignals["activate-proposal"] = 1; 151 } 152 onActivateProposalListeners ~= dlg; 153 } 154 extern(C) static void callBackActivateProposal(GtkSourceCompletion* completionStruct, SourceCompletion _sourceCompletion) 155 { 156 foreach ( void delegate(SourceCompletion) dlg ; _sourceCompletion.onActivateProposalListeners ) 157 { 158 dlg(_sourceCompletion); 159 } 160 } 161 162 void delegate(SourceCompletion)[] onHideListeners; 163 /** 164 * Emitted when the completion window is hidden. The default handler 165 * will actually hide the window. 166 */ 167 void addOnHide(void delegate(SourceCompletion) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 168 { 169 if ( !("hide" in connectedSignals) ) 170 { 171 Signals.connectData( 172 getStruct(), 173 "hide", 174 cast(GCallback)&callBackHide, 175 cast(void*)this, 176 null, 177 connectFlags); 178 connectedSignals["hide"] = 1; 179 } 180 onHideListeners ~= dlg; 181 } 182 extern(C) static void callBackHide(GtkSourceCompletion* completionStruct, SourceCompletion _sourceCompletion) 183 { 184 foreach ( void delegate(SourceCompletion) dlg ; _sourceCompletion.onHideListeners ) 185 { 186 dlg(_sourceCompletion); 187 } 188 } 189 190 void delegate(GtkScrollStep, gint, SourceCompletion)[] onMoveCursorListeners; 191 /** 192 * The ::move-cursor signal is a keybinding signal which gets emitted when 193 * the user initiates a cursor movement. 194 * Applications should not connect to it, but may emit it with 195 * g_signal_emit_by_name if they need to control the cursor 196 * programmatically. 197 */ 198 void addOnMoveCursor(void delegate(GtkScrollStep, gint, SourceCompletion) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 199 { 200 if ( !("move-cursor" in connectedSignals) ) 201 { 202 Signals.connectData( 203 getStruct(), 204 "move-cursor", 205 cast(GCallback)&callBackMoveCursor, 206 cast(void*)this, 207 null, 208 connectFlags); 209 connectedSignals["move-cursor"] = 1; 210 } 211 onMoveCursorListeners ~= dlg; 212 } 213 extern(C) static void callBackMoveCursor(GtkSourceCompletion* completionStruct, GtkScrollStep step, gint num, SourceCompletion _sourceCompletion) 214 { 215 foreach ( void delegate(GtkScrollStep, gint, SourceCompletion) dlg ; _sourceCompletion.onMoveCursorListeners ) 216 { 217 dlg(step, num, _sourceCompletion); 218 } 219 } 220 221 void delegate(GtkScrollStep, gint, SourceCompletion)[] onMovePageListeners; 222 /** 223 * The ::move-page signal is a keybinding signal which gets emitted when 224 * the user initiates a page movement (i.e. switches between provider 225 * pages). 226 * Applications should not connect to it, but may emit it with 227 * g_signal_emit_by_name if they need to control the page selection 228 * programmatically. 229 */ 230 void addOnMovePage(void delegate(GtkScrollStep, gint, SourceCompletion) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 231 { 232 if ( !("move-page" in connectedSignals) ) 233 { 234 Signals.connectData( 235 getStruct(), 236 "move-page", 237 cast(GCallback)&callBackMovePage, 238 cast(void*)this, 239 null, 240 connectFlags); 241 connectedSignals["move-page"] = 1; 242 } 243 onMovePageListeners ~= dlg; 244 } 245 extern(C) static void callBackMovePage(GtkSourceCompletion* completionStruct, GtkScrollStep step, gint num, SourceCompletion _sourceCompletion) 246 { 247 foreach ( void delegate(GtkScrollStep, gint, SourceCompletion) dlg ; _sourceCompletion.onMovePageListeners ) 248 { 249 dlg(step, num, _sourceCompletion); 250 } 251 } 252 253 void delegate(SourceCompletionContext, SourceCompletion)[] onPopulateContextListeners; 254 /** 255 * Emitted just before starting to populate the completion with providers. 256 * You can use this signal to add additional attributes in the context. 257 */ 258 void addOnPopulateContext(void delegate(SourceCompletionContext, SourceCompletion) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 259 { 260 if ( !("populate-context" in connectedSignals) ) 261 { 262 Signals.connectData( 263 getStruct(), 264 "populate-context", 265 cast(GCallback)&callBackPopulateContext, 266 cast(void*)this, 267 null, 268 connectFlags); 269 connectedSignals["populate-context"] = 1; 270 } 271 onPopulateContextListeners ~= dlg; 272 } 273 extern(C) static void callBackPopulateContext(GtkSourceCompletion* completionStruct, GtkSourceCompletionContext* context, SourceCompletion _sourceCompletion) 274 { 275 foreach ( void delegate(SourceCompletionContext, SourceCompletion) dlg ; _sourceCompletion.onPopulateContextListeners ) 276 { 277 dlg(ObjectG.getDObject!(SourceCompletionContext)(context), _sourceCompletion); 278 } 279 } 280 281 void delegate(SourceCompletion)[] onShowListeners; 282 /** 283 * Emitted when the completion window is shown. The default handler 284 * will actually show the window. 285 */ 286 void addOnShow(void delegate(SourceCompletion) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 287 { 288 if ( !("show" in connectedSignals) ) 289 { 290 Signals.connectData( 291 getStruct(), 292 "show", 293 cast(GCallback)&callBackShow, 294 cast(void*)this, 295 null, 296 connectFlags); 297 connectedSignals["show"] = 1; 298 } 299 onShowListeners ~= dlg; 300 } 301 extern(C) static void callBackShow(GtkSourceCompletion* completionStruct, SourceCompletion _sourceCompletion) 302 { 303 foreach ( void delegate(SourceCompletion) dlg ; _sourceCompletion.onShowListeners ) 304 { 305 dlg(_sourceCompletion); 306 } 307 } 308 309 310 /** 311 * Add a new GtkSourceCompletionProvider to the completion object. This will 312 * add a reference provider, so make sure to unref your own copy when you 313 * no longer need it. 314 * Params: 315 * provider = A GtkSourceCompletionProvider 316 * Returns: TRUE if provider was successfully added, otherwise if error is provided, it will be set with the error and FALSE is returned. 317 * Throws: GException on failure. 318 */ 319 public int addProvider(SourceCompletionProviderIF provider) 320 { 321 // gboolean gtk_source_completion_add_provider (GtkSourceCompletion *completion, GtkSourceCompletionProvider *provider, GError **error); 322 GError* err = null; 323 324 auto p = gtk_source_completion_add_provider(gtkSourceCompletion, (provider is null) ? null : provider.getSourceCompletionProviderTStruct(), &err); 325 326 if (err !is null) 327 { 328 throw new GException( new ErrorG(err) ); 329 } 330 331 return p; 332 } 333 334 /** 335 * Remove provider from the completion. 336 * Params: 337 * provider = A GtkSourceCompletionProvider 338 * Returns: TRUE if provider was successfully removed, otherwise if error is provided, it will be set with the error and FALSE is returned. 339 * Throws: GException on failure. 340 */ 341 public int removeProvider(SourceCompletionProviderIF provider) 342 { 343 // gboolean gtk_source_completion_remove_provider (GtkSourceCompletion *completion, GtkSourceCompletionProvider *provider, GError **error); 344 GError* err = null; 345 346 auto p = gtk_source_completion_remove_provider(gtkSourceCompletion, (provider is null) ? null : provider.getSourceCompletionProviderTStruct(), &err); 347 348 if (err !is null) 349 { 350 throw new GException( new ErrorG(err) ); 351 } 352 353 return p; 354 } 355 356 /** 357 * Get list of providers registered on completion. The returned list is owned 358 * by the completion and should not be freed. 359 * Returns: list of GtkSourceCompletionProvider 360 */ 361 public ListG getProviders() 362 { 363 // GList * gtk_source_completion_get_providers (GtkSourceCompletion *completion); 364 auto p = gtk_source_completion_get_providers(gtkSourceCompletion); 365 366 if(p is null) 367 { 368 return null; 369 } 370 371 return ObjectG.getDObject!(ListG)(cast(GList*) p); 372 } 373 374 /** 375 * Starts a new completion with the specified GtkSourceCompletionContext and 376 * a list of potential candidate providers for completion. 377 * Params: 378 * providers = A list of GtkSourceCompletionProvider or NULL 379 * context = The GtkSourceCompletionContext with which to start the completion 380 * Returns: TRUE if it was possible to the show completion window. 381 */ 382 public int show(ListG providers, SourceCompletionContext context) 383 { 384 // gboolean gtk_source_completion_show (GtkSourceCompletion *completion, GList *providers, GtkSourceCompletionContext *context); 385 return gtk_source_completion_show(gtkSourceCompletion, (providers is null) ? null : providers.getListGStruct(), (context is null) ? null : context.getSourceCompletionContextStruct()); 386 } 387 388 /** 389 * Hides the completion if it is active (visible). 390 */ 391 public void hide() 392 { 393 // void gtk_source_completion_hide (GtkSourceCompletion *completion); 394 gtk_source_completion_hide(gtkSourceCompletion); 395 } 396 397 /** 398 * The info widget is the window where the completion displays optional extra 399 * information of the proposal. 400 * Returns: The GtkSourceCompletionInfo window. 401 */ 402 public SourceCompletionInfo getInfoWindow() 403 { 404 // GtkSourceCompletionInfo * gtk_source_completion_get_info_window (GtkSourceCompletion *completion); 405 auto p = gtk_source_completion_get_info_window(gtkSourceCompletion); 406 407 if(p is null) 408 { 409 return null; 410 } 411 412 return ObjectG.getDObject!(SourceCompletionInfo)(cast(GtkSourceCompletionInfo*) p); 413 } 414 415 /** 416 * The GtkSourceView associated with completion. 417 * Returns: The GtkSourceView associated with completion. 418 */ 419 public SourceView getView() 420 { 421 // struct _GtkSourceView * gtk_source_completion_get_view (GtkSourceCompletion *completion); 422 auto p = gtk_source_completion_get_view(gtkSourceCompletion); 423 424 if(p is null) 425 { 426 return null; 427 } 428 429 return ObjectG.getDObject!(SourceView)(cast(GtkSourceView*) p); 430 } 431 432 /** 433 * Create a new GtkSourceCompletionContext for completion. The position at 434 * which the completion using the new context will consider completion can 435 * be provider by position. If position is NULL, the current cursor 436 * position will be used. 437 * Params: 438 * position = A GtkTextIter 439 * Returns: a new GtkSourceCompletionContext. The reference being returned is a 'floating' reference, so if you invoke gtk_source_completion_show with this context you don't need to unref it. 440 */ 441 public SourceCompletionContext createContext(TextIter position) 442 { 443 // GtkSourceCompletionContext * gtk_source_completion_create_context (GtkSourceCompletion *completion, GtkTextIter *position); 444 auto p = gtk_source_completion_create_context(gtkSourceCompletion, (position is null) ? null : position.getTextIterStruct()); 445 446 if(p is null) 447 { 448 return null; 449 } 450 451 return ObjectG.getDObject!(SourceCompletionContext)(cast(GtkSourceCompletionContext*) p); 452 } 453 454 /** 455 * Move the completion window to a specific iter. 456 * Params: 457 * iter = A GtkTextIter 458 */ 459 public void moveWindow(TextIter iter) 460 { 461 // void gtk_source_completion_move_window (GtkSourceCompletion *completion, GtkTextIter *iter); 462 gtk_source_completion_move_window(gtkSourceCompletion, (iter is null) ? null : iter.getTextIterStruct()); 463 } 464 465 /** 466 */ 467 public void blockInteractive() 468 { 469 // void gtk_source_completion_block_interactive (GtkSourceCompletion *completion); 470 gtk_source_completion_block_interactive(gtkSourceCompletion); 471 } 472 473 /** 474 */ 475 public void unblockInteractive() 476 { 477 // void gtk_source_completion_unblock_interactive (GtkSourceCompletion *completion); 478 gtk_source_completion_unblock_interactive(gtkSourceCompletion); 479 } 480 }