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.SourceSearchContext; 26 27 private import gio.AsyncResultIF; 28 private import gio.Cancellable; 29 private import glib.ConstructionException; 30 private import glib.ErrorG; 31 private import glib.GException; 32 private import glib.Str; 33 private import gobject.ObjectG; 34 private import gsv.SourceBuffer; 35 private import gsv.SourceSearchSettings; 36 private import gsv.SourceStyle; 37 private import gsv.c.functions; 38 public import gsv.c.types; 39 public import gsvc.gsvtypes; 40 private import gtk.TextIter; 41 42 43 /** */ 44 public class SourceSearchContext : ObjectG 45 { 46 /** the main Gtk struct */ 47 protected GtkSourceSearchContext* gtkSourceSearchContext; 48 49 /** Get the main Gtk struct */ 50 public GtkSourceSearchContext* getSourceSearchContextStruct(bool transferOwnership = false) 51 { 52 if (transferOwnership) 53 ownedRef = false; 54 return gtkSourceSearchContext; 55 } 56 57 /** the main Gtk struct as a void* */ 58 protected override void* getStruct() 59 { 60 return cast(void*)gtkSourceSearchContext; 61 } 62 63 protected override void setStruct(GObject* obj) 64 { 65 gtkSourceSearchContext = cast(GtkSourceSearchContext*)obj; 66 super.setStruct(obj); 67 } 68 69 /** 70 * Sets our main struct and passes it to the parent class. 71 */ 72 public this (GtkSourceSearchContext* gtkSourceSearchContext, bool ownedRef = false) 73 { 74 this.gtkSourceSearchContext = gtkSourceSearchContext; 75 super(cast(GObject*)gtkSourceSearchContext, ownedRef); 76 } 77 78 79 /** */ 80 public static GType getType() 81 { 82 return gtk_source_search_context_get_type(); 83 } 84 85 /** 86 * Creates a new search context, associated with @buffer, and customized with 87 * @settings. If @settings is %NULL, a new #GtkSourceSearchSettings object will 88 * be created, that you can retrieve with 89 * gtk_source_search_context_get_settings(). 90 * 91 * Params: 92 * buffer = a #GtkSourceBuffer. 93 * settings = a #GtkSourceSearchSettings, or %NULL. 94 * 95 * Returns: a new search context. 96 * 97 * Since: 3.10 98 * 99 * Throws: ConstructionException GTK+ fails to create the object. 100 */ 101 public this(SourceBuffer buffer, SourceSearchSettings settings) 102 { 103 auto p = gtk_source_search_context_new((buffer is null) ? null : buffer.getSourceBufferStruct(), (settings is null) ? null : settings.getSourceSearchSettingsStruct()); 104 105 if(p is null) 106 { 107 throw new ConstructionException("null returned by new"); 108 } 109 110 this(cast(GtkSourceSearchContext*) p, true); 111 } 112 113 /** 114 * Synchronous backward search. It is recommended to use the asynchronous 115 * functions instead, to not block the user interface. However, if you are sure 116 * that the @buffer is small, this function is more convenient to use. 117 * 118 * Deprecated: Use gtk_source_search_context_backward2() instead. 119 * 120 * Params: 121 * iter = start of search. 122 * matchStart = return location for start of match, or %NULL. 123 * matchEnd = return location for end of match, or %NULL. 124 * 125 * Returns: whether a match was found. 126 * 127 * Since: 3.10 128 */ 129 public bool backward(TextIter iter, out TextIter matchStart, out TextIter matchEnd) 130 { 131 GtkTextIter* outmatchStart = gMalloc!GtkTextIter(); 132 GtkTextIter* outmatchEnd = gMalloc!GtkTextIter(); 133 134 auto p = gtk_source_search_context_backward(gtkSourceSearchContext, (iter is null) ? null : iter.getTextIterStruct(), outmatchStart, outmatchEnd) != 0; 135 136 matchStart = ObjectG.getDObject!(TextIter)(outmatchStart, true); 137 matchEnd = ObjectG.getDObject!(TextIter)(outmatchEnd, true); 138 139 return p; 140 } 141 142 /** 143 * Synchronous backward search. It is recommended to use the asynchronous 144 * functions instead, to not block the user interface. However, if you are sure 145 * that the @buffer is small, this function is more convenient to use. 146 * 147 * The difference with gtk_source_search_context_backward() is that the 148 * @has_wrapped_around out parameter has been added for convenience. 149 * 150 * If the #GtkSourceSearchSettings:wrap-around property is %FALSE, this function 151 * doesn't try to wrap around. 152 * 153 * The @has_wrapped_around out parameter is set independently of whether a match 154 * is found. So if this function returns %FALSE, @has_wrapped_around will have 155 * the same value as the #GtkSourceSearchSettings:wrap-around property. 156 * 157 * Params: 158 * iter = start of search. 159 * matchStart = return location for start of match, or %NULL. 160 * matchEnd = return location for end of match, or %NULL. 161 * hasWrappedAround = return location to know whether the 162 * search has wrapped around, or %NULL. 163 * 164 * Returns: whether a match was found. 165 * 166 * Since: 3.22 167 */ 168 public bool backward2(TextIter iter, out TextIter matchStart, out TextIter matchEnd, out bool hasWrappedAround) 169 { 170 GtkTextIter* outmatchStart = gMalloc!GtkTextIter(); 171 GtkTextIter* outmatchEnd = gMalloc!GtkTextIter(); 172 int outhasWrappedAround; 173 174 auto p = gtk_source_search_context_backward2(gtkSourceSearchContext, (iter is null) ? null : iter.getTextIterStruct(), outmatchStart, outmatchEnd, &outhasWrappedAround) != 0; 175 176 matchStart = ObjectG.getDObject!(TextIter)(outmatchStart, true); 177 matchEnd = ObjectG.getDObject!(TextIter)(outmatchEnd, true); 178 hasWrappedAround = (outhasWrappedAround == 1); 179 180 return p; 181 } 182 183 /** 184 * The asynchronous version of gtk_source_search_context_backward2(). 185 * 186 * See the documentation of gtk_source_search_context_backward2() for more 187 * details. 188 * 189 * See the #GAsyncResult documentation to know how to use this function. 190 * 191 * If the operation is cancelled, the @callback will only be called if 192 * @cancellable was not %NULL. gtk_source_search_context_backward_async() takes 193 * ownership of @cancellable, so you can unref it after calling this function. 194 * 195 * Params: 196 * iter = start of search. 197 * cancellable = a #GCancellable, or %NULL. 198 * callback = a #GAsyncReadyCallback to call when the operation is finished. 199 * userData = the data to pass to the @callback function. 200 * 201 * Since: 3.10 202 */ 203 public void backwardAsync(TextIter iter, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 204 { 205 gtk_source_search_context_backward_async(gtkSourceSearchContext, (iter is null) ? null : iter.getTextIterStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 206 } 207 208 /** 209 * Finishes a backward search started with 210 * gtk_source_search_context_backward_async(). 211 * 212 * Deprecated: Use gtk_source_search_context_backward_finish2() instead. 213 * 214 * Params: 215 * result = a #GAsyncResult. 216 * matchStart = return location for start of match, or %NULL. 217 * matchEnd = return location for end of match, or %NULL. 218 * 219 * Returns: whether a match was found. 220 * 221 * Since: 3.10 222 * 223 * Throws: GException on failure. 224 */ 225 public bool backwardFinish(AsyncResultIF result, out TextIter matchStart, out TextIter matchEnd) 226 { 227 GtkTextIter* outmatchStart = gMalloc!GtkTextIter(); 228 GtkTextIter* outmatchEnd = gMalloc!GtkTextIter(); 229 GError* err = null; 230 231 auto p = gtk_source_search_context_backward_finish(gtkSourceSearchContext, (result is null) ? null : result.getAsyncResultStruct(), outmatchStart, outmatchEnd, &err) != 0; 232 233 if (err !is null) 234 { 235 throw new GException( new ErrorG(err) ); 236 } 237 238 matchStart = ObjectG.getDObject!(TextIter)(outmatchStart, true); 239 matchEnd = ObjectG.getDObject!(TextIter)(outmatchEnd, true); 240 241 return p; 242 } 243 244 /** 245 * Finishes a backward search started with 246 * gtk_source_search_context_backward_async(). 247 * 248 * See the documentation of gtk_source_search_context_backward2() for more 249 * details. 250 * 251 * Params: 252 * result = a #GAsyncResult. 253 * matchStart = return location for start of match, or %NULL. 254 * matchEnd = return location for end of match, or %NULL. 255 * hasWrappedAround = return location to know whether the 256 * search has wrapped around, or %NULL. 257 * 258 * Returns: whether a match was found. 259 * 260 * Since: 3.22 261 * 262 * Throws: GException on failure. 263 */ 264 public bool backwardFinish2(AsyncResultIF result, out TextIter matchStart, out TextIter matchEnd, out bool hasWrappedAround) 265 { 266 GtkTextIter* outmatchStart = gMalloc!GtkTextIter(); 267 GtkTextIter* outmatchEnd = gMalloc!GtkTextIter(); 268 int outhasWrappedAround; 269 GError* err = null; 270 271 auto p = gtk_source_search_context_backward_finish2(gtkSourceSearchContext, (result is null) ? null : result.getAsyncResultStruct(), outmatchStart, outmatchEnd, &outhasWrappedAround, &err) != 0; 272 273 if (err !is null) 274 { 275 throw new GException( new ErrorG(err) ); 276 } 277 278 matchStart = ObjectG.getDObject!(TextIter)(outmatchStart, true); 279 matchEnd = ObjectG.getDObject!(TextIter)(outmatchEnd, true); 280 hasWrappedAround = (outhasWrappedAround == 1); 281 282 return p; 283 } 284 285 /** 286 * Synchronous forward search. It is recommended to use the asynchronous 287 * functions instead, to not block the user interface. However, if you are sure 288 * that the @buffer is small, this function is more convenient to use. 289 * 290 * Deprecated: Use gtk_source_search_context_forward2() instead. 291 * 292 * Params: 293 * iter = start of search. 294 * matchStart = return location for start of match, or %NULL. 295 * matchEnd = return location for end of match, or %NULL. 296 * 297 * Returns: whether a match was found. 298 * 299 * Since: 3.10 300 */ 301 public bool forward(TextIter iter, out TextIter matchStart, out TextIter matchEnd) 302 { 303 GtkTextIter* outmatchStart = gMalloc!GtkTextIter(); 304 GtkTextIter* outmatchEnd = gMalloc!GtkTextIter(); 305 306 auto p = gtk_source_search_context_forward(gtkSourceSearchContext, (iter is null) ? null : iter.getTextIterStruct(), outmatchStart, outmatchEnd) != 0; 307 308 matchStart = ObjectG.getDObject!(TextIter)(outmatchStart, true); 309 matchEnd = ObjectG.getDObject!(TextIter)(outmatchEnd, true); 310 311 return p; 312 } 313 314 /** 315 * Synchronous forward search. It is recommended to use the asynchronous 316 * functions instead, to not block the user interface. However, if you are sure 317 * that the @buffer is small, this function is more convenient to use. 318 * 319 * The difference with gtk_source_search_context_forward() is that the 320 * @has_wrapped_around out parameter has been added for convenience. 321 * 322 * If the #GtkSourceSearchSettings:wrap-around property is %FALSE, this function 323 * doesn't try to wrap around. 324 * 325 * The @has_wrapped_around out parameter is set independently of whether a match 326 * is found. So if this function returns %FALSE, @has_wrapped_around will have 327 * the same value as the #GtkSourceSearchSettings:wrap-around property. 328 * 329 * Params: 330 * iter = start of search. 331 * matchStart = return location for start of match, or %NULL. 332 * matchEnd = return location for end of match, or %NULL. 333 * hasWrappedAround = return location to know whether the 334 * search has wrapped around, or %NULL. 335 * 336 * Returns: whether a match was found. 337 * 338 * Since: 3.22 339 */ 340 public bool forward2(TextIter iter, out TextIter matchStart, out TextIter matchEnd, out bool hasWrappedAround) 341 { 342 GtkTextIter* outmatchStart = gMalloc!GtkTextIter(); 343 GtkTextIter* outmatchEnd = gMalloc!GtkTextIter(); 344 int outhasWrappedAround; 345 346 auto p = gtk_source_search_context_forward2(gtkSourceSearchContext, (iter is null) ? null : iter.getTextIterStruct(), outmatchStart, outmatchEnd, &outhasWrappedAround) != 0; 347 348 matchStart = ObjectG.getDObject!(TextIter)(outmatchStart, true); 349 matchEnd = ObjectG.getDObject!(TextIter)(outmatchEnd, true); 350 hasWrappedAround = (outhasWrappedAround == 1); 351 352 return p; 353 } 354 355 /** 356 * The asynchronous version of gtk_source_search_context_forward2(). 357 * 358 * See the documentation of gtk_source_search_context_forward2() for more 359 * details. 360 * 361 * See the #GAsyncResult documentation to know how to use this function. 362 * 363 * If the operation is cancelled, the @callback will only be called if 364 * @cancellable was not %NULL. gtk_source_search_context_forward_async() takes 365 * ownership of @cancellable, so you can unref it after calling this function. 366 * 367 * Params: 368 * iter = start of search. 369 * cancellable = a #GCancellable, or %NULL. 370 * callback = a #GAsyncReadyCallback to call when the operation is finished. 371 * userData = the data to pass to the @callback function. 372 * 373 * Since: 3.10 374 */ 375 public void forwardAsync(TextIter iter, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 376 { 377 gtk_source_search_context_forward_async(gtkSourceSearchContext, (iter is null) ? null : iter.getTextIterStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 378 } 379 380 /** 381 * Finishes a forward search started with 382 * gtk_source_search_context_forward_async(). 383 * 384 * Deprecated: Use gtk_source_search_context_forward_finish2() instead. 385 * 386 * Params: 387 * result = a #GAsyncResult. 388 * matchStart = return location for start of match, or %NULL. 389 * matchEnd = return location for end of match, or %NULL. 390 * 391 * Returns: whether a match was found. 392 * 393 * Since: 3.10 394 * 395 * Throws: GException on failure. 396 */ 397 public bool forwardFinish(AsyncResultIF result, out TextIter matchStart, out TextIter matchEnd) 398 { 399 GtkTextIter* outmatchStart = gMalloc!GtkTextIter(); 400 GtkTextIter* outmatchEnd = gMalloc!GtkTextIter(); 401 GError* err = null; 402 403 auto p = gtk_source_search_context_forward_finish(gtkSourceSearchContext, (result is null) ? null : result.getAsyncResultStruct(), outmatchStart, outmatchEnd, &err) != 0; 404 405 if (err !is null) 406 { 407 throw new GException( new ErrorG(err) ); 408 } 409 410 matchStart = ObjectG.getDObject!(TextIter)(outmatchStart, true); 411 matchEnd = ObjectG.getDObject!(TextIter)(outmatchEnd, true); 412 413 return p; 414 } 415 416 /** 417 * Finishes a forward search started with 418 * gtk_source_search_context_forward_async(). 419 * 420 * See the documentation of gtk_source_search_context_forward2() for more 421 * details. 422 * 423 * Params: 424 * result = a #GAsyncResult. 425 * matchStart = return location for start of match, or %NULL. 426 * matchEnd = return location for end of match, or %NULL. 427 * hasWrappedAround = return location to know whether the 428 * search has wrapped around, or %NULL. 429 * 430 * Returns: whether a match was found. 431 * 432 * Since: 3.22 433 * 434 * Throws: GException on failure. 435 */ 436 public bool forwardFinish2(AsyncResultIF result, out TextIter matchStart, out TextIter matchEnd, out bool hasWrappedAround) 437 { 438 GtkTextIter* outmatchStart = gMalloc!GtkTextIter(); 439 GtkTextIter* outmatchEnd = gMalloc!GtkTextIter(); 440 int outhasWrappedAround; 441 GError* err = null; 442 443 auto p = gtk_source_search_context_forward_finish2(gtkSourceSearchContext, (result is null) ? null : result.getAsyncResultStruct(), outmatchStart, outmatchEnd, &outhasWrappedAround, &err) != 0; 444 445 if (err !is null) 446 { 447 throw new GException( new ErrorG(err) ); 448 } 449 450 matchStart = ObjectG.getDObject!(TextIter)(outmatchStart, true); 451 matchEnd = ObjectG.getDObject!(TextIter)(outmatchEnd, true); 452 hasWrappedAround = (outhasWrappedAround == 1); 453 454 return p; 455 } 456 457 /** 458 * Returns: the associated buffer. 459 * 460 * Since: 3.10 461 */ 462 public SourceBuffer getBuffer() 463 { 464 auto p = gtk_source_search_context_get_buffer(gtkSourceSearchContext); 465 466 if(p is null) 467 { 468 return null; 469 } 470 471 return ObjectG.getDObject!(SourceBuffer)(cast(GtkSourceBuffer*) p); 472 } 473 474 /** 475 * Returns: whether to highlight the search occurrences. 476 * 477 * Since: 3.10 478 */ 479 public bool getHighlight() 480 { 481 return gtk_source_search_context_get_highlight(gtkSourceSearchContext) != 0; 482 } 483 484 /** 485 * Returns: the #GtkSourceStyle to apply on search matches. 486 * 487 * Since: 3.16 488 */ 489 public SourceStyle getMatchStyle() 490 { 491 auto p = gtk_source_search_context_get_match_style(gtkSourceSearchContext); 492 493 if(p is null) 494 { 495 return null; 496 } 497 498 return ObjectG.getDObject!(SourceStyle)(cast(GtkSourceStyle*) p); 499 } 500 501 /** 502 * Gets the position of a search occurrence. If the buffer is not already fully 503 * scanned, the position may be unknown, and -1 is returned. If 0 is returned, 504 * it means that this part of the buffer has already been scanned, and that 505 * @match_start and @match_end don't delimit an occurrence. 506 * 507 * Params: 508 * matchStart = the start of the occurrence. 509 * matchEnd = the end of the occurrence. 510 * 511 * Returns: the position of the search occurrence. The first occurrence has the 512 * position 1 (not 0). Returns 0 if @match_start and @match_end don't delimit 513 * an occurrence. Returns -1 if the position is not yet known. 514 * 515 * Since: 3.10 516 */ 517 public int getOccurrencePosition(TextIter matchStart, TextIter matchEnd) 518 { 519 return gtk_source_search_context_get_occurrence_position(gtkSourceSearchContext, (matchStart is null) ? null : matchStart.getTextIterStruct(), (matchEnd is null) ? null : matchEnd.getTextIterStruct()); 520 } 521 522 /** 523 * Gets the total number of search occurrences. If the buffer is not already 524 * fully scanned, the total number of occurrences is unknown, and -1 is 525 * returned. 526 * 527 * Returns: the total number of search occurrences, or -1 if unknown. 528 * 529 * Since: 3.10 530 */ 531 public int getOccurrencesCount() 532 { 533 return gtk_source_search_context_get_occurrences_count(gtkSourceSearchContext); 534 } 535 536 /** 537 * Regular expression patterns must follow certain rules. If 538 * #GtkSourceSearchSettings:search-text breaks a rule, the error can be retrieved 539 * with this function. The error domain is #G_REGEX_ERROR. 540 * 541 * Free the return value with g_error_free(). 542 * 543 * Returns: the #GError, or %NULL if the pattern is valid. 544 * 545 * Since: 3.10 546 */ 547 public ErrorG getRegexError() 548 { 549 auto p = gtk_source_search_context_get_regex_error(gtkSourceSearchContext); 550 551 if(p is null) 552 { 553 return null; 554 } 555 556 return new ErrorG(cast(GError*) p, true); 557 } 558 559 /** 560 * Returns: the search settings. 561 * 562 * Since: 3.10 563 */ 564 public SourceSearchSettings getSettings() 565 { 566 auto p = gtk_source_search_context_get_settings(gtkSourceSearchContext); 567 568 if(p is null) 569 { 570 return null; 571 } 572 573 return ObjectG.getDObject!(SourceSearchSettings)(cast(GtkSourceSearchSettings*) p); 574 } 575 576 /** 577 * Replaces a search match by another text. If @match_start and @match_end 578 * doesn't correspond to a search match, %FALSE is returned. 579 * 580 * For a regular expression replacement, you can check if @replace is valid by 581 * calling g_regex_check_replacement(). The @replace text can contain 582 * backreferences; read the g_regex_replace() documentation for more details. 583 * 584 * Deprecated: Use gtk_source_search_context_replace2() instead. 585 * 586 * Params: 587 * matchStart = the start of the match to replace. 588 * matchEnd = the end of the match to replace. 589 * replace = the replacement text. 590 * replaceLength = the length of @replace in bytes, or -1. 591 * 592 * Returns: whether the match has been replaced. 593 * 594 * Since: 3.10 595 * 596 * Throws: GException on failure. 597 */ 598 public bool replace(TextIter matchStart, TextIter matchEnd, string replace, int replaceLength) 599 { 600 GError* err = null; 601 602 auto p = gtk_source_search_context_replace(gtkSourceSearchContext, (matchStart is null) ? null : matchStart.getTextIterStruct(), (matchEnd is null) ? null : matchEnd.getTextIterStruct(), Str.toStringz(replace), replaceLength, &err) != 0; 603 604 if (err !is null) 605 { 606 throw new GException( new ErrorG(err) ); 607 } 608 609 return p; 610 } 611 612 /** 613 * Replaces a search match by another text. If @match_start and @match_end 614 * doesn't correspond to a search match, %FALSE is returned. 615 * 616 * Unlike with gtk_source_search_context_replace(), the @match_start and 617 * @match_end iters are revalidated to point to the replacement text boundaries. 618 * 619 * For a regular expression replacement, you can check if @replace is valid by 620 * calling g_regex_check_replacement(). The @replace text can contain 621 * backreferences; read the g_regex_replace() documentation for more details. 622 * 623 * Params: 624 * matchStart = the start of the match to replace. 625 * matchEnd = the end of the match to replace. 626 * replace = the replacement text. 627 * replaceLength = the length of @replace in bytes, or -1. 628 * 629 * Returns: whether the match has been replaced. 630 * 631 * Since: 3.22 632 * 633 * Throws: GException on failure. 634 */ 635 public bool replace2(TextIter matchStart, TextIter matchEnd, string replace, int replaceLength) 636 { 637 GError* err = null; 638 639 auto p = gtk_source_search_context_replace2(gtkSourceSearchContext, (matchStart is null) ? null : matchStart.getTextIterStruct(), (matchEnd is null) ? null : matchEnd.getTextIterStruct(), Str.toStringz(replace), replaceLength, &err) != 0; 640 641 if (err !is null) 642 { 643 throw new GException( new ErrorG(err) ); 644 } 645 646 return p; 647 } 648 649 /** 650 * Replaces all search matches by another text. It is a synchronous function, so 651 * it can block the user interface. 652 * 653 * For a regular expression replacement, you can check if @replace is valid by 654 * calling g_regex_check_replacement(). The @replace text can contain 655 * backreferences; read the g_regex_replace() documentation for more details. 656 * 657 * Params: 658 * replace = the replacement text. 659 * replaceLength = the length of @replace in bytes, or -1. 660 * 661 * Returns: the number of replaced matches. 662 * 663 * Since: 3.10 664 * 665 * Throws: GException on failure. 666 */ 667 public uint replaceAll(string replace, int replaceLength) 668 { 669 GError* err = null; 670 671 auto p = gtk_source_search_context_replace_all(gtkSourceSearchContext, Str.toStringz(replace), replaceLength, &err); 672 673 if (err !is null) 674 { 675 throw new GException( new ErrorG(err) ); 676 } 677 678 return p; 679 } 680 681 /** 682 * Enables or disables the search occurrences highlighting. 683 * 684 * Params: 685 * highlight = the setting. 686 * 687 * Since: 3.10 688 */ 689 public void setHighlight(bool highlight) 690 { 691 gtk_source_search_context_set_highlight(gtkSourceSearchContext, highlight); 692 } 693 694 /** 695 * Set the style to apply on search matches. If @match_style is %NULL, default 696 * theme's scheme 'match-style' will be used. 697 * To enable or disable the search highlighting, use 698 * gtk_source_search_context_set_highlight(). 699 * 700 * Params: 701 * matchStyle = a #GtkSourceStyle, or %NULL. 702 * 703 * Since: 3.16 704 */ 705 public void setMatchStyle(SourceStyle matchStyle) 706 { 707 gtk_source_search_context_set_match_style(gtkSourceSearchContext, (matchStyle is null) ? null : matchStyle.getSourceStyleStruct()); 708 } 709 710 /** 711 * Associate a #GtkSourceSearchSettings with the search context. If @settings is 712 * %NULL, a new one will be created. 713 * 714 * The search context holds a reference to @settings. 715 * 716 * Deprecated: The #GtkSourceSearchContext:settings property will become a 717 * construct-only property in a future version. Create a new 718 * #GtkSourceSearchContext instead, or change the #GtkSourceSearchSettings 719 * properties. When the #GtkSourceSearchContext:settings property will become 720 * construct-only, it will be possible to simplify some code that needed to 721 * listen to the notify::settings signal. 722 * 723 * Params: 724 * settings = the new #GtkSourceSearchSettings, or %NULL. 725 * 726 * Since: 3.10 727 */ 728 public void setSettings(SourceSearchSettings settings) 729 { 730 gtk_source_search_context_set_settings(gtkSourceSearchContext, (settings is null) ? null : settings.getSourceSearchSettingsStruct()); 731 } 732 }