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