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