public class Window extends Object
In theory, some, but not all, Widgets have their own native windows to draw upon and from whence events originate. Thus Widgets such as Buttons have their own underlying native resource, whereas Labels and various Containers do not. In practise, this distinction is blurred and newer versions of GTK do all sorts of strange things under the hood for greater efficiency. You don't need to worry about any of this.
These are wrappers around Xlib's Window
object. They can be
arranged in tree structures, wrapping and overlapping one another, with
parents cropping children, etc. You don't need to worry about any of this
either.
What this is useful for is as a way to get to the state of top level windows and various low level drawing functions.
Since the C name of this class is GdkWindow
, the
unavoidable consequence of the java-gnome mapping algorithm is that the
name of this class Java is Window. This can be a bit of a pain if you're
working in a piece of code where org.gnome.gtk.Window
is already imported, but c'est la vie.
Modifier and Type | Method and Description |
---|---|
boolean |
ensureNative()
Force GDK to use the old X Window allocation behaviour for this Window.
|
int |
getHeight()
Get the height of this Window.
|
int |
getOriginX()
Get the horizontal position of this Window in terms of the root
Window's co-ordinates.
|
int |
getOriginY()
Get the vertical position of this Window in terms of the root Window's
co-ordinates.
|
int |
getPositionX()
Get the horizontal position of this Window relative to its parent
Window.
|
int |
getPositionY()
Get the vertical position of this Window relative to its parent Window.
|
WindowState |
getState()
Return a flags object representing the current state of the Window
(maximized, iconified, etc).
|
int |
getWidth()
Get the width of this Window.
|
void |
invalidate(Rectangle area,
boolean recursive)
Mark the given area as damaged and needing redrawing.
|
boolean |
isViewable()
Has this underlying resouce been mapped?
|
void |
setCursor(Cursor cursor)
Set the Cursor that will be shown when the pointer hovers over this
Window.
|
public boolean ensureNative()
GDK_NATIVE_WINDOW
environment variable but not nearly as invasive.
Theoretically you should not need to use this; the whole idea of the "client-side windows" patch to GTK was to avoid having to use unnecesssary intermediate X Windows, and calling this method circumvents this optimization. Most GTK Widgets should perform just fine without reverting to the old behaviour, but in isolated corner cases it may be necessary to workaround obscure bugs.
false
should GDK be unable to
allocate native resources as requested. The consequences of
that are unclear.public int getHeight()
public int getOriginX()
public int getOriginY()
public int getPositionX()
org.gnome.gdk
Window, you may at times be surprised at
what this reports.public int getPositionY()
public WindowState getState()
WindowState
for
the individual constants, obviously, but be aware that an unmapped
Window will have no WindowState bits set.public int getWidth()
public void invalidate(Rectangle area, boolean recursive)
Widget.Draw
being emitted
on Widgets that are present in the area being invalidated.recursive
- If true
, calling this method will invalidate
not only the described area in this [org.gnome.gdk] Window,
but also the corresponding areas of any child
[org.gnome.gdk] Windows that overlap it. This is mostly an
implementation detail, but occasionally you need to find
tune the control. We tend to use true
.public boolean isViewable()
true
if show()
has been called on the Widget
that draws on this [org.gnome.gdk] Window and on all its parents, if
this Window happens to be a sub-Window.public void setCursor(Cursor cursor)
cursor
- Passing null
will cause this Window to [revert
to] using the Cursor default inherited from its parent.