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