1 /*
2  * This file is part of d-handy.
3  *
4  * d-handy 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  * d-handy 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 d-handy; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 module handy.ExpanderRow;
20 
21 private import glib.ConstructionException;
22 private import glib.Str;
23 private import gobject.ObjectG;
24 private import gtk.Widget;
25 private import handy.PreferencesRow;
26 private import handy.c.functions;
27 public  import handy.c.types;
28 
29 
30 /** */
31 public class ExpanderRow : PreferencesRow
32 {
33 	/** the main Gtk struct */
34 	protected HdyExpanderRow* hdyExpanderRow;
35 
36 	/** Get the main Gtk struct */
37 	public HdyExpanderRow* getExpanderRowStruct(bool transferOwnership = false)
38 	{
39 		if (transferOwnership)
40 			ownedRef = false;
41 		return hdyExpanderRow;
42 	}
43 
44 	/** the main Gtk struct as a void* */
45 	protected override void* getStruct()
46 	{
47 		return cast(void*)hdyExpanderRow;
48 	}
49 
50 	/**
51 	 * Sets our main struct and passes it to the parent class.
52 	 */
53 	public this (HdyExpanderRow* hdyExpanderRow, bool ownedRef = false)
54 	{
55 		this.hdyExpanderRow = hdyExpanderRow;
56 		super(cast(HdyPreferencesRow*)hdyExpanderRow, ownedRef);
57 	}
58 
59 
60 	/** */
61 	public static GType getType()
62 	{
63 		return hdy_expander_row_get_type();
64 	}
65 
66 	/**
67 	 * Creates a new #HdyExpanderRow.
68 	 *
69 	 * Returns: a new #HdyExpanderRow
70 	 *
71 	 * Since: 0.0.6
72 	 *
73 	 * Throws: ConstructionException GTK+ fails to create the object.
74 	 */
75 	public this()
76 	{
77 		auto __p = hdy_expander_row_new();
78 
79 		if(__p is null)
80 		{
81 			throw new ConstructionException("null returned by new");
82 		}
83 
84 		this(cast(HdyExpanderRow*) __p);
85 	}
86 
87 	/**
88 	 * Adds an action widget to @self.
89 	 *
90 	 * Params:
91 	 *     widget = the action widget
92 	 *
93 	 * Since: 1.0
94 	 */
95 	public void addAction(Widget widget)
96 	{
97 		hdy_expander_row_add_action(hdyExpanderRow, (widget is null) ? null : widget.getWidgetStruct());
98 	}
99 
100 	/**
101 	 * Adds a prefix widget to @self.
102 	 *
103 	 * Params:
104 	 *     widget = the prefix widget
105 	 *
106 	 * Since: 1.0
107 	 */
108 	public void addPrefix(Widget widget)
109 	{
110 		hdy_expander_row_add_prefix(hdyExpanderRow, (widget is null) ? null : widget.getWidgetStruct());
111 	}
112 
113 	/**
114 	 * Gets whether the expansion of @self is enabled.
115 	 *
116 	 * Returns: whether the expansion of @self is enabled.
117 	 *
118 	 * Since: 0.0.6
119 	 */
120 	public bool getEnableExpansion()
121 	{
122 		return hdy_expander_row_get_enable_expansion(hdyExpanderRow) != 0;
123 	}
124 
125 	/** */
126 	public bool getExpanded()
127 	{
128 		return hdy_expander_row_get_expanded(hdyExpanderRow) != 0;
129 	}
130 
131 	/**
132 	 * Gets the icon name for @self.
133 	 *
134 	 * Returns: the icon name for @self.
135 	 *
136 	 * Since: 1.0
137 	 */
138 	public string getIconName()
139 	{
140 		return Str.toString(hdy_expander_row_get_icon_name(hdyExpanderRow));
141 	}
142 
143 	/**
144 	 * Gets whether the switch enabling the expansion of @self is visible.
145 	 *
146 	 * Returns: whether the switch enabling the expansion of @self is visible.
147 	 *
148 	 * Since: 0.0.6
149 	 */
150 	public bool getShowEnableSwitch()
151 	{
152 		return hdy_expander_row_get_show_enable_switch(hdyExpanderRow) != 0;
153 	}
154 
155 	/**
156 	 * Gets the subtitle for @self.
157 	 *
158 	 * Returns: the subtitle for @self, or %NULL.
159 	 *
160 	 * Since: 1.0
161 	 */
162 	public string getSubtitle()
163 	{
164 		return Str.toString(hdy_expander_row_get_subtitle(hdyExpanderRow));
165 	}
166 
167 	/**
168 	 * Gets whether an embedded underline in the text of the title and subtitle
169 	 * labels indicates a mnemonic. See hdy_expander_row_set_use_underline().
170 	 *
171 	 * Returns: %TRUE if an embedded underline in the title and subtitle labels
172 	 *     indicates the mnemonic accelerator keys.
173 	 *
174 	 * Since: 1.0
175 	 */
176 	public override bool getUseUnderline()
177 	{
178 		return hdy_expander_row_get_use_underline(hdyExpanderRow) != 0;
179 	}
180 
181 	/**
182 	 * Sets whether the expansion of @self is enabled.
183 	 *
184 	 * Params:
185 	 *     enableExpansion = %TRUE to enable the expansion
186 	 *
187 	 * Since: 0.0.6
188 	 */
189 	public void setEnableExpansion(bool enableExpansion)
190 	{
191 		hdy_expander_row_set_enable_expansion(hdyExpanderRow, enableExpansion);
192 	}
193 
194 	/** */
195 	public void setExpanded(bool expanded)
196 	{
197 		hdy_expander_row_set_expanded(hdyExpanderRow, expanded);
198 	}
199 
200 	/**
201 	 * Sets the icon name for @self.
202 	 *
203 	 * Params:
204 	 *     iconName = the icon name
205 	 *
206 	 * Since: 1.0
207 	 */
208 	public void setIconName(string iconName)
209 	{
210 		hdy_expander_row_set_icon_name(hdyExpanderRow, Str.toStringz(iconName));
211 	}
212 
213 	/**
214 	 * Sets whether the switch enabling the expansion of @self is visible.
215 	 *
216 	 * Params:
217 	 *     showEnableSwitch = %TRUE to show the switch enabling the expansion
218 	 *
219 	 * Since: 0.0.6
220 	 */
221 	public void setShowEnableSwitch(bool showEnableSwitch)
222 	{
223 		hdy_expander_row_set_show_enable_switch(hdyExpanderRow, showEnableSwitch);
224 	}
225 
226 	/**
227 	 * Sets the subtitle for @self.
228 	 *
229 	 * Params:
230 	 *     subtitle = the subtitle
231 	 *
232 	 * Since: 1.0
233 	 */
234 	public void setSubtitle(string subtitle)
235 	{
236 		hdy_expander_row_set_subtitle(hdyExpanderRow, Str.toStringz(subtitle));
237 	}
238 
239 	/**
240 	 * If true, an underline in the text of the title and subtitle labels indicates
241 	 * the next character should be used for the mnemonic accelerator key.
242 	 *
243 	 * Params:
244 	 *     useUnderline = %TRUE if underlines in the text indicate mnemonics
245 	 *
246 	 * Since: 1.0
247 	 */
248 	public override void setUseUnderline(bool useUnderline)
249 	{
250 		hdy_expander_row_set_use_underline(hdyExpanderRow, useUnderline);
251 	}
252 }