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