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