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