2 * This file is part of duit.
4 * duit is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * duit is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkWindow.html
55 * - GdkPixbuf* -> Pixbuf
56 * - GdkScreen* -> Screen
57 * - GtkAccelGroup* -> AccelGroup
58 * - GtkWidget* -> Widget
59 * - GtkWindow* -> Window
65 private import gtk
.gtktypes
;
67 private import lib
.gtk
;
69 private import glib
.Str
;
70 private import gtk
.AccelGroup
;
71 private import gtk
.Widget
;
72 private import gtk
.Window
;
73 private import gdk
.Screen
;
74 private import glib
.ListG
;
75 private import gdk
.Pixbuf
;
76 private import gtk
.Window
;
81 private import gtk
.Bin
;
82 public class Window
: Bin
85 /** the main Gtk struct */
86 protected GtkWindow
* gtkWindow
;
89 public GtkWindow
* getWindowStruct()
95 /** the main Gtk struct as a void* */
96 protected void* getStruct()
98 return cast(void*)gtkWindow
;
102 * Sets our main struct and passes it to the parent class
104 public this (GtkWindow
* gtkWindow
)
106 super(cast(GtkBin
*)gtkWindow
);
107 this.gtkWindow
= gtkWindow
;
111 * Creates a top level window with a title
113 * title: The Window title
115 public this(char[] title
)
117 this(GtkWindowType
.TOPLEVEL
);
122 * Move the window to an absolute position.
123 * just calls move(int, int).
124 * convinience because GdkEvent structs return the position coords as doubles
126 public void move(double x
, double y
)
128 move(cast(int)x
, cast(int)y
);
135 // imports for the signal processing
136 private import gobject
.Signals
;
137 private import gdk
.gdktypes
;
138 int[char[]] connectedSignals
;
140 void delegate(Window
)[] onActivateDefaultListeners
;
141 void addOnActivateDefault(void delegate(Window
) dlg
)
143 if ( !("activate-default" in connectedSignals
) )
148 cast(GCallback
)&callBackActivateDefault
,
151 cast(ConnectFlags
)0);
152 connectedSignals
["activate-default"] = 1;
154 onActivateDefaultListeners
~= dlg
;
156 extern(C
) static void callBackActivateDefault(GtkWindow
* windowStruct
, Window window
)
158 bit consumed
= false;
160 foreach ( void delegate(Window
) dlg
; window
.onActivateDefaultListeners
)
168 void delegate(Window
)[] onActivateFocusListeners
;
169 void addOnActivateFocus(void delegate(Window
) dlg
)
171 if ( !("activate-focus" in connectedSignals
) )
176 cast(GCallback
)&callBackActivateFocus
,
179 cast(ConnectFlags
)0);
180 connectedSignals
["activate-focus"] = 1;
182 onActivateFocusListeners
~= dlg
;
184 extern(C
) static void callBackActivateFocus(GtkWindow
* windowStruct
, Window window
)
186 bit consumed
= false;
188 foreach ( void delegate(Window
) dlg
; window
.onActivateFocusListeners
)
196 gboolean
delegate(GdkEvent
*, Window
)[] onFrameListeners
;
197 void addOnFrame(gboolean
delegate(GdkEvent
*, Window
) dlg
)
199 if ( !("frame-event" in connectedSignals
) )
204 cast(GCallback
)&callBackFrame
,
207 cast(ConnectFlags
)0);
208 connectedSignals
["frame-event"] = 1;
210 onFrameListeners
~= dlg
;
212 extern(C
) static void callBackFrame(GtkWindow
* windowStruct
, GdkEvent
* event
, Window window
)
214 bit consumed
= false;
216 foreach ( gboolean
delegate(GdkEvent
*, Window
) dlg
; window
.onFrameListeners
)
224 void delegate(Window
)[] onKeysChangedListeners
;
225 void addOnKeysChanged(void delegate(Window
) dlg
)
227 if ( !("keys-changed" in connectedSignals
) )
232 cast(GCallback
)&callBackKeysChanged
,
235 cast(ConnectFlags
)0);
236 connectedSignals
["keys-changed"] = 1;
238 onKeysChangedListeners
~= dlg
;
240 extern(C
) static void callBackKeysChanged(GtkWindow
* windowStruct
, Window window
)
242 bit consumed
= false;
244 foreach ( void delegate(Window
) dlg
; window
.onKeysChangedListeners
)
252 void delegate(GtkDirectionType
, Window
)[] onMoveFocusListeners
;
253 void addOnMoveFocus(void delegate(GtkDirectionType
, Window
) dlg
)
255 if ( !("move-focus" in connectedSignals
) )
260 cast(GCallback
)&callBackMoveFocus
,
263 cast(ConnectFlags
)0);
264 connectedSignals
["move-focus"] = 1;
266 onMoveFocusListeners
~= dlg
;
268 extern(C
) static void callBackMoveFocus(GtkWindow
* windowStruct
, GtkDirectionType arg1
, Window window
)
270 bit consumed
= false;
272 foreach ( void delegate(GtkDirectionType
, Window
) dlg
; window
.onMoveFocusListeners
)
280 void delegate(Widget
, Window
)[] onSetFocusListeners
;
281 void addOnSetFocus(void delegate(Widget
, Window
) dlg
)
283 if ( !("set-focus" in connectedSignals
) )
288 cast(GCallback
)&callBackSetFocus
,
291 cast(ConnectFlags
)0);
292 connectedSignals
["set-focus"] = 1;
294 onSetFocusListeners
~= dlg
;
296 extern(C
) static void callBackSetFocus(GtkWindow
* windowStruct
, GtkWidget
* widget
, Window window
)
298 bit consumed
= false;
300 foreach ( void delegate(Widget
, Window
) dlg
; window
.onSetFocusListeners
)
302 dlg(new Widget(widget
), window
);
311 * Creates a new GtkWindow, which is a toplevel window that can
312 * contain other widgets. Nearly always, the type of the window should
313 * be GTK_WINDOW_TOPLEVEL. If you're implementing something like a
314 * popup menu from scratch (which is a bad idea, just use GtkMenu),
315 * you might use GTK_WINDOW_POPUP. GTK_WINDOW_POPUP is not for
316 * dialogs, though in some other toolkits dialogs are called "popups".
317 * In GTK+, GTK_WINDOW_POPUP means a pop-up menu or pop-up tooltip.
318 * On X11, popup windows are not controlled by the window manager.
319 * If you simply want an undecorated window (no window borders), use
320 * gtk_window_set_decorated(), don't use GTK_WINDOW_POPUP.
326 public this (GtkWindowType type
)
328 // GtkWidget* gtk_window_new (GtkWindowType type);
329 this(cast(GtkWindow
*)gtk_window_new(type
) );
333 * Sets the title of the GtkWindow. The title of a window will be
334 * displayed in its title bar; on the X Window System, the title bar
335 * is rendered by the window
336 * manager, so exactly how the title appears to users may vary
337 * according to a user's exact configuration. The title should help a
338 * user distinguish this window from other windows they may have
339 * open. A good title might include the application name and current
340 * document filename, for example.
344 * title of the window
346 public void setTitle(char[] title
)
348 // void gtk_window_set_title (GtkWindow *window, const gchar *title);
349 gtk_window_set_title(gtkWindow
, Str
.toStringz(title
));
353 * Don't use this function. It sets the X Window System "class" and
354 * "name" hints for a window. According to the ICCCM, you should
355 * always set these to the same value for all windows in an
356 * application, and GTK+ sets them to that value by default, so calling
357 * this function is sort of pointless. However, you may want to call
358 * gtk_window_set_role() on each window in your application, for the
359 * benefit of the session manager. Setting the role allows the window
360 * manager to restore window positions when loading a saved session.
368 public void setWmclass(char[] wmclassName
, char[] wmclassClass
)
370 // void gtk_window_set_wmclass (GtkWindow *window, const gchar *wmclass_name, const gchar *wmclass_class);
371 gtk_window_set_wmclass(gtkWindow
, Str
.toStringz(wmclassName
), Str
.toStringz(wmclassClass
));
376 * gtk_window_set_policy is deprecated and should not be used in newly-written code. Use gtk_window_set_resizable() instead.
377 * Changes how a toplevel window deals with its size request and user resize
378 * attempts. There are really only two reasonable ways to call this function:
379 * gtk_window_set_policy (GTK_WINDOW (window), FALSE, TRUE, FALSE)
380 * means that the window is user-resizable.
381 * gtk_window_set_policy (GTK_WINDOW (window), FALSE, FALSE, TRUE)
382 * means that the window's size is program-controlled, and should simply match
383 * the current size request of the window's children.
384 * The first policy is the default, that is, by default windows are designed to
385 * be resized by users.
386 * The basic ugly truth of this function is that it should be simply:
387 * void gtk_window_set_resizable (GtkWindow* window, gboolean setting);
388 * ...which is why GTK+ 2.0 introduces gtk_window_set_resizable(), which you
389 * should use instead of gtk_window_set_policy().
390 * If set to TRUE, the allow_grow parameter allows the user to expand the window
391 * beyond the size request of its child widgets. If allow_grow is TRUE, be sure to
392 * check that your child widgets work properly as the window is resized.
393 * A toplevel window will always change size to ensure its child widgets receive
394 * their requested size. This means that if you add child widgets, the toplevel
395 * window will expand to contain them. However, normally the toplevel will not
396 * shrink to fit the size request of its children if it's too large; the
397 * auto_shrink parameter causes the window to shrink when child widgets have too
398 * much space. auto_shrink is normally used with the second of the two window
399 * policies mentioned above. That is, set auto_shrink to TRUE if you want the
400 * window to have a fixed, always-optimal size determined by your program.
401 * Note that auto_shrink doesn't do anything if allow_shrink and allow_grow are
403 * Neither of the two suggested window policies set the allow_shrink parameter to
404 * TRUE. If allow_shrink is TRUE, the user can shrink the window so that its
405 * children do not receive their full size request; this is basically a bad thing,
406 * because most widgets will look wrong if this happens. Furthermore GTK+ has a
407 * tendency to re-expand the window if size is recalculated for any reason. The
408 * upshot is that allow_shrink should always be set to FALSE.
409 * Sometimes when you think you want to use allow_shrink, the real problem is that
410 * some specific child widget is requesting too much space, so the user can't
411 * shrink the window sufficiently. Perhaps you are calling gtk_widget_set_size_request()
412 * on a child widget, and forcing its size request to be too large. Instead of
413 * setting the child's usize, consider using gtk_window_set_default_size() so that
414 * the child gets a larger allocation than it requests.
418 * whether the user can shrink the window below its size request
420 * whether the user can grow the window larger than its size request
422 * whether the window automatically snaps back to its size request
425 public void setPolicy(int allowShrink
, int allowGrow
, int autoShrink
)
427 // void gtk_window_set_policy (GtkWindow *window, gint allow_shrink, gint allow_grow, gint auto_shrink);
428 gtk_window_set_policy(gtkWindow
, allowShrink
, allowGrow
, autoShrink
);
432 * Sets whether the user can resize a window. Windows are user resizable
437 * TRUE if the user can resize this window
439 public void setResizable(int resizable
)
441 // void gtk_window_set_resizable (GtkWindow *window, gboolean resizable);
442 gtk_window_set_resizable(gtkWindow
, resizable
);
446 * Gets the value set by gtk_window_set_resizable().
450 * TRUE if the user can resize the window
452 public int getResizable()
454 // gboolean gtk_window_get_resizable (GtkWindow *window);
455 return gtk_window_get_resizable(gtkWindow
);
459 * Associate accel_group with window, such that calling
460 * gtk_accel_groups_activate() on window will activate accelerators
463 * window to attach accelerator group to
467 public void addAccelGroup(AccelGroup accelGroup
)
469 // void gtk_window_add_accel_group (GtkWindow *window, GtkAccelGroup *accel_group);
470 gtk_window_add_accel_group(gtkWindow
, (accelGroup
is null) ?
null : accelGroup
.getAccelGroupStruct());
474 * Reverses the effects of gtk_window_add_accel_group().
480 public void removeAccelGroup(AccelGroup accelGroup
)
482 // void gtk_window_remove_accel_group (GtkWindow *window, GtkAccelGroup *accel_group);
483 gtk_window_remove_accel_group(gtkWindow
, (accelGroup
is null) ?
null : accelGroup
.getAccelGroupStruct());
488 * Activates the current focused widget within the window.
492 * TRUE if a widget got activated.
494 public int activateFocus()
496 // gboolean gtk_window_activate_focus (GtkWindow *window);
497 return gtk_window_activate_focus(gtkWindow
);
501 * Activates the default widget for the window, unless the current
502 * focused widget has been configured to receive the default action
503 * (see GTK_RECEIVES_DEFAULT in GtkWidgetFlags), in which case the
504 * focused widget is activated.
508 * TRUE if a widget got activated.
510 public int activateDefault()
512 // gboolean gtk_window_activate_default (GtkWindow *window);
513 return gtk_window_activate_default(gtkWindow
);
517 * Sets a window modal or non-modal. Modal windows prevent interaction
518 * with other windows in the same application. To keep modal dialogs
519 * on top of main application windows, use
520 * gtk_window_set_transient_for() to make the dialog transient for the
521 * parent; most window managers
522 * will then disallow lowering the dialog below the parent.
526 * whether the window is modal
528 public void setModal(int modal
)
530 // void gtk_window_set_modal (GtkWindow *window, gboolean modal);
531 gtk_window_set_modal(gtkWindow
, modal
);
535 * Sets the default size of a window. If the window's "natural" size
536 * (its size request) is larger than the default, the default will be
537 * ignored. More generally, if the default size does not obey the
538 * geometry hints for the window (gtk_window_set_geometry_hints() can
539 * be used to set these explicitly), the default size will be clamped
540 * to the nearest permitted size.
541 * Unlike gtk_widget_set_size_request(), which sets a size request for
542 * a widget and thus would keep users from shrinking the window, this
543 * function only sets the initial size, just as if the user had
544 * resized the window themselves. Users can still shrink the window
545 * again as they normally would. Setting a default size of -1 means to
546 * use the "natural" default size (the size request of the window).
547 * For more control over a window's initial size and how resizing works,
548 * investigate gtk_window_set_geometry_hints().
549 * For some uses, gtk_window_resize() is a more appropriate function.
550 * gtk_window_resize() changes the current size of the window, rather
551 * than the size to be used on initial display. gtk_window_resize() always
552 * affects the window itself, not the geometry widget.
553 * The default size of a window only affects the first time a window is
554 * shown; if a window is hidden and re-shown, it will remember the size
555 * it had prior to hiding, rather than using the default size.
556 * Windows can't actually be 0x0 in size, they must be at least 1x1, but
557 * passing 0 for width and height is OK, resulting in a 1x1 default size.
561 * width in pixels, or -1 to unset the default width
563 * height in pixels, or -1 to unset the default height
565 public void setDefaultSize(int width
, int height
)
567 // void gtk_window_set_default_size (GtkWindow *window, gint width, gint height);
568 gtk_window_set_default_size(gtkWindow
, width
, height
);
572 * This function sets up hints about how a window can be resized by
573 * the user. You can set a minimum and maximum size; allowed resize
574 * increments (e.g. for xterm, you can only resize by the size of a
575 * character); aspect ratios; and more. See the GdkGeometry struct.
579 * widget the geometry hints will be applied to
581 * struct containing geometry information
583 * mask indicating which struct fields should be paid attention to
585 public void setGeometryHints(Widget geometryWidget
, GdkGeometry
* geometry
, GdkWindowHints geomMask
)
587 // void gtk_window_set_geometry_hints (GtkWindow *window, GtkWidget *geometry_widget, GdkGeometry *geometry, GdkWindowHints geom_mask);
588 gtk_window_set_geometry_hints(gtkWindow
, (geometryWidget
is null) ?
null : geometryWidget
.getWidgetStruct(), geometry
, geomMask
);
592 * Window gravity defines the meaning of coordinates passed to
593 * gtk_window_move(). See gtk_window_move() and GdkGravity for
595 * The default window gravity is GDK_GRAVITY_NORTH_WEST which will
596 * typically "do what you mean."
602 public void setGravity(GdkGravity gravity
)
604 // void gtk_window_set_gravity (GtkWindow *window, GdkGravity gravity);
605 gtk_window_set_gravity(gtkWindow
, gravity
);
609 * Gets the value set by gtk_window_set_gravity().
615 public GdkGravity
getGravity()
617 // GdkGravity gtk_window_get_gravity (GtkWindow *window);
618 return gtk_window_get_gravity(gtkWindow
);
622 * Sets a position constraint for this window. If the old or new
623 * constraint is GTK_WIN_POS_CENTER_ALWAYS, this will also cause
624 * the window to be repositioned to satisfy the new constraint.
628 * a position constraint.
630 public void setPosition(GtkWindowPosition position
)
632 // void gtk_window_set_position (GtkWindow *window, GtkWindowPosition position);
633 gtk_window_set_position(gtkWindow
, position
);
637 * Dialog windows should be set transient for the main application
638 * window they were spawned from. This allows window managers to e.g. keep the
639 * dialog on top of the main window, or center the dialog over the
640 * main window. gtk_dialog_new_with_buttons() and other convenience
641 * functions in GTK+ will sometimes call
642 * gtk_window_set_transient_for() on your behalf.
643 * On Windows, this function will and put the child window
644 * on top of the parent, much as the window manager would have
651 public void setTransientFor(Window parent
)
653 // void gtk_window_set_transient_for (GtkWindow *window, GtkWindow *parent);
654 gtk_window_set_transient_for(gtkWindow
, (parent
is null) ?
null : parent
.getWindowStruct());
658 * If setting is TRUE, then destroying the transient parent of window
659 * will also destroy window itself. This is useful for dialogs that
660 * shouldn't persist beyond the lifetime of the main window they're
661 * associated with, for example.
665 * whether to destroy window with its transient parent
667 public void setDestroyWithParent(int setting
)
669 // void gtk_window_set_destroy_with_parent (GtkWindow *window, gboolean setting);
670 gtk_window_set_destroy_with_parent(gtkWindow
, setting
);
674 * Sets the GdkScreen where the window is displayed; if
675 * the window is already mapped, it will be unmapped, and
676 * then remapped on the new screen.
683 public void setScreen(Screen screen
)
685 // void gtk_window_set_screen (GtkWindow *window, GdkScreen *screen);
686 gtk_window_set_screen(gtkWindow
, (screen
is null) ?
null : screen
.getScreenStruct());
690 * Returns the GdkScreen associated with window.
697 public Screen
getScreen()
699 // GdkScreen* gtk_window_get_screen (GtkWindow *window);
700 return new Screen( gtk_window_get_screen(gtkWindow
) );
704 * Returns whether the window is part of the current active toplevel.
705 * (That is, the toplevel window receiving keystrokes.)
706 * The return value is TRUE if the window is active toplevel
707 * itself, but also if it is, say, a GtkPlug embedded in the active toplevel.
708 * You might use this function if you wanted to draw a widget
709 * differently in an active window from a widget in an inactive window.
710 * See gtk_window_has_toplevel_focus()
714 * TRUE if the window part of the current active window.
717 public int isActive()
719 // gboolean gtk_window_is_active (GtkWindow *window);
720 return gtk_window_is_active(gtkWindow
);
724 * Returns whether the input focus is within this GtkWindow.
725 * For real toplevel windows, this is identical to gtk_window_is_active(),
726 * but for embedded windows, like GtkPlug, the results will differ.
730 * TRUE if the input focus is within this GtkWindow
733 public int hasToplevelFocus()
735 // gboolean gtk_window_has_toplevel_focus (GtkWindow *window);
736 return gtk_window_has_toplevel_focus(gtkWindow
);
740 * Returns a list of all existing toplevel windows. The widgets
741 * in the list are not individually referenced. If you want
742 * to iterate through the list and perform actions involving
743 * callbacks that might destroy the widgets, you must call
744 * g_list_foreach (result, (GFunc)g_object_ref, NULL) first, and
745 * then unref all the widgets afterwards.
747 * list of toplevel widgets
749 public static ListG
listToplevels()
751 // GList* gtk_window_list_toplevels (void);
752 return new ListG( gtk_window_list_toplevels() );
756 * Adds a mnemonic to this window.
762 * the widget that gets activated by the mnemonic
764 public void addMnemonic(uint keyval
, Widget target
)
766 // void gtk_window_add_mnemonic (GtkWindow *window, guint keyval, GtkWidget *target);
767 gtk_window_add_mnemonic(gtkWindow
, keyval
, (target
is null) ?
null : target
.getWidgetStruct());
771 * Removes a mnemonic from this window.
777 * the widget that gets activated by the mnemonic
779 public void removeMnemonic(uint keyval
, Widget target
)
781 // void gtk_window_remove_mnemonic (GtkWindow *window, guint keyval, GtkWidget *target);
782 gtk_window_remove_mnemonic(gtkWindow
, keyval
, (target
is null) ?
null : target
.getWidgetStruct());
786 * Activates the targets associated with the mnemonic.
794 * TRUE if the activation is done.
796 public int mnemonicActivate(uint keyval
, GdkModifierType modifier
)
798 // gboolean gtk_window_mnemonic_activate (GtkWindow *window, guint keyval, GdkModifierType modifier);
799 return gtk_window_mnemonic_activate(gtkWindow
, keyval
, modifier
);
803 * Activates mnemonics and accelerators for this GtkWindow. This is normally
804 * called by the default ::key_press_event handler for toplevel windows,
805 * however in some cases it may be useful to call this directly when
806 * overriding the standard key handling for a toplevel window.
812 * TRUE if a mnemonic or accelerator was found and activated.
814 public int activateKey(GdkEventKey
* event
)
816 // gboolean gtk_window_activate_key (GtkWindow *window, GdkEventKey *event);
817 return gtk_window_activate_key(gtkWindow
, event
);
821 * Propagate a key press or release event to the focus widget and
822 * up the focus container chain until a widget handles event.
823 * This is normally called by the default ::key_press_event and
824 * ::key_release_event handlers for toplevel windows,
825 * however in some cases it may be useful to call this directly when
826 * overriding the standard key handling for a toplevel window.
832 * TRUE if a widget in the focus chain handled the event.
834 public int propagateKeyEvent(GdkEventKey
* event
)
836 // gboolean gtk_window_propagate_key_event (GtkWindow *window, GdkEventKey *event);
837 return gtk_window_propagate_key_event(gtkWindow
, event
);
841 * Retrieves the current focused widget within the window.
842 * Note that this is the widget that would have the focus
843 * if the toplevel window focused; if the toplevel window
844 * is not focused then GTK_WIDGET_HAS_FOCUS (widget) will
845 * not be TRUE for the widget.
849 * the currently focused widget, or NULL if there is none.
851 public Widget
getFocus()
853 // GtkWidget* gtk_window_get_focus (GtkWindow *window);
854 return new Widget( gtk_window_get_focus(gtkWindow
) );
858 * If focus is not the current focus widget, and is focusable, sets
859 * it as the focus widget for the window. If focus is NULL, unsets
860 * the focus widget for this window. To set the focus to a particular
861 * widget in the toplevel, it is usually more convenient to use
862 * gtk_widget_grab_focus() instead of this function.
866 * widget to be the new focus widget, or NULL to unset
867 * any focus widget for the toplevel window.
869 public void setFocus(Widget focus
)
871 // void gtk_window_set_focus (GtkWindow *window, GtkWidget *focus);
872 gtk_window_set_focus(gtkWindow
, (focus
is null) ?
null : focus
.getWidgetStruct());
876 * The default widget is the widget that's activated when the user
877 * presses Enter in a dialog (for example). This function sets or
878 * unsets the default widget for a GtkWindow about. When setting
879 * (rather than unsetting) the default widget it's generally easier to
880 * call gtk_widget_grab_focus() on the widget. Before making a widget
881 * the default widget, you must set the GTK_CAN_DEFAULT flag on the
882 * widget you'd like to make the default using GTK_WIDGET_SET_FLAGS().
886 * widget to be the default, or NULL to unset the
887 * default widget for the toplevel.
889 public void setDefault(Widget defaultWidget
)
891 // void gtk_window_set_default (GtkWindow *window, GtkWidget *default_widget);
892 gtk_window_set_default(gtkWindow
, (defaultWidget
is null) ?
null : defaultWidget
.getWidgetStruct());
896 * Presents a window to the user. This may mean raising the window
897 * in the stacking order, deiconifying it, moving it to the current
898 * desktop, and/or giving it the keyboard focus, possibly dependent
899 * on the user's platform, window manager, and preferences.
900 * If window is hidden, this function calls gtk_widget_show()
902 * This function should be used when the user tries to open a window
903 * that's already open. Say for example the preferences dialog is
904 * currently open, and the user chooses Preferences from the menu
905 * a second time; use gtk_window_present() to move the already-open dialog
906 * where the user can see it.
907 * If you are calling this function in response to a user interaction,
908 * it is preferable to use gtk_window_present_with_time().
912 public void present()
914 // void gtk_window_present (GtkWindow *window);
915 gtk_window_present(gtkWindow
);
919 * Presents a window to the user in response to a user interaction.
920 * If you need to present a window without a timestamp, use
921 * gtk_window_present(). See gtk_window_present() for details.
925 * the timestamp of the user interaction (typically a
926 * button or key press event) which triggered this call
929 public void presentWithTime(uint timestamp
)
931 // void gtk_window_present_with_time (GtkWindow *window, guint32 timestamp);
932 gtk_window_present_with_time(gtkWindow
, timestamp
);
936 * Asks to iconify (i.e. minimize) the specified window. Note that
937 * you shouldn't assume the window is definitely iconified afterward,
938 * because other entities (e.g. the user or window manager) could deiconify it
939 * again, or there may not be a window manager in which case
940 * iconification isn't possible, etc. But normally the window will end
941 * up iconified. Just don't write code that crashes if not.
942 * It's permitted to call this function before showing a window,
943 * in which case the window will be iconified before it ever appears
945 * You can track iconification via the "window_state_event" signal
950 public void iconify()
952 // void gtk_window_iconify (GtkWindow *window);
953 gtk_window_iconify(gtkWindow
);
957 * Asks to deiconify (i.e. unminimize) the specified window. Note
958 * that you shouldn't assume the window is definitely deiconified
959 * afterward, because other entities (e.g. the user or window manager) could iconify it
960 * again before your code which assumes deiconification gets to run.
961 * You can track iconification via the "window_state_event" signal
966 public void deiconify()
968 // void gtk_window_deiconify (GtkWindow *window);
969 gtk_window_deiconify(gtkWindow
);
973 * Asks to stick window, which means that it will appear on all user
974 * desktops. Note that you shouldn't assume the window is definitely
975 * stuck afterward, because other entities (e.g. the user or window manager) could unstick it
976 * again, and some window managers do not support sticking
977 * windows. But normally the window will end up stuck. Just don't
978 * write code that crashes if not.
979 * It's permitted to call this function before showing a window.
980 * You can track stickiness via the "window_state_event" signal
987 // void gtk_window_stick (GtkWindow *window);
988 gtk_window_stick(gtkWindow
);
992 * Asks to unstick window, which means that it will appear on only
993 * one of the user's desktops. Note that you shouldn't assume the
994 * window is definitely unstuck afterward, because other entities
995 * (e.g. the user or window
996 * manager) could stick it again. But normally the window will
997 * end up stuck. Just don't write code that crashes if not.
998 * You can track stickiness via the "window_state_event" signal
1003 public void unstick()
1005 // void gtk_window_unstick (GtkWindow *window);
1006 gtk_window_unstick(gtkWindow
);
1010 * Asks to maximize window, so that it becomes full-screen. Note that
1011 * you shouldn't assume the window is definitely maximized afterward,
1012 * because other entities (e.g. the user or window manager) could unmaximize it
1013 * again, and not all window managers support maximization. But
1014 * normally the window will end up maximized. Just don't write code
1015 * that crashes if not.
1016 * It's permitted to call this function before showing a window,
1017 * in which case the window will be maximized when it appears onscreen
1019 * You can track maximization via the "window_state_event" signal
1024 public void maximize()
1026 // void gtk_window_maximize (GtkWindow *window);
1027 gtk_window_maximize(gtkWindow
);
1031 * Asks to unmaximize window. Note that you shouldn't assume the
1032 * window is definitely unmaximized afterward, because other entities
1033 * (e.g. the user or window
1034 * manager) could maximize it again, and not all window
1035 * managers honor requests to unmaximize. But normally the window will
1036 * end up unmaximized. Just don't write code that crashes if not.
1037 * You can track maximization via the "window_state_event" signal
1042 public void unmaximize()
1044 // void gtk_window_unmaximize (GtkWindow *window);
1045 gtk_window_unmaximize(gtkWindow
);
1049 * Asks to place window in the fullscreen state. Note that you
1050 * shouldn't assume the window is definitely full screen afterward,
1051 * because other entities (e.g. the user or window manager) could unfullscreen it
1052 * again, and not all window managers honor requests to fullscreen
1053 * windows. But normally the window will end up fullscreen. Just
1054 * don't write code that crashes if not.
1055 * You can track the fullscreen state via the "window_state_event" signal
1061 public void fullscreen()
1063 // void gtk_window_fullscreen (GtkWindow *window);
1064 gtk_window_fullscreen(gtkWindow
);
1068 * Asks to toggle off the fullscreen state for window. Note that you
1069 * shouldn't assume the window is definitely not full screen
1070 * afterward, because other entities (e.g. the user or window manager) could fullscreen it
1071 * again, and not all window managers honor requests to unfullscreen
1072 * windows. But normally the window will end up restored to its normal
1073 * state. Just don't write code that crashes if not.
1074 * You can track the fullscreen state via the "window_state_event" signal
1080 public void unfullscreen()
1082 // void gtk_window_unfullscreen (GtkWindow *window);
1083 gtk_window_unfullscreen(gtkWindow
);
1087 * Asks to keep window above, so that it stays on top. Note that
1088 * you shouldn't assume the window is definitely above afterward,
1089 * because other entities (e.g. the user or window manager) could not keep it above,
1090 * and not all window managers support keeping windows above. But
1091 * normally the window will end kept above. Just don't write code
1092 * that crashes if not.
1093 * It's permitted to call this function before showing a window,
1094 * in which case the window will be kept above when it appears onscreen
1096 * You can track the above state via the "window_state_event" signal
1098 * Note that, according to the Extended Window
1099 * Manager Hints specification, the above state is mainly meant
1100 * for user preferences and should not be used by applications e.g. for
1101 * drawing attention to their dialogs.
1105 * whether to keep window above other windows
1108 public void setKeepAbove(int setting
)
1110 // void gtk_window_set_keep_above (GtkWindow *window, gboolean setting);
1111 gtk_window_set_keep_above(gtkWindow
, setting
);
1115 * Asks to keep window below, so that it stays in bottom. Note that
1116 * you shouldn't assume the window is definitely below afterward,
1117 * because other entities (e.g. the user or window manager) could not keep it below,
1118 * and not all window managers support putting windows below. But
1119 * normally the window will be kept below. Just don't write code
1120 * that crashes if not.
1121 * It's permitted to call this function before showing a window,
1122 * in which case the window will be kept below when it appears onscreen
1124 * You can track the below state via the "window_state_event" signal
1126 * Note that, according to the Extended Window
1127 * Manager Hints specification, the above state is mainly meant
1128 * for user preferences and should not be used by applications e.g. for
1129 * drawing attention to their dialogs.
1133 * whether to keep window below other windows
1136 public void setKeepBelow(int setting
)
1138 // void gtk_window_set_keep_below (GtkWindow *window, gboolean setting);
1139 gtk_window_set_keep_below(gtkWindow
, setting
);
1143 * Starts resizing a window. This function is used if an application
1144 * has window resizing controls. When GDK can support it, the resize
1145 * will be done using the standard mechanism for the window manager or windowing
1146 * system. Otherwise, GDK will try to emulate window resizing,
1147 * potentially not all that well, depending on the windowing system.
1151 * position of the resize control
1153 * mouse button that initiated the drag
1155 * X position where the user clicked to initiate the drag, in root window coordinates
1157 * Y position where the user clicked to initiate the drag
1159 * timestamp from the click event that initiated the drag
1161 public void beginResizeDrag(GdkWindowEdge edge
, int button
, int rootX
, int rootY
, uint timestamp
)
1163 // void gtk_window_begin_resize_drag (GtkWindow *window, GdkWindowEdge edge, gint button, gint root_x, gint root_y, guint32 timestamp);
1164 gtk_window_begin_resize_drag(gtkWindow
, edge
, button
, rootX
, rootY
, timestamp
);
1168 * Starts moving a window. This function is used if an application has
1169 * window movement grips. When GDK can support it, the window movement
1170 * will be done using the standard mechanism for the window manager or windowing
1171 * system. Otherwise, GDK will try to emulate window movement,
1172 * potentially not all that well, depending on the windowing system.
1176 * mouse button that initiated the drag
1178 * X position where the user clicked to initiate the drag, in root window coordinates
1180 * Y position where the user clicked to initiate the drag
1182 * timestamp from the click event that initiated the drag
1184 public void beginMoveDrag(int button
, int rootX
, int rootY
, uint timestamp
)
1186 // void gtk_window_begin_move_drag (GtkWindow *window, gint button, gint root_x, gint root_y, guint32 timestamp);
1187 gtk_window_begin_move_drag(gtkWindow
, button
, rootX
, rootY
, timestamp
);
1191 * By default, windows are decorated with a title bar, resize
1192 * controls, etc. Some window
1193 * managers allow GTK+ to disable these decorations, creating a
1194 * borderless window. If you set the decorated property to FALSE
1195 * using this function, GTK+ will do its best to convince the window
1196 * manager not to decorate the window. Depending on the system, this
1197 * function may not have any effect when called on a window that is
1198 * already visible, so you should call it before calling gtk_window_show().
1199 * On Windows, this function always works, since there's no window manager
1204 * TRUE to decorate the window
1206 public void setDecorated(int setting
)
1208 // void gtk_window_set_decorated (GtkWindow *window, gboolean setting);
1209 gtk_window_set_decorated(gtkWindow
, setting
);
1213 * By default, windows have a close button in the window frame. Some
1214 * window managers allow GTK+ to
1215 * disable this button. If you set the deletable property to FALSE
1216 * using this function, GTK+ will do its best to convince the window
1217 * manager not to show a close button. Depending on the system, this
1218 * function may not have any effect when called on a window that is
1219 * already visible, so you should call it before calling gtk_window_show().
1220 * On Windows, this function always works, since there's no window manager
1225 * TRUE to decorate the window as deletable
1228 public void setDeletable(int setting
)
1230 // void gtk_window_set_deletable (GtkWindow *window, gboolean setting);
1231 gtk_window_set_deletable(gtkWindow
, setting
);
1235 * (Note: this is a special-purpose function intended for the framebuffer
1236 * port; see gtk_window_set_has_frame(). It will have no effect on the
1237 * window border drawn by the window manager, which is the normal
1238 * case when using the X Window system.)
1239 * For windows with frames (see gtk_window_set_has_frame()) this function
1240 * can be used to change the size of the frame border.
1242 * a GtkWindow that has a frame
1244 * The width of the left border
1246 * The height of the top border
1248 * The width of the right border
1250 * The height of the bottom border
1252 public void setFrameDimensions(int left
, int top
, int right
, int bottom
)
1254 // void gtk_window_set_frame_dimensions (GtkWindow *window, gint left, gint top, gint right, gint bottom);
1255 gtk_window_set_frame_dimensions(gtkWindow
, left
, top
, right
, bottom
);
1259 * (Note: this is a special-purpose function for the framebuffer port,
1260 * that causes GTK+ to draw its own window border. For most applications,
1261 * you want gtk_window_set_decorated() instead, which tells the window
1262 * manager whether to draw the window border.)
1263 * If this function is called on a window with setting of TRUE, before
1264 * it is realized or showed, it will have a "frame" window around
1265 * window->window, accessible in window->frame. Using the signal
1266 * frame_event you can receive all events targeted at the frame.
1267 * This function is used by the linux-fb port to implement managed
1268 * windows, but it could conceivably be used by X-programs that
1269 * want to do their own window decorations.
1275 public void setHasFrame(int setting
)
1277 // void gtk_window_set_has_frame (GtkWindow *window, gboolean setting);
1278 gtk_window_set_has_frame(gtkWindow
, setting
);
1282 * Sets the mnemonic modifier for this window.
1286 * the modifier mask used to activate
1287 * mnemonics on this window.
1289 public void setMnemonicModifier(GdkModifierType modifier
)
1291 // void gtk_window_set_mnemonic_modifier (GtkWindow *window, GdkModifierType modifier);
1292 gtk_window_set_mnemonic_modifier(gtkWindow
, modifier
);
1296 * This function is only useful on X11, not with other GTK+ targets.
1297 * In combination with the window title, the window role allows a
1298 * window manager to identify "the
1299 * same" window when an application is restarted. So for example you
1300 * might set the "toolbox" role on your app's toolbox window, so that
1301 * when the user restarts their session, the window manager can put
1302 * the toolbox back in the same place.
1303 * If a window already has a unique title, you don't need to set the
1304 * role, since the WM can use the title to identify the window when
1305 * restoring the session.
1309 * unique identifier for the window to be used when restoring a session
1311 public void setRole(char[] role
)
1313 // void gtk_window_set_role (GtkWindow *window, const gchar *role);
1314 gtk_window_set_role(gtkWindow
, Str
.toStringz(role
));
1318 * By setting the type hint for the window, you allow the window
1319 * manager to decorate and handle the window in a way which is
1320 * suitable to the function of the window in your application.
1321 * This function should be called before the window becomes visible.
1322 * gtk_dialog_new_with_buttons() and other convenience functions in GTK+
1323 * will sometimes call gtk_window_set_type_hint() on your behalf.
1329 public void setTypeHint(GdkWindowTypeHint hint
)
1331 // void gtk_window_set_type_hint (GtkWindow *window, GdkWindowTypeHint hint);
1332 gtk_window_set_type_hint(gtkWindow
, hint
);
1336 * Windows may set a hint asking the desktop environment not to display
1337 * the window in the task bar. This function sets this hint.
1341 * TRUE to keep this window from appearing in the task bar
1344 public void setSkipTaskbarHint(int setting
)
1346 // void gtk_window_set_skip_taskbar_hint (GtkWindow *window, gboolean setting);
1347 gtk_window_set_skip_taskbar_hint(gtkWindow
, setting
);
1351 * Windows may set a hint asking the desktop environment not to display
1352 * the window in the pager. This function sets this hint.
1353 * (A "pager" is any desktop navigation tool such as a workspace
1354 * switcher that displays a thumbnail representation of the windows
1359 * TRUE to keep this window from appearing in the pager
1362 public void setSkipPagerHint(int setting
)
1364 // void gtk_window_set_skip_pager_hint (GtkWindow *window, gboolean setting);
1365 gtk_window_set_skip_pager_hint(gtkWindow
, setting
);
1369 * Windows may set a hint asking the desktop environment to draw
1370 * the users attention to the window. This function sets this hint.
1374 * TRUE to mark this window as urgent
1377 public void setUrgencyHint(int setting
)
1379 // void gtk_window_set_urgency_hint (GtkWindow *window, gboolean setting);
1380 gtk_window_set_urgency_hint(gtkWindow
, setting
);
1384 * Windows may set a hint asking the desktop environment not to receive
1385 * the input focus. This function sets this hint.
1389 * TRUE to let this window receive input focus
1392 public void setAcceptFocus(int setting
)
1394 // void gtk_window_set_accept_focus (GtkWindow *window, gboolean setting);
1395 gtk_window_set_accept_focus(gtkWindow
, setting
);
1399 * Windows may set a hint asking the desktop environment not to receive
1400 * the input focus when the window is mapped. This function sets this
1405 * TRUE to let this window receive input focus on map
1408 public void setFocusOnMap(int setting
)
1410 // void gtk_window_set_focus_on_map (GtkWindow *window, gboolean setting);
1411 gtk_window_set_focus_on_map(gtkWindow
, setting
);
1415 * Returns whether the window has been set to have decorations
1416 * such as a title bar via gtk_window_set_decorated().
1420 * TRUE if the window has been set to have decorations
1422 public int getDecorated()
1424 // gboolean gtk_window_get_decorated (GtkWindow *window);
1425 return gtk_window_get_decorated(gtkWindow
);
1429 * Returns whether the window has been set to have a close button
1430 * via gtk_window_set_deletable().
1434 * TRUE if the window has been set to have a close button
1437 public int getDeletable()
1439 // gboolean gtk_window_get_deletable (GtkWindow *window);
1440 return gtk_window_get_deletable(gtkWindow
);
1444 * Gets the value set by gtk_window_set_default_icon_list().
1445 * The list is a copy and should be freed with g_list_free(),
1446 * but the pixbufs in the list have not had their reference count
1449 * copy of default icon list
1451 public static ListG
getDefaultIconList()
1453 // GList* gtk_window_get_default_icon_list (void);
1454 return new ListG( gtk_window_get_default_icon_list() );
1458 * Gets the default size of the window. A value of -1 for the width or
1459 * height indicates that a default size has not been explicitly set
1460 * for that dimension, so the "natural" size of the window will be
1465 * location to store the default width, or NULL
1467 * location to store the default height, or NULL
1469 public void getDefaultSize(int* width
, int* height
)
1471 // void gtk_window_get_default_size (GtkWindow *window, gint *width, gint *height);
1472 gtk_window_get_default_size(gtkWindow
, width
, height
);
1476 * Returns whether the window will be destroyed with its transient parent. See
1477 * gtk_window_set_destroy_with_parent().
1481 * TRUE if the window will be destroyed with its transient parent.
1483 public int getDestroyWithParent()
1485 // gboolean gtk_window_get_destroy_with_parent (GtkWindow *window);
1486 return gtk_window_get_destroy_with_parent(gtkWindow
);
1490 * (Note: this is a special-purpose function intended for the
1491 * framebuffer port; see gtk_window_set_has_frame(). It will not
1492 * return the size of the window border drawn by the window manager, which is the normal
1493 * case when using a windowing system. See
1494 * gdk_window_get_frame_extents() to get the standard window border
1496 * Retrieves the dimensions of the frame window for this toplevel.
1497 * See gtk_window_set_has_frame(), gtk_window_set_frame_dimensions().
1501 * location to store the width of the frame at the left, or NULL
1503 * location to store the height of the frame at the top, or NULL
1505 * location to store the width of the frame at the returns, or NULL
1507 * location to store the height of the frame at the bottom, or NULL
1509 public void getFrameDimensions(int* left
, int* top
, int* right
, int* bottom
)
1511 // void gtk_window_get_frame_dimensions (GtkWindow *window, gint *left, gint *top, gint *right, gint *bottom);
1512 gtk_window_get_frame_dimensions(gtkWindow
, left
, top
, right
, bottom
);
1516 * Accessor for whether the window has a frame window exterior to
1517 * window->window. Gets the value set by gtk_window_set_has_frame().
1521 * TRUE if a frame has been added to the window
1522 * via gtk_window_set_has_frame().
1524 public int getHasFrame()
1526 // gboolean gtk_window_get_has_frame (GtkWindow *window);
1527 return gtk_window_get_has_frame(gtkWindow
);
1531 * Gets the value set by gtk_window_set_icon() (or if you've
1532 * called gtk_window_set_icon_list(), gets the first icon in
1539 public Pixbuf
getIcon()
1541 // GdkPixbuf* gtk_window_get_icon (GtkWindow *window);
1542 return new Pixbuf( gtk_window_get_icon(gtkWindow
) );
1546 * Retrieves the list of icons set by gtk_window_set_icon_list().
1547 * The list is copied, but the reference count on each
1548 * member won't be incremented.
1552 * copy of window's icon list
1554 public ListG
getIconList()
1556 // GList* gtk_window_get_icon_list (GtkWindow *window);
1557 return new ListG( gtk_window_get_icon_list(gtkWindow
) );
1561 * Returns the name of the themed icon for the window,
1562 * see gtk_window_set_icon_name().
1566 * the icon name or NULL if the window has
1570 public char[] getIconName()
1572 // gchar* gtk_window_get_icon_name (GtkWindow *window);
1573 return Str
.toString(gtk_window_get_icon_name(gtkWindow
) );
1577 * Returns the mnemonic modifier for this window. See
1578 * gtk_window_set_mnemonic_modifier().
1582 * the modifier mask used to activate
1583 * mnemonics on this window.
1585 public GdkModifierType
getMnemonicModifier()
1587 // GdkModifierType gtk_window_get_mnemonic_modifier (GtkWindow *window);
1588 return gtk_window_get_mnemonic_modifier(gtkWindow
);
1592 * Returns whether the window is modal. See gtk_window_set_modal().
1596 * TRUE if the window is set to be modal and
1597 * establishes a grab when shown
1599 public int getModal()
1601 // gboolean gtk_window_get_modal (GtkWindow *window);
1602 return gtk_window_get_modal(gtkWindow
);
1606 * This function returns the position you need to pass to
1607 * gtk_window_move() to keep window in its current position. This
1608 * means that the meaning of the returned value varies with window
1609 * gravity. See gtk_window_move() for more details.
1610 * If you haven't changed the window gravity, its gravity will be
1611 * GDK_GRAVITY_NORTH_WEST. This means that gtk_window_get_position()
1612 * gets the position of the top-left corner of the window manager
1613 * frame for the window. gtk_window_move() sets the position of this
1614 * same top-left corner.
1615 * gtk_window_get_position() is not 100% reliable because the X Window System
1616 * does not specify a way to obtain the geometry of the
1617 * decorations placed on a window by the window manager.
1618 * Thus GTK+ is using a "best guess" that works with most
1620 * Moreover, nearly all window managers are historically broken with
1621 * respect to their handling of window gravity. So moving a window to
1622 * its current position as returned by gtk_window_get_position() tends
1623 * to result in moving the window slightly. Window managers are
1624 * slowly getting better over time.
1625 * If a window has gravity GDK_GRAVITY_STATIC the window manager
1626 * frame is not relevant, and thus gtk_window_get_position() will
1627 * always produce accurate results. However you can't use static
1628 * gravity to do things like place a window in a corner of the screen,
1629 * because static gravity ignores the window manager decorations.
1630 * If you are saving and restoring your application's window
1631 * positions, you should know that it's impossible for applications to
1632 * do this without getting it somewhat wrong because applications do
1633 * not have sufficient knowledge of window manager state. The Correct
1634 * Mechanism is to support the session management protocol (see the
1635 * "GnomeClient" object in the GNOME libraries for example) and allow
1636 * the window manager to save your window sizes and positions.
1640 * return location for X coordinate of gravity-determined reference p\oint
1642 * return location for Y coordinate of gravity-determined reference p\oint
1644 public void getPosition(int* rootX
, int* rootY
)
1646 // void gtk_window_get_position (GtkWindow *window, gint *root_x, gint *root_y);
1647 gtk_window_get_position(gtkWindow
, rootX
, rootY
);
1651 * Returns the role of the window. See gtk_window_set_role() for
1652 * further explanation.
1656 * the role of the window if set, or NULL. The
1657 * returned is owned by the widget and must not be modified
1660 public char[] getRole()
1662 // const gchar* gtk_window_get_role (GtkWindow *window);
1663 return Str
.toString(gtk_window_get_role(gtkWindow
) );
1667 * Obtains the current size of window. If window is not onscreen,
1668 * it returns the size GTK+ will suggest to the window manager for the initial window
1669 * size (but this is not reliably the same as the size the window
1670 * manager will actually select). The size obtained by
1671 * gtk_window_get_size() is the last size received in a
1672 * GdkEventConfigure, that is, GTK+ uses its locally-stored size,
1673 * rather than querying the X server for the size. As a result, if you
1674 * call gtk_window_resize() then immediately call
1675 * gtk_window_get_size(), the size won't have taken effect yet. After
1676 * the window manager processes the resize request, GTK+ receives
1677 * notification that the size has changed via a configure event, and
1678 * the size of the window gets updated.
1679 * Note 1: Nearly any use of this function creates a race condition,
1680 * because the size of the window may change between the time that you
1681 * get the size and the time that you perform some action assuming
1682 * that size is the current size. To avoid race conditions, connect to
1683 * "configure_event" on the window and adjust your size-dependent
1684 * state to match the size delivered in the GdkEventConfigure.
1685 * Note 2: The returned size does not include the
1686 * size of the window manager decorations (aka the window frame or
1687 * border). Those are not drawn by GTK+ and GTK+ has no reliable
1688 * method of determining their size.
1689 * Note 3: If you are getting a window size in order to position
1690 * the window onscreen, there may be a better way. The preferred
1691 * way is to simply set the window's semantic type with
1692 * gtk_window_set_type_hint(), which allows the window manager to
1693 * e.g. center dialogs. Also, if you set the transient parent of
1694 * dialogs with gtk_window_set_transient_for() window managers
1695 * will often center the dialog over its parent window. It's
1696 * much preferred to let the window manager handle these
1697 * things rather than doing it yourself, because all apps will
1698 * behave consistently and according to user prefs if the window
1699 * manager handles it. Also, the window manager can take the size
1700 * of the window decorations/border into account, while your
1701 * application cannot.
1702 * In any case, if you insist on application-specified window
1703 * positioning, there's still a better way than
1704 * doing it yourself - gtk_window_set_position() will frequently
1705 * handle the details for you.
1709 * return location for width, or NULL
1711 * return location for height, or NULL
1713 public void getSize(int* width
, int* height
)
1715 // void gtk_window_get_size (GtkWindow *window, gint *width, gint *height);
1716 gtk_window_get_size(gtkWindow
, width
, height
);
1720 * Retrieves the title of the window. See gtk_window_set_title().
1724 * the title of the window, or NULL if none has
1725 * been set explicitely. The returned string is owned by the widget
1726 * and must not be modified or freed.
1728 public char[] getTitle()
1730 // const gchar* gtk_window_get_title (GtkWindow *window);
1731 return Str
.toString(gtk_window_get_title(gtkWindow
) );
1735 * Fetches the transient parent for this window. See
1736 * gtk_window_set_transient_for().
1740 * the transient parent for this window, or NULL
1741 * if no transient parent has been set.
1743 public Window
getTransientFor()
1745 // GtkWindow* gtk_window_get_transient_for (GtkWindow *window);
1746 return new Window( gtk_window_get_transient_for(gtkWindow
) );
1750 * Gets the type hint for this window. See gtk_window_set_type_hint().
1754 * the type hint for window.
1756 public GdkWindowTypeHint
getTypeHint()
1758 // GdkWindowTypeHint gtk_window_get_type_hint (GtkWindow *window);
1759 return gtk_window_get_type_hint(gtkWindow
);
1763 * Gets the value set by gtk_window_set_skip_taskbar_hint()
1767 * TRUE if window shouldn't be in taskbar
1770 public int getSkipTaskbarHint()
1772 // gboolean gtk_window_get_skip_taskbar_hint (GtkWindow *window);
1773 return gtk_window_get_skip_taskbar_hint(gtkWindow
);
1777 * Gets the value set by gtk_window_set_skip_pager_hint().
1781 * TRUE if window shouldn't be in pager
1784 public int getSkipPagerHint()
1786 // gboolean gtk_window_get_skip_pager_hint (GtkWindow *window);
1787 return gtk_window_get_skip_pager_hint(gtkWindow
);
1791 * Gets the value set by gtk_window_set_urgency_hint()
1795 * TRUE if window is urgent
1798 public int getUrgencyHint()
1800 // gboolean gtk_window_get_urgency_hint (GtkWindow *window);
1801 return gtk_window_get_urgency_hint(gtkWindow
);
1805 * Gets the value set by gtk_window_set_accept_focus().
1809 * TRUE if window should receive the input focus
1812 public int getAcceptFocus()
1814 // gboolean gtk_window_get_accept_focus (GtkWindow *window);
1815 return gtk_window_get_accept_focus(gtkWindow
);
1819 * Gets the value set by gtk_window_set_focus_on_map().
1823 * TRUE if window should receive the input focus when
1827 public int getFocusOnMap()
1829 // gboolean gtk_window_get_focus_on_map (GtkWindow *window);
1830 return gtk_window_get_focus_on_map(gtkWindow
);
1834 * Returns the group for window or the default group, if
1835 * window is NULL or if window does not have an explicit
1838 * a GtkWindow, or NULL
1840 * the GtkWindowGroup for a window or the default group
1843 public GtkWindowGroup
* getGroup()
1845 // GtkWindowGroup* gtk_window_get_group (GtkWindow *window);
1846 return gtk_window_get_group(gtkWindow
);
1850 * Asks the window manager to move
1851 * window to the given position. Window managers are free to ignore
1852 * this; most window managers ignore requests for initial window
1853 * positions (instead using a user-defined placement algorithm) and
1854 * honor requests after the window has already been shown.
1855 * Note: the position is the position of the gravity-determined
1856 * reference point for the window. The gravity determines two things:
1857 * first, the location of the reference point in root window
1858 * coordinates; and second, which point on the window is positioned at
1859 * the reference point.
1860 * By default the gravity is GDK_GRAVITY_NORTH_WEST, so the reference
1861 * point is simply the x, y supplied to gtk_window_move(). The
1862 * top-left corner of the window decorations (aka window frame or
1863 * border) will be placed at x, y. Therefore, to position a window
1864 * at the top left of the screen, you want to use the default gravity
1865 * (which is GDK_GRAVITY_NORTH_WEST) and move the window to 0,0.
1866 * To position a window at the bottom right corner of the screen, you
1867 * would set GDK_GRAVITY_SOUTH_EAST, which means that the reference
1868 * point is at x + the window width and y + the window height, and
1869 * the bottom-right corner of the window border will be placed at that
1870 * reference point. So, to place a window in the bottom right corner
1871 * you would first set gravity to south east, then write:
1872 * gtk_window_move (window, gdk_screen_width() - window_width,
1873 * gdk_screen_height() - window_height) (note that this
1874 * example does not take multi-head scenarios into account).
1875 * The Extended Window Manager Hints specification at
1876 * http://www.freedesktop.org/Standards/wm-spec has a
1877 * nice table of gravities in the "implementation notes" section.
1878 * The gtk_window_get_position() documentation may also be relevant.
1882 * X coordinate to move window to
1884 * Y coordinate to move window to
1886 public void move(int x
, int y
)
1888 // void gtk_window_move (GtkWindow *window, gint x, gint y);
1889 gtk_window_move(gtkWindow
, x
, y
);
1893 * Parses a standard X Window System geometry string - see the
1894 * manual page for X (type 'man X') for details on this.
1895 * gtk_window_parse_geometry() does work on all GTK+ ports
1896 * including Win32 but is primarily intended for an X environment.
1897 * If either a size or a position can be extracted from the
1898 * geometry string, gtk_window_parse_geometry() returns TRUE
1899 * and calls gtk_window_set_default_size() and/or gtk_window_move()
1900 * to resize/move the window.
1901 * If gtk_window_parse_geometry() returns TRUE, it will also
1902 * set the GDK_HINT_USER_POS and/or GDK_HINT_USER_SIZE hints
1903 * indicating to the window manager that the size/position of
1904 * the window was user-specified. This causes most window
1905 * managers to honor the geometry.
1906 * Note that for gtk_window_parse_geometry() to work as expected, it has
1907 * to be called when the window has its "final" size, i.e. after calling
1908 * gtk_widget_show_all() on the contents and gtk_window_set_geometry_hints()
1910 * include <gtk/gtk.h>
1912 * fill_with_content (GtkWidget *vbox)
1914 * /+* fill with content... +/
1917 * main (int argc, char *argv[])
1919 * GtkWidget *window, *vbox;
1920 * GdkGeometry size_hints = {
1921 * 100, 50, 0, 0, 100, 50, 10, 10, 0.0, 0.0, GDK_GRAVITY_NORTH_WEST
1923 * gtk_init (argc, argv);
1924 * window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
1925 * vbox = gtk_vbox_new (FALSE, 0);
1926 * gtk_container_add (GTK_CONTAINER (window), vbox);
1927 * fill_with_content (vbox);
1928 * gtk_widget_show_all (vbox);
1929 * gtk_window_set_geometry_hints (GTK_WINDOW (window),
1932 * GDK_HINT_MIN_SIZE |
1933 * GDK_HINT_BASE_SIZE |
1934 * GDK_HINT_RESIZE_INC);
1937 * if (!gtk_window_parse_geometry (GTK_WINDOW (window), argv[1]))
1938 * fprintf (stderr, "Failed to parse '%s'\n", argv[1]);
1940 * gtk_widget_show_all (window);
1949 * TRUE if string was parsed successfully
1951 public int parseGeometry(char[] geometry
)
1953 // gboolean gtk_window_parse_geometry (GtkWindow *window, const gchar *geometry);
1954 return gtk_window_parse_geometry(gtkWindow
, Str
.toStringz(geometry
));
1958 * Hides window, then reshows it, resetting the
1959 * default size and position of the window. Used
1960 * by GUI builders only.
1964 public void reshowWithInitialSize()
1966 // void gtk_window_reshow_with_initial_size (GtkWindow *window);
1967 gtk_window_reshow_with_initial_size(gtkWindow
);
1971 * Resizes the window as if the user had done so, obeying geometry
1972 * constraints. The default geometry constraint is that windows may
1973 * not be smaller than their size request; to override this
1974 * constraint, call gtk_widget_set_size_request() to set the window's
1975 * request to a smaller value.
1976 * If gtk_window_resize() is called before showing a window for the
1977 * first time, it overrides any default size set with
1978 * gtk_window_set_default_size().
1979 * Windows may not be resized smaller than 1 by 1 pixels.
1983 * width in pixels to resize the window to
1985 * height in pixels to resize the window to
1987 public void resize(int width
, int height
)
1989 // void gtk_window_resize (GtkWindow *window, gint width, gint height);
1990 gtk_window_resize(gtkWindow
, width
, height
);
1994 * Sets an icon list to be used as fallback for windows that haven't
1995 * had gtk_window_set_icon_list() called on them to set up a
1996 * window-specific icon list. This function allows you to set up the
1997 * icon for all windows in your app at once.
1998 * See gtk_window_set_icon_list() for more details.
2000 * a list of GdkPixbuf
2002 public static void setDefaultIconList(ListG list
)
2004 // void gtk_window_set_default_icon_list (GList *list);
2005 gtk_window_set_default_icon_list((list
is null) ?
null : list
.getListGStruct());
2009 * Sets an icon to be used as fallback for windows that haven't
2010 * had gtk_window_set_icon() called on them from a pixbuf.
2015 public static void setDefaultIcon(Pixbuf icon
)
2017 // void gtk_window_set_default_icon (GdkPixbuf *icon);
2018 gtk_window_set_default_icon((icon
is null) ?
null : icon
.getPixbufStruct());
2022 * Sets an icon to be used as fallback for windows that haven't
2023 * had gtk_window_set_icon_list() called on them from a file
2024 * on disk. Warns on failure if err is NULL.
2026 * location of icon file
2028 * location to store error, or NULL.
2030 * TRUE if setting the icon succeeded.
2033 public static int setDefaultIconFromFile(char[] filename
, GError
** err
)
2035 // gboolean gtk_window_set_default_icon_from_file (const gchar *filename, GError **err);
2036 return gtk_window_set_default_icon_from_file(Str
.toStringz(filename
), err
);
2040 * Sets an icon to be used as fallback for windows that haven't
2041 * had gtk_window_set_icon_list() called on them from a named
2042 * themed icon, see gtk_window_set_icon_name().
2044 * the name of the themed icon
2047 public static void setDefaultIconName(char[] name
)
2049 // void gtk_window_set_default_icon_name (const gchar *name);
2050 gtk_window_set_default_icon_name(Str
.toStringz(name
));
2054 * Sets up the icon representing a GtkWindow. This icon is used when
2055 * the window is minimized (also known as iconified). Some window
2056 * managers or desktop environments may also place it in the window
2057 * frame, or display it in other contexts.
2058 * The icon should be provided in whatever size it was naturally
2059 * drawn; that is, don't scale the image before passing it to
2060 * GTK+. Scaling is postponed until the last minute, when the desired
2061 * final size is known, to allow best quality.
2062 * If you have your icon hand-drawn in multiple sizes, use
2063 * gtk_window_set_icon_list(). Then the best size will be used.
2064 * This function is equivalent to calling gtk_window_set_icon_list()
2065 * with a 1-element list.
2066 * See also gtk_window_set_default_icon_list() to set the icon
2067 * for all windows in your application in one go.
2071 * icon image, or NULL
2073 public void setIcon(Pixbuf icon
)
2075 // void gtk_window_set_icon (GtkWindow *window, GdkPixbuf *icon);
2076 gtk_window_set_icon(gtkWindow
, (icon
is null) ?
null : icon
.getPixbufStruct());
2080 * Sets up the icon representing a GtkWindow. The icon is used when
2081 * the window is minimized (also known as iconified). Some window
2082 * managers or desktop environments may also place it in the window
2083 * frame, or display it in other contexts.
2084 * gtk_window_set_icon_list() allows you to pass in the same icon in
2085 * several hand-drawn sizes. The list should contain the natural sizes
2086 * your icon is available in; that is, don't scale the image before
2087 * passing it to GTK+. Scaling is postponed until the last minute,
2088 * when the desired final size is known, to allow best quality.
2089 * By passing several sizes, you may improve the final image quality
2090 * of the icon, by reducing or eliminating automatic image scaling.
2091 * Recommended sizes to provide: 16x16, 32x32, 48x48 at minimum, and
2092 * larger images (64x64, 128x128) if you have them.
2093 * See also gtk_window_set_default_icon_list() to set the icon
2094 * for all windows in your application in one go.
2095 * Note that transient windows (those who have been set transient for another
2096 * window using gtk_window_set_transient_for()) will inherit their
2097 * icon from their transient parent. So there's no need to explicitly
2098 * set the icon on transient windows.
2104 public void setIconList(ListG list
)
2106 // void gtk_window_set_icon_list (GtkWindow *window, GList *list);
2107 gtk_window_set_icon_list(gtkWindow
, (list
is null) ?
null : list
.getListGStruct());
2111 * Sets the icon for window.
2112 * Warns on failure if err is NULL.
2113 * This function is equivalent to calling gtk_window_set_icon()
2114 * with a pixbuf created by loading the image from filename.
2118 * location of icon file
2120 * location to store error, or NULL.
2122 * TRUE if setting the icon succeeded.
2125 public int setIconFromFile(char[] filename
, GError
** err
)
2127 // gboolean gtk_window_set_icon_from_file (GtkWindow *window, const gchar *filename, GError **err);
2128 return gtk_window_set_icon_from_file(gtkWindow
, Str
.toStringz(filename
), err
);
2132 * Sets the icon for the window from a named themed icon. See
2133 * the docs for GtkIconTheme for more details.
2134 * Note that this has nothing to do with the WM_ICON_NAME
2135 * property which is mentioned in the ICCCM.
2139 * the name of the themed icon
2142 public void setIconName(char[] name
)
2144 // void gtk_window_set_icon_name (GtkWindow *window, const gchar *name);
2145 gtk_window_set_icon_name(gtkWindow
, Str
.toStringz(name
));
2149 * By default, after showing the first GtkWindow, GTK+ calls
2150 * gdk_notify_startup_complete(). Call this function to disable
2151 * the automatic startup notification. You might do this if your
2152 * first window is a splash screen, and you want to delay notification
2153 * until after your real main window has been shown, for example.
2154 * In that example, you would disable startup notification
2155 * temporarily, show your splash screen, then re-enable it so that
2156 * showing the main window would automatically result in notification.
2158 * TRUE to automatically do startup notification
2161 public static void setAutoStartupNotification(int setting
)
2163 // void gtk_window_set_auto_startup_notification (gboolean setting);
2164 gtk_window_set_auto_startup_notification(setting
);
2170 public void decoratedWindowInit()
2172 // void gtk_decorated_window_init (GtkWindow *window);
2173 gtk_decorated_window_init(gtkWindow
);
2179 public void decoratedWindowCalculateFrameSize()
2181 // void gtk_decorated_window_calculate_frame_size (GtkWindow *window);
2182 gtk_decorated_window_calculate_frame_size(gtkWindow
);
2189 public void decoratedWindowSetTitle(char[] title
)
2191 // void gtk_decorated_window_set_title (GtkWindow *window, const gchar *title);
2192 gtk_decorated_window_set_title(gtkWindow
, Str
.toStringz(title
));
2202 * The "accept-focus" property
2203 * "accept-focus" gboolean : Read / Write
2204 * TRUE if the window should receive the input focus.
2205 * Default value: TRUE
2207 public void decoratedWindowMoveResizeWindow(int x
, int y
, int width
, int height
)
2209 // void gtk_decorated_window_move_resize_window (GtkWindow *window, gint x, gint y, gint width, gint height);
2210 gtk_decorated_window_move_resize_window(gtkWindow
, x
, y
, width
, height
);