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 = GtkWindow.html 27 * outPack = gtk 28 * outFile = Window 29 * strct = GtkWindow 30 * realStrct= 31 * ctorStrct= 32 * clss = Window 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_window_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.Str 47 * - glib.ErrorG 48 * - glib.GException 49 * - glib.ListG 50 * - gdk.Pixbuf 51 * - gdk.Screen 52 * - gtk.AccelGroup 53 * - gtk.Application 54 * - gtk.Widget 55 * - gtk.WindowGroup 56 * structWrap: 57 * - GList* -> ListG 58 * - GdkPixbuf* -> Pixbuf 59 * - GdkScreen* -> Screen 60 * - GtkAccelGroup* -> AccelGroup 61 * - GtkApplication* -> Application 62 * - GtkWidget* -> Widget 63 * - GtkWindow* -> Window 64 * - GtkWindowGroup* -> WindowGroup 65 * module aliases: 66 * local aliases: 67 * overrides: 68 * - getScreen 69 * - setOpacity 70 * - getOpacity 71 */ 72 73 module gtk.Window; 74 75 public import gtkc.gtktypes; 76 77 private import gtkc.gtk; 78 private import glib.ConstructionException; 79 private import gobject.ObjectG; 80 81 private import gobject.Signals; 82 public import gtkc.gdktypes; 83 private import glib.Str; 84 private import glib.ErrorG; 85 private import glib.GException; 86 private import glib.ListG; 87 private import gdk.Pixbuf; 88 private import gdk.Screen; 89 private import gtk.AccelGroup; 90 private import gtk.Application; 91 private import gtk.Widget; 92 private import gtk.WindowGroup; 93 94 95 private import gtk.Bin; 96 97 /** 98 * A GtkWindow is a toplevel window which can contain other widgets. 99 * Windows normally have decorations that are under the control 100 * of the windowing system and allow the user to manipulate the window 101 * (resize it, move it, close it,...). 102 * 103 * GTK+ also allows windows to have a resize grip (a small area in the lower 104 * right or left corner) which can be clicked to resize the window. To 105 * control whether a window has a resize grip, use 106 * gtk_window_set_has_resize_grip(). 107 * 108 * GtkWindow as GtkBuildable 109 * 110 * The GtkWindow implementation of the GtkBuildable interface supports a 111 * custom <accel-groups> element, which supports 112 * any number of <group> elements representing the 113 * GtkAccelGroup objects you want to add to your window (synonymous with 114 * gtk_window_add_accel_group(). 115 * 116 * $(DDOC_COMMENT example) 117 * 118 * The GtkWindow implementation of the GtkBuildable interface 119 * supports setting a child as the titlebar by specifying "titlebar" as 120 * the "type" attribute of a <child> element. 121 */ 122 public class Window : Bin 123 { 124 125 /** the main Gtk struct */ 126 protected GtkWindow* gtkWindow; 127 128 129 /** Get the main Gtk struct */ 130 public GtkWindow* getWindowStruct() 131 { 132 return gtkWindow; 133 } 134 135 136 /** the main Gtk struct as a void* */ 137 protected override void* getStruct() 138 { 139 return cast(void*)gtkWindow; 140 } 141 142 /** 143 * Sets our main struct and passes it to the parent class 144 */ 145 public this (GtkWindow* gtkWindow) 146 { 147 super(cast(GtkBin*)gtkWindow); 148 this.gtkWindow = gtkWindow; 149 } 150 151 protected override void setStruct(GObject* obj) 152 { 153 super.setStruct(obj); 154 gtkWindow = cast(GtkWindow*)obj; 155 } 156 157 /** 158 * Creates a top level window with a title 159 * Params: 160 * title = The Window title 161 */ 162 public this(string title) 163 { 164 this(GtkWindowType.TOPLEVEL); 165 setTitle(title); 166 } 167 168 /** 169 * Move the window to an absolute position. 170 * just calls move(int, int). 171 * convinience because GdkEvent structs return the position coords as doubles 172 */ 173 public void move(double x, double y) 174 { 175 move(cast(int)x, cast(int)y); 176 } 177 178 /** 179 */ 180 int[string] connectedSignals; 181 182 void delegate(Window)[] onActivateDefaultListeners; 183 /** 184 * The ::activate-default signal is a 185 * keybinding signal 186 * which gets emitted when the user activates the default widget 187 * of window. 188 */ 189 void addOnActivateDefault(void delegate(Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 190 { 191 if ( !("activate-default" in connectedSignals) ) 192 { 193 Signals.connectData( 194 getStruct(), 195 "activate-default", 196 cast(GCallback)&callBackActivateDefault, 197 cast(void*)this, 198 null, 199 connectFlags); 200 connectedSignals["activate-default"] = 1; 201 } 202 onActivateDefaultListeners ~= dlg; 203 } 204 extern(C) static void callBackActivateDefault(GtkWindow* windowStruct, Window _window) 205 { 206 foreach ( void delegate(Window) dlg ; _window.onActivateDefaultListeners ) 207 { 208 dlg(_window); 209 } 210 } 211 212 void delegate(Window)[] onActivateFocusListeners; 213 /** 214 * The ::activate-focus signal is a 215 * keybinding signal 216 * which gets emitted when the user activates the currently 217 * focused widget of window. 218 */ 219 void addOnActivateFocus(void delegate(Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 220 { 221 if ( !("activate-focus" in connectedSignals) ) 222 { 223 Signals.connectData( 224 getStruct(), 225 "activate-focus", 226 cast(GCallback)&callBackActivateFocus, 227 cast(void*)this, 228 null, 229 connectFlags); 230 connectedSignals["activate-focus"] = 1; 231 } 232 onActivateFocusListeners ~= dlg; 233 } 234 extern(C) static void callBackActivateFocus(GtkWindow* windowStruct, Window _window) 235 { 236 foreach ( void delegate(Window) dlg ; _window.onActivateFocusListeners ) 237 { 238 dlg(_window); 239 } 240 } 241 242 void delegate(Window)[] onKeysChangedListeners; 243 /** 244 * The ::keys-changed signal gets emitted when the set of accelerators 245 * or mnemonics that are associated with window changes. 246 */ 247 void addOnKeysChanged(void delegate(Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 248 { 249 if ( !("keys-changed" in connectedSignals) ) 250 { 251 Signals.connectData( 252 getStruct(), 253 "keys-changed", 254 cast(GCallback)&callBackKeysChanged, 255 cast(void*)this, 256 null, 257 connectFlags); 258 connectedSignals["keys-changed"] = 1; 259 } 260 onKeysChangedListeners ~= dlg; 261 } 262 extern(C) static void callBackKeysChanged(GtkWindow* windowStruct, Window _window) 263 { 264 foreach ( void delegate(Window) dlg ; _window.onKeysChangedListeners ) 265 { 266 dlg(_window); 267 } 268 } 269 270 void delegate(Widget, Window)[] onSetFocusListeners; 271 /** 272 */ 273 void addOnSetFocus(void delegate(Widget, Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 274 { 275 if ( !("set-focus" in connectedSignals) ) 276 { 277 Signals.connectData( 278 getStruct(), 279 "set-focus", 280 cast(GCallback)&callBackSetFocus, 281 cast(void*)this, 282 null, 283 connectFlags); 284 connectedSignals["set-focus"] = 1; 285 } 286 onSetFocusListeners ~= dlg; 287 } 288 extern(C) static void callBackSetFocus(GtkWindow* windowStruct, GtkWidget* widget, Window _window) 289 { 290 foreach ( void delegate(Widget, Window) dlg ; _window.onSetFocusListeners ) 291 { 292 dlg(ObjectG.getDObject!(Widget)(widget), _window); 293 } 294 } 295 296 297 /** 298 * Creates a new GtkWindow, which is a toplevel window that can 299 * contain other widgets. Nearly always, the type of the window should 300 * be GTK_WINDOW_TOPLEVEL. If you're implementing something like a 301 * popup menu from scratch (which is a bad idea, just use GtkMenu), 302 * you might use GTK_WINDOW_POPUP. GTK_WINDOW_POPUP is not for 303 * dialogs, though in some other toolkits dialogs are called "popups". 304 * In GTK+, GTK_WINDOW_POPUP means a pop-up menu or pop-up tooltip. 305 * On X11, popup windows are not controlled by the window manager. 306 * If you simply want an undecorated window (no window borders), use 307 * gtk_window_set_decorated(), don't use GTK_WINDOW_POPUP. 308 * Params: 309 * type = type of window 310 * Throws: ConstructionException GTK+ fails to create the object. 311 */ 312 public this (GtkWindowType type) 313 { 314 // GtkWidget * gtk_window_new (GtkWindowType type); 315 auto p = gtk_window_new(type); 316 if(p is null) 317 { 318 throw new ConstructionException("null returned by gtk_window_new(type)"); 319 } 320 this(cast(GtkWindow*) p); 321 } 322 323 /** 324 * Sets the title of the GtkWindow. The title of a window will be 325 * displayed in its title bar; on the X Window System, the title bar 326 * is rendered by the window 327 * manager, so exactly how the title appears to users may vary 328 * according to a user's exact configuration. The title should help a 329 * user distinguish this window from other windows they may have 330 * open. A good title might include the application name and current 331 * document filename, for example. 332 * Params: 333 * title = title of the window 334 */ 335 public void setTitle(string title) 336 { 337 // void gtk_window_set_title (GtkWindow *window, const gchar *title); 338 gtk_window_set_title(gtkWindow, Str.toStringz(title)); 339 } 340 341 /** 342 * Don't use this function. It sets the X Window System "class" and 343 * "name" hints for a window. According to the ICCCM, you should 344 * always set these to the same value for all windows in an 345 * application, and GTK+ sets them to that value by default, so calling 346 * this function is sort of pointless. However, you may want to call 347 * gtk_window_set_role() on each window in your application, for the 348 * benefit of the session manager. Setting the role allows the window 349 * manager to restore window positions when loading a saved session. 350 * Params: 351 * wmclassName = window name hint 352 * wmclassClass = window class hint 353 */ 354 public void setWmclass(string wmclassName, string wmclassClass) 355 { 356 // void gtk_window_set_wmclass (GtkWindow *window, const gchar *wmclass_name, const gchar *wmclass_class); 357 gtk_window_set_wmclass(gtkWindow, Str.toStringz(wmclassName), Str.toStringz(wmclassClass)); 358 } 359 360 /** 361 * Sets whether the user can resize a window. Windows are user resizable 362 * by default. 363 * Params: 364 * resizable = TRUE if the user can resize this window 365 */ 366 public void setResizable(int resizable) 367 { 368 // void gtk_window_set_resizable (GtkWindow *window, gboolean resizable); 369 gtk_window_set_resizable(gtkWindow, resizable); 370 } 371 372 /** 373 * Gets the value set by gtk_window_set_resizable(). 374 * Returns: TRUE if the user can resize the window 375 */ 376 public int getResizable() 377 { 378 // gboolean gtk_window_get_resizable (GtkWindow *window); 379 return gtk_window_get_resizable(gtkWindow); 380 } 381 382 /** 383 * Associate accel_group with window, such that calling 384 * gtk_accel_groups_activate() on window will activate accelerators 385 * in accel_group. 386 * Params: 387 * accelGroup = a GtkAccelGroup 388 */ 389 public void addAccelGroup(AccelGroup accelGroup) 390 { 391 // void gtk_window_add_accel_group (GtkWindow *window, GtkAccelGroup *accel_group); 392 gtk_window_add_accel_group(gtkWindow, (accelGroup is null) ? null : accelGroup.getAccelGroupStruct()); 393 } 394 395 /** 396 * Reverses the effects of gtk_window_add_accel_group(). 397 * Params: 398 * accelGroup = a GtkAccelGroup 399 */ 400 public void removeAccelGroup(AccelGroup accelGroup) 401 { 402 // void gtk_window_remove_accel_group (GtkWindow *window, GtkAccelGroup *accel_group); 403 gtk_window_remove_accel_group(gtkWindow, (accelGroup is null) ? null : accelGroup.getAccelGroupStruct()); 404 } 405 406 /** 407 * Activates the current focused widget within the window. 408 * Returns: TRUE if a widget got activated. 409 */ 410 public int activateFocus() 411 { 412 // gboolean gtk_window_activate_focus (GtkWindow *window); 413 return gtk_window_activate_focus(gtkWindow); 414 } 415 416 /** 417 * Activates the default widget for the window, unless the current 418 * focused widget has been configured to receive the default action 419 * (see gtk_widget_set_receives_default()), in which case the 420 * focused widget is activated. 421 * Returns: TRUE if a widget got activated. 422 */ 423 public int activateDefault() 424 { 425 // gboolean gtk_window_activate_default (GtkWindow *window); 426 return gtk_window_activate_default(gtkWindow); 427 } 428 429 /** 430 * Sets a window modal or non-modal. Modal windows prevent interaction 431 * with other windows in the same application. To keep modal dialogs 432 * on top of main application windows, use 433 * gtk_window_set_transient_for() to make the dialog transient for the 434 * parent; most window managers 435 * will then disallow lowering the dialog below the parent. 436 * Params: 437 * modal = whether the window is modal 438 */ 439 public void setModal(int modal) 440 { 441 // void gtk_window_set_modal (GtkWindow *window, gboolean modal); 442 gtk_window_set_modal(gtkWindow, modal); 443 } 444 445 /** 446 * Sets the default size of a window. If the window's "natural" size 447 * (its size request) is larger than the default, the default will be 448 * ignored. More generally, if the default size does not obey the 449 * geometry hints for the window (gtk_window_set_geometry_hints() can 450 * be used to set these explicitly), the default size will be clamped 451 * to the nearest permitted size. 452 * Unlike gtk_widget_set_size_request(), which sets a size request for 453 * a widget and thus would keep users from shrinking the window, this 454 * function only sets the initial size, just as if the user had 455 * resized the window themselves. Users can still shrink the window 456 * again as they normally would. Setting a default size of -1 means to 457 * use the "natural" default size (the size request of the window). 458 * For more control over a window's initial size and how resizing works, 459 * investigate gtk_window_set_geometry_hints(). 460 * For some uses, gtk_window_resize() is a more appropriate function. 461 * gtk_window_resize() changes the current size of the window, rather 462 * than the size to be used on initial display. gtk_window_resize() always 463 * affects the window itself, not the geometry widget. 464 * The default size of a window only affects the first time a window is 465 * shown; if a window is hidden and re-shown, it will remember the size 466 * it had prior to hiding, rather than using the default size. 467 * Windows can't actually be 0x0 in size, they must be at least 1x1, but 468 * passing 0 for width and height is OK, resulting in a 1x1 default size. 469 * Params: 470 * width = width in pixels, or -1 to unset the default width 471 * height = height in pixels, or -1 to unset the default height 472 */ 473 public void setDefaultSize(int width, int height) 474 { 475 // void gtk_window_set_default_size (GtkWindow *window, gint width, gint height); 476 gtk_window_set_default_size(gtkWindow, width, height); 477 } 478 479 /** 480 * Like gtk_window_set_default_size(), but width and height are interpreted 481 * in terms of the base size and increment set with 482 * gtk_window_set_geometry_hints. 483 * Params: 484 * width = width in resize increments, or -1 to unset the default width 485 * height = height in resize increments, or -1 to unset the default height 486 * Since 3.0 487 */ 488 public void setDefaultGeometry(int width, int height) 489 { 490 // void gtk_window_set_default_geometry (GtkWindow *window, gint width, gint height); 491 gtk_window_set_default_geometry(gtkWindow, width, height); 492 } 493 494 /** 495 * This function sets up hints about how a window can be resized by 496 * the user. You can set a minimum and maximum size; allowed resize 497 * increments (e.g. for xterm, you can only resize by the size of a 498 * character); aspect ratios; and more. See the GdkGeometry struct. 499 * Params: 500 * geometryWidget = widget the geometry hints will be applied to or NULL. [allow-none] 501 * geometry = struct containing geometry information or NULL. [allow-none] 502 * geomMask = mask indicating which struct fields should be paid attention to 503 */ 504 public void setGeometryHints(Widget geometryWidget, ref GdkGeometry geometry, GdkWindowHints geomMask) 505 { 506 // void gtk_window_set_geometry_hints (GtkWindow *window, GtkWidget *geometry_widget, GdkGeometry *geometry, GdkWindowHints geom_mask); 507 gtk_window_set_geometry_hints(gtkWindow, (geometryWidget is null) ? null : geometryWidget.getWidgetStruct(), &geometry, geomMask); 508 } 509 510 /** 511 * Window gravity defines the meaning of coordinates passed to 512 * gtk_window_move(). See gtk_window_move() and GdkGravity for 513 * more details. 514 * The default window gravity is GDK_GRAVITY_NORTH_WEST which will 515 * typically "do what you mean." 516 * Params: 517 * gravity = window gravity 518 */ 519 public void setGravity(GdkGravity gravity) 520 { 521 // void gtk_window_set_gravity (GtkWindow *window, GdkGravity gravity); 522 gtk_window_set_gravity(gtkWindow, gravity); 523 } 524 525 /** 526 * Gets the value set by gtk_window_set_gravity(). 527 * Returns: window gravity. [transfer none] 528 */ 529 public GdkGravity getGravity() 530 { 531 // GdkGravity gtk_window_get_gravity (GtkWindow *window); 532 return gtk_window_get_gravity(gtkWindow); 533 } 534 535 /** 536 * Sets a position constraint for this window. If the old or new 537 * constraint is GTK_WIN_POS_CENTER_ALWAYS, this will also cause 538 * the window to be repositioned to satisfy the new constraint. 539 * Params: 540 * position = a position constraint. 541 */ 542 public void setPosition(GtkWindowPosition position) 543 { 544 // void gtk_window_set_position (GtkWindow *window, GtkWindowPosition position); 545 gtk_window_set_position(gtkWindow, position); 546 } 547 548 /** 549 * Dialog windows should be set transient for the main application 550 * window they were spawned from. This allows window managers to e.g. keep the 551 * dialog on top of the main window, or center the dialog over the 552 * main window. gtk_dialog_new_with_buttons() and other convenience 553 * functions in GTK+ will sometimes call 554 * gtk_window_set_transient_for() on your behalf. 555 * Passing NULL for parent unsets the current transient window. 556 * On Windows, this function puts the child window on top of the parent, 557 * much as the window manager would have done on X. 558 * Params: 559 * parent = parent window, or NULL. [allow-none] 560 */ 561 public void setTransientFor(Window parent) 562 { 563 // void gtk_window_set_transient_for (GtkWindow *window, GtkWindow *parent); 564 gtk_window_set_transient_for(gtkWindow, (parent is null) ? null : parent.getWindowStruct()); 565 } 566 567 /** 568 * Marks window as attached to attach_widget. This creates a logical binding 569 * between the window and the widget it belongs to, which is used by GTK+ to 570 * propagate information such as styling or accessibility to window as if it 571 * was a children of attach_widget. 572 * Examples of places where specifying this relation is useful are for instance 573 * a GtkMenu created by a GtkComboBox, a completion popup window 574 * created by GtkEntry or a typeahead search entry created by GtkTreeView. 575 * Note that this function should not be confused with 576 * gtk_window_set_transient_for(), which specifies a window manager relation 577 * between two toplevels instead. 578 * Passing NULL for attach_widget detaches the window. 579 * Params: 580 * attachWidget = a GtkWidget, or NULL. [allow-none] 581 * Since 3.4 582 */ 583 public void setAttachedTo(Widget attachWidget) 584 { 585 // void gtk_window_set_attached_to (GtkWindow *window, GtkWidget *attach_widget); 586 gtk_window_set_attached_to(gtkWindow, (attachWidget is null) ? null : attachWidget.getWidgetStruct()); 587 } 588 589 /** 590 * If setting is TRUE, then destroying the transient parent of window 591 * will also destroy window itself. This is useful for dialogs that 592 * shouldn't persist beyond the lifetime of the main window they're 593 * associated with, for example. 594 * Params: 595 * setting = whether to destroy window with its transient parent 596 */ 597 public void setDestroyWithParent(int setting) 598 { 599 // void gtk_window_set_destroy_with_parent (GtkWindow *window, gboolean setting); 600 gtk_window_set_destroy_with_parent(gtkWindow, setting); 601 } 602 603 /** 604 * If setting is TRUE, then window will request that it's titlebar 605 * should be hidden when maximized. 606 * This is useful for windows that don't convey any information other 607 * than the application name in the titlebar, to put the available 608 * screen space to better use. If the underlying window system does not 609 * support the request, the setting will not have any effect. 610 * Params: 611 * setting = whether to hide the titlebar when window is maximized 612 * Since 3.4 613 */ 614 public void setHideTitlebarWhenMaximized(int setting) 615 { 616 // void gtk_window_set_hide_titlebar_when_maximized (GtkWindow *window, gboolean setting); 617 gtk_window_set_hide_titlebar_when_maximized(gtkWindow, setting); 618 } 619 620 /** 621 * Sets the GdkScreen where the window is displayed; if 622 * the window is already mapped, it will be unmapped, and 623 * then remapped on the new screen. 624 * Since 2.2 625 * Params: 626 * screen = a GdkScreen. 627 */ 628 public void setScreen(Screen screen) 629 { 630 // void gtk_window_set_screen (GtkWindow *window, GdkScreen *screen); 631 gtk_window_set_screen(gtkWindow, (screen is null) ? null : screen.getScreenStruct()); 632 } 633 634 /** 635 * Returns the GdkScreen associated with window. 636 * Since 2.2 637 * Returns: a GdkScreen. [transfer none] 638 */ 639 public override Screen getScreen() 640 { 641 // GdkScreen * gtk_window_get_screen (GtkWindow *window); 642 auto p = gtk_window_get_screen(gtkWindow); 643 644 if(p is null) 645 { 646 return null; 647 } 648 649 return ObjectG.getDObject!(Screen)(cast(GdkScreen*) p); 650 } 651 652 /** 653 * Returns whether the window is part of the current active toplevel. 654 * (That is, the toplevel window receiving keystrokes.) 655 * The return value is TRUE if the window is active toplevel 656 * itself, but also if it is, say, a GtkPlug embedded in the active toplevel. 657 * You might use this function if you wanted to draw a widget 658 * differently in an active window from a widget in an inactive window. 659 * See gtk_window_has_toplevel_focus() 660 * Since 2.4 661 * Returns: TRUE if the window part of the current active window. 662 */ 663 public int isActive() 664 { 665 // gboolean gtk_window_is_active (GtkWindow *window); 666 return gtk_window_is_active(gtkWindow); 667 } 668 669 /** 670 * Returns whether the input focus is within this GtkWindow. 671 * For real toplevel windows, this is identical to gtk_window_is_active(), 672 * but for embedded windows, like GtkPlug, the results will differ. 673 * Since 2.4 674 * Returns: TRUE if the input focus is within this GtkWindow 675 */ 676 public int hasToplevelFocus() 677 { 678 // gboolean gtk_window_has_toplevel_focus (GtkWindow *window); 679 return gtk_window_has_toplevel_focus(gtkWindow); 680 } 681 682 /** 683 * Returns a list of all existing toplevel windows. The widgets 684 * in the list are not individually referenced. If you want 685 * to iterate through the list and perform actions involving 686 * callbacks that might destroy the widgets, you must call 687 * g_list_foreach (result, (GFunc)g_object_ref, NULL) first, and 688 * then unref all the widgets afterwards. 689 * Returns: list of toplevel widgets. [element-type GtkWidget][transfer container] 690 */ 691 public static ListG listToplevels() 692 { 693 // GList * gtk_window_list_toplevels (void); 694 auto p = gtk_window_list_toplevels(); 695 696 if(p is null) 697 { 698 return null; 699 } 700 701 return ObjectG.getDObject!(ListG)(cast(GList*) p); 702 } 703 704 /** 705 * Adds a mnemonic to this window. 706 * Params: 707 * keyval = the mnemonic 708 * target = the widget that gets activated by the mnemonic 709 */ 710 public void addMnemonic(uint keyval, Widget target) 711 { 712 // void gtk_window_add_mnemonic (GtkWindow *window, guint keyval, GtkWidget *target); 713 gtk_window_add_mnemonic(gtkWindow, keyval, (target is null) ? null : target.getWidgetStruct()); 714 } 715 716 /** 717 * Removes a mnemonic from this window. 718 * Params: 719 * keyval = the mnemonic 720 * target = the widget that gets activated by the mnemonic 721 */ 722 public void removeMnemonic(uint keyval, Widget target) 723 { 724 // void gtk_window_remove_mnemonic (GtkWindow *window, guint keyval, GtkWidget *target); 725 gtk_window_remove_mnemonic(gtkWindow, keyval, (target is null) ? null : target.getWidgetStruct()); 726 } 727 728 /** 729 * Activates the targets associated with the mnemonic. 730 * Params: 731 * keyval = the mnemonic 732 * modifier = the modifiers 733 * Returns: TRUE if the activation is done. 734 */ 735 public int mnemonicActivate(uint keyval, GdkModifierType modifier) 736 { 737 // gboolean gtk_window_mnemonic_activate (GtkWindow *window, guint keyval, GdkModifierType modifier); 738 return gtk_window_mnemonic_activate(gtkWindow, keyval, modifier); 739 } 740 741 /** 742 * Activates mnemonics and accelerators for this GtkWindow. This is normally 743 * called by the default ::key_press_event handler for toplevel windows, 744 * however in some cases it may be useful to call this directly when 745 * overriding the standard key handling for a toplevel window. 746 * Since 2.4 747 * Params: 748 * event = a GdkEventKey 749 * Returns: TRUE if a mnemonic or accelerator was found and activated. 750 */ 751 public int activateKey(GdkEventKey* event) 752 { 753 // gboolean gtk_window_activate_key (GtkWindow *window, GdkEventKey *event); 754 return gtk_window_activate_key(gtkWindow, event); 755 } 756 757 /** 758 * Propagate a key press or release event to the focus widget and 759 * up the focus container chain until a widget handles event. 760 * This is normally called by the default ::key_press_event and 761 * ::key_release_event handlers for toplevel windows, 762 * however in some cases it may be useful to call this directly when 763 * overriding the standard key handling for a toplevel window. 764 * Since 2.4 765 * Params: 766 * event = a GdkEventKey 767 * Returns: TRUE if a widget in the focus chain handled the event. 768 */ 769 public int propagateKeyEvent(GdkEventKey* event) 770 { 771 // gboolean gtk_window_propagate_key_event (GtkWindow *window, GdkEventKey *event); 772 return gtk_window_propagate_key_event(gtkWindow, event); 773 } 774 775 /** 776 * Retrieves the current focused widget within the window. 777 * Note that this is the widget that would have the focus 778 * if the toplevel window focused; if the toplevel window 779 * is not focused then gtk_widget_has_focus (widget) will 780 * not be TRUE for the widget. 781 * Returns: the currently focused widget, or NULL if there is none. [transfer none] 782 */ 783 public Widget getFocus() 784 { 785 // GtkWidget * gtk_window_get_focus (GtkWindow *window); 786 auto p = gtk_window_get_focus(gtkWindow); 787 788 if(p is null) 789 { 790 return null; 791 } 792 793 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 794 } 795 796 /** 797 * If focus is not the current focus widget, and is focusable, sets 798 * it as the focus widget for the window. If focus is NULL, unsets 799 * the focus widget for this window. To set the focus to a particular 800 * widget in the toplevel, it is usually more convenient to use 801 * gtk_widget_grab_focus() instead of this function. 802 * Params: 803 * focus = widget to be the new focus widget, or NULL to unset 804 * any focus widget for the toplevel window. [allow-none] 805 */ 806 public void setFocus(Widget focus) 807 { 808 // void gtk_window_set_focus (GtkWindow *window, GtkWidget *focus); 809 gtk_window_set_focus(gtkWindow, (focus is null) ? null : focus.getWidgetStruct()); 810 } 811 812 /** 813 * Returns the default widget for window. See gtk_window_set_default() 814 * for more details. 815 * Since 2.14 816 * Returns: the default widget, or NULL if there is none. [transfer none] 817 */ 818 public Widget getDefaultWidget() 819 { 820 // GtkWidget * gtk_window_get_default_widget (GtkWindow *window); 821 auto p = gtk_window_get_default_widget(gtkWindow); 822 823 if(p is null) 824 { 825 return null; 826 } 827 828 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 829 } 830 831 /** 832 * The default widget is the widget that's activated when the user 833 * presses Enter in a dialog (for example). This function sets or 834 * unsets the default widget for a GtkWindow about. When setting 835 * (rather than unsetting) the default widget it's generally easier to 836 * call gtk_widget_grab_focus() on the widget. Before making a widget 837 * the default widget, you must call gtk_widget_set_can_default() on the 838 * widget you'd like to make the default. 839 * Params: 840 * defaultWidget = widget to be the default, or NULL to unset the 841 * default widget for the toplevel. [allow-none] 842 */ 843 public void setDefault(Widget defaultWidget) 844 { 845 // void gtk_window_set_default (GtkWindow *window, GtkWidget *default_widget); 846 gtk_window_set_default(gtkWindow, (defaultWidget is null) ? null : defaultWidget.getWidgetStruct()); 847 } 848 849 /** 850 * Presents a window to the user. This may mean raising the window 851 * in the stacking order, deiconifying it, moving it to the current 852 * desktop, and/or giving it the keyboard focus, possibly dependent 853 * on the user's platform, window manager, and preferences. 854 * If window is hidden, this function calls gtk_widget_show() 855 * as well. 856 * This function should be used when the user tries to open a window 857 * that's already open. Say for example the preferences dialog is 858 * currently open, and the user chooses Preferences from the menu 859 * a second time; use gtk_window_present() to move the already-open dialog 860 * where the user can see it. 861 * If you are calling this function in response to a user interaction, 862 * it is preferable to use gtk_window_present_with_time(). 863 */ 864 public void present() 865 { 866 // void gtk_window_present (GtkWindow *window); 867 gtk_window_present(gtkWindow); 868 } 869 870 /** 871 * Presents a window to the user in response to a user interaction. 872 * If you need to present a window without a timestamp, use 873 * gtk_window_present(). See gtk_window_present() for details. 874 * Since 2.8 875 * Params: 876 * timestamp = the timestamp of the user interaction (typically a 877 * button or key press event) which triggered this call 878 */ 879 public void presentWithTime(uint timestamp) 880 { 881 // void gtk_window_present_with_time (GtkWindow *window, guint32 timestamp); 882 gtk_window_present_with_time(gtkWindow, timestamp); 883 } 884 885 /** 886 * Requests that the window is closed, similar to what happens 887 * when a window manager close button is clicked. 888 * This function can be used with close buttons in custom 889 * titlebars. 890 */ 891 public void close() 892 { 893 // void gtk_window_close (GtkWindow *window); 894 gtk_window_close(gtkWindow); 895 } 896 897 /** 898 * Asks to iconify (i.e. minimize) the specified window. Note that 899 * you shouldn't assume the window is definitely iconified afterward, 900 * because other entities (e.g. the user or window manager) could deiconify it 901 * again, or there may not be a window manager in which case 902 * iconification isn't possible, etc. But normally the window will end 903 * up iconified. Just don't write code that crashes if not. 904 * It's permitted to call this function before showing a window, 905 * in which case the window will be iconified before it ever appears 906 * onscreen. 907 * You can track iconification via the "window-state-event" signal 908 * on GtkWidget. 909 */ 910 public void iconify() 911 { 912 // void gtk_window_iconify (GtkWindow *window); 913 gtk_window_iconify(gtkWindow); 914 } 915 916 /** 917 * Asks to deiconify (i.e. unminimize) the specified window. Note 918 * that you shouldn't assume the window is definitely deiconified 919 * afterward, because other entities (e.g. the user or window manager) could iconify it 920 * again before your code which assumes deiconification gets to run. 921 * You can track iconification via the "window-state-event" signal 922 * on GtkWidget. 923 */ 924 public void deiconify() 925 { 926 // void gtk_window_deiconify (GtkWindow *window); 927 gtk_window_deiconify(gtkWindow); 928 } 929 930 /** 931 * Asks to stick window, which means that it will appear on all user 932 * desktops. Note that you shouldn't assume the window is definitely 933 * stuck afterward, because other entities (e.g. the user or window manager) could unstick it 934 * again, and some window managers do not support sticking 935 * windows. But normally the window will end up stuck. Just don't 936 * write code that crashes if not. 937 * It's permitted to call this function before showing a window. 938 * You can track stickiness via the "window-state-event" signal 939 * on GtkWidget. 940 */ 941 public void stick() 942 { 943 // void gtk_window_stick (GtkWindow *window); 944 gtk_window_stick(gtkWindow); 945 } 946 947 /** 948 * Asks to unstick window, which means that it will appear on only 949 * one of the user's desktops. Note that you shouldn't assume the 950 * window is definitely unstuck afterward, because other entities 951 * (e.g. the user or window 952 * manager) could stick it again. But normally the window will 953 * end up stuck. Just don't write code that crashes if not. 954 * You can track stickiness via the "window-state-event" signal 955 * on GtkWidget. 956 */ 957 public void unstick() 958 { 959 // void gtk_window_unstick (GtkWindow *window); 960 gtk_window_unstick(gtkWindow); 961 } 962 963 /** 964 * Asks to maximize window, so that it becomes full-screen. Note that 965 * you shouldn't assume the window is definitely maximized afterward, 966 * because other entities (e.g. the user or window manager) could unmaximize it 967 * again, and not all window managers support maximization. But 968 * normally the window will end up maximized. Just don't write code 969 * that crashes if not. 970 * It's permitted to call this function before showing a window, 971 * in which case the window will be maximized when it appears onscreen 972 * initially. 973 * You can track maximization via the "window-state-event" signal 974 * on GtkWidget. 975 */ 976 public void maximize() 977 { 978 // void gtk_window_maximize (GtkWindow *window); 979 gtk_window_maximize(gtkWindow); 980 } 981 982 /** 983 * Asks to unmaximize window. Note that you shouldn't assume the 984 * window is definitely unmaximized afterward, because other entities 985 * (e.g. the user or window 986 * manager) could maximize it again, and not all window 987 * managers honor requests to unmaximize. But normally the window will 988 * end up unmaximized. Just don't write code that crashes if not. 989 * You can track maximization via the "window-state-event" signal 990 * on GtkWidget. 991 */ 992 public void unmaximize() 993 { 994 // void gtk_window_unmaximize (GtkWindow *window); 995 gtk_window_unmaximize(gtkWindow); 996 } 997 998 /** 999 * Asks to place window in the fullscreen state. Note that you 1000 * shouldn't assume the window is definitely full screen afterward, 1001 * because other entities (e.g. the user or window manager) could unfullscreen it 1002 * again, and not all window managers honor requests to fullscreen 1003 * windows. But normally the window will end up fullscreen. Just 1004 * don't write code that crashes if not. 1005 * You can track the fullscreen state via the "window-state-event" signal 1006 * on GtkWidget. 1007 * Since 2.2 1008 */ 1009 public void fullscreen() 1010 { 1011 // void gtk_window_fullscreen (GtkWindow *window); 1012 gtk_window_fullscreen(gtkWindow); 1013 } 1014 1015 /** 1016 * Asks to toggle off the fullscreen state for window. Note that you 1017 * shouldn't assume the window is definitely not full screen 1018 * afterward, because other entities (e.g. the user or window manager) could fullscreen it 1019 * again, and not all window managers honor requests to unfullscreen 1020 * windows. But normally the window will end up restored to its normal 1021 * state. Just don't write code that crashes if not. 1022 * You can track the fullscreen state via the "window-state-event" signal 1023 * on GtkWidget. 1024 * Since 2.2 1025 */ 1026 public void unfullscreen() 1027 { 1028 // void gtk_window_unfullscreen (GtkWindow *window); 1029 gtk_window_unfullscreen(gtkWindow); 1030 } 1031 1032 /** 1033 * Asks to keep window above, so that it stays on top. Note that 1034 * you shouldn't assume the window is definitely above afterward, 1035 * because other entities (e.g. the user or window manager) could not keep it above, 1036 * and not all window managers support keeping windows above. But 1037 * normally the window will end kept above. Just don't write code 1038 * that crashes if not. 1039 * It's permitted to call this function before showing a window, 1040 * in which case the window will be kept above when it appears onscreen 1041 * initially. 1042 * You can track the above state via the "window-state-event" signal 1043 * on GtkWidget. 1044 * Note that, according to the Extended Window 1045 * Manager Hints specification, the above state is mainly meant 1046 * for user preferences and should not be used by applications e.g. for 1047 * drawing attention to their dialogs. 1048 * Since 2.4 1049 * Params: 1050 * setting = whether to keep window above other windows 1051 */ 1052 public void setKeepAbove(int setting) 1053 { 1054 // void gtk_window_set_keep_above (GtkWindow *window, gboolean setting); 1055 gtk_window_set_keep_above(gtkWindow, setting); 1056 } 1057 1058 /** 1059 * Asks to keep window below, so that it stays in bottom. Note that 1060 * you shouldn't assume the window is definitely below afterward, 1061 * because other entities (e.g. the user or window manager) could not keep it below, 1062 * and not all window managers support putting windows below. But 1063 * normally the window will be kept below. Just don't write code 1064 * that crashes if not. 1065 * It's permitted to call this function before showing a window, 1066 * in which case the window will be kept below when it appears onscreen 1067 * initially. 1068 * You can track the below state via the "window-state-event" signal 1069 * on GtkWidget. 1070 * Note that, according to the Extended Window 1071 * Manager Hints specification, the above state is mainly meant 1072 * for user preferences and should not be used by applications e.g. for 1073 * drawing attention to their dialogs. 1074 * Since 2.4 1075 * Params: 1076 * setting = whether to keep window below other windows 1077 */ 1078 public void setKeepBelow(int setting) 1079 { 1080 // void gtk_window_set_keep_below (GtkWindow *window, gboolean setting); 1081 gtk_window_set_keep_below(gtkWindow, setting); 1082 } 1083 1084 /** 1085 * Starts resizing a window. This function is used if an application 1086 * has window resizing controls. When GDK can support it, the resize 1087 * will be done using the standard mechanism for the window manager or windowing 1088 * system. Otherwise, GDK will try to emulate window resizing, 1089 * potentially not all that well, depending on the windowing system. 1090 * Params: 1091 * button = mouse button that initiated the drag 1092 * edge = position of the resize control 1093 * rootX = X position where the user clicked to initiate the drag, in root window coordinates 1094 * rootY = Y position where the user clicked to initiate the drag 1095 * timestamp = timestamp from the click event that initiated the drag 1096 */ 1097 public void beginResizeDrag(GdkWindowEdge edge, int button, int rootX, int rootY, uint timestamp) 1098 { 1099 // void gtk_window_begin_resize_drag (GtkWindow *window, GdkWindowEdge edge, gint button, gint root_x, gint root_y, guint32 timestamp); 1100 gtk_window_begin_resize_drag(gtkWindow, edge, button, rootX, rootY, timestamp); 1101 } 1102 1103 /** 1104 * Starts moving a window. This function is used if an application has 1105 * window movement grips. When GDK can support it, the window movement 1106 * will be done using the standard mechanism for the window manager or windowing 1107 * system. Otherwise, GDK will try to emulate window movement, 1108 * potentially not all that well, depending on the windowing system. 1109 * Params: 1110 * button = mouse button that initiated the drag 1111 * rootX = X position where the user clicked to initiate the drag, in root window coordinates 1112 * rootY = Y position where the user clicked to initiate the drag 1113 * timestamp = timestamp from the click event that initiated the drag 1114 */ 1115 public void beginMoveDrag(int button, int rootX, int rootY, uint timestamp) 1116 { 1117 // void gtk_window_begin_move_drag (GtkWindow *window, gint button, gint root_x, gint root_y, guint32 timestamp); 1118 gtk_window_begin_move_drag(gtkWindow, button, rootX, rootY, timestamp); 1119 } 1120 1121 /** 1122 * By default, windows are decorated with a title bar, resize 1123 * controls, etc. Some window 1124 * managers allow GTK+ to disable these decorations, creating a 1125 * borderless window. If you set the decorated property to FALSE 1126 * using this function, GTK+ will do its best to convince the window 1127 * manager not to decorate the window. Depending on the system, this 1128 * function may not have any effect when called on a window that is 1129 * already visible, so you should call it before calling gtk_widget_show(). 1130 * On Windows, this function always works, since there's no window manager 1131 * policy involved. 1132 * Params: 1133 * setting = TRUE to decorate the window 1134 */ 1135 public void setDecorated(int setting) 1136 { 1137 // void gtk_window_set_decorated (GtkWindow *window, gboolean setting); 1138 gtk_window_set_decorated(gtkWindow, setting); 1139 } 1140 1141 /** 1142 * By default, windows have a close button in the window frame. Some 1143 * window managers allow GTK+ to 1144 * disable this button. If you set the deletable property to FALSE 1145 * using this function, GTK+ will do its best to convince the window 1146 * manager not to show a close button. Depending on the system, this 1147 * function may not have any effect when called on a window that is 1148 * already visible, so you should call it before calling gtk_widget_show(). 1149 * On Windows, this function always works, since there's no window manager 1150 * policy involved. 1151 * Since 2.10 1152 * Params: 1153 * setting = TRUE to decorate the window as deletable 1154 */ 1155 public void setDeletable(int setting) 1156 { 1157 // void gtk_window_set_deletable (GtkWindow *window, gboolean setting); 1158 gtk_window_set_deletable(gtkWindow, setting); 1159 } 1160 1161 /** 1162 * Sets the mnemonic modifier for this window. 1163 * Params: 1164 * modifier = the modifier mask used to activate 1165 * mnemonics on this window. 1166 */ 1167 public void setMnemonicModifier(GdkModifierType modifier) 1168 { 1169 // void gtk_window_set_mnemonic_modifier (GtkWindow *window, GdkModifierType modifier); 1170 gtk_window_set_mnemonic_modifier(gtkWindow, modifier); 1171 } 1172 1173 /** 1174 * By setting the type hint for the window, you allow the window 1175 * manager to decorate and handle the window in a way which is 1176 * suitable to the function of the window in your application. 1177 * This function should be called before the window becomes visible. 1178 * gtk_dialog_new_with_buttons() and other convenience functions in GTK+ 1179 * will sometimes call gtk_window_set_type_hint() on your behalf. 1180 * Params: 1181 * hint = the window type 1182 */ 1183 public void setTypeHint(GdkWindowTypeHint hint) 1184 { 1185 // void gtk_window_set_type_hint (GtkWindow *window, GdkWindowTypeHint hint); 1186 gtk_window_set_type_hint(gtkWindow, hint); 1187 } 1188 1189 /** 1190 * Windows may set a hint asking the desktop environment not to display 1191 * the window in the task bar. This function sets this hint. 1192 * Since 2.2 1193 * Params: 1194 * setting = TRUE to keep this window from appearing in the task bar 1195 */ 1196 public void setSkipTaskbarHint(int setting) 1197 { 1198 // void gtk_window_set_skip_taskbar_hint (GtkWindow *window, gboolean setting); 1199 gtk_window_set_skip_taskbar_hint(gtkWindow, setting); 1200 } 1201 1202 /** 1203 * Windows may set a hint asking the desktop environment not to display 1204 * the window in the pager. This function sets this hint. 1205 * (A "pager" is any desktop navigation tool such as a workspace 1206 * switcher that displays a thumbnail representation of the windows 1207 * on the screen.) 1208 * Since 2.2 1209 * Params: 1210 * setting = TRUE to keep this window from appearing in the pager 1211 */ 1212 public void setSkipPagerHint(int setting) 1213 { 1214 // void gtk_window_set_skip_pager_hint (GtkWindow *window, gboolean setting); 1215 gtk_window_set_skip_pager_hint(gtkWindow, setting); 1216 } 1217 1218 /** 1219 * Windows may set a hint asking the desktop environment to draw 1220 * the users attention to the window. This function sets this hint. 1221 * Since 2.8 1222 * Params: 1223 * setting = TRUE to mark this window as urgent 1224 */ 1225 public void setUrgencyHint(int setting) 1226 { 1227 // void gtk_window_set_urgency_hint (GtkWindow *window, gboolean setting); 1228 gtk_window_set_urgency_hint(gtkWindow, setting); 1229 } 1230 1231 /** 1232 * Windows may set a hint asking the desktop environment not to receive 1233 * the input focus. This function sets this hint. 1234 * Since 2.4 1235 * Params: 1236 * setting = TRUE to let this window receive input focus 1237 */ 1238 public void setAcceptFocus(int setting) 1239 { 1240 // void gtk_window_set_accept_focus (GtkWindow *window, gboolean setting); 1241 gtk_window_set_accept_focus(gtkWindow, setting); 1242 } 1243 1244 /** 1245 * Windows may set a hint asking the desktop environment not to receive 1246 * the input focus when the window is mapped. This function sets this 1247 * hint. 1248 * Since 2.6 1249 * Params: 1250 * setting = TRUE to let this window receive input focus on map 1251 */ 1252 public void setFocusOnMap(int setting) 1253 { 1254 // void gtk_window_set_focus_on_map (GtkWindow *window, gboolean setting); 1255 gtk_window_set_focus_on_map(gtkWindow, setting); 1256 } 1257 1258 /** 1259 * Startup notification identifiers are used by desktop environment to 1260 * track application startup, to provide user feedback and other 1261 * features. This function changes the corresponding property on the 1262 * underlying GdkWindow. Normally, startup identifier is managed 1263 * automatically and you should only use this function in special cases 1264 * like transferring focus from other processes. You should use this 1265 * function before calling gtk_window_present() or any equivalent 1266 * function generating a window map event. 1267 * This function is only useful on X11, not with other GTK+ targets. 1268 * Since 2.12 1269 * Params: 1270 * startupId = a string with startup-notification identifier 1271 */ 1272 public void setStartupId(string startupId) 1273 { 1274 // void gtk_window_set_startup_id (GtkWindow *window, const gchar *startup_id); 1275 gtk_window_set_startup_id(gtkWindow, Str.toStringz(startupId)); 1276 } 1277 1278 /** 1279 * This function is only useful on X11, not with other GTK+ targets. 1280 * In combination with the window title, the window role allows a 1281 * window manager to identify "the 1282 * same" window when an application is restarted. So for example you 1283 * might set the "toolbox" role on your app's toolbox window, so that 1284 * when the user restarts their session, the window manager can put 1285 * the toolbox back in the same place. 1286 * If a window already has a unique title, you don't need to set the 1287 * role, since the WM can use the title to identify the window when 1288 * restoring the session. 1289 * Params: 1290 * role = unique identifier for the window to be used when restoring a session 1291 */ 1292 public void setRole(string role) 1293 { 1294 // void gtk_window_set_role (GtkWindow *window, const gchar *role); 1295 gtk_window_set_role(gtkWindow, Str.toStringz(role)); 1296 } 1297 1298 /** 1299 * Returns whether the window has been set to have decorations 1300 * such as a title bar via gtk_window_set_decorated(). 1301 * Returns: TRUE if the window has been set to have decorations 1302 */ 1303 public int getDecorated() 1304 { 1305 // gboolean gtk_window_get_decorated (GtkWindow *window); 1306 return gtk_window_get_decorated(gtkWindow); 1307 } 1308 1309 /** 1310 * Returns whether the window has been set to have a close button 1311 * via gtk_window_set_deletable(). 1312 * Since 2.10 1313 * Returns: TRUE if the window has been set to have a close button 1314 */ 1315 public int getDeletable() 1316 { 1317 // gboolean gtk_window_get_deletable (GtkWindow *window); 1318 return gtk_window_get_deletable(gtkWindow); 1319 } 1320 1321 /** 1322 * Gets the value set by gtk_window_set_default_icon_list(). 1323 * The list is a copy and should be freed with g_list_free(), 1324 * but the pixbufs in the list have not had their reference count 1325 * incremented. 1326 * Returns: copy of default icon list. [element-type GdkPixbuf][transfer container] 1327 */ 1328 public static ListG getDefaultIconList() 1329 { 1330 // GList * gtk_window_get_default_icon_list (void); 1331 auto p = gtk_window_get_default_icon_list(); 1332 1333 if(p is null) 1334 { 1335 return null; 1336 } 1337 1338 return ObjectG.getDObject!(ListG)(cast(GList*) p); 1339 } 1340 1341 /** 1342 * Returns the fallback icon name for windows that has been set 1343 * with gtk_window_set_default_icon_name(). The returned 1344 * string is owned by GTK+ and should not be modified. It 1345 * is only valid until the next call to 1346 * gtk_window_set_default_icon_name(). 1347 * Since 2.16 1348 * Returns: the fallback icon name for windows 1349 */ 1350 public static string getDefaultIconName() 1351 { 1352 // const gchar * gtk_window_get_default_icon_name (void); 1353 return Str.toString(gtk_window_get_default_icon_name()); 1354 } 1355 1356 /** 1357 * Gets the default size of the window. A value of -1 for the width or 1358 * height indicates that a default size has not been explicitly set 1359 * for that dimension, so the "natural" size of the window will be 1360 * used. 1361 * Params: 1362 * width = location to store the default width, or NULL. [out][allow-none] 1363 * height = location to store the default height, or NULL. [out][allow-none] 1364 */ 1365 public void getDefaultSize(out int width, out int height) 1366 { 1367 // void gtk_window_get_default_size (GtkWindow *window, gint *width, gint *height); 1368 gtk_window_get_default_size(gtkWindow, &width, &height); 1369 } 1370 1371 /** 1372 * Returns whether the window will be destroyed with its transient parent. See 1373 * gtk_window_set_destroy_with_parent(). 1374 * Returns: TRUE if the window will be destroyed with its transient parent. 1375 */ 1376 public int getDestroyWithParent() 1377 { 1378 // gboolean gtk_window_get_destroy_with_parent (GtkWindow *window); 1379 return gtk_window_get_destroy_with_parent(gtkWindow); 1380 } 1381 1382 /** 1383 * Returns whether the window has requested to have its titlebar hidden 1384 * when maximized. See gtk_window_set_hide_titlebar_when_maximized(). 1385 * Returns: TRUE if the window has requested to have its titlebar hidden when maximized Since 3.4 1386 */ 1387 public int getHideTitlebarWhenMaximized() 1388 { 1389 // gboolean gtk_window_get_hide_titlebar_when_maximized (GtkWindow *window); 1390 return gtk_window_get_hide_titlebar_when_maximized(gtkWindow); 1391 } 1392 1393 /** 1394 * Gets the value set by gtk_window_set_icon() (or if you've 1395 * called gtk_window_set_icon_list(), gets the first icon in 1396 * the icon list). 1397 * Returns: icon for window. [transfer none] 1398 */ 1399 public Pixbuf getIcon() 1400 { 1401 // GdkPixbuf * gtk_window_get_icon (GtkWindow *window); 1402 auto p = gtk_window_get_icon(gtkWindow); 1403 1404 if(p is null) 1405 { 1406 return null; 1407 } 1408 1409 import gtkc.gobject : g_object_ref; 1410 g_object_ref(cast(GObject*)p); 1411 1412 return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p); 1413 } 1414 1415 /** 1416 * Retrieves the list of icons set by gtk_window_set_icon_list(). 1417 * The list is copied, but the reference count on each 1418 * member won't be incremented. 1419 * Returns: copy of window's icon list. [element-type GdkPixbuf][transfer container] 1420 */ 1421 public ListG getIconList() 1422 { 1423 // GList * gtk_window_get_icon_list (GtkWindow *window); 1424 auto p = gtk_window_get_icon_list(gtkWindow); 1425 1426 if(p is null) 1427 { 1428 return null; 1429 } 1430 1431 return ObjectG.getDObject!(ListG)(cast(GList*) p); 1432 } 1433 1434 /** 1435 * Returns the name of the themed icon for the window, 1436 * see gtk_window_set_icon_name(). 1437 * Since 2.6 1438 * Returns: the icon name or NULL if the window has no themed icon 1439 */ 1440 public string getIconName() 1441 { 1442 // const gchar * gtk_window_get_icon_name (GtkWindow *window); 1443 return Str.toString(gtk_window_get_icon_name(gtkWindow)); 1444 } 1445 1446 /** 1447 * Returns the mnemonic modifier for this window. See 1448 * gtk_window_set_mnemonic_modifier(). 1449 * Returns: the modifier mask used to activate mnemonics on this window. 1450 */ 1451 public GdkModifierType getMnemonicModifier() 1452 { 1453 // GdkModifierType gtk_window_get_mnemonic_modifier (GtkWindow *window); 1454 return gtk_window_get_mnemonic_modifier(gtkWindow); 1455 } 1456 1457 /** 1458 * Returns whether the window is modal. See gtk_window_set_modal(). 1459 * Returns: TRUE if the window is set to be modal and establishes a grab when shown 1460 */ 1461 public int getModal() 1462 { 1463 // gboolean gtk_window_get_modal (GtkWindow *window); 1464 return gtk_window_get_modal(gtkWindow); 1465 } 1466 1467 /** 1468 * This function returns the position you need to pass to 1469 * gtk_window_move() to keep window in its current position. 1470 * This means that the meaning of the returned value varies with 1471 * window gravity. See gtk_window_move() for more details. 1472 * If you haven't changed the window gravity, its gravity will be 1473 * GDK_GRAVITY_NORTH_WEST. This means that gtk_window_get_position() 1474 * gets the position of the top-left corner of the window manager 1475 * frame for the window. gtk_window_move() sets the position of this 1476 * same top-left corner. 1477 * gtk_window_get_position() is not 100% reliable because the X Window System 1478 * does not specify a way to obtain the geometry of the 1479 * decorations placed on a window by the window manager. 1480 * Thus GTK+ is using a "best guess" that works with most 1481 * window managers. 1482 * Moreover, nearly all window managers are historically broken with 1483 * respect to their handling of window gravity. So moving a window to 1484 * its current position as returned by gtk_window_get_position() tends 1485 * to result in moving the window slightly. Window managers are 1486 * slowly getting better over time. 1487 * If a window has gravity GDK_GRAVITY_STATIC the window manager 1488 * frame is not relevant, and thus gtk_window_get_position() will 1489 * always produce accurate results. However you can't use static 1490 * gravity to do things like place a window in a corner of the screen, 1491 * because static gravity ignores the window manager decorations. 1492 * If you are saving and restoring your application's window 1493 * positions, you should know that it's impossible for applications to 1494 * do this without getting it somewhat wrong because applications do 1495 * not have sufficient knowledge of window manager state. The Correct 1496 * Mechanism is to support the session management protocol (see the 1497 * "GnomeClient" object in the GNOME libraries for example) and allow 1498 * the window manager to save your window sizes and positions. 1499 * Params: 1500 * rootX = return location for X coordinate of 1501 * gravity-determined reference point, or NULL. [out][allow-none] 1502 * rootY = return location for Y coordinate of 1503 * gravity-determined reference point, or NULL. [out][allow-none] 1504 */ 1505 public void getPosition(out int rootX, out int rootY) 1506 { 1507 // void gtk_window_get_position (GtkWindow *window, gint *root_x, gint *root_y); 1508 gtk_window_get_position(gtkWindow, &rootX, &rootY); 1509 } 1510 1511 /** 1512 * Returns the role of the window. See gtk_window_set_role() for 1513 * further explanation. 1514 * Returns: the role of the window if set, or NULL. The returned is owned by the widget and must not be modified or freed. 1515 */ 1516 public string getRole() 1517 { 1518 // const gchar * gtk_window_get_role (GtkWindow *window); 1519 return Str.toString(gtk_window_get_role(gtkWindow)); 1520 } 1521 1522 /** 1523 * Obtains the current size of window. If window is not onscreen, 1524 * it returns the size GTK+ will suggest to the window manager for the initial window 1525 * size (but this is not reliably the same as the size the window 1526 * manager will actually select). The size obtained by 1527 * gtk_window_get_size() is the last size received in a 1528 * GdkEventConfigure, that is, GTK+ uses its locally-stored size, 1529 * rather than querying the X server for the size. As a result, if you 1530 * call gtk_window_resize() then immediately call 1531 * gtk_window_get_size(), the size won't have taken effect yet. After 1532 * the window manager processes the resize request, GTK+ receives 1533 * notification that the size has changed via a configure event, and 1534 * the size of the window gets updated. 1535 * Note 1: Nearly any use of this function creates a race condition, 1536 * because the size of the window may change between the time that you 1537 * get the size and the time that you perform some action assuming 1538 * that size is the current size. To avoid race conditions, connect to 1539 * "configure-event" on the window and adjust your size-dependent 1540 * state to match the size delivered in the GdkEventConfigure. 1541 * Note 2: The returned size does not include the 1542 * size of the window manager decorations (aka the window frame or 1543 * border). Those are not drawn by GTK+ and GTK+ has no reliable 1544 * method of determining their size. 1545 * Note 3: If you are getting a window size in order to position 1546 * the window onscreen, there may be a better way. The preferred 1547 * way is to simply set the window's semantic type with 1548 * gtk_window_set_type_hint(), which allows the window manager to 1549 * e.g. center dialogs. Also, if you set the transient parent of 1550 * dialogs with gtk_window_set_transient_for() window managers 1551 * will often center the dialog over its parent window. It's 1552 * much preferred to let the window manager handle these 1553 * things rather than doing it yourself, because all apps will 1554 * behave consistently and according to user prefs if the window 1555 * manager handles it. Also, the window manager can take the size 1556 * of the window decorations/border into account, while your 1557 * application cannot. 1558 * In any case, if you insist on application-specified window 1559 * positioning, there's still a better way than 1560 * doing it yourself - gtk_window_set_position() will frequently 1561 * handle the details for you. 1562 * Params: 1563 * width = return location for width, or NULL. [out][allow-none] 1564 * height = return location for height, or NULL. [out][allow-none] 1565 */ 1566 public void getSize(out int width, out int height) 1567 { 1568 // void gtk_window_get_size (GtkWindow *window, gint *width, gint *height); 1569 gtk_window_get_size(gtkWindow, &width, &height); 1570 } 1571 1572 /** 1573 * Retrieves the title of the window. See gtk_window_set_title(). 1574 * Returns: the title of the window, or NULL if none has been set explicitely. The returned string is owned by the widget and must not be modified or freed. 1575 */ 1576 public string getTitle() 1577 { 1578 // const gchar * gtk_window_get_title (GtkWindow *window); 1579 return Str.toString(gtk_window_get_title(gtkWindow)); 1580 } 1581 1582 /** 1583 * Fetches the transient parent for this window. See 1584 * gtk_window_set_transient_for(). 1585 * Returns: the transient parent for this window, or NULL if no transient parent has been set. [transfer none] 1586 */ 1587 public Window getTransientFor() 1588 { 1589 // GtkWindow * gtk_window_get_transient_for (GtkWindow *window); 1590 auto p = gtk_window_get_transient_for(gtkWindow); 1591 1592 if(p is null) 1593 { 1594 return null; 1595 } 1596 1597 return ObjectG.getDObject!(Window)(cast(GtkWindow*) p); 1598 } 1599 1600 /** 1601 * Fetches the attach widget for this window. See 1602 * gtk_window_set_attached_to(). 1603 * Returns: the widget where the window is attached, or NULL if the window is not attached to any widget. [transfer none] Since 3.4 1604 */ 1605 public Widget getAttachedTo() 1606 { 1607 // GtkWidget * gtk_window_get_attached_to (GtkWindow *window); 1608 auto p = gtk_window_get_attached_to(gtkWindow); 1609 1610 if(p is null) 1611 { 1612 return null; 1613 } 1614 1615 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 1616 } 1617 1618 /** 1619 * Gets the type hint for this window. See gtk_window_set_type_hint(). 1620 * Returns: the type hint for window. 1621 */ 1622 public GdkWindowTypeHint getTypeHint() 1623 { 1624 // GdkWindowTypeHint gtk_window_get_type_hint (GtkWindow *window); 1625 return gtk_window_get_type_hint(gtkWindow); 1626 } 1627 1628 /** 1629 * Gets the value set by gtk_window_set_skip_taskbar_hint() 1630 * Since 2.2 1631 * Returns: TRUE if window shouldn't be in taskbar 1632 */ 1633 public int getSkipTaskbarHint() 1634 { 1635 // gboolean gtk_window_get_skip_taskbar_hint (GtkWindow *window); 1636 return gtk_window_get_skip_taskbar_hint(gtkWindow); 1637 } 1638 1639 /** 1640 * Gets the value set by gtk_window_set_skip_pager_hint(). 1641 * Since 2.2 1642 * Returns: TRUE if window shouldn't be in pager 1643 */ 1644 public int getSkipPagerHint() 1645 { 1646 // gboolean gtk_window_get_skip_pager_hint (GtkWindow *window); 1647 return gtk_window_get_skip_pager_hint(gtkWindow); 1648 } 1649 1650 /** 1651 * Gets the value set by gtk_window_set_urgency_hint() 1652 * Since 2.8 1653 * Returns: TRUE if window is urgent 1654 */ 1655 public int getUrgencyHint() 1656 { 1657 // gboolean gtk_window_get_urgency_hint (GtkWindow *window); 1658 return gtk_window_get_urgency_hint(gtkWindow); 1659 } 1660 1661 /** 1662 * Gets the value set by gtk_window_set_accept_focus(). 1663 * Since 2.4 1664 * Returns: TRUE if window should receive the input focus 1665 */ 1666 public int getAcceptFocus() 1667 { 1668 // gboolean gtk_window_get_accept_focus (GtkWindow *window); 1669 return gtk_window_get_accept_focus(gtkWindow); 1670 } 1671 1672 /** 1673 * Gets the value set by gtk_window_set_focus_on_map(). 1674 * Since 2.6 1675 * Returns: TRUE if window should receive the input focus when mapped. 1676 */ 1677 public int getFocusOnMap() 1678 { 1679 // gboolean gtk_window_get_focus_on_map (GtkWindow *window); 1680 return gtk_window_get_focus_on_map(gtkWindow); 1681 } 1682 1683 /** 1684 * Returns the group for window or the default group, if 1685 * window is NULL or if window does not have an explicit 1686 * window group. 1687 * Since 2.10 1688 * Returns: the GtkWindowGroup for a window or the default group. [transfer none] 1689 */ 1690 public WindowGroup getGroup() 1691 { 1692 // GtkWindowGroup * gtk_window_get_group (GtkWindow *window); 1693 auto p = gtk_window_get_group(gtkWindow); 1694 1695 if(p is null) 1696 { 1697 return null; 1698 } 1699 1700 return ObjectG.getDObject!(WindowGroup)(cast(GtkWindowGroup*) p); 1701 } 1702 1703 /** 1704 * Returns whether window has an explicit window group. 1705 * Since 2.22 1706 * Returns: TRUE if window has an explicit window group. 1707 */ 1708 public int hasGroup() 1709 { 1710 // gboolean gtk_window_has_group (GtkWindow *window); 1711 return gtk_window_has_group(gtkWindow); 1712 } 1713 1714 /** 1715 * Gets the type of the window. See GtkWindowType. 1716 * Since 2.20 1717 * Returns: the type of the window 1718 */ 1719 public GtkWindowType getWindowType() 1720 { 1721 // GtkWindowType gtk_window_get_window_type (GtkWindow *window); 1722 return gtk_window_get_window_type(gtkWindow); 1723 } 1724 1725 /** 1726 * Asks the window manager to move 1727 * window to the given position. Window managers are free to ignore 1728 * this; most window managers ignore requests for initial window 1729 * positions (instead using a user-defined placement algorithm) and 1730 * honor requests after the window has already been shown. 1731 * Note: the position is the position of the gravity-determined 1732 * Params: 1733 * x = X coordinate to move window to 1734 * y = Y coordinate to move window to 1735 */ 1736 public void move(int x, int y) 1737 { 1738 // void gtk_window_move (GtkWindow *window, gint x, gint y); 1739 gtk_window_move(gtkWindow, x, y); 1740 } 1741 1742 /** 1743 * Parses a standard X Window System geometry string - see the 1744 * manual page for X (type 'man X') for details on this. 1745 * gtk_window_parse_geometry() does work on all GTK+ ports 1746 * including Win32 but is primarily intended for an X environment. 1747 * If either a size or a position can be extracted from the 1748 * geometry string, gtk_window_parse_geometry() returns TRUE 1749 * and calls gtk_window_set_default_size() and/or gtk_window_move() 1750 * to resize/move the window. 1751 * If gtk_window_parse_geometry() returns TRUE, it will also 1752 * set the GDK_HINT_USER_POS and/or GDK_HINT_USER_SIZE hints 1753 * indicating to the window manager that the size/position of 1754 * the window was user-specified. This causes most window 1755 * managers to honor the geometry. 1756 * Note that for gtk_window_parse_geometry() to work as expected, it has 1757 * to be called when the window has its "final" size, i.e. after calling 1758 * gtk_widget_show_all() on the contents and gtk_window_set_geometry_hints() 1759 * on the window. 1760 * $(DDOC_COMMENT example) 1761 * Params: 1762 * geometry = geometry string 1763 * Returns: TRUE if string was parsed successfully 1764 */ 1765 public int parseGeometry(string geometry) 1766 { 1767 // gboolean gtk_window_parse_geometry (GtkWindow *window, const gchar *geometry); 1768 return gtk_window_parse_geometry(gtkWindow, Str.toStringz(geometry)); 1769 } 1770 1771 /** 1772 * Warning 1773 * gtk_window_reshow_with_initial_size has been deprecated since version 3.10 and should not be used in newly-written code. GUI builders can call gtk_widget_hide(), 1774 * gtk_widget_unrealize() and then gtk_widget_show() on window 1775 * themselves, if they still need this functionality. 1776 * Hides window, then reshows it, resetting the 1777 * default size and position of the window. Used 1778 * by GUI builders only. 1779 */ 1780 public void reshowWithInitialSize() 1781 { 1782 // void gtk_window_reshow_with_initial_size (GtkWindow *window); 1783 gtk_window_reshow_with_initial_size(gtkWindow); 1784 } 1785 1786 /** 1787 * Resizes the window as if the user had done so, obeying geometry 1788 * constraints. The default geometry constraint is that windows may 1789 * not be smaller than their size request; to override this 1790 * constraint, call gtk_widget_set_size_request() to set the window's 1791 * request to a smaller value. 1792 * If gtk_window_resize() is called before showing a window for the 1793 * first time, it overrides any default size set with 1794 * gtk_window_set_default_size(). 1795 * Windows may not be resized smaller than 1 by 1 pixels. 1796 * Params: 1797 * width = width in pixels to resize the window to 1798 * height = height in pixels to resize the window to 1799 */ 1800 public void resize(int width, int height) 1801 { 1802 // void gtk_window_resize (GtkWindow *window, gint width, gint height); 1803 gtk_window_resize(gtkWindow, width, height); 1804 } 1805 1806 /** 1807 * Like gtk_window_resize(), but width and height are interpreted 1808 * in terms of the base size and increment set with 1809 * gtk_window_set_geometry_hints. 1810 * Params: 1811 * width = width in resize increments to resize the window to 1812 * height = height in resize increments to resize the window to 1813 * Since 3.0 1814 */ 1815 public void resizeToGeometry(int width, int height) 1816 { 1817 // void gtk_window_resize_to_geometry (GtkWindow *window, gint width, gint height); 1818 gtk_window_resize_to_geometry(gtkWindow, width, height); 1819 } 1820 1821 /** 1822 * Sets an icon list to be used as fallback for windows that haven't 1823 * had gtk_window_set_icon_list() called on them to set up a 1824 * window-specific icon list. This function allows you to set up the 1825 * icon for all windows in your app at once. 1826 * See gtk_window_set_icon_list() for more details. 1827 * Params: 1828 * list = a list of GdkPixbuf. [element-type GdkPixbuf][transfer container] 1829 */ 1830 public static void setDefaultIconList(ListG list) 1831 { 1832 // void gtk_window_set_default_icon_list (GList *list); 1833 gtk_window_set_default_icon_list((list is null) ? null : list.getListGStruct()); 1834 } 1835 1836 /** 1837 * Sets an icon to be used as fallback for windows that haven't 1838 * had gtk_window_set_icon() called on them from a pixbuf. 1839 * Since 2.4 1840 * Params: 1841 * icon = the icon 1842 */ 1843 public static void setDefaultIcon(Pixbuf icon) 1844 { 1845 // void gtk_window_set_default_icon (GdkPixbuf *icon); 1846 gtk_window_set_default_icon((icon is null) ? null : icon.getPixbufStruct()); 1847 } 1848 1849 /** 1850 * Sets an icon to be used as fallback for windows that haven't 1851 * had gtk_window_set_icon_list() called on them from a file 1852 * on disk. Warns on failure if err is NULL. 1853 * Since 2.2 1854 * Params: 1855 * filename = location of icon file. [type filename] 1856 * Returns: TRUE if setting the icon succeeded. 1857 * Throws: GException on failure. 1858 */ 1859 public static int setDefaultIconFromFile(string filename) 1860 { 1861 // gboolean gtk_window_set_default_icon_from_file (const gchar *filename, GError **err); 1862 GError* err = null; 1863 1864 auto p = gtk_window_set_default_icon_from_file(Str.toStringz(filename), &err); 1865 1866 if (err !is null) 1867 { 1868 throw new GException( new ErrorG(err) ); 1869 } 1870 1871 return p; 1872 } 1873 1874 /** 1875 * Sets an icon to be used as fallback for windows that haven't 1876 * had gtk_window_set_icon_list() called on them from a named 1877 * themed icon, see gtk_window_set_icon_name(). 1878 * Since 2.6 1879 * Params: 1880 * name = the name of the themed icon 1881 */ 1882 public static void setDefaultIconName(string name) 1883 { 1884 // void gtk_window_set_default_icon_name (const gchar *name); 1885 gtk_window_set_default_icon_name(Str.toStringz(name)); 1886 } 1887 1888 /** 1889 * Sets up the icon representing a GtkWindow. This icon is used when 1890 * the window is minimized (also known as iconified). Some window 1891 * managers or desktop environments may also place it in the window 1892 * frame, or display it in other contexts. 1893 * The icon should be provided in whatever size it was naturally 1894 * drawn; that is, don't scale the image before passing it to 1895 * GTK+. Scaling is postponed until the last minute, when the desired 1896 * final size is known, to allow best quality. 1897 * If you have your icon hand-drawn in multiple sizes, use 1898 * gtk_window_set_icon_list(). Then the best size will be used. 1899 * This function is equivalent to calling gtk_window_set_icon_list() 1900 * with a 1-element list. 1901 * See also gtk_window_set_default_icon_list() to set the icon 1902 * for all windows in your application in one go. 1903 * Params: 1904 * icon = icon image, or NULL. [allow-none] 1905 */ 1906 public void setIcon(Pixbuf icon) 1907 { 1908 // void gtk_window_set_icon (GtkWindow *window, GdkPixbuf *icon); 1909 gtk_window_set_icon(gtkWindow, (icon is null) ? null : icon.getPixbufStruct()); 1910 } 1911 1912 /** 1913 * Sets up the icon representing a GtkWindow. The icon is used when 1914 * the window is minimized (also known as iconified). Some window 1915 * managers or desktop environments may also place it in the window 1916 * frame, or display it in other contexts. 1917 * gtk_window_set_icon_list() allows you to pass in the same icon in 1918 * several hand-drawn sizes. The list should contain the natural sizes 1919 * your icon is available in; that is, don't scale the image before 1920 * passing it to GTK+. Scaling is postponed until the last minute, 1921 * when the desired final size is known, to allow best quality. 1922 * By passing several sizes, you may improve the final image quality 1923 * of the icon, by reducing or eliminating automatic image scaling. 1924 * Recommended sizes to provide: 16x16, 32x32, 48x48 at minimum, and 1925 * larger images (64x64, 128x128) if you have them. 1926 * See also gtk_window_set_default_icon_list() to set the icon 1927 * for all windows in your application in one go. 1928 * Note that transient windows (those who have been set transient for another 1929 * window using gtk_window_set_transient_for()) will inherit their 1930 * icon from their transient parent. So there's no need to explicitly 1931 * set the icon on transient windows. 1932 * Params: 1933 * list = list of GdkPixbuf. [element-type GdkPixbuf] 1934 */ 1935 public void setIconList(ListG list) 1936 { 1937 // void gtk_window_set_icon_list (GtkWindow *window, GList *list); 1938 gtk_window_set_icon_list(gtkWindow, (list is null) ? null : list.getListGStruct()); 1939 } 1940 1941 /** 1942 * Sets the icon for window. 1943 * Warns on failure if err is NULL. 1944 * This function is equivalent to calling gtk_window_set_icon() 1945 * with a pixbuf created by loading the image from filename. 1946 * Since 2.2 1947 * Params: 1948 * filename = location of icon file. [type filename] 1949 * Returns: TRUE if setting the icon succeeded. 1950 * Throws: GException on failure. 1951 */ 1952 public int setIconFromFile(string filename) 1953 { 1954 // gboolean gtk_window_set_icon_from_file (GtkWindow *window, const gchar *filename, GError **err); 1955 GError* err = null; 1956 1957 auto p = gtk_window_set_icon_from_file(gtkWindow, Str.toStringz(filename), &err); 1958 1959 if (err !is null) 1960 { 1961 throw new GException( new ErrorG(err) ); 1962 } 1963 1964 return p; 1965 } 1966 1967 /** 1968 * Sets the icon for the window from a named themed icon. See 1969 * the docs for GtkIconTheme for more details. 1970 * Note that this has nothing to do with the WM_ICON_NAME 1971 * property which is mentioned in the ICCCM. 1972 * Since 2.6 1973 * Params: 1974 * name = the name of the themed icon. [allow-none] 1975 */ 1976 public void setIconName(string name) 1977 { 1978 // void gtk_window_set_icon_name (GtkWindow *window, const gchar *name); 1979 gtk_window_set_icon_name(gtkWindow, Str.toStringz(name)); 1980 } 1981 1982 /** 1983 * By default, after showing the first GtkWindow, GTK+ calls 1984 * gdk_notify_startup_complete(). Call this function to disable 1985 * the automatic startup notification. You might do this if your 1986 * first window is a splash screen, and you want to delay notification 1987 * until after your real main window has been shown, for example. 1988 * In that example, you would disable startup notification 1989 * temporarily, show your splash screen, then re-enable it so that 1990 * showing the main window would automatically result in notification. 1991 * Since 2.2 1992 * Params: 1993 * setting = TRUE to automatically do startup notification 1994 */ 1995 public static void setAutoStartupNotification(int setting) 1996 { 1997 // void gtk_window_set_auto_startup_notification (gboolean setting); 1998 gtk_window_set_auto_startup_notification(setting); 1999 } 2000 2001 /** 2002 * Warning 2003 * gtk_window_get_opacity has been deprecated since version 3.8 and should not be used in newly-written code. Use gtk_widget_get_opacity instead. 2004 * Fetches the requested opacity for this window. See 2005 * gtk_window_set_opacity(). 2006 * Since 2.12 2007 * Returns: the requested opacity for this window. 2008 */ 2009 public override double getOpacity() 2010 { 2011 // gdouble gtk_window_get_opacity (GtkWindow *window); 2012 return gtk_window_get_opacity(gtkWindow); 2013 } 2014 2015 /** 2016 * Warning 2017 * gtk_window_set_opacity has been deprecated since version 3.8 and should not be used in newly-written code. Use gtk_widget_set_opacity instead. 2018 * Request the windowing system to make window partially transparent, 2019 * with opacity 0 being fully transparent and 1 fully opaque. (Values 2020 * of the opacity parameter are clamped to the [0,1] range.) On X11 2021 * this has any effect only on X screens with a compositing manager 2022 * running. See gtk_widget_is_composited(). On Windows it should work 2023 * always. 2024 * Note that setting a window's opacity after the window has been 2025 * shown causes it to flicker once on Windows. 2026 * Since 2.12 2027 * Params: 2028 * opacity = desired opacity, between 0 and 1 2029 */ 2030 public override void setOpacity(double opacity) 2031 { 2032 // void gtk_window_set_opacity (GtkWindow *window, gdouble opacity); 2033 gtk_window_set_opacity(gtkWindow, opacity); 2034 } 2035 2036 /** 2037 * Gets the value of the "mnemonics-visible" property. 2038 * Since 2.20 2039 * Returns: TRUE if mnemonics are supposed to be visible in this window. 2040 */ 2041 public int getMnemonicsVisible() 2042 { 2043 // gboolean gtk_window_get_mnemonics_visible (GtkWindow *window); 2044 return gtk_window_get_mnemonics_visible(gtkWindow); 2045 } 2046 2047 /** 2048 * Sets the "mnemonics-visible" property. 2049 * Since 2.20 2050 * Params: 2051 * setting = the new value 2052 */ 2053 public void setMnemonicsVisible(int setting) 2054 { 2055 // void gtk_window_set_mnemonics_visible (GtkWindow *window, gboolean setting); 2056 gtk_window_set_mnemonics_visible(gtkWindow, setting); 2057 } 2058 2059 /** 2060 * Gets the value of the "focus-visible" property. 2061 * Returns: TRUE if 'focus rectangles' are supposed to be visible in this window. Since 3.2 2062 */ 2063 public int getFocusVisible() 2064 { 2065 // gboolean gtk_window_get_focus_visible (GtkWindow *window); 2066 return gtk_window_get_focus_visible(gtkWindow); 2067 } 2068 2069 /** 2070 * Sets the "focus-visible" property. 2071 * Params: 2072 * setting = the new value 2073 * Since 3.2 2074 */ 2075 public void setFocusVisible(int setting) 2076 { 2077 // void gtk_window_set_focus_visible (GtkWindow *window, gboolean setting); 2078 gtk_window_set_focus_visible(gtkWindow, setting); 2079 } 2080 2081 /** 2082 * Sets whether window has a corner resize grip. 2083 * Note that the resize grip is only shown if the window 2084 * is actually resizable and not maximized. Use 2085 * gtk_window_resize_grip_is_visible() to find out if the 2086 * resize grip is currently shown. 2087 * Params: 2088 * value = TRUE to allow a resize grip 2089 * Since 3.0 2090 */ 2091 public void setHasResizeGrip(int value) 2092 { 2093 // void gtk_window_set_has_resize_grip (GtkWindow *window, gboolean value); 2094 gtk_window_set_has_resize_grip(gtkWindow, value); 2095 } 2096 2097 /** 2098 * Determines whether the window may have a resize grip. 2099 * Returns: TRUE if the window has a resize grip Since 3.0 2100 */ 2101 public int getHasResizeGrip() 2102 { 2103 // gboolean gtk_window_get_has_resize_grip (GtkWindow *window); 2104 return gtk_window_get_has_resize_grip(gtkWindow); 2105 } 2106 2107 /** 2108 * Determines whether a resize grip is visible for the specified window. 2109 * Returns: TRUE if a resize grip exists and is visible Since 3.0 2110 */ 2111 public int resizeGripIsVisible() 2112 { 2113 // gboolean gtk_window_resize_grip_is_visible (GtkWindow *window); 2114 return gtk_window_resize_grip_is_visible(gtkWindow); 2115 } 2116 2117 /** 2118 * If a window has a resize grip, this will retrieve the grip 2119 * position, width and height into the specified GdkRectangle. 2120 * Params: 2121 * rect = a pointer to a GdkRectangle which we should store 2122 * the resize grip area. [out] 2123 * Returns: TRUE if the resize grip's area was retrieved Since 3.0 2124 */ 2125 public int getResizeGripArea(out Rectangle rect) 2126 { 2127 // gboolean gtk_window_get_resize_grip_area (GtkWindow *window, GdkRectangle *rect); 2128 return gtk_window_get_resize_grip_area(gtkWindow, &rect); 2129 } 2130 2131 /** 2132 * Gets the GtkApplication associated with the window (if any). 2133 * Returns: a GtkApplication, or NULL. [transfer none] Since 3.0 2134 */ 2135 public Application getApplication() 2136 { 2137 // GtkApplication * gtk_window_get_application (GtkWindow *window); 2138 auto p = gtk_window_get_application(gtkWindow); 2139 2140 if(p is null) 2141 { 2142 return null; 2143 } 2144 2145 return ObjectG.getDObject!(Application)(cast(GtkApplication*) p); 2146 } 2147 2148 /** 2149 * Sets or unsets the GtkApplication associated with the window. 2150 * The application will be kept alive for at least as long as the window 2151 * is open. 2152 * Params: 2153 * application = a GtkApplication, or NULL. [allow-none] 2154 * Since 3.0 2155 */ 2156 public void setApplication(Application application) 2157 { 2158 // void gtk_window_set_application (GtkWindow *window, GtkApplication *application); 2159 gtk_window_set_application(gtkWindow, (application is null) ? null : application.getGtkApplicationStruct()); 2160 } 2161 2162 /** 2163 * Tells GTK+ whether to drop its extra reference to the window 2164 * when gtk_widget_destroy() is called. 2165 * This function is only exported for the benefit of language 2166 * bindings which may need to keep the window alive until their 2167 * wrapper object is garbage collected. There is no justification 2168 * for ever calling this function in an application. 2169 * Params: 2170 * setting = the new value 2171 * Since 3.0 2172 */ 2173 public void setHasUserRefCount(int setting) 2174 { 2175 // void gtk_window_set_has_user_ref_count (GtkWindow *window, gboolean setting); 2176 gtk_window_set_has_user_ref_count(gtkWindow, setting); 2177 } 2178 2179 /** 2180 * Sets a custom titlebar for window. 2181 * If you set a custom titlebar, GTK+ will do its best to convince 2182 * the window manager not to put its own titlebar on the window. 2183 * Depending on the system, this function may not work for a window 2184 * that is already visible, so you set the titlebar before calling 2185 * gtk_widget_show(). 2186 * Params: 2187 * titlebar = the widget to use as titlebar 2188 * Since 3.10 2189 */ 2190 public void setTitlebar(Widget titlebar) 2191 { 2192 // void gtk_window_set_titlebar (GtkWindow *window, GtkWidget *titlebar); 2193 gtk_window_set_titlebar(gtkWindow, (titlebar is null) ? null : titlebar.getWidgetStruct()); 2194 } 2195 }