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