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  = GtkApplicationWindow.html
27  * outPack = gtk
28  * outFile = ApplicationWindow
29  * strct   = GtkApplicationWindow
30  * realStrct=
31  * ctorStrct=
32  * clss    = ApplicationWindow
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * 	- ActionGroupIF
40  * 	- ActionMapIF
41  * prefixes:
42  * 	- gtk_application_window_
43  * omit structs:
44  * omit prefixes:
45  * omit code:
46  * omit signals:
47  * imports:
48  * 	- gtk.Application
49  * 	- gio.ActionGroupIF
50  * 	- gio.ActionGroupT
51  * 	- gio.ActionMapIF
52  * 	- gio.ActionMapT
53  * structWrap:
54  * 	- GtkApplication* -> Application
55  * module aliases:
56  * local aliases:
57  * overrides:
58  */
59 
60 module gtk.ApplicationWindow;
61 
62 public  import gtkc.gtktypes;
63 
64 private import gtkc.gtk;
65 private import glib.ConstructionException;
66 private import gobject.ObjectG;
67 
68 
69 private import gtk.Application;
70 private import gio.ActionGroupIF;
71 private import gio.ActionGroupT;
72 private import gio.ActionMapIF;
73 private import gio.ActionMapT;
74 
75 
76 
77 private import gtk.Window;
78 
79 /**
80  * GtkApplicationWindow is a GtkWindow subclass that offers some
81  * extra functionality for better integration with GtkApplication
82  * features. Notably, it can handle both the application menu as well
83  * as the menubar. See gtk_application_set_app_menu() and
84  * gtk_application_set_menubar().
85  *
86  * This class implements the GActionGroup and GActionMap interfaces,
87  * to let you add window-specific actions that will be exported by the
88  * associated GtkApplication, together with its application-wide
89  * actions. Window-specific actions are prefixed with the "win."
90  * prefix and application-wide actions are prefixed with the "app."
91  * prefix. Actions must be addressed with the prefixed name when
92  * referring to them from a GMenuModel.
93  *
94  * Note that widgets that are placed inside a GtkApplicationWindow
95  * can also activate these actions, if they implement the
96  * GtkActionable interface.
97  *
98  * As with GtkApplication, the GDK lock will be acquired when
99  * processing actions arriving from other processes and should therefore
100  * be held when activating actions locally (if GDK threads are enabled).
101  *
102  * The settings "gtk-shell-shows-app-menu" and
103  * "gtk-shell-shows-menubar" tell GTK+ whether the
104  * desktop environment is showing the application menu and menubar
105  * models outside the application as part of the desktop shell.
106  * For instance, on OS X, both menus will be displayed remotely;
107  * on Windows neither will be. gnome-shell (starting with version 3.4)
108  * will display the application menu, but not the menubar.
109  *
110  * If the desktop environment does not display the menubar, then
111  * GtkApplicationWindow will automatically show a GtkMenuBar for it.
112  * (see the GtkApplication docs for some screenshots of how this
113  * looks on different platforms).
114  * This behaviour can be overridden with the "show-menubar"
115  * property. If the desktop environment does not display the application
116  * menu, then it will automatically be included in the menubar.
117  *
118  * $(DDOC_COMMENT example)
119  *
120  * $(DDOC_COMMENT example)
121  *
122  * The XML format understood by GtkBuilder for GMenuModel consists
123  * of a toplevel <menu> element, which contains
124  * one or more <item> elements. Each
125  * <item> element contains
126  * <attribute> and <link>
127  * elements with a mandatory name attribute.
128  * <link> elements have the same content
129  * model as <menu>.
130  *
131  * Attribute values can be translated using gettext, like other GtkBuilder
132  * content. <attribute> elements can be marked for
133  * translation with a translatable="yes" attribute.
134  * It is also possible to specify message context and translator comments,
135  * using the context and comments attributes. To make use of this, the
136  * GtkBuilder must have been given the gettext domain to use.
137  */
138 public class ApplicationWindow : Window, ActionGroupIF, ActionMapIF
139 {
140 	
141 	/** the main Gtk struct */
142 	protected GtkApplicationWindow* gtkApplicationWindow;
143 	
144 	
145 	public GtkApplicationWindow* getApplicationWindowStruct()
146 	{
147 		return gtkApplicationWindow;
148 	}
149 	
150 	
151 	/** the main Gtk struct as a void* */
152 	protected override void* getStruct()
153 	{
154 		return cast(void*)gtkApplicationWindow;
155 	}
156 	
157 	/**
158 	 * Sets our main struct and passes it to the parent class
159 	 */
160 	public this (GtkApplicationWindow* gtkApplicationWindow)
161 	{
162 		super(cast(GtkWindow*)gtkApplicationWindow);
163 		this.gtkApplicationWindow = gtkApplicationWindow;
164 	}
165 	
166 	protected override void setStruct(GObject* obj)
167 	{
168 		super.setStruct(obj);
169 		gtkApplicationWindow = cast(GtkApplicationWindow*)obj;
170 	}
171 	
172 	// add the ActionGroup capabilities
173 	mixin ActionGroupT!(GtkApplicationWindow);
174 	
175 	// add the ActionMap capabilities
176 	mixin ActionMapT!(GtkApplicationWindow);
177 	
178 	/**
179 	 */
180 	
181 	/**
182 	 * Creates a new GtkApplicationWindow.
183 	 * Params:
184 	 * application = a GtkApplication
185 	 * Throws: ConstructionException GTK+ fails to create the object.
186 	 */
187 	public this (Application application)
188 	{
189 		// GtkWidget * gtk_application_window_new (GtkApplication *application);
190 		auto p = gtk_application_window_new((application is null) ? null : application.getGtkApplicationStruct());
191 		if(p is null)
192 		{
193 			throw new ConstructionException("null returned by gtk_application_window_new((application is null) ? null : application.getGtkApplicationStruct())");
194 		}
195 		this(cast(GtkApplicationWindow*) p);
196 	}
197 	
198 	/**
199 	 * Sets whether the window will display a menubar for the app menu
200 	 * and menubar as needed.
201 	 * Params:
202 	 * showMenubar = whether to show a menubar when needed
203 	 * Since 3.4
204 	 */
205 	public void setShowMenubar(int showMenubar)
206 	{
207 		// void gtk_application_window_set_show_menubar  (GtkApplicationWindow *window,  gboolean show_menubar);
208 		gtk_application_window_set_show_menubar(gtkApplicationWindow, showMenubar);
209 	}
210 	
211 	/**
212 	 * Returns whether the window will display a menubar for the app menu
213 	 * and menubar as needed.
214 	 * Returns: TRUE if window will display a menubar when needed Since 3.4
215 	 */
216 	public int getShowMenubar()
217 	{
218 		// gboolean gtk_application_window_get_show_menubar  (GtkApplicationWindow *window);
219 		return gtk_application_window_get_show_menubar(gtkApplicationWindow);
220 	}
221 	
222 	/**
223 	 * Returns the unique ID of the window. If the window has not yet been added to
224 	 * a GtkApplication, returns 0.
225 	 * Returns: the unique ID for window, or 0 if the window has not yet been added to a GtkApplication Since 3.6
226 	 */
227 	public uint getId()
228 	{
229 		// guint gtk_application_window_get_id (GtkApplicationWindow *window);
230 		return gtk_application_window_get_id(gtkApplicationWindow);
231 	}
232 }