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  * 	- gtk_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- gtk.Widget
48  * 	- gtk.Menu;
49  * 	- gtk.MenuItem;
50  * structWrap:
51  * 	- GtkMenu* -> Menu
52  * 	- GtkMenuItem* -> MenuItem
53  * 	- GtkWidget* -> Widget
54  * module aliases:
55  * local aliases:
56  * overrides:
57  */
58 
59 module gtk.MenuBar;
60 
61 public  import gtkc.gtktypes;
62 
63 private import gtkc.gtk;
64 private import glib.ConstructionException;
65 private import gobject.ObjectG;
66 
67 
68 private import gtk.Widget;
69 private import gtk.Menu;;
70 private import gtk.MenuItem;;
71 
72 
73 
74 private import gtk.MenuShell;
75 
76 /**
77  * Description
78  * The GtkMenuBar is a subclass of GtkMenuShell which contains one to many GtkMenuItem. The result is a standard menu bar which can hold many menu items. GtkMenuBar allows for a shadow type to be set for aesthetic purposes. The shadow types are defined in the gtk_menu_bar_set_shadow_type function.
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 the 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 	 * Sets how items should be packed inside a menubar.
151 	 * Since 2.8
152 	 * Params:
153 	 * packDir = a new GtkPackDirection
154 	 */
155 	public void setPackDirection(GtkPackDirection packDir)
156 	{
157 		// void gtk_menu_bar_set_pack_direction (GtkMenuBar *menubar,  GtkPackDirection pack_dir);
158 		gtk_menu_bar_set_pack_direction(gtkMenuBar, packDir);
159 	}
160 	
161 	/**
162 	 * Retrieves the current pack direction of the menubar.
163 	 * See gtk_menu_bar_set_pack_direction().
164 	 * Since 2.8
165 	 * Returns: the pack direction
166 	 */
167 	public GtkPackDirection getPackDirection()
168 	{
169 		// GtkPackDirection gtk_menu_bar_get_pack_direction (GtkMenuBar *menubar);
170 		return gtk_menu_bar_get_pack_direction(gtkMenuBar);
171 	}
172 	
173 	/**
174 	 * Sets how widgets should be packed inside the children of a menubar.
175 	 * Since 2.8
176 	 * Params:
177 	 * childPackDir = a new GtkPackDirection
178 	 */
179 	public void setChildPackDirection(GtkPackDirection childPackDir)
180 	{
181 		// void gtk_menu_bar_set_child_pack_direction  (GtkMenuBar *menubar,  GtkPackDirection child_pack_dir);
182 		gtk_menu_bar_set_child_pack_direction(gtkMenuBar, childPackDir);
183 	}
184 	
185 	/**
186 	 * Retrieves the current child pack direction of the menubar.
187 	 * See gtk_menu_bar_set_child_pack_direction().
188 	 * Since 2.8
189 	 * Returns: the child pack direction
190 	 */
191 	public GtkPackDirection getChildPackDirection()
192 	{
193 		// GtkPackDirection gtk_menu_bar_get_child_pack_direction  (GtkMenuBar *menubar);
194 		return gtk_menu_bar_get_child_pack_direction(gtkMenuBar);
195 	}
196 }