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  * Conversion parameters:
26  * inFile  = GtkHeaderBar.html
27  * outPack = gtk
28  * outFile = HeaderBar
29  * strct   = GtkHeaderBar
30  * realStrct=
31  * ctorStrct=
32  * clss    = HeaderBar
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_header_bar_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- gtk.Widget
48  * structWrap:
49  * 	- GtkWidget* -> Widget
50  * module aliases:
51  * local aliases:
52  * overrides:
53  */
54 
55 module gtk.HeaderBar;
56 
57 public  import gtkc.gtktypes;
58 
59 private import gtkc.gtk;
60 private import glib.ConstructionException;
61 private import gobject.ObjectG;
62 
63 
64 private import glib.Str;
65 private import gtk.Widget;
66 
67 
68 
69 private import gtk.Container;
70 
71 /**
72  * GtkHeaderBar is similar to a horizontal GtkBox, it allows
73  * to place children at the start or the end. In addition,
74  * it allows a title to be displayed. The title will be
75  * centered with respect to the width of the box, even if the children
76  * at either side take up different amounts of space.
77  */
78 public class HeaderBar : Container
79 {
80 	
81 	/** the main Gtk struct */
82 	protected GtkHeaderBar* gtkHeaderBar;
83 	
84 	
85 	public GtkHeaderBar* getHeaderBarStruct()
86 	{
87 		return gtkHeaderBar;
88 	}
89 	
90 	
91 	/** the main Gtk struct as a void* */
92 	protected override void* getStruct()
93 	{
94 		return cast(void*)gtkHeaderBar;
95 	}
96 	
97 	/**
98 	 * Sets our main struct and passes it to the parent class
99 	 */
100 	public this (GtkHeaderBar* gtkHeaderBar)
101 	{
102 		super(cast(GtkContainer*)gtkHeaderBar);
103 		this.gtkHeaderBar = gtkHeaderBar;
104 	}
105 	
106 	protected override void setStruct(GObject* obj)
107 	{
108 		super.setStruct(obj);
109 		gtkHeaderBar = cast(GtkHeaderBar*)obj;
110 	}
111 	
112 	/**
113 	 */
114 	
115 	/**
116 	 * Creates a new GtkHeaderBar widget.
117 	 * Throws: ConstructionException GTK+ fails to create the object.
118 	 */
119 	public this ()
120 	{
121 		// GtkWidget * gtk_header_bar_new (void);
122 		auto p = gtk_header_bar_new();
123 		if(p is null)
124 		{
125 			throw new ConstructionException("null returned by gtk_header_bar_new()");
126 		}
127 		this(cast(GtkHeaderBar*) p);
128 	}
129 	
130 	/**
131 	 * Sets the title of the GtkHeaderBar. The title should help a user
132 	 * identify the current view. A good title should not include the
133 	 * application name.
134 	 * Params:
135 	 * title = a title. [allow-none]
136 	 * Since 3.10
137 	 */
138 	public void setTitle(string title)
139 	{
140 		// void gtk_header_bar_set_title (GtkHeaderBar *bar,  const gchar *title);
141 		gtk_header_bar_set_title(gtkHeaderBar, Str.toStringz(title));
142 	}
143 	
144 	/**
145 	 * Retrieves the title of the header. See gtk_header_bar_set_title().
146 	 * Returns: the title of the header, or NULL if none has been set explicitely. The returned string is owned by the widget and must not be modified or freed. Since 3.10
147 	 */
148 	public string getTitle()
149 	{
150 		// const gchar * gtk_header_bar_get_title (GtkHeaderBar *bar);
151 		return Str.toString(gtk_header_bar_get_title(gtkHeaderBar));
152 	}
153 	
154 	/**
155 	 * Sets the subtitle of the GtkHeaderBar. The title should give a user
156 	 * an additional detail to help him identify the current view.
157 	 * Note that GtkHeaderBar always reserves room for the subtitle, even
158 	 * if none is currently set. If this is not desired, use
159 	 * gtk_header_bar_set_custom_title() to place your own label in the
160 	 * title position. To achieve the same style, use the "title" style
161 	 * class.
162 	 * Params:
163 	 * subtitle = a subtitle. [allow-none]
164 	 * Since 3.10
165 	 */
166 	public void setSubtitle(string subtitle)
167 	{
168 		// void gtk_header_bar_set_subtitle (GtkHeaderBar *bar,  const gchar *subtitle);
169 		gtk_header_bar_set_subtitle(gtkHeaderBar, Str.toStringz(subtitle));
170 	}
171 	
172 	/**
173 	 * Retrieves the subtitle of the header. See gtk_header_bar_set_subtitle().
174 	 * Returns: the subtitle of the header, or NULL if none has been set explicitely. The returned string is owned by the widget and must not be modified or freed. Since 3.10
175 	 */
176 	public string getSubtitle()
177 	{
178 		// const gchar * gtk_header_bar_get_subtitle (GtkHeaderBar *bar);
179 		return Str.toString(gtk_header_bar_get_subtitle(gtkHeaderBar));
180 	}
181 	
182 	/**
183 	 * Sets a custom title for the GtkHeaderBar. The title should help a
184 	 * user identify the current view. This supercedes any title set by
185 	 * gtk_header_bar_set_title() or gtk_header_bar_set_subtitle().
186 	 * You should set the custom title to NULL, for the header title label
187 	 * to be visible again.
188 	 * Params:
189 	 * titleWidget = a custom widget to use for a title. [allow-none]
190 	 * Since 3.10
191 	 */
192 	public void setCustomTitle(Widget titleWidget)
193 	{
194 		// void gtk_header_bar_set_custom_title (GtkHeaderBar *bar,  GtkWidget *title_widget);
195 		gtk_header_bar_set_custom_title(gtkHeaderBar, (titleWidget is null) ? null : titleWidget.getWidgetStruct());
196 	}
197 	
198 	/**
199 	 * Retrieves the custom title widget of the header. See
200 	 * gtk_header_bar_set_custom_title().
201 	 * Returns: the custom title widget of the header, or NULL if none has been set explicitely. [transfer none] Since 3.10
202 	 */
203 	public Widget getCustomTitle()
204 	{
205 		// GtkWidget * gtk_header_bar_get_custom_title (GtkHeaderBar *bar);
206 		auto p = gtk_header_bar_get_custom_title(gtkHeaderBar);
207 		
208 		if(p is null)
209 		{
210 			return null;
211 		}
212 		
213 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
214 	}
215 	
216 	/**
217 	 * Adds child to box, packed with reference to the
218 	 * start of the box.
219 	 * Params:
220 	 * child = the GtkWidget to be added to bar
221 	 * Since 3.10
222 	 */
223 	public void packStart(Widget child)
224 	{
225 		// void gtk_header_bar_pack_start (GtkHeaderBar *bar,  GtkWidget *child);
226 		gtk_header_bar_pack_start(gtkHeaderBar, (child is null) ? null : child.getWidgetStruct());
227 	}
228 	
229 	/**
230 	 * Adds child to box, packed with reference to the
231 	 * end of the box.
232 	 * Params:
233 	 * child = the GtkWidget to be added to bar
234 	 * Since 3.10
235 	 */
236 	public void packEnd(Widget child)
237 	{
238 		// void gtk_header_bar_pack_end (GtkHeaderBar *bar,  GtkWidget *child);
239 		gtk_header_bar_pack_end(gtkHeaderBar, (child is null) ? null : child.getWidgetStruct());
240 	}
241 	
242 	/**
243 	 * Sets whether this header bar shows a window close
244 	 * button.
245 	 * Params:
246 	 * setting = TRUE to show a window close button
247 	 * Since 3.10
248 	 */
249 	public void setShowCloseButton(int setting)
250 	{
251 		// void gtk_header_bar_set_show_close_button  (GtkHeaderBar *bar,  gboolean setting);
252 		gtk_header_bar_set_show_close_button(gtkHeaderBar, setting);
253 	}
254 	
255 	/**
256 	 * Returns whether this header bar shows a window close
257 	 * button.
258 	 * Returns: TRUE if a window close button is shown Since 3.10
259 	 */
260 	public int getShowCloseButton()
261 	{
262 		// gboolean gtk_header_bar_get_show_close_button  (GtkHeaderBar *bar);
263 		return gtk_header_bar_get_show_close_button(gtkHeaderBar);
264 	}
265 }