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 gdk.ToplevelLayout; 26 27 private import gdk.MonitorGdk; 28 private import gdk.c.functions; 29 public import gdk.c.types; 30 private import glib.ConstructionException; 31 private import gobject.ObjectG; 32 private import gtkd.Loader; 33 34 35 /** 36 * The `GdkToplevelLayout` struct contains information that 37 * is necessary to present a sovereign window on screen. 38 * 39 * The `GdkToplevelLayout` struct is necessary for using 40 * [method@Gdk.Toplevel.present]. 41 * 42 * Toplevel surfaces are sovereign windows that can be presented 43 * to the user in various states (maximized, on all workspaces, 44 * etc). 45 */ 46 public class ToplevelLayout 47 { 48 /** the main Gtk struct */ 49 protected GdkToplevelLayout* gdkToplevelLayout; 50 protected bool ownedRef; 51 52 /** Get the main Gtk struct */ 53 public GdkToplevelLayout* getToplevelLayoutStruct(bool transferOwnership = false) 54 { 55 if (transferOwnership) 56 ownedRef = false; 57 return gdkToplevelLayout; 58 } 59 60 /** the main Gtk struct as a void* */ 61 protected void* getStruct() 62 { 63 return cast(void*)gdkToplevelLayout; 64 } 65 66 /** 67 * Sets our main struct and passes it to the parent class. 68 */ 69 public this (GdkToplevelLayout* gdkToplevelLayout, bool ownedRef = false) 70 { 71 this.gdkToplevelLayout = gdkToplevelLayout; 72 this.ownedRef = ownedRef; 73 } 74 75 ~this () 76 { 77 if ( Linker.isLoaded(LIBRARY_GDK) && ownedRef ) 78 gdk_toplevel_layout_unref(gdkToplevelLayout); 79 } 80 81 82 /** */ 83 public static GType getType() 84 { 85 return gdk_toplevel_layout_get_type(); 86 } 87 88 /** 89 * Create a toplevel layout description. 90 * 91 * Used together with gdk_toplevel_present() to describe 92 * how a toplevel surface should be placed and behave on-screen. 93 * 94 * The size is in ”application pixels”, not 95 * ”device pixels” (see gdk_surface_get_scale_factor()). 96 * 97 * Returns: newly created instance of #GdkToplevelLayout 98 * 99 * Throws: ConstructionException GTK+ fails to create the object. 100 */ 101 public this() 102 { 103 auto __p = gdk_toplevel_layout_new(); 104 105 if(__p is null) 106 { 107 throw new ConstructionException("null returned by new"); 108 } 109 110 this(cast(GdkToplevelLayout*) __p); 111 } 112 113 /** 114 * Create a new #GdkToplevelLayout and copy the contents of @layout into it. 115 * 116 * Returns: a copy of @layout. 117 */ 118 public ToplevelLayout copy() 119 { 120 auto __p = gdk_toplevel_layout_copy(gdkToplevelLayout); 121 122 if(__p is null) 123 { 124 return null; 125 } 126 127 return ObjectG.getDObject!(ToplevelLayout)(cast(GdkToplevelLayout*) __p, true); 128 } 129 130 /** 131 * Check whether @layout and @other has identical layout properties. 132 * 133 * Params: 134 * other = another #GdkToplevelLayout 135 * 136 * Returns: %TRUE if @layout and @other have identical layout properties, 137 * otherwise %FALSE. 138 */ 139 public bool equal(ToplevelLayout other) 140 { 141 return gdk_toplevel_layout_equal(gdkToplevelLayout, (other is null) ? null : other.getToplevelLayoutStruct()) != 0; 142 } 143 144 /** 145 * If the layout specifies whether to the toplevel should go fullscreen, 146 * the value pointed to by @fullscreen is set to %TRUE if it should go 147 * fullscreen, or %FALSE, if it should go unfullscreen. 148 * 149 * Params: 150 * fullscreen = location to store whether the toplevel should be fullscreen 151 * 152 * Returns: whether the @layout specifies the fullscreen state for the toplevel 153 */ 154 public bool getFullscreen(out bool fullscreen) 155 { 156 int outfullscreen; 157 158 auto __p = gdk_toplevel_layout_get_fullscreen(gdkToplevelLayout, &outfullscreen) != 0; 159 160 fullscreen = (outfullscreen == 1); 161 162 return __p; 163 } 164 165 /** 166 * Returns the monitor that the layout is fullscreening 167 * the surface on. 168 * 169 * Returns: the monitor on which @layout fullscreens 170 */ 171 public MonitorGdk getFullscreenMonitor() 172 { 173 auto __p = gdk_toplevel_layout_get_fullscreen_monitor(gdkToplevelLayout); 174 175 if(__p is null) 176 { 177 return null; 178 } 179 180 return ObjectG.getDObject!(MonitorGdk)(cast(GdkMonitor*) __p); 181 } 182 183 /** 184 * If the layout specifies whether to the toplevel should go maximized, 185 * the value pointed to by @maximized is set to %TRUE if it should go 186 * fullscreen, or %FALSE, if it should go unmaximized. 187 * 188 * Params: 189 * maximized = set to %TRUE if the toplevel should be maximized 190 * 191 * Returns: whether the @layout specifies the maximized state for the toplevel 192 */ 193 public bool getMaximized(out bool maximized) 194 { 195 int outmaximized; 196 197 auto __p = gdk_toplevel_layout_get_maximized(gdkToplevelLayout, &outmaximized) != 0; 198 199 maximized = (outmaximized == 1); 200 201 return __p; 202 } 203 204 /** 205 * Returns whether the layout should allow the user 206 * to resize the surface. 207 * 208 * Returns: %TRUE if the layout is resizable 209 */ 210 public bool getResizable() 211 { 212 return gdk_toplevel_layout_get_resizable(gdkToplevelLayout) != 0; 213 } 214 215 alias doref = ref_; 216 /** 217 * Increases the reference count of @layout. 218 * 219 * Returns: the same @layout 220 */ 221 public ToplevelLayout ref_() 222 { 223 auto __p = gdk_toplevel_layout_ref(gdkToplevelLayout); 224 225 if(__p is null) 226 { 227 return null; 228 } 229 230 return ObjectG.getDObject!(ToplevelLayout)(cast(GdkToplevelLayout*) __p, true); 231 } 232 233 /** 234 * Sets whether the layout should cause the surface 235 * to be fullscreen when presented. 236 * 237 * Params: 238 * fullscreen = %TRUE to fullscreen the surface 239 * monitor = the monitor to fullscreen on 240 */ 241 public void setFullscreen(bool fullscreen, MonitorGdk monitor) 242 { 243 gdk_toplevel_layout_set_fullscreen(gdkToplevelLayout, fullscreen, (monitor is null) ? null : monitor.getMonitorGdkStruct()); 244 } 245 246 /** 247 * Sets whether the layout should cause the surface 248 * to be maximized when presented. 249 * 250 * Params: 251 * maximized = %TRUE to maximize 252 */ 253 public void setMaximized(bool maximized) 254 { 255 gdk_toplevel_layout_set_maximized(gdkToplevelLayout, maximized); 256 } 257 258 /** 259 * Sets whether the layout should allow the user 260 * to resize the surface after it has been presented. 261 * 262 * Params: 263 * resizable = %TRUE to allow resizing 264 */ 265 public void setResizable(bool resizable) 266 { 267 gdk_toplevel_layout_set_resizable(gdkToplevelLayout, resizable); 268 } 269 270 /** 271 * Decreases the reference count of @layout. 272 */ 273 public void unref() 274 { 275 gdk_toplevel_layout_unref(gdkToplevelLayout); 276 } 277 }