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 
80 	public static GType getType()
81 	{
82 		return gtk_action_bar_get_type();
83 	}
84 
85 	/**
86 	 * Creates a new #GtkActionBar widget.
87 	 *
88 	 * Return: a new #GtkActionBar
89 	 *
90 	 * Since: 3.12
91 	 *
92 	 * Throws: ConstructionException GTK+ fails to create the object.
93 	 */
94 	public this()
95 	{
96 		auto p = gtk_action_bar_new();
97 		
98 		if(p is null)
99 		{
100 			throw new ConstructionException("null returned by new");
101 		}
102 		
103 		this(cast(GtkActionBar*) p);
104 	}
105 
106 	/**
107 	 * Retrieves the center bar widget of the bar.
108 	 *
109 	 * Return: the center #GtkWidget.
110 	 *
111 	 * Since: 3.12
112 	 */
113 	public Widget getCenterWidget()
114 	{
115 		auto p = gtk_action_bar_get_center_widget(gtkActionBar);
116 		
117 		if(p is null)
118 		{
119 			return null;
120 		}
121 		
122 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
123 	}
124 
125 	/**
126 	 * Adds @child to @action_bar, packed with reference to the
127 	 * end of the @action_bar.
128 	 *
129 	 * Params:
130 	 *     child = the #GtkWidget to be added to @action_bar
131 	 *
132 	 * Since: 3.12
133 	 */
134 	public void packEnd(Widget child)
135 	{
136 		gtk_action_bar_pack_end(gtkActionBar, (child is null) ? null : child.getWidgetStruct());
137 	}
138 
139 	/**
140 	 * Adds @child to @action_bar, packed with reference to the
141 	 * start of the @action_bar.
142 	 *
143 	 * Params:
144 	 *     child = the #GtkWidget to be added to @action_bar
145 	 *
146 	 * Since: 3.12
147 	 */
148 	public void packStart(Widget child)
149 	{
150 		gtk_action_bar_pack_start(gtkActionBar, (child is null) ? null : child.getWidgetStruct());
151 	}
152 
153 	/**
154 	 * Sets the center widget for the #GtkActionBar.
155 	 *
156 	 * Params:
157 	 *     centerWidget = a widget to use for the center
158 	 *
159 	 * Since: 3.12
160 	 */
161 	public void setCenterWidget(Widget centerWidget)
162 	{
163 		gtk_action_bar_set_center_widget(gtkActionBar, (centerWidget is null) ? null : centerWidget.getWidgetStruct());
164 	}
165 }