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 gtk.ActionBar;
26 
27 private import glib.ConstructionException;
28 private import gobject.ObjectG;
29 private import gtk.Bin;
30 private import gtk.Widget;
31 private import gtkc.gtk;
32 public  import gtkc.gtktypes;
33 
34 
35 /**
36  * GtkActionBar is designed to present contextual actions. It is
37  * expected to be displayed below the content and expand horizontally
38  * to fill the area.
39  * 
40  * It allows placing children at the start or the end. In addition, it
41  * contains an internal centered box which is centered with respect to
42  * the full width of the box, even if the children at either side take
43  * up different amounts of space.
44  * 
45  * # CSS nodes
46  * 
47  * GtkActionBar has a single CSS node with name actionbar.
48  */
49 public class ActionBar : Bin
50 {
51 	/** the main Gtk struct */
52 	protected GtkActionBar* gtkActionBar;
53 
54 	/** Get the main Gtk struct */
55 	public GtkActionBar* getActionBarStruct(bool transferOwnership = false)
56 	{
57 		if (transferOwnership)
58 			ownedRef = false;
59 		return gtkActionBar;
60 	}
61 
62 	/** the main Gtk struct as a void* */
63 	protected override void* getStruct()
64 	{
65 		return cast(void*)gtkActionBar;
66 	}
67 
68 	protected override void setStruct(GObject* obj)
69 	{
70 		gtkActionBar = cast(GtkActionBar*)obj;
71 		super.setStruct(obj);
72 	}
73 
74 	/**
75 	 * Sets our main struct and passes it to the parent class.
76 	 */
77 	public this (GtkActionBar* gtkActionBar, bool ownedRef = false)
78 	{
79 		this.gtkActionBar = gtkActionBar;
80 		super(cast(GtkBin*)gtkActionBar, ownedRef);
81 	}
82 
83 
84 	/** */
85 	public static GType getType()
86 	{
87 		return gtk_action_bar_get_type();
88 	}
89 
90 	/**
91 	 * Creates a new #GtkActionBar widget.
92 	 *
93 	 * Returns: a new #GtkActionBar
94 	 *
95 	 * Since: 3.12
96 	 *
97 	 * Throws: ConstructionException GTK+ fails to create the object.
98 	 */
99 	public this()
100 	{
101 		auto p = gtk_action_bar_new();
102 		
103 		if(p is null)
104 		{
105 			throw new ConstructionException("null returned by new");
106 		}
107 		
108 		this(cast(GtkActionBar*) p);
109 	}
110 
111 	/**
112 	 * Retrieves the center bar widget of the bar.
113 	 *
114 	 * Returns: the center #GtkWidget or %NULL.
115 	 *
116 	 * Since: 3.12
117 	 */
118 	public Widget getCenterWidget()
119 	{
120 		auto p = gtk_action_bar_get_center_widget(gtkActionBar);
121 		
122 		if(p is null)
123 		{
124 			return null;
125 		}
126 		
127 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
128 	}
129 
130 	/**
131 	 * Adds @child to @action_bar, packed with reference to the
132 	 * end of the @action_bar.
133 	 *
134 	 * Params:
135 	 *     child = the #GtkWidget to be added to @action_bar
136 	 *
137 	 * Since: 3.12
138 	 */
139 	public void packEnd(Widget child)
140 	{
141 		gtk_action_bar_pack_end(gtkActionBar, (child is null) ? null : child.getWidgetStruct());
142 	}
143 
144 	/**
145 	 * Adds @child to @action_bar, packed with reference to the
146 	 * start of the @action_bar.
147 	 *
148 	 * Params:
149 	 *     child = the #GtkWidget to be added to @action_bar
150 	 *
151 	 * Since: 3.12
152 	 */
153 	public void packStart(Widget child)
154 	{
155 		gtk_action_bar_pack_start(gtkActionBar, (child is null) ? null : child.getWidgetStruct());
156 	}
157 
158 	/**
159 	 * Sets the center widget for the #GtkActionBar.
160 	 *
161 	 * Params:
162 	 *     centerWidget = a widget to use for the center
163 	 *
164 	 * Since: 3.12
165 	 */
166 	public void setCenterWidget(Widget centerWidget)
167 	{
168 		gtk_action_bar_set_center_widget(gtkActionBar, (centerWidget is null) ? null : centerWidget.getWidgetStruct());
169 	}
170 }