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  = GtkMenuBar.html
27  * outPack = gtk
28  * outFile = MenuBar
29  * strct   = GtkMenuBar
30  * realStrct=
31  * ctorStrct=
32  * clss    = MenuBar
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_menu_bar_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- gio.MenuModel
47  * 	- gtk.Menu
48  * 	- gtk.MenuItem
49  * 	- gtk.Widget
50  * structWrap:
51  * 	- GMenuModel* -> MenuModel
52  * module aliases:
53  * local aliases:
54  * overrides:
55  */
56 
57 module gtk.MenuBar;
58 
59 public  import gtkc.gtktypes;
60 
61 private import gtkc.gtk;
62 private import glib.ConstructionException;
63 private import gobject.ObjectG;
64 
65 
66 private import gio.MenuModel;
67 private import gtk.Menu;
68 private import gtk.MenuItem;
69 private import gtk.Widget;
70 
71 
72 
73 private import gtk.MenuShell;
74 
75 /**
76  * The GtkMenuBar is a subclass of GtkMenuShell which contains one or
77  * more GtkMenuItems. The result is a standard menu bar which can hold
78  * many menu items.
79  */
80 public class MenuBar : MenuShell
81 {
82 	
83 	/** the main Gtk struct */
84 	protected GtkMenuBar* gtkMenuBar;
85 	
86 	
87 	public GtkMenuBar* getMenuBarStruct()
88 	{
89 		return gtkMenuBar;
90 	}
91 	
92 	
93 	/** the main Gtk struct as a void* */
94 	protected override void* getStruct()
95 	{
96 		return cast(void*)gtkMenuBar;
97 	}
98 	
99 	/**
100 	 * Sets our main struct and passes it to the parent class
101 	 */
102 	public this (GtkMenuBar* gtkMenuBar)
103 	{
104 		super(cast(GtkMenuShell*)gtkMenuBar);
105 		this.gtkMenuBar = gtkMenuBar;
106 	}
107 	
108 	protected override void setStruct(GObject* obj)
109 	{
110 		super.setStruct(obj);
111 		gtkMenuBar = cast(GtkMenuBar*)obj;
112 	}
113 	
114 	/** */
115 	Menu append(string label, bool rightJustify=false)
116 	{
117 		MenuItem item = new MenuItem(label);
118 		super.append(item);
119 		item.setRightJustified(rightJustify);
120 		Menu menu= new Menu();
121 		item.setSubmenu(menu);
122 		return menu;
123 	}
124 	
125 	/** */
126 	public override void append(Widget widget)
127 	{
128 		super.append(widget);
129 	}
130 	
131 	/**
132 	 */
133 	
134 	/**
135 	 * Creates a new GtkMenuBar
136 	 * Throws: ConstructionException GTK+ fails to create the object.
137 	 */
138 	public this ()
139 	{
140 		// GtkWidget * gtk_menu_bar_new (void);
141 		auto p = gtk_menu_bar_new();
142 		if(p is null)
143 		{
144 			throw new ConstructionException("null returned by gtk_menu_bar_new()");
145 		}
146 		this(cast(GtkMenuBar*) p);
147 	}
148 	
149 	/**
150 	 * Creates a new GtkMenuBar and populates it with menu items
151 	 * and submenus according to model.
152 	 * The created menu items are connected to actions found in the
153 	 * GtkApplicationWindow to which the menu bar belongs - typically
154 	 * by means of being contained within the GtkApplicationWindows
155 	 * widget hierarchy.
156 	 * Params:
157 	 * model = a GMenuModel
158 	 * Throws: ConstructionException GTK+ fails to create the object.
159 	 */
160 	public this (MenuModel model)
161 	{
162 		// GtkWidget * gtk_menu_bar_new_from_model (GMenuModel *model);
163 		auto p = gtk_menu_bar_new_from_model((model is null) ? null : model.getMenuModelStruct());
164 		if(p is null)
165 		{
166 			throw new ConstructionException("null returned by gtk_menu_bar_new_from_model((model is null) ? null : model.getMenuModelStruct())");
167 		}
168 		this(cast(GtkMenuBar*) p);
169 	}
170 	
171 	/**
172 	 * Sets how items should be packed inside a menubar.
173 	 * Since 2.8
174 	 * Params:
175 	 * packDir = a new GtkPackDirection
176 	 */
177 	public void setPackDirection(GtkPackDirection packDir)
178 	{
179 		// void gtk_menu_bar_set_pack_direction (GtkMenuBar *menubar,  GtkPackDirection pack_dir);
180 		gtk_menu_bar_set_pack_direction(gtkMenuBar, packDir);
181 	}
182 	
183 	/**
184 	 * Retrieves the current pack direction of the menubar.
185 	 * See gtk_menu_bar_set_pack_direction().
186 	 * Since 2.8
187 	 * Returns: the pack direction
188 	 */
189 	public GtkPackDirection getPackDirection()
190 	{
191 		// GtkPackDirection gtk_menu_bar_get_pack_direction (GtkMenuBar *menubar);
192 		return gtk_menu_bar_get_pack_direction(gtkMenuBar);
193 	}
194 	
195 	/**
196 	 * Sets how widgets should be packed inside the children of a menubar.
197 	 * Since 2.8
198 	 * Params:
199 	 * childPackDir = a new GtkPackDirection
200 	 */
201 	public void setChildPackDirection(GtkPackDirection childPackDir)
202 	{
203 		// void gtk_menu_bar_set_child_pack_direction  (GtkMenuBar *menubar,  GtkPackDirection child_pack_dir);
204 		gtk_menu_bar_set_child_pack_direction(gtkMenuBar, childPackDir);
205 	}
206 	
207 	/**
208 	 * Retrieves the current child pack direction of the menubar.
209 	 * See gtk_menu_bar_set_child_pack_direction().
210 	 * Since 2.8
211 	 * Returns: the child pack direction
212 	 */
213 	public GtkPackDirection getChildPackDirection()
214 	{
215 		// GtkPackDirection gtk_menu_bar_get_child_pack_direction  (GtkMenuBar *menubar);
216 		return gtk_menu_bar_get_child_pack_direction(gtkMenuBar);
217 	}
218 }