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 * Returns the custom titlebar that has been set with 1037 * gtk_window_set_titlebar(). 1038 * 1039 * Return: the custom titlebar, or %NULL 1040 * 1041 * Since: 3.16 1042 */ 1043 public Widget getTitlebar() 1044 { 1045 auto p = gtk_window_get_titlebar(gtkWindow); 1046 1047 if(p is null) 1048 { 1049 return null; 1050 } 1051 1052 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 1053 } 1054 1055 /** 1056 * Fetches the transient parent for this window. See 1057 * gtk_window_set_transient_for(). 1058 * 1059 * Return: the transient parent for this window, or %NULL 1060 * if no transient parent has been set. 1061 */ 1062 public Window getTransientFor() 1063 { 1064 auto p = gtk_window_get_transient_for(gtkWindow); 1065 1066 if(p is null) 1067 { 1068 return null; 1069 } 1070 1071 return ObjectG.getDObject!(Window)(cast(GtkWindow*) p); 1072 } 1073 1074 /** 1075 * Gets the type hint for this window. See gtk_window_set_type_hint(). 1076 * 1077 * Return: the type hint for @window. 1078 */ 1079 public GdkWindowTypeHint getTypeHint() 1080 { 1081 return gtk_window_get_type_hint(gtkWindow); 1082 } 1083 1084 /** 1085 * Gets the value set by gtk_window_set_urgency_hint() 1086 * 1087 * Return: %TRUE if window is urgent 1088 * 1089 * Since: 2.8 1090 */ 1091 public bool getUrgencyHint() 1092 { 1093 return gtk_window_get_urgency_hint(gtkWindow) != 0; 1094 } 1095 1096 /** 1097 * Gets the type of the window. See #GtkWindowType. 1098 * 1099 * Return: the type of the window 1100 * 1101 * Since: 2.20 1102 */ 1103 public GtkWindowType getWindowType() 1104 { 1105 return gtk_window_get_window_type(gtkWindow); 1106 } 1107 1108 /** 1109 * Returns whether @window has an explicit window group. 1110 * 1111 * Return: %TRUE if @window has an explicit window group. 1112 * 1113 * Since 2.22 1114 */ 1115 public bool hasGroup() 1116 { 1117 return gtk_window_has_group(gtkWindow) != 0; 1118 } 1119 1120 /** 1121 * Returns whether the input focus is within this GtkWindow. 1122 * For real toplevel windows, this is identical to gtk_window_is_active(), 1123 * but for embedded windows, like #GtkPlug, the results will differ. 1124 * 1125 * Return: %TRUE if the input focus is within this GtkWindow 1126 * 1127 * Since: 2.4 1128 */ 1129 public bool hasToplevelFocus() 1130 { 1131 return gtk_window_has_toplevel_focus(gtkWindow) != 0; 1132 } 1133 1134 /** 1135 * Asks to iconify (i.e. minimize) the specified @window. Note that 1136 * you shouldn’t assume the window is definitely iconified afterward, 1137 * because other entities (e.g. the user or 1138 * [window manager][gtk-X11-arch]) could deiconify it 1139 * again, or there may not be a window manager in which case 1140 * iconification isn’t possible, etc. But normally the window will end 1141 * up iconified. Just don’t write code that crashes if not. 1142 * 1143 * It’s permitted to call this function before showing a window, 1144 * in which case the window will be iconified before it ever appears 1145 * onscreen. 1146 * 1147 * You can track iconification via the “window-state-event” signal 1148 * on #GtkWidget. 1149 */ 1150 public void iconify() 1151 { 1152 gtk_window_iconify(gtkWindow); 1153 } 1154 1155 /** 1156 * Returns whether the window is part of the current active toplevel. 1157 * (That is, the toplevel window receiving keystrokes.) 1158 * The return value is %TRUE if the window is active toplevel 1159 * itself, but also if it is, say, a #GtkPlug embedded in the active toplevel. 1160 * You might use this function if you wanted to draw a widget 1161 * differently in an active window from a widget in an inactive window. 1162 * See gtk_window_has_toplevel_focus() 1163 * 1164 * Return: %TRUE if the window part of the current active window. 1165 * 1166 * Since: 2.4 1167 */ 1168 public bool isActive() 1169 { 1170 return gtk_window_is_active(gtkWindow) != 0; 1171 } 1172 1173 /** 1174 * Retrieves the current maximized state of @window. 1175 * 1176 * Note that since maximization is ultimately handled by the window 1177 * manager and happens asynchronously to an application request, you 1178 * shouldn’t assume the return value of this function changing 1179 * immediately (or at all), as an effect of calling 1180 * gtk_window_maximize() or gtk_window_unmaximize(). 1181 * 1182 * Return: whether the window has a maximized state. 1183 * 1184 * Since: 3.12 1185 */ 1186 public bool isMaximized() 1187 { 1188 return gtk_window_is_maximized(gtkWindow) != 0; 1189 } 1190 1191 /** 1192 * Asks to maximize @window, so that it becomes full-screen. Note that 1193 * you shouldn’t assume the window is definitely maximized afterward, 1194 * because other entities (e.g. the user or 1195 * [window manager][gtk-X11-arch]) could unmaximize it 1196 * again, and not all window managers support maximization. But 1197 * normally the window will end up maximized. Just don’t write code 1198 * that crashes if not. 1199 * 1200 * It’s permitted to call this function before showing a window, 1201 * in which case the window will be maximized when it appears onscreen 1202 * initially. 1203 * 1204 * You can track maximization via the “window-state-event” signal 1205 * on #GtkWidget, or by listening to notifications on the 1206 * #GtkWindow:is-maximized property. 1207 */ 1208 public void maximize() 1209 { 1210 gtk_window_maximize(gtkWindow); 1211 } 1212 1213 /** 1214 * Activates the targets associated with the mnemonic. 1215 * 1216 * Params: 1217 * keyval = the mnemonic 1218 * modifier = the modifiers 1219 * 1220 * Return: %TRUE if the activation is done. 1221 */ 1222 public bool mnemonicActivate(uint keyval, GdkModifierType modifier) 1223 { 1224 return gtk_window_mnemonic_activate(gtkWindow, keyval, modifier) != 0; 1225 } 1226 1227 /** 1228 * Asks the [window manager][gtk-X11-arch] to move 1229 * @window to the given position. Window managers are free to ignore 1230 * this; most window managers ignore requests for initial window 1231 * positions (instead using a user-defined placement algorithm) and 1232 * honor requests after the window has already been shown. 1233 * 1234 * Note: the position is the position of the gravity-determined 1235 * reference point for the window. The gravity determines two things: 1236 * first, the location of the reference point in root window 1237 * coordinates; and second, which point on the window is positioned at 1238 * the reference point. 1239 * 1240 * By default the gravity is #GDK_GRAVITY_NORTH_WEST, so the reference 1241 * point is simply the @x, @y supplied to gtk_window_move(). The 1242 * top-left corner of the window decorations (aka window frame or 1243 * border) will be placed at @x, @y. Therefore, to position a window 1244 * at the top left of the screen, you want to use the default gravity 1245 * (which is #GDK_GRAVITY_NORTH_WEST) and move the window to 0,0. 1246 * 1247 * To position a window at the bottom right corner of the screen, you 1248 * would set #GDK_GRAVITY_SOUTH_EAST, which means that the reference 1249 * point is at @x + the window width and @y + the window height, and 1250 * the bottom-right corner of the window border will be placed at that 1251 * reference point. So, to place a window in the bottom right corner 1252 * you would first set gravity to south east, then write: 1253 * `gtk_window_move (window, gdk_screen_width () - window_width, 1254 * gdk_screen_height () - window_height)` (note that this 1255 * example does not take multi-head scenarios into account). 1256 * 1257 * The [Extended Window Manager Hints Specification](http://www.freedesktop.org/Standards/wm-spec) 1258 * has a nice table of gravities in the “implementation notes” section. 1259 * 1260 * The gtk_window_get_position() documentation may also be relevant. 1261 * 1262 * Params: 1263 * x = X coordinate to move window to 1264 * y = Y coordinate to move window to 1265 */ 1266 public void move(int x, int y) 1267 { 1268 gtk_window_move(gtkWindow, x, y); 1269 } 1270 1271 /** 1272 * Parses a standard X Window System geometry string - see the 1273 * manual page for X (type “man X”) for details on this. 1274 * gtk_window_parse_geometry() does work on all GTK+ ports 1275 * including Win32 but is primarily intended for an X environment. 1276 * 1277 * If either a size or a position can be extracted from the 1278 * geometry string, gtk_window_parse_geometry() returns %TRUE 1279 * and calls gtk_window_set_default_size() and/or gtk_window_move() 1280 * to resize/move the window. 1281 * 1282 * If gtk_window_parse_geometry() returns %TRUE, it will also 1283 * set the #GDK_HINT_USER_POS and/or #GDK_HINT_USER_SIZE hints 1284 * indicating to the window manager that the size/position of 1285 * the window was user-specified. This causes most window 1286 * managers to honor the geometry. 1287 * 1288 * Note that for gtk_window_parse_geometry() to work as expected, it has 1289 * to be called when the window has its “final” size, i.e. after calling 1290 * gtk_widget_show_all() on the contents and gtk_window_set_geometry_hints() 1291 * on the window. 1292 * |[<!-- language="C" --> 1293 * #include <gtk/gtk.h> 1294 * 1295 * static void 1296 * fill_with_content (GtkWidget *vbox) 1297 * { 1298 * // fill with content... 1299 * } 1300 * 1301 * int 1302 * main (int argc, char *argv[]) 1303 * { 1304 * GtkWidget *window, *vbox; 1305 * GdkGeometry size_hints = { 1306 * 100, 50, 0, 0, 100, 50, 10, 1307 * 10, 0.0, 0.0, GDK_GRAVITY_NORTH_WEST 1308 * }; 1309 * 1310 * gtk_init (&argc, &argv); 1311 * 1312 * window = gtk_window_new (GTK_WINDOW_TOPLEVEL); 1313 * vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); 1314 * 1315 * gtk_container_add (GTK_CONTAINER (window), vbox); 1316 * fill_with_content (vbox); 1317 * gtk_widget_show_all (vbox); 1318 * 1319 * gtk_window_set_geometry_hints (GTK_WINDOW (window), 1320 * window, 1321 * &size_hints, 1322 * GDK_HINT_MIN_SIZE | 1323 * GDK_HINT_BASE_SIZE | 1324 * GDK_HINT_RESIZE_INC); 1325 * 1326 * if (argc > 1) 1327 * { 1328 * gboolean res; 1329 * res = gtk_window_parse_geometry (GTK_WINDOW (window), 1330 * argv[1]); 1331 * if (! res) 1332 * fprintf (stderr, 1333 * "Failed to parse “%s”\n", 1334 * argv[1]); 1335 * } 1336 * 1337 * gtk_widget_show_all (window); 1338 * gtk_main (); 1339 * 1340 * return 0; 1341 * } 1342 * ]| 1343 * 1344 * Params: 1345 * geometry = geometry string 1346 * 1347 * Return: %TRUE if string was parsed successfully 1348 */ 1349 public bool parseGeometry(string geometry) 1350 { 1351 return gtk_window_parse_geometry(gtkWindow, Str.toStringz(geometry)) != 0; 1352 } 1353 1354 /** 1355 * Presents a window to the user. This may mean raising the window 1356 * in the stacking order, deiconifying it, moving it to the current 1357 * desktop, and/or giving it the keyboard focus, possibly dependent 1358 * on the user’s platform, window manager, and preferences. 1359 * 1360 * If @window is hidden, this function calls gtk_widget_show() 1361 * as well. 1362 * 1363 * This function should be used when the user tries to open a window 1364 * that’s already open. Say for example the preferences dialog is 1365 * currently open, and the user chooses Preferences from the menu 1366 * a second time; use gtk_window_present() to move the already-open dialog 1367 * where the user can see it. 1368 * 1369 * If you are calling this function in response to a user interaction, 1370 * it is preferable to use gtk_window_present_with_time(). 1371 */ 1372 public void present() 1373 { 1374 gtk_window_present(gtkWindow); 1375 } 1376 1377 /** 1378 * Presents a window to the user in response to a user interaction. 1379 * If you need to present a window without a timestamp, use 1380 * gtk_window_present(). See gtk_window_present() for details. 1381 * 1382 * Params: 1383 * timestamp = the timestamp of the user interaction (typically a 1384 * button or key press event) which triggered this call 1385 * 1386 * Since: 2.8 1387 */ 1388 public void presentWithTime(uint timestamp) 1389 { 1390 gtk_window_present_with_time(gtkWindow, timestamp); 1391 } 1392 1393 /** 1394 * Propagate a key press or release event to the focus widget and 1395 * up the focus container chain until a widget handles @event. 1396 * This is normally called by the default ::key_press_event and 1397 * ::key_release_event handlers for toplevel windows, 1398 * however in some cases it may be useful to call this directly when 1399 * overriding the standard key handling for a toplevel window. 1400 * 1401 * Params: 1402 * event = a #GdkEventKey 1403 * 1404 * Return: %TRUE if a widget in the focus chain handled the event. 1405 * 1406 * Since: 2.4 1407 */ 1408 public bool propagateKeyEvent(GdkEventKey* event) 1409 { 1410 return gtk_window_propagate_key_event(gtkWindow, event) != 0; 1411 } 1412 1413 /** 1414 * Reverses the effects of gtk_window_add_accel_group(). 1415 * 1416 * Params: 1417 * accelGroup = a #GtkAccelGroup 1418 */ 1419 public void removeAccelGroup(AccelGroup accelGroup) 1420 { 1421 gtk_window_remove_accel_group(gtkWindow, (accelGroup is null) ? null : accelGroup.getAccelGroupStruct()); 1422 } 1423 1424 /** 1425 * Removes a mnemonic from this window. 1426 * 1427 * Params: 1428 * keyval = the mnemonic 1429 * target = the widget that gets activated by the mnemonic 1430 */ 1431 public void removeMnemonic(uint keyval, Widget target) 1432 { 1433 gtk_window_remove_mnemonic(gtkWindow, keyval, (target is null) ? null : target.getWidgetStruct()); 1434 } 1435 1436 /** 1437 * Hides @window, then reshows it, resetting the 1438 * default size and position of the window. Used 1439 * by GUI builders only. 1440 * 1441 * Deprecated: GUI builders can call gtk_widget_hide(), 1442 * gtk_widget_unrealize() and then gtk_widget_show() on @window 1443 * themselves, if they still need this functionality. 1444 */ 1445 public void reshowWithInitialSize() 1446 { 1447 gtk_window_reshow_with_initial_size(gtkWindow); 1448 } 1449 1450 /** 1451 * Resizes the window as if the user had done so, obeying geometry 1452 * constraints. The default geometry constraint is that windows may 1453 * not be smaller than their size request; to override this 1454 * constraint, call gtk_widget_set_size_request() to set the window's 1455 * request to a smaller value. 1456 * 1457 * If gtk_window_resize() is called before showing a window for the 1458 * first time, it overrides any default size set with 1459 * gtk_window_set_default_size(). 1460 * 1461 * Windows may not be resized smaller than 1 by 1 pixels. 1462 * 1463 * Params: 1464 * width = width in pixels to resize the window to 1465 * height = height in pixels to resize the window to 1466 */ 1467 public void resize(int width, int height) 1468 { 1469 gtk_window_resize(gtkWindow, width, height); 1470 } 1471 1472 /** 1473 * Determines whether a resize grip is visible for the specified window. 1474 * 1475 * Deprecated: Resize grips have been removed. 1476 * 1477 * Return: %TRUE if a resize grip exists and is visible 1478 * 1479 * Since: 3.0 1480 */ 1481 public bool resizeGripIsVisible() 1482 { 1483 return gtk_window_resize_grip_is_visible(gtkWindow) != 0; 1484 } 1485 1486 /** 1487 * Like gtk_window_resize(), but @width and @height are interpreted 1488 * in terms of the base size and increment set with 1489 * gtk_window_set_geometry_hints. 1490 * 1491 * Params: 1492 * width = width in resize increments to resize the window to 1493 * height = height in resize increments to resize the window to 1494 * 1495 * Since: 3.0 1496 */ 1497 public void resizeToGeometry(int width, int height) 1498 { 1499 gtk_window_resize_to_geometry(gtkWindow, width, height); 1500 } 1501 1502 /** 1503 * Windows may set a hint asking the desktop environment not to receive 1504 * the input focus. This function sets this hint. 1505 * 1506 * Params: 1507 * setting = %TRUE to let this window receive input focus 1508 * 1509 * Since: 2.4 1510 */ 1511 public void setAcceptFocus(bool setting) 1512 { 1513 gtk_window_set_accept_focus(gtkWindow, setting); 1514 } 1515 1516 /** 1517 * Sets or unsets the #GtkApplication associated with the window. 1518 * 1519 * The application will be kept alive for at least as long as the window 1520 * is open. 1521 * 1522 * Params: 1523 * application = a #GtkApplication, or %NULL 1524 * 1525 * Since: 3.0 1526 */ 1527 public void setApplication(Application application) 1528 { 1529 gtk_window_set_application(gtkWindow, (application is null) ? null : application.getGtkApplicationStruct()); 1530 } 1531 1532 /** 1533 * Marks @window as attached to @attach_widget. This creates a logical binding 1534 * between the window and the widget it belongs to, which is used by GTK+ to 1535 * propagate information such as styling or accessibility to @window as if it 1536 * was a children of @attach_widget. 1537 * 1538 * Examples of places where specifying this relation is useful are for instance 1539 * a #GtkMenu created by a #GtkComboBox, a completion popup window 1540 * created by #GtkEntry or a typeahead search entry created by #GtkTreeView. 1541 * 1542 * Note that this function should not be confused with 1543 * gtk_window_set_transient_for(), which specifies a window manager relation 1544 * between two toplevels instead. 1545 * 1546 * Passing %NULL for @attach_widget detaches the window. 1547 * 1548 * Params: 1549 * attachWidget = a #GtkWidget, or %NULL 1550 * 1551 * Since: 3.4 1552 */ 1553 public void setAttachedTo(Widget attachWidget) 1554 { 1555 gtk_window_set_attached_to(gtkWindow, (attachWidget is null) ? null : attachWidget.getWidgetStruct()); 1556 } 1557 1558 /** 1559 * By default, windows are decorated with a title bar, resize 1560 * controls, etc. Some [window managers][gtk-X11-arch] 1561 * allow GTK+ to disable these decorations, creating a 1562 * borderless window. If you set the decorated property to %FALSE 1563 * using this function, GTK+ will do its best to convince the window 1564 * manager not to decorate the window. Depending on the system, this 1565 * function may not have any effect when called on a window that is 1566 * already visible, so you should call it before calling gtk_widget_show(). 1567 * 1568 * On Windows, this function always works, since there’s no window manager 1569 * policy involved. 1570 * 1571 * Params: 1572 * setting = %TRUE to decorate the window 1573 */ 1574 public void setDecorated(bool setting) 1575 { 1576 gtk_window_set_decorated(gtkWindow, setting); 1577 } 1578 1579 /** 1580 * The default widget is the widget that’s activated when the user 1581 * presses Enter in a dialog (for example). This function sets or 1582 * unsets the default widget for a #GtkWindow. When setting (rather 1583 * than unsetting) the default widget it’s generally easier to call 1584 * gtk_widget_grab_default() on the widget. Before making a widget 1585 * the default widget, you must call gtk_widget_set_can_default() on 1586 * the widget you’d like to make the default. 1587 * 1588 * Params: 1589 * defaultWidget = widget to be the default, or %NULL 1590 * to unset the default widget for the toplevel 1591 */ 1592 public void setDefault(Widget defaultWidget) 1593 { 1594 gtk_window_set_default(gtkWindow, (defaultWidget is null) ? null : defaultWidget.getWidgetStruct()); 1595 } 1596 1597 /** 1598 * Like gtk_window_set_default_size(), but @width and @height are interpreted 1599 * in terms of the base size and increment set with 1600 * gtk_window_set_geometry_hints. 1601 * 1602 * Params: 1603 * width = width in resize increments, or -1 to unset the default width 1604 * height = height in resize increments, or -1 to unset the default height 1605 * 1606 * Since: 3.0 1607 */ 1608 public void setDefaultGeometry(int width, int height) 1609 { 1610 gtk_window_set_default_geometry(gtkWindow, width, height); 1611 } 1612 1613 /** 1614 * Sets the default size of a window. If the window’s “natural” size 1615 * (its size request) is larger than the default, the default will be 1616 * ignored. More generally, if the default size does not obey the 1617 * geometry hints for the window (gtk_window_set_geometry_hints() can 1618 * be used to set these explicitly), the default size will be clamped 1619 * to the nearest permitted size. 1620 * 1621 * Unlike gtk_widget_set_size_request(), which sets a size request for 1622 * a widget and thus would keep users from shrinking the window, this 1623 * function only sets the initial size, just as if the user had 1624 * resized the window themselves. Users can still shrink the window 1625 * again as they normally would. Setting a default size of -1 means to 1626 * use the “natural” default size (the size request of the window). 1627 * 1628 * For more control over a window’s initial size and how resizing works, 1629 * investigate gtk_window_set_geometry_hints(). 1630 * 1631 * For some uses, gtk_window_resize() is a more appropriate function. 1632 * gtk_window_resize() changes the current size of the window, rather 1633 * than the size to be used on initial display. gtk_window_resize() always 1634 * affects the window itself, not the geometry widget. 1635 * 1636 * The default size of a window only affects the first time a window is 1637 * shown; if a window is hidden and re-shown, it will remember the size 1638 * it had prior to hiding, rather than using the default size. 1639 * 1640 * Windows can’t actually be 0x0 in size, they must be at least 1x1, but 1641 * passing 0 for @width and @height is OK, resulting in a 1x1 default size. 1642 * 1643 * Params: 1644 * width = width in pixels, or -1 to unset the default width 1645 * height = height in pixels, or -1 to unset the default height 1646 */ 1647 public void setDefaultSize(int width, int height) 1648 { 1649 gtk_window_set_default_size(gtkWindow, width, height); 1650 } 1651 1652 /** 1653 * By default, windows have a close button in the window frame. Some 1654 * [window managers][gtk-X11-arch] allow GTK+ to 1655 * disable this button. If you set the deletable property to %FALSE 1656 * using this function, GTK+ will do its best to convince the window 1657 * manager not to show a close button. Depending on the system, this 1658 * function may not have any effect when called on a window that is 1659 * already visible, so you should call it before calling gtk_widget_show(). 1660 * 1661 * On Windows, this function always works, since there’s no window manager 1662 * policy involved. 1663 * 1664 * Params: 1665 * setting = %TRUE to decorate the window as deletable 1666 * 1667 * Since: 2.10 1668 */ 1669 public void setDeletable(bool setting) 1670 { 1671 gtk_window_set_deletable(gtkWindow, setting); 1672 } 1673 1674 /** 1675 * If @setting is %TRUE, then destroying the transient parent of @window 1676 * will also destroy @window itself. This is useful for dialogs that 1677 * shouldn’t persist beyond the lifetime of the main window they're 1678 * associated with, for example. 1679 * 1680 * Params: 1681 * setting = whether to destroy @window with its transient parent 1682 */ 1683 public void setDestroyWithParent(bool setting) 1684 { 1685 gtk_window_set_destroy_with_parent(gtkWindow, setting); 1686 } 1687 1688 /** 1689 * If @focus is not the current focus widget, and is focusable, sets 1690 * it as the focus widget for the window. If @focus is %NULL, unsets 1691 * the focus widget for this window. To set the focus to a particular 1692 * widget in the toplevel, it is usually more convenient to use 1693 * gtk_widget_grab_focus() instead of this function. 1694 * 1695 * Params: 1696 * focus = widget to be the new focus widget, or %NULL to unset 1697 * any focus widget for the toplevel window. 1698 */ 1699 public void setFocus(Widget focus) 1700 { 1701 gtk_window_set_focus(gtkWindow, (focus is null) ? null : focus.getWidgetStruct()); 1702 } 1703 1704 /** 1705 * Windows may set a hint asking the desktop environment not to receive 1706 * the input focus when the window is mapped. This function sets this 1707 * hint. 1708 * 1709 * Params: 1710 * setting = %TRUE to let this window receive input focus on map 1711 * 1712 * Since: 2.6 1713 */ 1714 public void setFocusOnMap(bool setting) 1715 { 1716 gtk_window_set_focus_on_map(gtkWindow, setting); 1717 } 1718 1719 /** 1720 * Sets the #GtkWindow:focus-visible property. 1721 * 1722 * Params: 1723 * setting = the new value 1724 * 1725 * Since: 3.2 1726 */ 1727 public void setFocusVisible(bool setting) 1728 { 1729 gtk_window_set_focus_visible(gtkWindow, setting); 1730 } 1731 1732 /** 1733 * This function sets up hints about how a window can be resized by 1734 * the user. You can set a minimum and maximum size; allowed resize 1735 * increments (e.g. for xterm, you can only resize by the size of a 1736 * character); aspect ratios; and more. See the #GdkGeometry struct. 1737 * 1738 * Params: 1739 * geometryWidget = widget the geometry hints will be applied to or %NULL 1740 * geometry = struct containing geometry information or %NULL 1741 * geomMask = mask indicating which struct fields should be paid attention to 1742 */ 1743 public void setGeometryHints(Widget geometryWidget, GdkGeometry* geometry, GdkWindowHints geomMask) 1744 { 1745 gtk_window_set_geometry_hints(gtkWindow, (geometryWidget is null) ? null : geometryWidget.getWidgetStruct(), geometry, geomMask); 1746 } 1747 1748 /** 1749 * Window gravity defines the meaning of coordinates passed to 1750 * gtk_window_move(). See gtk_window_move() and #GdkGravity for 1751 * more details. 1752 * 1753 * The default window gravity is #GDK_GRAVITY_NORTH_WEST which will 1754 * typically “do what you mean.” 1755 * 1756 * Params: 1757 * gravity = window gravity 1758 */ 1759 public void setGravity(GdkGravity gravity) 1760 { 1761 gtk_window_set_gravity(gtkWindow, gravity); 1762 } 1763 1764 /** 1765 * Sets whether @window has a corner resize grip. 1766 * 1767 * Note that the resize grip is only shown if the window 1768 * is actually resizable and not maximized. Use 1769 * gtk_window_resize_grip_is_visible() to find out if the 1770 * resize grip is currently shown. 1771 * 1772 * Deprecated: Resize grips have been removed. 1773 * 1774 * Params: 1775 * value = %TRUE to allow a resize grip 1776 * 1777 * Since: 3.0 1778 */ 1779 public void setHasResizeGrip(bool value) 1780 { 1781 gtk_window_set_has_resize_grip(gtkWindow, value); 1782 } 1783 1784 /** 1785 * Tells GTK+ whether to drop its extra reference to the window 1786 * when gtk_widget_destroy() is called. 1787 * 1788 * This function is only exported for the benefit of language 1789 * bindings which may need to keep the window alive until their 1790 * wrapper object is garbage collected. There is no justification 1791 * for ever calling this function in an application. 1792 * 1793 * Params: 1794 * setting = the new value 1795 * 1796 * Since: 3.0 1797 */ 1798 public void setHasUserRefCount(bool setting) 1799 { 1800 gtk_window_set_has_user_ref_count(gtkWindow, setting); 1801 } 1802 1803 /** 1804 * If @setting is %TRUE, then @window will request that it’s titlebar 1805 * should be hidden when maximized. 1806 * This is useful for windows that don’t convey any information other 1807 * than the application name in the titlebar, to put the available 1808 * screen space to better use. If the underlying window system does not 1809 * support the request, the setting will not have any effect. 1810 * 1811 * Note that custom titlebars set with gtk_window_set_titlebar() are 1812 * not affected by this. The application is in full control of their 1813 * content and visibility anyway. 1814 * 1815 * Params: 1816 * setting = whether to hide the titlebar when @window is maximized 1817 * 1818 * Since: 3.4 1819 */ 1820 public void setHideTitlebarWhenMaximized(bool setting) 1821 { 1822 gtk_window_set_hide_titlebar_when_maximized(gtkWindow, setting); 1823 } 1824 1825 /** 1826 * Sets up the icon representing a #GtkWindow. This icon is used when 1827 * the window is minimized (also known as iconified). Some window 1828 * managers or desktop environments may also place it in the window 1829 * frame, or display it in other contexts. 1830 * 1831 * The icon should be provided in whatever size it was naturally 1832 * drawn; that is, don’t scale the image before passing it to 1833 * GTK+. Scaling is postponed until the last minute, when the desired 1834 * final size is known, to allow best quality. 1835 * 1836 * If you have your icon hand-drawn in multiple sizes, use 1837 * gtk_window_set_icon_list(). Then the best size will be used. 1838 * 1839 * This function is equivalent to calling gtk_window_set_icon_list() 1840 * with a 1-element list. 1841 * 1842 * See also gtk_window_set_default_icon_list() to set the icon 1843 * for all windows in your application in one go. 1844 * 1845 * Params: 1846 * icon = icon image, or %NULL 1847 */ 1848 public void setIcon(Pixbuf icon) 1849 { 1850 gtk_window_set_icon(gtkWindow, (icon is null) ? null : icon.getPixbufStruct()); 1851 } 1852 1853 /** 1854 * Sets the icon for @window. 1855 * Warns on failure if @err is %NULL. 1856 * 1857 * This function is equivalent to calling gtk_window_set_icon() 1858 * with a pixbuf created by loading the image from @filename. 1859 * 1860 * Params: 1861 * filename = location of icon file 1862 * 1863 * Return: %TRUE if setting the icon succeeded. 1864 * 1865 * Since: 2.2 1866 * 1867 * Throws: GException on failure. 1868 */ 1869 public bool setIconFromFile(string filename) 1870 { 1871 GError* err = null; 1872 1873 auto p = gtk_window_set_icon_from_file(gtkWindow, Str.toStringz(filename), &err) != 0; 1874 1875 if (err !is null) 1876 { 1877 throw new GException( new ErrorG(err) ); 1878 } 1879 1880 return p; 1881 } 1882 1883 /** 1884 * Sets up the icon representing a #GtkWindow. The icon is used when 1885 * the window is minimized (also known as iconified). Some window 1886 * managers or desktop environments may also place it in the window 1887 * frame, or display it in other contexts. 1888 * 1889 * gtk_window_set_icon_list() allows you to pass in the same icon in 1890 * several hand-drawn sizes. The list should contain the natural sizes 1891 * your icon is available in; that is, don’t scale the image before 1892 * passing it to GTK+. Scaling is postponed until the last minute, 1893 * when the desired final size is known, to allow best quality. 1894 * 1895 * By passing several sizes, you may improve the final image quality 1896 * of the icon, by reducing or eliminating automatic image scaling. 1897 * 1898 * Recommended sizes to provide: 16x16, 32x32, 48x48 at minimum, and 1899 * larger images (64x64, 128x128) if you have them. 1900 * 1901 * See also gtk_window_set_default_icon_list() to set the icon 1902 * for all windows in your application in one go. 1903 * 1904 * Note that transient windows (those who have been set transient for another 1905 * window using gtk_window_set_transient_for()) will inherit their 1906 * icon from their transient parent. So there’s no need to explicitly 1907 * set the icon on transient windows. 1908 * 1909 * Params: 1910 * list = list of #GdkPixbuf 1911 */ 1912 public void setIconList(ListG list) 1913 { 1914 gtk_window_set_icon_list(gtkWindow, (list is null) ? null : list.getListGStruct()); 1915 } 1916 1917 /** 1918 * Sets the icon for the window from a named themed icon. See 1919 * the docs for #GtkIconTheme for more details. 1920 * 1921 * Note that this has nothing to do with the WM_ICON_NAME 1922 * property which is mentioned in the ICCCM. 1923 * 1924 * Params: 1925 * name = the name of the themed icon 1926 * 1927 * Since: 2.6 1928 */ 1929 public void setIconName(string name) 1930 { 1931 gtk_window_set_icon_name(gtkWindow, Str.toStringz(name)); 1932 } 1933 1934 /** 1935 * Asks to keep @window above, so that it stays on top. Note that 1936 * you shouldn’t assume the window is definitely above afterward, 1937 * because other entities (e.g. the user or 1938 * [window manager][gtk-X11-arch]) could not keep it above, 1939 * and not all window managers support keeping windows above. But 1940 * normally the window will end kept above. Just don’t write code 1941 * that crashes if not. 1942 * 1943 * It’s permitted to call this function before showing a window, 1944 * in which case the window will be kept above when it appears onscreen 1945 * initially. 1946 * 1947 * You can track the above state via the “window-state-event” signal 1948 * on #GtkWidget. 1949 * 1950 * Note that, according to the 1951 * [Extended Window Manager Hints Specification](http://www.freedesktop.org/Standards/wm-spec), 1952 * the above state is mainly meant for user preferences and should not 1953 * be used by applications e.g. for drawing attention to their 1954 * dialogs. 1955 * 1956 * Params: 1957 * setting = whether to keep @window above other windows 1958 * 1959 * Since: 2.4 1960 */ 1961 public void setKeepAbove(bool setting) 1962 { 1963 gtk_window_set_keep_above(gtkWindow, setting); 1964 } 1965 1966 /** 1967 * Asks to keep @window below, so that it stays in bottom. Note that 1968 * you shouldn’t assume the window is definitely below afterward, 1969 * because other entities (e.g. the user or 1970 * [window manager][gtk-X11-arch]) could not keep it below, 1971 * and not all window managers support putting windows below. But 1972 * normally the window will be kept below. Just don’t write code 1973 * that crashes if not. 1974 * 1975 * It’s permitted to call this function before showing a window, 1976 * in which case the window will be kept below when it appears onscreen 1977 * initially. 1978 * 1979 * You can track the below state via the “window-state-event” signal 1980 * on #GtkWidget. 1981 * 1982 * Note that, according to the 1983 * [Extended Window Manager Hints Specification](http://www.freedesktop.org/Standards/wm-spec), 1984 * the above state is mainly meant for user preferences and should not 1985 * be used by applications e.g. for drawing attention to their 1986 * dialogs. 1987 * 1988 * Params: 1989 * setting = whether to keep @window below other windows 1990 * 1991 * Since: 2.4 1992 */ 1993 public void setKeepBelow(bool setting) 1994 { 1995 gtk_window_set_keep_below(gtkWindow, setting); 1996 } 1997 1998 /** 1999 * Sets the mnemonic modifier for this window. 2000 * 2001 * Params: 2002 * modifier = the modifier mask used to activate 2003 * mnemonics on this window. 2004 */ 2005 public void setMnemonicModifier(GdkModifierType modifier) 2006 { 2007 gtk_window_set_mnemonic_modifier(gtkWindow, modifier); 2008 } 2009 2010 /** 2011 * Sets the #GtkWindow:mnemonics-visible property. 2012 * 2013 * Params: 2014 * setting = the new value 2015 * 2016 * Since: 2.20 2017 */ 2018 public void setMnemonicsVisible(bool setting) 2019 { 2020 gtk_window_set_mnemonics_visible(gtkWindow, setting); 2021 } 2022 2023 /** 2024 * Sets a window modal or non-modal. Modal windows prevent interaction 2025 * with other windows in the same application. To keep modal dialogs 2026 * on top of main application windows, use 2027 * gtk_window_set_transient_for() to make the dialog transient for the 2028 * parent; most [window managers][gtk-X11-arch] 2029 * will then disallow lowering the dialog below the parent. 2030 * 2031 * Params: 2032 * modal = whether the window is modal 2033 */ 2034 public void setModal(bool modal) 2035 { 2036 gtk_window_set_modal(gtkWindow, modal); 2037 } 2038 2039 /** 2040 * Request the windowing system to make @window partially transparent, 2041 * with opacity 0 being fully transparent and 1 fully opaque. (Values 2042 * of the opacity parameter are clamped to the [0,1] range.) On X11 2043 * this has any effect only on X screens with a compositing manager 2044 * running. See gtk_widget_is_composited(). On Windows it should work 2045 * always. 2046 * 2047 * Note that setting a window’s opacity after the window has been 2048 * shown causes it to flicker once on Windows. 2049 * 2050 * Deprecated: Use gtk_widget_set_opacity instead. 2051 * 2052 * Params: 2053 * opacity = desired opacity, between 0 and 1 2054 * 2055 * Since: 2.12 2056 */ 2057 public override void setOpacity(double opacity) 2058 { 2059 gtk_window_set_opacity(gtkWindow, opacity); 2060 } 2061 2062 /** 2063 * Sets a position constraint for this window. If the old or new 2064 * constraint is %GTK_WIN_POS_CENTER_ALWAYS, this will also cause 2065 * the window to be repositioned to satisfy the new constraint. 2066 * 2067 * Params: 2068 * position = a position constraint. 2069 */ 2070 public void setPosition(GtkWindowPosition position) 2071 { 2072 gtk_window_set_position(gtkWindow, position); 2073 } 2074 2075 /** 2076 * Sets whether the user can resize a window. Windows are user resizable 2077 * by default. 2078 * 2079 * Params: 2080 * resizable = %TRUE if the user can resize this window 2081 */ 2082 public void setResizable(bool resizable) 2083 { 2084 gtk_window_set_resizable(gtkWindow, resizable); 2085 } 2086 2087 /** 2088 * This function is only useful on X11, not with other GTK+ targets. 2089 * 2090 * In combination with the window title, the window role allows a 2091 * [window manager][gtk-X11-arch] to identify "the 2092 * same" window when an application is restarted. So for example you 2093 * might set the “toolbox” role on your app’s toolbox window, so that 2094 * when the user restarts their session, the window manager can put 2095 * the toolbox back in the same place. 2096 * 2097 * If a window already has a unique title, you don’t need to set the 2098 * role, since the WM can use the title to identify the window when 2099 * restoring the session. 2100 * 2101 * Params: 2102 * role = unique identifier for the window to be used when restoring a session 2103 */ 2104 public void setRole(string role) 2105 { 2106 gtk_window_set_role(gtkWindow, Str.toStringz(role)); 2107 } 2108 2109 /** 2110 * Sets the #GdkScreen where the @window is displayed; if 2111 * the window is already mapped, it will be unmapped, and 2112 * then remapped on the new screen. 2113 * 2114 * Params: 2115 * screen = a #GdkScreen. 2116 * 2117 * Since: 2.2 2118 */ 2119 public void setScreen(Screen screen) 2120 { 2121 gtk_window_set_screen(gtkWindow, (screen is null) ? null : screen.getScreenStruct()); 2122 } 2123 2124 /** 2125 * Windows may set a hint asking the desktop environment not to display 2126 * the window in the pager. This function sets this hint. 2127 * (A "pager" is any desktop navigation tool such as a workspace 2128 * switcher that displays a thumbnail representation of the windows 2129 * on the screen.) 2130 * 2131 * Params: 2132 * setting = %TRUE to keep this window from appearing in the pager 2133 * 2134 * Since: 2.2 2135 */ 2136 public void setSkipPagerHint(bool setting) 2137 { 2138 gtk_window_set_skip_pager_hint(gtkWindow, setting); 2139 } 2140 2141 /** 2142 * Windows may set a hint asking the desktop environment not to display 2143 * the window in the task bar. This function sets this hint. 2144 * 2145 * Params: 2146 * setting = %TRUE to keep this window from appearing in the task bar 2147 * 2148 * Since: 2.2 2149 */ 2150 public void setSkipTaskbarHint(bool setting) 2151 { 2152 gtk_window_set_skip_taskbar_hint(gtkWindow, setting); 2153 } 2154 2155 /** 2156 * Startup notification identifiers are used by desktop environment to 2157 * track application startup, to provide user feedback and other 2158 * features. This function changes the corresponding property on the 2159 * underlying GdkWindow. Normally, startup identifier is managed 2160 * automatically and you should only use this function in special cases 2161 * like transferring focus from other processes. You should use this 2162 * function before calling gtk_window_present() or any equivalent 2163 * function generating a window map event. 2164 * 2165 * This function is only useful on X11, not with other GTK+ targets. 2166 * 2167 * Params: 2168 * startupId = a string with startup-notification identifier 2169 * 2170 * Since: 2.12 2171 */ 2172 public void setStartupId(string startupId) 2173 { 2174 gtk_window_set_startup_id(gtkWindow, Str.toStringz(startupId)); 2175 } 2176 2177 /** 2178 * Sets the title of the #GtkWindow. The title of a window will be 2179 * displayed in its title bar; on the X Window System, the title bar 2180 * is rendered by the [window manager][gtk-X11-arch], 2181 * so exactly how the title appears to users may vary 2182 * according to a user’s exact configuration. The title should help a 2183 * user distinguish this window from other windows they may have 2184 * open. A good title might include the application name and current 2185 * document filename, for example. 2186 * 2187 * Params: 2188 * title = title of the window 2189 */ 2190 public void setTitle(string title) 2191 { 2192 gtk_window_set_title(gtkWindow, Str.toStringz(title)); 2193 } 2194 2195 /** 2196 * Sets a custom titlebar for @window. 2197 * 2198 * If you set a custom titlebar, GTK+ will do its best to convince 2199 * the window manager not to put its own titlebar on the window. 2200 * Depending on the system, this function may not work for a window 2201 * that is already visible, so you set the titlebar before calling 2202 * gtk_widget_show(). 2203 * 2204 * Params: 2205 * titlebar = the widget to use as titlebar 2206 * 2207 * Since: 3.10 2208 */ 2209 public void setTitlebar(Widget titlebar) 2210 { 2211 gtk_window_set_titlebar(gtkWindow, (titlebar is null) ? null : titlebar.getWidgetStruct()); 2212 } 2213 2214 /** 2215 * Dialog windows should be set transient for the main application 2216 * window they were spawned from. This allows 2217 * [window managers][gtk-X11-arch] to e.g. keep the 2218 * dialog on top of the main window, or center the dialog over the 2219 * main window. gtk_dialog_new_with_buttons() and other convenience 2220 * functions in GTK+ will sometimes call 2221 * gtk_window_set_transient_for() on your behalf. 2222 * 2223 * Passing %NULL for @parent unsets the current transient window. 2224 * 2225 * On Windows, this function puts the child window on top of the parent, 2226 * much as the window manager would have done on X. 2227 * 2228 * Params: 2229 * parent = parent window, or %NULL 2230 */ 2231 public void setTransientFor(Window parent) 2232 { 2233 gtk_window_set_transient_for(gtkWindow, (parent is null) ? null : parent.getWindowStruct()); 2234 } 2235 2236 /** 2237 * By setting the type hint for the window, you allow the window 2238 * manager to decorate and handle the window in a way which is 2239 * suitable to the function of the window in your application. 2240 * 2241 * This function should be called before the window becomes visible. 2242 * 2243 * gtk_dialog_new_with_buttons() and other convenience functions in GTK+ 2244 * will sometimes call gtk_window_set_type_hint() on your behalf. 2245 * 2246 * Params: 2247 * hint = the window type 2248 */ 2249 public void setTypeHint(GdkWindowTypeHint hint) 2250 { 2251 gtk_window_set_type_hint(gtkWindow, hint); 2252 } 2253 2254 /** 2255 * Windows may set a hint asking the desktop environment to draw 2256 * the users attention to the window. This function sets this hint. 2257 * 2258 * Params: 2259 * setting = %TRUE to mark this window as urgent 2260 * 2261 * Since: 2.8 2262 */ 2263 public void setUrgencyHint(bool setting) 2264 { 2265 gtk_window_set_urgency_hint(gtkWindow, setting); 2266 } 2267 2268 /** 2269 * Don’t use this function. It sets the X Window System “class” and 2270 * “name” hints for a window. According to the ICCCM, you should 2271 * always set these to the same value for all windows in an 2272 * application, and GTK+ sets them to that value by default, so calling 2273 * this function is sort of pointless. However, you may want to call 2274 * gtk_window_set_role() on each window in your application, for the 2275 * benefit of the session manager. Setting the role allows the window 2276 * manager to restore window positions when loading a saved session. 2277 * 2278 * Params: 2279 * wmclassName = window name hint 2280 * wmclassClass = window class hint 2281 */ 2282 public void setWmclass(string wmclassName, string wmclassClass) 2283 { 2284 gtk_window_set_wmclass(gtkWindow, Str.toStringz(wmclassName), Str.toStringz(wmclassClass)); 2285 } 2286 2287 /** 2288 * Asks to stick @window, which means that it will appear on all user 2289 * desktops. Note that you shouldn’t assume the window is definitely 2290 * stuck afterward, because other entities (e.g. the user or 2291 * [window manager][gtk-X11-arch] could unstick it 2292 * again, and some window managers do not support sticking 2293 * windows. But normally the window will end up stuck. Just don't 2294 * write code that crashes if not. 2295 * 2296 * It’s permitted to call this function before showing a window. 2297 * 2298 * You can track stickiness via the “window-state-event” signal 2299 * on #GtkWidget. 2300 */ 2301 public void stick() 2302 { 2303 gtk_window_stick(gtkWindow); 2304 } 2305 2306 /** 2307 * Asks to toggle off the fullscreen state for @window. Note that you 2308 * shouldn’t assume the window is definitely not full screen 2309 * afterward, because other entities (e.g. the user or 2310 * [window manager][gtk-X11-arch]) could fullscreen it 2311 * again, and not all window managers honor requests to unfullscreen 2312 * windows. But normally the window will end up restored to its normal 2313 * state. Just don’t write code that crashes if not. 2314 * 2315 * You can track the fullscreen state via the “window-state-event” signal 2316 * on #GtkWidget. 2317 * 2318 * Since: 2.2 2319 */ 2320 public void unfullscreen() 2321 { 2322 gtk_window_unfullscreen(gtkWindow); 2323 } 2324 2325 /** 2326 * Asks to unmaximize @window. Note that you shouldn’t assume the 2327 * window is definitely unmaximized afterward, because other entities 2328 * (e.g. the user or [window manager][gtk-X11-arch]) 2329 * could maximize it again, and not all window 2330 * managers honor requests to unmaximize. But normally the window will 2331 * end up unmaximized. Just don’t write code that crashes if not. 2332 * 2333 * You can track maximization via the “window-state-event” signal 2334 * on #GtkWidget. 2335 */ 2336 public void unmaximize() 2337 { 2338 gtk_window_unmaximize(gtkWindow); 2339 } 2340 2341 /** 2342 * Asks to unstick @window, which means that it will appear on only 2343 * one of the user’s desktops. Note that you shouldn’t assume the 2344 * window is definitely unstuck afterward, because other entities 2345 * (e.g. the user or [window manager][gtk-X11-arch]) could 2346 * stick it again. But normally the window will 2347 * end up stuck. Just don’t write code that crashes if not. 2348 * 2349 * You can track stickiness via the “window-state-event” signal 2350 * on #GtkWidget. 2351 */ 2352 public void unstick() 2353 { 2354 gtk_window_unstick(gtkWindow); 2355 } 2356 2357 int[string] connectedSignals; 2358 2359 void delegate(Window)[] onActivateDefaultListeners; 2360 /** 2361 * The ::activate-default signal is a 2362 * [keybinding signal][GtkBindingSignal] 2363 * which gets emitted when the user activates the default widget 2364 * of @window. 2365 */ 2366 void addOnActivateDefault(void delegate(Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2367 { 2368 if ( "activate-default" !in connectedSignals ) 2369 { 2370 Signals.connectData( 2371 this, 2372 "activate-default", 2373 cast(GCallback)&callBackActivateDefault, 2374 cast(void*)this, 2375 null, 2376 connectFlags); 2377 connectedSignals["activate-default"] = 1; 2378 } 2379 onActivateDefaultListeners ~= dlg; 2380 } 2381 extern(C) static void callBackActivateDefault(GtkWindow* windowStruct, Window _window) 2382 { 2383 foreach ( void delegate(Window) dlg; _window.onActivateDefaultListeners ) 2384 { 2385 dlg(_window); 2386 } 2387 } 2388 2389 void delegate(Window)[] onActivateFocusListeners; 2390 /** 2391 * The ::activate-focus signal is a 2392 * [keybinding signal][GtkBindingSignal] 2393 * which gets emitted when the user activates the currently 2394 * focused widget of @window. 2395 */ 2396 void addOnActivateFocus(void delegate(Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2397 { 2398 if ( "activate-focus" !in connectedSignals ) 2399 { 2400 Signals.connectData( 2401 this, 2402 "activate-focus", 2403 cast(GCallback)&callBackActivateFocus, 2404 cast(void*)this, 2405 null, 2406 connectFlags); 2407 connectedSignals["activate-focus"] = 1; 2408 } 2409 onActivateFocusListeners ~= dlg; 2410 } 2411 extern(C) static void callBackActivateFocus(GtkWindow* windowStruct, Window _window) 2412 { 2413 foreach ( void delegate(Window) dlg; _window.onActivateFocusListeners ) 2414 { 2415 dlg(_window); 2416 } 2417 } 2418 2419 bool delegate(bool, Window)[] onEnableDebuggingListeners; 2420 /** 2421 * The ::enable-debugging signal is a [keybinding signal][GtkBindingSignal] 2422 * which gets emitted when the user enables or disables interactive 2423 * debugging. When @toggle is %TRUE, interactive debugging is toggled 2424 * on or off, when it is %FALSE, the debugger will be pointed at the 2425 * widget under the pointer. 2426 * 2427 * The default bindings for this signal are Ctrl-Shift-I 2428 * and Ctrl-Shift-D. 2429 * 2430 * Params: 2431 * toggle = toggle the debugger 2432 * 2433 * Return: %TRUE if the key binding was handled 2434 */ 2435 void addOnEnableDebugging(bool delegate(bool, Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2436 { 2437 if ( "enable-debugging" !in connectedSignals ) 2438 { 2439 Signals.connectData( 2440 this, 2441 "enable-debugging", 2442 cast(GCallback)&callBackEnableDebugging, 2443 cast(void*)this, 2444 null, 2445 connectFlags); 2446 connectedSignals["enable-debugging"] = 1; 2447 } 2448 onEnableDebuggingListeners ~= dlg; 2449 } 2450 extern(C) static int callBackEnableDebugging(GtkWindow* windowStruct, bool toggle, Window _window) 2451 { 2452 foreach ( bool delegate(bool, Window) dlg; _window.onEnableDebuggingListeners ) 2453 { 2454 if ( dlg(toggle, _window) ) 2455 { 2456 return 1; 2457 } 2458 } 2459 2460 return 0; 2461 } 2462 2463 void delegate(Window)[] onKeysChangedListeners; 2464 /** 2465 * The ::keys-changed signal gets emitted when the set of accelerators 2466 * or mnemonics that are associated with @window changes. 2467 */ 2468 void addOnKeysChanged(void delegate(Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2469 { 2470 if ( "keys-changed" !in connectedSignals ) 2471 { 2472 Signals.connectData( 2473 this, 2474 "keys-changed", 2475 cast(GCallback)&callBackKeysChanged, 2476 cast(void*)this, 2477 null, 2478 connectFlags); 2479 connectedSignals["keys-changed"] = 1; 2480 } 2481 onKeysChangedListeners ~= dlg; 2482 } 2483 extern(C) static void callBackKeysChanged(GtkWindow* windowStruct, Window _window) 2484 { 2485 foreach ( void delegate(Window) dlg; _window.onKeysChangedListeners ) 2486 { 2487 dlg(_window); 2488 } 2489 } 2490 2491 void delegate(Widget, Window)[] onSetFocusListeners; 2492 void addOnSetFocus(void delegate(Widget, Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2493 { 2494 if ( "set-focus" !in connectedSignals ) 2495 { 2496 Signals.connectData( 2497 this, 2498 "set-focus", 2499 cast(GCallback)&callBackSetFocus, 2500 cast(void*)this, 2501 null, 2502 connectFlags); 2503 connectedSignals["set-focus"] = 1; 2504 } 2505 onSetFocusListeners ~= dlg; 2506 } 2507 extern(C) static void callBackSetFocus(GtkWindow* windowStruct, GtkWidget* object, Window _window) 2508 { 2509 foreach ( void delegate(Widget, Window) dlg; _window.onSetFocusListeners ) 2510 { 2511 dlg(ObjectG.getDObject!(Widget)(object), _window); 2512 } 2513 } 2514 }