javax.media.nativewindow
Interface NativeWindow

All Superinterfaces:
NativeSurface, SurfaceUpdatedListener
All Known Subinterfaces:
Window
All Known Implementing Classes:
GLWindow, JAWTWindow

public interface NativeWindow
extends NativeSurface

Extend the NativeSurface interface with windowing information such as window handle and position.

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 javax.media.nativewindow.NativeSurface
LOCK_SUCCESS, LOCK_SURFACE_CHANGED, LOCK_SURFACE_NOT_READY, LOCK_SURFACE_UNLOCKED
 
Method Summary
 void destroy()
          Destroys this window incl.
 InsetsImmutable getInsets()
          Returns the insets defined as the width and height of the window decoration on the left, right, top and bottom.
Insets are zero if the window is undecorated, including child windows.
 Point getLocationOnScreen(Point point)
          Returns the current position of the top-left corner of the client area in screen coordinates.
 NativeWindow getParent()
           
 long getWindowHandle()
          Returns the window handle for this NativeWindow.
 int getX()
           
 int getY()
           
 boolean hasFocus()
          Returns true if this native window owns the focus, otherwise false.
 
Methods inherited from interface javax.media.nativewindow.NativeSurface
addSurfaceUpdatedListener, addSurfaceUpdatedListener, getDisplayHandle, getGraphicsConfiguration, getHeight, getScreenIndex, getSurfaceHandle, getSurfaceLockOwner, getWidth, isSurfaceLockedByOtherThread, lockSurface, removeSurfaceUpdatedListener, surfaceSwap, unlockSurface
 
Methods inherited from interface javax.media.nativewindow.SurfaceUpdatedListener
surfaceUpdated
 

Method Detail

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.
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 at

   getX() - getInsets().getLeftWidth()
   getY() - getInsets().getTopHeight()
 
The top-level window size is
   getWidth()  + getInsets().getTotalWidth()
   getHeight() + getInsets().getTotalHeight()
 

Returns:
insets

getX

int getX()
Returns:
the current x position of the top-left corner of the client area relative to it's parent. Since the position reflects the client area, it does not include the insets.
See Also:
getInsets()

getY

int getY()
Returns:
the current y position of the top-left corner of the client area relative to it's parent. Since the position reflects the client area, it does not include the insets.
See Also:
getInsets()

getLocationOnScreen

Point getLocationOnScreen(Point point)
Returns the current position of the top-left corner of the client area in screen coordinates.

Since the position reflects the client area, it does not include the insets.

Parameters:
point - if not null, Point.translate(javax.media.nativewindow.util.Point) the passed Point by this location on the screen and return it.
Returns:
either the passed non null translated point by the screen location of this NativeWindow, or a new instance with the screen location of this NativeWindow.

hasFocus

boolean hasFocus()
Returns true if this native window owns the focus, otherwise false.



Copyright 2010 JogAmp Community.