Maintainer | gtk2hs-users@lists.sourceforge.net |
---|---|
Stability | provisional |
Portability | portable (depends on GHC) |
Safe Haskell | None |
Language | Haskell98 |
Toplevel which can contain other widgets
- data Window
- class BinClass o => WindowClass o
- castToWindow :: GObjectClass obj => obj -> Window
- gTypeWindow :: GType
- toWindow :: WindowClass o => o -> Window
- data WindowType
- data WindowEdge
- data WindowTypeHint
- = WindowTypeHintNormal
- | WindowTypeHintDialog
- | WindowTypeHintMenu
- | WindowTypeHintToolbar
- | WindowTypeHintSplashscreen
- | WindowTypeHintUtility
- | WindowTypeHintDock
- | WindowTypeHintDesktop
- | WindowTypeHintDropdownMenu
- | WindowTypeHintPopupMenu
- | WindowTypeHintTooltip
- | WindowTypeHintNotification
- | WindowTypeHintCombo
- | WindowTypeHintDnd
- data Gravity
- windowNew :: IO Window
- windowNewPopup :: IO Window
- windowActivateFocus :: WindowClass self => self -> IO Bool
- windowActivateDefault :: WindowClass self => self -> IO Bool
- windowSetDefaultSize :: WindowClass self => self -> Int -> Int -> IO ()
- windowGetDefaultSize :: WindowClass self => self -> IO (Int, Int)
- windowSetPosition :: WindowClass self => self -> WindowPosition -> IO ()
- data WindowPosition
- windowIsActive :: WindowClass self => self -> IO Bool
- windowHasToplevelFocus :: WindowClass self => self -> IO Bool
- windowListToplevels :: IO [Window]
- windowSetDefault :: (WindowClass self, WidgetClass widget) => self -> Maybe widget -> IO ()
- windowGetDefaultWidget :: WindowClass self => self -> IO (Maybe Widget)
- windowAddMnemonic :: (WindowClass self, WidgetClass widget) => self -> KeyVal -> widget -> IO ()
- windowRemoveMnemonic :: (WindowClass self, WidgetClass widget) => self -> KeyVal -> widget -> IO ()
- windowMnemonicActivate :: WindowClass self => self -> KeyVal -> [Modifier] -> IO Bool
- windowActivateKey :: WindowClass self => self -> EventM EKey Bool
- windowPropagateKeyEvent :: WindowClass self => self -> EventM EKey Bool
- windowPresent :: WindowClass self => self -> IO ()
- windowDeiconify :: WindowClass self => self -> IO ()
- windowIconify :: WindowClass self => self -> IO ()
- windowMaximize :: WindowClass self => self -> IO ()
- windowUnmaximize :: WindowClass self => self -> IO ()
- windowFullscreen :: WindowClass self => self -> IO ()
- windowUnfullscreen :: WindowClass self => self -> IO ()
- windowSetKeepAbove :: WindowClass self => self -> Bool -> IO ()
- windowSetKeepBelow :: WindowClass self => self -> Bool -> IO ()
- windowSetStartupId :: (WindowClass self, GlibString string) => self -> string -> IO ()
- windowStick :: WindowClass self => self -> IO ()
- windowUnstick :: WindowClass self => self -> IO ()
- windowAddAccelGroup :: WindowClass self => self -> AccelGroup -> IO ()
- windowRemoveAccelGroup :: WindowClass self => self -> AccelGroup -> IO ()
- windowSetDefaultIconList :: [Pixbuf] -> IO ()
- windowGetDefaultIconList :: IO [Pixbuf]
- windowSetDefaultIcon :: Maybe Pixbuf -> IO ()
- windowSetDefaultIconFromFile :: GlibString string => string -> IO Bool
- windowSetDefaultIconName :: GlibString string => string -> IO ()
- windowGetDefaultIconName :: GlibString string => IO string
- windowSetGravity :: WindowClass self => self -> Gravity -> IO ()
- windowGetGravity :: WindowClass self => self -> IO Gravity
- windowSetScreen :: WindowClass self => self -> Screen -> IO ()
- windowGetScreen :: WindowClass self => self -> IO Screen
- windowBeginResizeDrag :: WindowClass self => self -> WindowEdge -> MouseButton -> Int -> Int -> TimeStamp -> IO ()
- windowBeginMoveDrag :: WindowClass self => self -> MouseButton -> Int -> Int -> TimeStamp -> IO ()
- windowSetTypeHint :: WindowClass self => self -> WindowTypeHint -> IO ()
- windowGetTypeHint :: WindowClass self => self -> IO WindowTypeHint
- windowGetIcon :: WindowClass self => self -> IO (Maybe Pixbuf)
- windowGetPosition :: WindowClass self => self -> IO (Int, Int)
- windowGetSize :: WindowClass self => self -> IO (Int, Int)
- windowMove :: WindowClass self => self -> Int -> Int -> IO ()
- windowParseGeometry :: (WindowClass self, GlibString string) => self -> string -> IO Bool
- windowReshowWithInitialSize :: WindowClass self => self -> IO ()
- windowResize :: WindowClass self => self -> Int -> Int -> IO ()
- windowSetIconFromFile :: (WindowClass self, GlibFilePath fp) => self -> fp -> IO ()
- windowSetAutoStartupNotification :: Bool -> IO ()
- windowPresentWithTime :: WindowClass self => self -> TimeStamp -> IO ()
- windowSetGeometryHints :: (WindowClass self, WidgetClass widget) => self -> Maybe widget -> Maybe (Int, Int) -> Maybe (Int, Int) -> Maybe (Int, Int) -> Maybe (Int, Int) -> Maybe (Double, Double) -> IO ()
- windowGetGroup :: WindowClass self => Maybe self -> IO WindowGroup
- windowGetWindowType :: WindowClass self => self -> IO WindowType
- windowTitle :: (WindowClass self, GlibString string) => Attr self string
- windowType :: WindowClass self => ReadAttr self WindowType
- windowAllowShrink :: WindowClass self => Attr self Bool
- windowAllowGrow :: WindowClass self => Attr self Bool
- windowResizable :: WindowClass self => Attr self Bool
- windowHasResizeGrip :: WindowClass self => Attr self Bool
- windowModal :: WindowClass self => Attr self Bool
- windowOpacity :: WindowClass self => Attr self Double
- windowRole :: (WindowClass self, GlibString string) => Attr self string
- windowStartupId :: (WindowClass self, GlibString string) => Attr self string
- windowWindowPosition :: WindowClass self => Attr self WindowPosition
- windowDefaultWidth :: WindowClass self => Attr self Int
- windowDefaultHeight :: WindowClass self => Attr self Int
- windowDeletable :: WindowClass self => Attr self Bool
- windowDestroyWithParent :: WindowClass self => Attr self Bool
- windowIcon :: WindowClass self => Attr self (Maybe Pixbuf)
- windowIconName :: (WindowClass self, GlibString string) => Attr self string
- windowScreen :: WindowClass self => Attr self Screen
- windowTypeHint :: WindowClass self => Attr self WindowTypeHint
- windowSkipTaskbarHint :: WindowClass self => Attr self Bool
- windowSkipPagerHint :: WindowClass self => Attr self Bool
- windowUrgencyHint :: WindowClass self => Attr self Bool
- windowAcceptFocus :: WindowClass self => Attr self Bool
- windowFocusOnMap :: WindowClass self => Attr self Bool
- windowDecorated :: WindowClass self => Attr self Bool
- windowGravity :: WindowClass self => Attr self Gravity
- windowToplevelFocus :: WindowClass self => Attr self Bool
- windowTransientFor :: (WindowClass self, WindowClass parent) => ReadWriteAttr self (Maybe Window) parent
- windowFocus :: WindowClass self => Attr self (Maybe Widget)
- windowIconList :: WindowClass self => Attr self [Pixbuf]
- windowMnemonicModifier :: WindowClass self => Attr self [Modifier]
- windowMnemonicVisible :: WindowClass self => Attr self Bool
- frameEvent :: WindowClass self => Signal self (EventM EAny Bool)
- keysChanged :: WindowClass self => Signal self (IO ())
- setFocus :: WindowClass self => Signal self (Maybe Widget -> IO ())
Class Hierarchy
|GObject
| +----Object
| +----Widget
| +----Container
| +----Bin
| +----Window | +----Dialog
| +----Plug
Types
class BinClass o => WindowClass o Source
castToWindow :: GObjectClass obj => obj -> Window Source
toWindow :: WindowClass o => o -> Window Source
data WindowType Source
Interaction of a window with window manager
data WindowEdge Source
Determines a window edge or corner.
data WindowTypeHint Source
Defines the reference point of a window and the meaning of coordinates
passed to windowMove
. See
windowMove
and the "implementation notes"
section of the extended window manager hints specification for more details.
GravityNorthWest | |
GravityNorth | |
GravityNorthEast | |
GravityWest | |
GravityCenter | |
GravityEast | |
GravitySouthWest | |
GravitySouth | |
GravitySouthEast | |
GravityStatic |
Enum Gravity Source | Returned by
|
Eq Gravity Source | |
Show Gravity Source |
Constructors
windowNewPopup :: IO Window Source
Create a popup window.
Methods
:: WindowClass self | |
=> self | |
-> IO Bool | returns |
Activates the current focused widget within the window.
:: WindowClass self | |
=> self | |
-> IO Bool | returns |
Activates the default widget for the window, unless the current focused
widget has been configured to receive the default action (see
ReceivesDefault
in WidgetFlags
), in which case the focused widget is
activated.
:: WindowClass self | |
=> self | |
-> Int |
|
-> Int |
|
-> IO () |
Sets the default size of a window. If the window's "natural" size (its
size request) is larger than the default, the default will be ignored. More
generally, if the default size does not obey the geometry hints for the
window (windowSetGeometryHints
can be used to set these explicitly), the
default size will be clamped to the nearest permitted size.
Unlike widgetSetSizeRequest
, which sets a size request for a widget and
thus would keep users from shrinking the window, this function only sets the
initial size, just as if the user had resized the window themselves. Users
can still shrink the window again as they normally would. Setting a default
size of -1 means to use the "natural" default size (the size request of
the window).
For more control over a window's initial size and how resizing works,
investigate windowSetGeometryHints
.
For some uses, windowResize
is a more appropriate function.
windowResize
changes the current size of the window, rather than the size
to be used on initial display. windowResize
always affects the window
itself, not the geometry widget.
The default size of a window only affects the first time a window is shown; if a window is hidden and re-shown, it will remember the size it had prior to hiding, rather than using the default size.
Windows can't actually be 0x0 in size, they must be at least 1x1, but
passing 0 for width
and height
is OK, resulting in a 1x1 default size.
:: WindowClass self | |
=> self | |
-> IO (Int, Int) |
|
Gets the default size of the window. A value of -1 for the width or height indicates that a default size has not been explicitly set for that dimension, so the "natural" size of the window will be used.
windowSetPosition :: WindowClass self => self -> WindowPosition -> IO () Source
Sets a position constraint for this window. If the old or new constraint
is WinPosCenterAlways
, this will also cause the window to be repositioned
to satisfy the new constraint.
data WindowPosition Source
Window position types
:: WindowClass self | |
=> self | |
-> IO Bool | returns |
Returns whether the window is part of the current active toplevel. (That
is, the toplevel window receiving keystrokes.) The return value is True
if
the window is active toplevel itself, but also if it is, say, a Plug
embedded in the active toplevel. You might use this function if you wanted
to draw a widget differently in an active window from a widget in an
inactive window. See windowHasToplevelFocus
- Available since Gtk+ version 2.4
:: WindowClass self | |
=> self | |
-> IO Bool | returns |
Returns whether the input focus is within this Window
. For real
toplevel windows, this is identical to windowIsActive
, but for embedded
windows, like Plug
, the results will differ.
- Available since Gtk+ version 2.4
windowListToplevels :: IO [Window] Source
Returns a list of all existing toplevel windows.
windowSetDefault :: (WindowClass self, WidgetClass widget) => self -> Maybe widget -> IO () Source
The default widget is the widget that's activated when the user presses
Enter in a dialog (for example). This function sets or unsets the default
widget for a Window about. When setting (rather than unsetting) the
default widget it's generally easier to call widgetGrabDefault on the
widget. Before making a widget the default widget, you must set the
widgetCanDefault
flag on the widget.
windowGetDefaultWidget :: WindowClass self => self -> IO (Maybe Widget) Source
Returns the default widget for window. See windowSetDefault
for more details.
- Available since Gtk+ version 2.14
:: (WindowClass self, WidgetClass widget) | |
=> self | |
-> KeyVal |
|
-> widget |
|
-> IO () |
Adds a mnemonic to this window.
:: (WindowClass self, WidgetClass widget) | |
=> self | |
-> KeyVal |
|
-> widget |
|
-> IO () |
Removes a mnemonic from this window.
:: WindowClass self | |
=> self | |
-> KeyVal |
|
-> [Modifier] |
|
-> IO Bool | return |
Activates the targets associated with the mnemonic.
:: WindowClass self | |
=> self | |
-> EventM EKey Bool | return |
Activates mnemonics and accelerators for this Window
.
This is normally called by the default keyPressEvent
handler for toplevel windows,
however in some cases it may be useful to call this directly when overriding the standard key handling for a toplevel window.
windowPropagateKeyEvent Source
:: WindowClass self | |
=> self | |
-> EventM EKey Bool | return |
Propagate a key press or release event to the focus widget and up the focus container chain until a widget handles event.
This is normally called by the default keyPressEvent
and keyReleaseEvent
handlers for toplevel windows,
however in some cases it may be useful to call this directly when overriding the standard key handling for a toplevel window.
windowPresent :: WindowClass self => self -> IO () Source
Presents a window to the user. This may mean raising the window in the stacking order, deiconifying it, moving it to the current desktop, and/or giving it the keyboard focus, possibly dependent on the user's platform, window manager, and preferences.
If window
is hidden, this function calls widgetShow
as well.
This function should be used when the user tries to open a window that's
already open. Say for example the preferences dialog is currently open, and
the user chooses Preferences from the menu a second time; use
windowPresent
to move the already-open dialog where the user can see it.
If you are calling this function in response to a user interaction, it is
preferable to use windowPresentWithTime
.
windowDeiconify :: WindowClass self => self -> IO () Source
Asks to deiconify (i.e. unminimize) the specified window
. Note that you
shouldn't assume the window is definitely deiconified afterward, because
other entities (e.g. the user or window manager) could iconify it again
before your code which assumes deiconification gets to run.
You can track iconification via the windowStateEvent
signal on
Widget
.
windowIconify :: WindowClass self => self -> IO () Source
Asks to iconify (i.e. minimize) the specified window
. Note that you
shouldn't assume the window is definitely iconified afterward, because other
entities (e.g. the user or window manager) could deiconify it again, or
there may not be a window manager in which case iconification isn't
possible, etc. But normally the window will end up iconified. Just don't
write code that crashes if not.
It's permitted to call this function before showing a window, in which case the window will be iconified before it ever appears onscreen.
You can track iconification via the windowStateEvent
signal on
Widget
.
windowMaximize :: WindowClass self => self -> IO () Source
Asks to maximize the window, so that it becomes full-screen. Note that you shouldn't assume the window is definitely maximized afterward, because other entities (e.g. the user or window manager) could unmaximize it again, and not all window managers support maximization. But normally the window will end up maximized. Just don't write code that crashes if not.
It's permitted to call this function before showing a window, in which case the window will be maximized when it appears onscreen initially.
You can track maximization via the windowStateEvent
signal on
Widget
.
windowUnmaximize :: WindowClass self => self -> IO () Source
Asks to unmaximize the window. Note that you shouldn't assume the window is definitely unmaximized afterward, because other entities (e.g. the user or window manager) could maximize it again, and not all window managers honor requests to unmaximize. But normally the window will end up unmaximized. Just don't write code that crashes if not.
You can track maximization via the windowStateEvent
signal on
Widget
.
windowFullscreen :: WindowClass self => self -> IO () Source
Asks to place window
in the fullscreen state. Note that you shouldn't
assume the window is definitely full screen afterward, because other
entities (e.g. the user or window manager) could unfullscreen it again, and
not all window managers honor requests to fullscreen windows. But normally
the window will end up fullscreen. Just don't write code that crashes if
not.
You can track the fullscreen state via the windowStateEvent
signal
on Widget
.
- Available since Gtk+ version 2.2
windowUnfullscreen :: WindowClass self => self -> IO () Source
Asks to toggle off the fullscreen state for window
. Note that you
shouldn't assume the window is definitely not full screen afterward, because
other entities (e.g. the user or window manager) could fullscreen it again,
and not all window managers honor requests to unfullscreen windows. But
normally the window will end up restored to its normal state. Just don't
write code that crashes if not.
You can track the fullscreen state via the windowStateEvent
signal
on Widget
.
- Available since Gtk+ version 2.2
:: WindowClass self | |
=> self | |
-> Bool |
|
-> IO () |
Asks to keep window
above, so that it stays on top. Note that you
shouldn't assume the window is definitely above afterward, because other
entities (e.g. the user or window manager) could not keep it above, and not
all window managers support keeping windows above. But normally the window
will end kept above. Just don't write code that crashes if not.
It's permitted to call this function before showing a window, in which case the window will be kept above when it appears onscreen initially.
You can track the above state via the windowStateEvent
signal on
Widget
.
Note that, according to the Extended Window Manager Hints specification, the above state is mainly meant for user preferences and should not be used by applications e.g. for drawing attention to their dialogs.
- Available since Gtk+ version 2.4
:: WindowClass self | |
=> self | |
-> Bool |
|
-> IO () |
Asks to keep window
below, so that it stays in bottom. Note that you
shouldn't assume the window is definitely below afterward, because other
entities (e.g. the user or window manager) could not keep it below, and not
all window managers support putting windows below. But normally the window
will be kept below. Just don't write code that crashes if not.
It's permitted to call this function before showing a window, in which case the window will be kept below when it appears onscreen initially.
You can track the below state via the windowStateEvent
signal on
Widget
.
Note that, according to the Extended Window Manager Hints specification, the above state is mainly meant for user preferences and should not be used by applications e.g. for drawing attention to their dialogs.
- Available since Gtk+ version 2.4
windowSetStartupId :: (WindowClass self, GlibString string) => self -> string -> IO () Source
Startup notification identifiers are used by desktop environment to track application startup,
to provide user feedback and other features. This function changes the corresponding property on the underlying GdkWindow.
Normally, startup identifier is managed automatically and you should only use this function in special cases like transferring focus from other processes. You should use this function before calling windowPresent
or any equivalent function generating a window map event.
This function is only useful on X11, not with other GTK+ targets.
- Available since Gtk+ version 2.12
windowStick :: WindowClass self => self -> IO () Source
Asks to stick window
, which means that it will appear on all user
desktops. Note that you shouldn't assume the window is definitely stuck
afterward, because other entities (e.g. the user or window manager) could
unstick it again, and some window managers do not support sticking windows.
But normally the window will end up stuck. Just don't write code that
crashes if not.
It's permitted to call this function before showing a window.
You can track stickiness via the windowStateEvent
signal on
Widget
.
windowUnstick :: WindowClass self => self -> IO () Source
Asks to unstick window
, which means that it will appear on only one of
the user's desktops. Note that you shouldn't assume the window is definitely
unstuck afterward, because other entities (e.g. the user or window manager)
could stick it again. But normally the window will end up stuck. Just don't
write code that crashes if not.
You can track stickiness via the windowStateEvent
signal on
Widget
.
:: WindowClass self | |
=> self | |
-> AccelGroup |
|
-> IO () |
Associate accelGroup
with window
, such that calling
accelGroupsActivate
on window
will activate accelerators in
accelGroup
.
:: WindowClass self | |
=> self | |
-> AccelGroup |
|
-> IO () |
Reverses the effects of windowAddAccelGroup
.
windowSetDefaultIconList :: [Pixbuf] -> IO () Source
Sets an icon list to be used as fallback for windows that haven't had windowSetIconList
called on them to set up a window-specific icon list.
This function allows you to set up the icon for all windows in your app at once.
See windowSetIconList
for more details.
windowGetDefaultIconList :: IO [Pixbuf] Source
Gets the value set by windowSetDefaultIconList
.
windowSetDefaultIcon :: Maybe Pixbuf -> IO () Source
Sets an icon to be used as fallback for windows that haven't had windowSetIcon
called on them from a pixbuf.
- Available since Gtk+ version 2.4
windowSetDefaultIconFromFile Source
:: GlibString string | |
=> string |
|
-> IO Bool | returns |
Sets an icon to be used as fallback for windows that haven't had
windowSetIconList
called on them from a file on disk. May throw a GError
if
the file cannot be loaded.
- Available since Gtk+ version 2.2
windowSetDefaultIconName Source
:: GlibString string | |
=> string |
|
-> IO () |
Sets an icon to be used as fallback for windows that haven't had
windowSetIconList
called on them from a named themed icon, see
windowSetIconName
.
- Available since Gtk+ version 2.6
windowGetDefaultIconName Source
:: GlibString string | |
=> IO string | returns the fallback icon name for windows |
Returns the fallback icon name for windows that has been set with
windowSetDefaultIconName
.
- Available since Gtk+ version 2.16
:: WindowClass self | |
=> self | |
-> Gravity |
|
-> IO () |
Window gravity defines the meaning of coordinates passed to windowMove
.
See windowMove
and Gravity
for more details.
The default window gravity is GravityNorthWest
which will typically
"do what you mean."
:: WindowClass self | |
=> self | |
-> IO Gravity | returns window gravity |
Gets the value set by windowSetGravity
.
:: WindowClass self | |
=> self | |
-> Screen |
|
-> IO () |
Sets the Screen
where the window
is displayed; if the window is
already mapped, it will be unmapped, and then remapped on the new screen.
- Available since Gtk+ version 2.2
:: WindowClass self | |
=> self | |
-> IO Screen | returns a |
Returns the Screen
associated with the window.
- Available since Gtk+ version 2.2
:: WindowClass self | |
=> self | |
-> WindowEdge |
|
-> MouseButton |
|
-> Int |
|
-> Int |
|
-> TimeStamp |
|
-> IO () |
Starts resizing a window. This function is used if an application has window resizing controls. When GDK can support it, the resize will be done using the standard mechanism for the window manager or windowing system. Otherwise, GDK will try to emulate window resizing, potentially not all that well, depending on the windowing system.
:: WindowClass self | |
=> self | |
-> MouseButton |
|
-> Int |
|
-> Int |
|
-> TimeStamp |
|
-> IO () |
Starts moving a window. This function is used if an application has window movement grips. When GDK can support it, the window movement will be done using the standard mechanism for the window manager or windowing system. Otherwise, GDK will try to emulate window movement, potentially not all that well, depending on the windowing system.
:: WindowClass self | |
=> self | |
-> WindowTypeHint |
|
-> IO () |
By setting the type hint for the window, you allow the window manager to decorate and handle the window in a way which is suitable to the function of the window in your application.
This function should be called before the window becomes visible.
:: WindowClass self | |
=> self | |
-> IO WindowTypeHint | returns the type hint for |
Gets the type hint for this window. See windowSetTypeHint
.
:: WindowClass self | |
=> self | |
-> IO (Maybe Pixbuf) | returns icon for window, or |
Gets the value set by windowSetIcon
(or if you've called
windowSetIconList
, gets the first icon in the icon list).
:: WindowClass self | |
=> self | |
-> IO (Int, Int) |
|
This function returns the position you need to pass to windowMove
to
keep window
in its current position. This means that the meaning of the
returned value varies with window gravity. See windowMove
for more
details.
If you haven't changed the window gravity, its gravity will be
GravityNorthWest
. This means that windowGetPosition
gets the position of
the top-left corner of the window manager frame for the window. windowMove
sets the position of this same top-left corner.
Moreover, nearly all window managers are historically broken with respect
to their handling of window gravity. So moving a window to its current
position as returned by windowGetPosition
tends to result in moving the
window slightly. Window managers are slowly getting better over time.
If a window has gravity GravityStatic
the window manager frame is not
relevant, and thus windowGetPosition
will always produce accurate results.
However you can't use static gravity to do things like place a window in a
corner of the screen, because static gravity ignores the window manager
decorations.
If you are saving and restoring your application's window positions, you should know that it's impossible for applications to do this without getting it somewhat wrong because applications do not have sufficient knowledge of window manager state. The Correct Mechanism is to support the session management protocol (see the "GnomeClient" object in the GNOME libraries for example) and allow the window manager to save your window sizes and positions.
:: WindowClass self | |
=> self | |
-> IO (Int, Int) | (width, height) |
Obtains the current size of the window. If the window is not onscreen, it
returns the size Gtk+ will suggest to the window manager for the initial
window size (but this is not reliably the same as the size the window
manager will actually select). The size obtained by windowGetSize
is the
last size received in a EventConfigure
, that is,
Gtk+ uses its locally-stored size, rather than querying the X server for the
size. As a result, if you call windowResize
then immediately call
windowGetSize
, the size won't have taken effect yet. After the window
manager processes the resize request, Gtk+ receives notification that the
size has changed via a configure event, and the size of the window gets
updated.
Note 1: Nearly any use of this function creates a race condition, because
the size of the window may change between the time that you get the size and
the time that you perform some action assuming that size is the current
size. To avoid race conditions, connect to "configure_event" on the window
and adjust your size-dependent state to match the size delivered in the
EventConfigure
.
Note 2: The returned size does not include the size of the window manager decorations (aka the window frame or border). Those are not drawn by Gtk+ and Gtk+ has no reliable method of determining their size.
Note 3: If you are getting a window size in order to position the window
onscreen, there may be a better way. The preferred way is to simply set the
window's semantic type with windowSetTypeHint
, which allows the window
manager to e.g. center dialogs. Also, if you set the transient parent of
dialogs with windowSetTransientFor
window managers will often center the
dialog over its parent window. It's much preferred to let the window manager
handle these things rather than doing it yourself, because all apps will
behave consistently and according to user prefs if the window manager
handles it. Also, the window manager can take the size of the window
decorations/border into account, while your application cannot.
In any case, if you insist on application-specified window positioning,
there's still a better way than doing it yourself - windowSetPosition
will frequently handle the details for you.
:: WindowClass self | |
=> self | |
-> Int |
|
-> Int |
|
-> IO () |
Asks the window manager to move window
to the given position. Window
managers are free to ignore this; most window managers ignore requests for
initial window positions (instead using a user-defined placement algorithm)
and honor requests after the window has already been shown.
Note: the position is the position of the gravity-determined reference point for the window. The gravity determines two things: first, the location of the reference point in root window coordinates; and second, which point on the window is positioned at the reference point.
By default the gravity is GravityNorthWest
, so the reference point is
simply the x
, y
supplied to windowMove
. The top-left corner of the
window decorations (aka window frame or border) will be placed at x
, y
.
Therefore, to position a window at the top left of the screen, you want to
use the default gravity (which is GravityNorthWest
) and move the window to
0,0.
To position a window at the bottom right corner of the screen, you would
set GravitySouthEast
, which means that the reference point is at x
+ the
window width and y
+ the window height, and the bottom-right corner of the
window border will be placed at that reference point. So, to place a window
in the bottom right corner you would first set gravity to south east, then
write: gtk_window_move (window, gdk_screen_width() - window_width,
gdk_screen_height() - window_height)
.
The Extended Window Manager Hints specification at http://www.freedesktop.org/Standards/wm-spec has a nice table of gravities in the "implementation notes" section.
The windowGetPosition
documentation may also be relevant.
windowParseGeometry :: (WindowClass self, GlibString string) => self -> string -> IO Bool Source
Parses a standard X Window System geometry string - see the manual page for X (type 'man X') for details on this.
windowParseGeometry
does work on all GTK+ ports including Win32 but is primarily intended for an X environment.
If either a size or a position can be extracted from the geometry string,
windowParseGeometry
returns True
and calls gtk_window_set_default_size() andor gtk_window_move() to resizemove the window.
If windowParseGeometry
returns True
,
it will also set the HintUserPos
andor HintUserSize
hints indicating to the window manager that the sizeposition of the window was user-specified
This causes most window managers to honor the geometry.
Note that for windowParseGeometry
to work as expected, it has to be called when the window has its "final" size, i.e.
after calling widgetShowAll
on the contents and windowSetGeometryHints
on the window.
windowReshowWithInitialSize :: WindowClass self => self -> IO () Source
Hides window, then reshows it, resetting the default size and position of the window. Used by GUI builders only.
:: WindowClass self | |
=> self | |
-> Int |
|
-> Int |
|
-> IO () |
Resizes the window as if the user had done so, obeying geometry
constraints. The default geometry constraint is that windows may not be
smaller than their size request; to override this constraint, call
widgetSetSizeRequest
to set the window's request to a smaller value.
If windowResize
is called before showing a window for the first time,
it overrides any default size set with windowSetDefaultSize
.
Windows may not be resized smaller than 1 by 1 pixels.
:: (WindowClass self, GlibFilePath fp) | |
=> self | |
-> fp |
|
-> IO () |
Sets the icon for window
.
This function is equivalent to calling windowSetIcon
with a pixbuf
created by loading the image from filename
.
This may throw an exception if the file cannot be loaded.
- Available since Gtk+ version 2.2
windowSetAutoStartupNotification Source
By default, after showing the first Window
for each Screen
, Gtk+
calls screenNotifyStartupComplete
. Call this function to disable the
automatic startup notification. You might do this if your first window is a
splash screen, and you want to delay notification until after your real main
window has been shown, for example.
In that example, you would disable startup notification temporarily, show your splash screen, then re-enable it so that showing the main window would automatically result in notification.
- Available since Gtk+ version 2.2
:: WindowClass self | |
=> self | |
-> TimeStamp |
|
-> IO () |
Presents a window to the user in response to a user interaction. If you
need to present a window without a timestamp, use windowPresent
. See
windowPresent
for details.
- Available since Gtk+ version 2.8
:: (WindowClass self, WidgetClass widget) | |
=> self |
|
-> Maybe widget |
|
-> Maybe (Int, Int) |
|
-> Maybe (Int, Int) |
|
-> Maybe (Int, Int) |
|
-> Maybe (Int, Int) |
|
-> Maybe (Double, Double) |
|
-> IO () |
This function sets up hints about how a window can be resized by the user. You can set a minimum and maximum size, the allowed resize increments (e.g. for xterm, you can only resize by the size of a character) and aspect ratios.
If you set a geometry widget, the hints will apply to the geometry widget instead of directly to the toplevel window. Of course since the geometry widget is a child widget of the top level window, constraining the sizing behaviour of the widget will have a knock-on effect on the sizing of the toplevel window.
The minWidth
/minHeight
/maxWidth
/maxHeight
fields may be set to
-1
, to use the size request of the window or geometry widget. If the
minimum size hint is not provided, Gtk+ will use the size requisition of the
window (or the geometry widget if it set) as the minimum size. The base size
is treated similarly.
The canonical use-case for windowSetGeometryHints
is to get a terminal
widget to resize properly. Here, the terminal text area should be the
geometry widget. Gtk+ will then automatically set the base size of the
terminal window to the size of other widgets in the terminal window, such as
the menubar and scrollbar. Then, the widthInc
and heightInc
values
should be set to the size of one character in the terminal. Finally, the
base size should be set to the size of one character. The net effect is that
the minimum size of the terminal will have a 1x1 character terminal area,
and only terminal sizes on the "character grid" will be allowed.
The other useful settings are minAspect
and maxAspect
. These specify a
width/height ratio as a floating point number. If a geometry widget is set,
the aspect applies to the geometry widget rather than the entire window. The
most common use of these hints is probably to set minAspect
and
maxAspect
to the same value, thus forcing the window to keep a constant
aspect ratio.
:: WindowClass self | |
=> Maybe self | |
-> IO WindowGroup | return the |
Returns the group for window or the default group, if window is Nothing
or if window does not have an explicit window group.
- Available since Gtk+ version 2.10
:: WindowClass self | |
=> self | |
-> IO WindowType | returns the type of the window |
Gets the type of the window. See WindowType
.
- Available since Gtk version 2.20
Attributes
windowTitle :: (WindowClass self, GlibString string) => Attr self string Source
The title of the window.
windowType :: WindowClass self => ReadAttr self WindowType Source
The type of the window.
Default value: WindowToplevel
windowAllowShrink :: WindowClass self => Attr self Bool Source
If True
, the window has no mimimum size. Setting this to True
is 99%
of the time a bad idea.
Default value: False
windowAllowGrow :: WindowClass self => Attr self Bool Source
If True
, users can expand the window beyond its minimum size.
Default value: True
windowResizable :: WindowClass self => Attr self Bool Source
If True
, users can resize the window.
Default value: True
windowHasResizeGrip :: WindowClass self => Attr self Bool Source
If True
, window has a resize grip.
Default value: True
windowModal :: WindowClass self => Attr self Bool Source
If True
, the window is modal (other windows are not usable while this
one is up).
Default value: False
windowOpacity :: WindowClass self => Attr self Double Source
The requested opacity of the window. See windowSetOpacity
for more details about window opacity.
Allowed values: [0,1]
Default values: 1
- Available since Gtk+ version 2.12
windowRole :: (WindowClass self, GlibString string) => Attr self string Source
Unique identifier for the window to be used when restoring a session.
Default value: "\"
windowStartupId :: (WindowClass self, GlibString string) => Attr self string Source
The windowStartupId
is a write-only property for setting window's startup notification identifier.
Default value: "\"
- Available since Gtk+ version 2.12
windowWindowPosition :: WindowClass self => Attr self WindowPosition Source
The initial position of the window.
Default value: WinPosNone
windowDefaultWidth :: WindowClass self => Attr self Int Source
The default width of the window, used when initially showing the window.
Allowed values: >= -1
Default value: -1
windowDefaultHeight :: WindowClass self => Attr self Int Source
The default height of the window, used when initially showing the window.
Allowed values: >= -1
Default value: -1
windowDeletable :: WindowClass self => Attr self Bool Source
Whether the window frame should have a close button.
Default values: True
- Available since Gtk+ version 2.10
windowDestroyWithParent :: WindowClass self => Attr self Bool Source
If this window should be destroyed when the parent is destroyed.
Default value: False
windowIcon :: WindowClass self => Attr self (Maybe Pixbuf) Source
Icon for this window.
windowIconName :: (WindowClass self, GlibString string) => Attr self string Source
The windowIconName
property specifies the name of the themed icon to use as the window icon. See IconTheme
for more details.
Default values: "\"
- Available since Gtk+ version 2.6
windowScreen :: WindowClass self => Attr self Screen Source
The screen where this window will be displayed.
windowTypeHint :: WindowClass self => Attr self WindowTypeHint Source
Hint to help the desktop environment understand what kind of window this is and how to treat it.
Default value: WindowTypeHintNormal
windowSkipTaskbarHint :: WindowClass self => Attr self Bool Source
True
if the window should not be in the task bar.
Default value: False
windowSkipPagerHint :: WindowClass self => Attr self Bool Source
True
if the window should not be in the pager.
Default value: False
windowUrgencyHint :: WindowClass self => Attr self Bool Source
True
if the window should be brought to the user's attention.
Default value: False
windowAcceptFocus :: WindowClass self => Attr self Bool Source
True
if the window should receive the input focus.
Default value: True
windowFocusOnMap :: WindowClass self => Attr self Bool Source
True
if the window should receive the input focus when mapped.
Default value: True
windowDecorated :: WindowClass self => Attr self Bool Source
Whether the window should be decorated by the window manager.
Default value: True
windowGravity :: WindowClass self => Attr self Gravity Source
The window gravity of the window. See windowMove
and Gravity
for more
details about window gravity.
Default value: GravityNorthWest
windowToplevelFocus :: WindowClass self => Attr self Bool Source
Whether the input focus is within this GtkWindow.
Note: If add window
before HasToplevelFocus
(has-toplevel-focus attribute)
will conflicts with fucntion windowHasToplevelFocus
, so we named this attribute
to windowToplevelFocus
.
Default values: False
windowTransientFor :: (WindowClass self, WindowClass parent) => ReadWriteAttr self (Maybe Window) parent Source
'transientFor' property. See windowGetTransientFor
and
windowSetTransientFor
windowFocus :: WindowClass self => Attr self (Maybe Widget) Source
If focus
is not the current focus widget, and is focusable, sets it as
the focus widget for the window. If focus
is Nothing
, unsets the focus widget for
this window. To set the focus to a particular widget in the toplevel, it is
usually more convenient to use widgetGrabFocus
instead of this function.
windowIconList :: WindowClass self => Attr self [Pixbuf] Source
Sets up the icon representing a Window
. The icon is used when the
window is minimized (also known as iconified). Some window managers or
desktop environments may also place it in the window frame, or display it in
other contexts.
By passing several sizes, you may improve the final image quality of the icon, by reducing or eliminating automatic image scaling.
Recommended sizes to provide: 16x16, 32x32, 48x48 at minimum, and larger images (64x64, 128x128) if you have them.
See also windowSetDefaultIconList
to set the icon for all windows in
your application in one go.
Note that transient windows (those who have been set transient for
another window using windowSetTransientFor
) will inherit their icon from
their transient parent. So there's no need to explicitly set the icon on
transient windows.
windowMnemonicModifier :: WindowClass self => Attr self [Modifier] Source
The mnemonic modifier for this window.
windowMnemonicVisible :: WindowClass self => Attr self Bool Source
Signals
frameEvent :: WindowClass self => Signal self (EventM EAny Bool) Source
Observe events that are emitted on the frame of this window.
keysChanged :: WindowClass self => Signal self (IO ()) Source
The keysChanged
signal gets emitted when the set of accelerators or mnemonics that are associated with window changes.
setFocus :: WindowClass self => Signal self (Maybe Widget -> IO ()) Source
Observe a change in input focus.