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