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