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