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.SourceSearchSettings;
26 
27 private import glib.ConstructionException;
28 private import glib.Str;
29 private import gobject.ObjectG;
30 private import gsv.c.functions;
31 public  import gsv.c.types;
32 public  import gsvc.gsvtypes;
33 
34 
35 /** */
36 public class SourceSearchSettings : ObjectG
37 {
38 	/** the main Gtk struct */
39 	protected GtkSourceSearchSettings* gtkSourceSearchSettings;
40 
41 	/** Get the main Gtk struct */
42 	public GtkSourceSearchSettings* getSourceSearchSettingsStruct(bool transferOwnership = false)
43 	{
44 		if (transferOwnership)
45 			ownedRef = false;
46 		return gtkSourceSearchSettings;
47 	}
48 
49 	/** the main Gtk struct as a void* */
50 	protected override void* getStruct()
51 	{
52 		return cast(void*)gtkSourceSearchSettings;
53 	}
54 
55 	/**
56 	 * Sets our main struct and passes it to the parent class.
57 	 */
58 	public this (GtkSourceSearchSettings* gtkSourceSearchSettings, bool ownedRef = false)
59 	{
60 		this.gtkSourceSearchSettings = gtkSourceSearchSettings;
61 		super(cast(GObject*)gtkSourceSearchSettings, ownedRef);
62 	}
63 
64 
65 	/** */
66 	public static GType getType()
67 	{
68 		return gtk_source_search_settings_get_type();
69 	}
70 
71 	/**
72 	 * Creates a new search settings object.
73 	 *
74 	 * Returns: a new search settings object.
75 	 *
76 	 * Since: 3.10
77 	 *
78 	 * Throws: ConstructionException GTK+ fails to create the object.
79 	 */
80 	public this()
81 	{
82 		auto p = gtk_source_search_settings_new();
83 
84 		if(p is null)
85 		{
86 			throw new ConstructionException("null returned by new");
87 		}
88 
89 		this(cast(GtkSourceSearchSettings*) p, true);
90 	}
91 
92 	/**
93 	 * Returns: whether to search at word boundaries.
94 	 *
95 	 * Since: 3.10
96 	 */
97 	public bool getAtWordBoundaries()
98 	{
99 		return gtk_source_search_settings_get_at_word_boundaries(gtkSourceSearchSettings) != 0;
100 	}
101 
102 	/**
103 	 * Returns: whether the search is case sensitive.
104 	 *
105 	 * Since: 3.10
106 	 */
107 	public bool getCaseSensitive()
108 	{
109 		return gtk_source_search_settings_get_case_sensitive(gtkSourceSearchSettings) != 0;
110 	}
111 
112 	/**
113 	 * Returns: whether to search by regular expressions.
114 	 *
115 	 * Since: 3.10
116 	 */
117 	public bool getRegexEnabled()
118 	{
119 		return gtk_source_search_settings_get_regex_enabled(gtkSourceSearchSettings) != 0;
120 	}
121 
122 	/**
123 	 * Gets the text to search. The return value must not be freed.
124 	 *
125 	 * You may be interested to call gtk_source_utils_escape_search_text() after
126 	 * this function.
127 	 *
128 	 * Returns: the text to search, or %NULL if the search is disabled.
129 	 *
130 	 * Since: 3.10
131 	 */
132 	public string getSearchText()
133 	{
134 		return Str.toString(gtk_source_search_settings_get_search_text(gtkSourceSearchSettings));
135 	}
136 
137 	/**
138 	 * Returns: whether to wrap around the search.
139 	 *
140 	 * Since: 3.10
141 	 */
142 	public bool getWrapAround()
143 	{
144 		return gtk_source_search_settings_get_wrap_around(gtkSourceSearchSettings) != 0;
145 	}
146 
147 	/**
148 	 * Change whether the search is done at word boundaries. If @at_word_boundaries
149 	 * is %TRUE, a search match must start and end a word. The match can span
150 	 * multiple words. See also gtk_text_iter_starts_word() and
151 	 * gtk_text_iter_ends_word().
152 	 *
153 	 * Params:
154 	 *     atWordBoundaries = the setting.
155 	 *
156 	 * Since: 3.10
157 	 */
158 	public void setAtWordBoundaries(bool atWordBoundaries)
159 	{
160 		gtk_source_search_settings_set_at_word_boundaries(gtkSourceSearchSettings, atWordBoundaries);
161 	}
162 
163 	/**
164 	 * Enables or disables the case sensitivity for the search.
165 	 *
166 	 * Params:
167 	 *     caseSensitive = the setting.
168 	 *
169 	 * Since: 3.10
170 	 */
171 	public void setCaseSensitive(bool caseSensitive)
172 	{
173 		gtk_source_search_settings_set_case_sensitive(gtkSourceSearchSettings, caseSensitive);
174 	}
175 
176 	/**
177 	 * Enables or disables whether to search by regular expressions.
178 	 * If enabled, the #GtkSourceSearchSettings:search-text property contains the
179 	 * pattern of the regular expression.
180 	 *
181 	 * #GtkSourceSearchContext uses #GRegex when regex search is enabled. See the
182 	 * [Regular expression syntax](https://developer.gnome.org/glib/stable/glib-regex-syntax.html)
183 	 * page in the GLib reference manual.
184 	 *
185 	 * Params:
186 	 *     regexEnabled = the setting.
187 	 *
188 	 * Since: 3.10
189 	 */
190 	public void setRegexEnabled(bool regexEnabled)
191 	{
192 		gtk_source_search_settings_set_regex_enabled(gtkSourceSearchSettings, regexEnabled);
193 	}
194 
195 	/**
196 	 * Sets the text to search. If @search_text is %NULL or is empty, the search
197 	 * will be disabled. A copy of @search_text will be made, so you can safely free
198 	 * @search_text after a call to this function.
199 	 *
200 	 * You may be interested to call gtk_source_utils_unescape_search_text() before
201 	 * this function.
202 	 *
203 	 * Params:
204 	 *     searchText = the nul-terminated text to search, or %NULL to disable the search.
205 	 *
206 	 * Since: 3.10
207 	 */
208 	public void setSearchText(string searchText)
209 	{
210 		gtk_source_search_settings_set_search_text(gtkSourceSearchSettings, Str.toStringz(searchText));
211 	}
212 
213 	/**
214 	 * Enables or disables the wrap around search. If @wrap_around is %TRUE, the
215 	 * forward search continues at the beginning of the buffer if no search
216 	 * occurrences are found. Similarly, the backward search continues to search at
217 	 * the end of the buffer.
218 	 *
219 	 * Params:
220 	 *     wrapAround = the setting.
221 	 *
222 	 * Since: 3.10
223 	 */
224 	public void setWrapAround(bool wrapAround)
225 	{
226 		gtk_source_search_settings_set_wrap_around(gtkSourceSearchSettings, wrapAround);
227 	}
228 }