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