Interface NativeWindow
-
- All Superinterfaces:
NativeSurface
,NativeSurfaceHolder
,SurfaceUpdatedListener
- All Known Implementing Classes:
JAWTWindow
public interface NativeWindow extends NativeSurface, NativeSurfaceHolder
Extend theNativeSurface
interface with windowing information such aswindow-handle
,window-size
andwindow-position
.All values of this interface are represented in window units, if not stated otherwise. See
NativeSurface
.Coordinate System
- Abstract screen space has it's origin in the top-left corner, and may not be at 0/0.
- Window origin is in it's top-left corner, see
getX()
andgetY()
. - Window client-area excludes
insets
, i.e. window decoration. - Window origin is relative to it's parent window if exist, or the screen position (top-level).
A window toolkit such as the AWT may either implement this interface directly with one of its components, or provide and register an implementation of
NativeWindowFactory
which can create NativeWindow objects for its components.
-
-
Field Summary
-
Fields inherited from interface com.jogamp.nativewindow.NativeSurface
LOCK_SUCCESS, LOCK_SURFACE_CHANGED, LOCK_SURFACE_NOT_READY, LOCK_SURFACE_UNLOCKED
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
destroy()
Destroys this window incl.Rectangle
getBounds()
Returns a newly createdRectangle
containing window origin,getX()
&getY()
, and size,getWidth()
&getHeight()
, in window units.int
getHeight()
Returns the height of the client area excluding insets (window decorations) in window units.InsetsImmutable
getInsets()
Returns the insets defined as the width and height of the window decoration on the left, right, top and bottom in window units.Point
getLocationOnScreen(Point point)
Returns the window's top-left client-area position in the screen.NativeSurface
getNativeSurface()
Returns the associatedNativeSurface
of thisNativeSurfaceHolder
.NativeWindow
getParent()
Rectangle
getSurfaceBounds()
Returns a newly createdRectangle
containing window's surface origin and size in pixel units.int
getWidth()
Returns the width of the client area excluding insets (window decorations) in window units.long
getWindowHandle()
Returns the window handle for this NativeWindow.int
getX()
Returns the x position of the top-left corner of the client area relative to it's parent in window units.int
getY()
Returns the current y position of the top-left corner of the client area relative to it's parent in window units.boolean
hasFocus()
Returns true if this native window owns the focus, otherwise false.-
Methods inherited from interface com.jogamp.nativewindow.NativeSurface
addSurfaceUpdatedListener, addSurfaceUpdatedListener, convertToPixelUnits, convertToWindowUnits, getDisplayHandle, getGraphicsConfiguration, getLock, getScreenIndex, getSurfaceHandle, getSurfaceHeight, getSurfaceLockOwner, getSurfaceWidth, isSurfaceLockedByOtherThread, lockSurface, removeSurfaceUpdatedListener, surfaceSwap, unlockSurface
-
Methods inherited from interface com.jogamp.nativewindow.SurfaceUpdatedListener
surfaceUpdated
-
-
-
-
Method Detail
-
getNativeSurface
NativeSurface getNativeSurface()
Returns the associatedNativeSurface
of thisNativeSurfaceHolder
.Returns this instance, which is-a
NativeSurface
.- Specified by:
getNativeSurface
in interfaceNativeSurfaceHolder
-
destroy
void destroy()
Destroys this window incl. releasing all related resources.
-
getParent
NativeWindow getParent()
- Returns:
- The parent NativeWindow, or null if this NativeWindow is top level.
-
getWindowHandle
long getWindowHandle()
Returns the window handle for this NativeWindow.The window handle shall reflect the platform one for all window related operations, e.g. open, close, resize.
On X11 this returns an entity of type Window.
On Microsoft Windows this returns an entity of type HWND.
-
getInsets
InsetsImmutable getInsets()
Returns the insets defined as the width and height of the window decoration on the left, right, top and bottom in window units.Insets are zero if the window is undecorated, including child windows.
Insets are available only after the native window has been created, ie. the native window has been made visible.
The top-level window area's top-left corner is located atgetX()
- getInsets().getLeftWidth()
getY()
- getInsets().getTopHeight()
getWidth()
+ getInsets().getTotalWidth()
getHeight()
+ getInsets().getTotalHeight()
- Returns:
- insets
-
getX
int getX()
Returns the x position of the top-left corner of the client area relative to it's parent in window units.If no parent exist (top-level window), this coordinate equals the screen coordinate.
Since the position reflects the client area, it does not include the insets.
See Coordinate System.
- See Also:
getInsets()
,getLocationOnScreen(Point)
-
getY
int getY()
Returns the current y position of the top-left corner of the client area relative to it's parent in window units.If no parent exist (top-level window), this coordinate equals the screen coordinate.
Since the position reflects the client area, it does not include the insets.
See Coordinate System.
- See Also:
getInsets()
,getLocationOnScreen(Point)
-
getWidth
int getWidth()
Returns the width of the client area excluding insets (window decorations) in window units.- Returns:
- width of the client area in window units
- See Also:
NativeSurface.getSurfaceWidth()
-
getHeight
int getHeight()
Returns the height of the client area excluding insets (window decorations) in window units.- Returns:
- height of the client area in window units
- See Also:
NativeSurface.getSurfaceHeight()
-
getBounds
Rectangle getBounds()
Returns a newly createdRectangle
containing window origin,getX()
&getY()
, and size,getWidth()
&getHeight()
, in window units.
-
getSurfaceBounds
Rectangle getSurfaceBounds()
Returns a newly createdRectangle
containing window's surface origin and size in pixel units.
-
getLocationOnScreen
Point getLocationOnScreen(Point point)
Returns the window's top-left client-area position in the screen.If
Point
is notnull
, it is translated about the resulting screen position and returned.See Coordinate System.
Since the position reflects the client area, it does not include the insets.
- Parameters:
point
- OptionalPoint
storage. If not null,null
, it is translated about the resulting screen position and returned.- See Also:
getX()
,getY()
,getInsets()
-
hasFocus
boolean hasFocus()
Returns true if this native window owns the focus, otherwise false.
-
-