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