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()
56 	{
57 		return gtkActionBar;
58 	}
59 
60 	/** the main Gtk struct as a void* */
61 	protected override void* getStruct()
62 	{
63 		return cast(void*)gtkActionBar;
64 	}
65 
66 	protected override void setStruct(GObject* obj)
67 	{
68 		gtkActionBar = cast(GtkActionBar*)obj;
69 		super.setStruct(obj);
70 	}
71 
72 	/**
73 	 * Sets our main struct and passes it to the parent class.
74 	 */
75 	public this (GtkActionBar* gtkActionBar, bool ownedRef = false)
76 	{
77 		this.gtkActionBar = gtkActionBar;
78 		super(cast(GtkBin*)gtkActionBar, ownedRef);
79 	}
80 
81 
82 	/** */
83 	public static GType getType()
84 	{
85 		return gtk_action_bar_get_type();
86 	}
87 
88 	/**
89 	 * Creates a new #GtkActionBar widget.
90 	 *
91 	 * Returns: a new #GtkActionBar
92 	 *
93 	 * Since: 3.12
94 	 *
95 	 * Throws: ConstructionException GTK+ fails to create the object.
96 	 */
97 	public this()
98 	{
99 		auto p = gtk_action_bar_new();
100 		
101 		if(p is null)
102 		{
103 			throw new ConstructionException("null returned by new");
104 		}
105 		
106 		this(cast(GtkActionBar*) p);
107 	}
108 
109 	/**
110 	 * Retrieves the center bar widget of the bar.
111 	 *
112 	 * Returns: the center #GtkWidget or %NULL.
113 	 *
114 	 * Since: 3.12
115 	 */
116 	public Widget getCenterWidget()
117 	{
118 		auto p = gtk_action_bar_get_center_widget(gtkActionBar);
119 		
120 		if(p is null)
121 		{
122 			return null;
123 		}
124 		
125 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
126 	}
127 
128 	/**
129 	 * Adds @child to @action_bar, packed with reference to the
130 	 * end of the @action_bar.
131 	 *
132 	 * Params:
133 	 *     child = the #GtkWidget to be added to @action_bar
134 	 *
135 	 * Since: 3.12
136 	 */
137 	public void packEnd(Widget child)
138 	{
139 		gtk_action_bar_pack_end(gtkActionBar, (child is null) ? null : child.getWidgetStruct());
140 	}
141 
142 	/**
143 	 * Adds @child to @action_bar, packed with reference to the
144 	 * start of the @action_bar.
145 	 *
146 	 * Params:
147 	 *     child = the #GtkWidget to be added to @action_bar
148 	 *
149 	 * Since: 3.12
150 	 */
151 	public void packStart(Widget child)
152 	{
153 		gtk_action_bar_pack_start(gtkActionBar, (child is null) ? null : child.getWidgetStruct());
154 	}
155 
156 	/**
157 	 * Sets the center widget for the #GtkActionBar.
158 	 *
159 	 * Params:
160 	 *     centerWidget = a widget to use for the center
161 	 *
162 	 * Since: 3.12
163 	 */
164 	public void setCenterWidget(Widget centerWidget)
165 	{
166 		gtk_action_bar_set_center_widget(gtkActionBar, (centerWidget is null) ? null : centerWidget.getWidgetStruct());
167 	}
168 }