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