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