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