com.jogamp.newt.impl
Class WindowImpl

java.lang.Object
  extended by com.jogamp.newt.impl.WindowImpl
All Implemented Interfaces:
NEWTEventConsumer, Window, NativeSurface, NativeWindow, SurfaceUpdatedListener, WindowClosingProtocol
Direct Known Subclasses:
AWTWindow, KDWindow, MacWindow, OffscreenWindow, Window, Window, WindowsWindow, X11Window

public abstract class WindowImpl
extends Object
implements Window, NEWTEventConsumer


Nested Class Summary
static interface WindowImpl.LifecycleHook
           
 
Nested classes/interfaces inherited from interface com.jogamp.newt.Window
Window.FocusRunnable, Window.ReparentAction
 
Field Summary
protected  CapabilitiesChooser capabilitiesChooser
           
protected  CapabilitiesImmutable capsRequested
           
protected  AbstractGraphicsConfiguration config
           
static boolean DEBUG_TEST_REPARENT_INCOMPATIBLE
           
protected  boolean fullscreen
           
protected  boolean hasFocus
           
protected  int height
           
protected  int nfs_height
           
protected  int nfs_width
           
protected  int nfs_x
           
protected  int nfs_y
           
protected  String title
           
protected  boolean undecorated
           
protected  boolean visible
           
protected  int width
           
protected  int x
           
protected  int y
           
 
Fields inherited from interface com.jogamp.newt.Window
DEBUG_IMPLEMENTATION, DEBUG_KEY_EVENT, DEBUG_MOUSE_EVENT, DEBUG_WINDOW_EVENT, TIMEOUT_NATIVEWINDOW
 
Fields inherited from interface javax.media.nativewindow.NativeSurface
LOCK_SUCCESS, LOCK_SURFACE_CHANGED, LOCK_SURFACE_NOT_READY, LOCK_SURFACE_UNLOCKED
 
Fields inherited from interface javax.media.nativewindow.WindowClosingProtocol
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE
 
Constructor Summary
WindowImpl()
           
 
Method Summary
 void addChild(NativeWindow win)
           
 void addKeyListener(int index, KeyListener l)
          Inserts the given KeyListener at the specified position in the list.
 void addKeyListener(KeyListener l)
          Appends the given KeyListener to the end of the list.
 void addMouseListener(int index, MouseListener l)
          Inserts the given MouseListener at the specified position in the list.
 void addMouseListener(MouseListener l)
          Appends the given MouseListener to the end of the list.
 void addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l)
          Inserts the given com.jogamp.newt.event.SurfaceUpdatedListener at the specified position in the list.
 void addSurfaceUpdatedListener(SurfaceUpdatedListener l)
          Appends the given com.jogamp.newt.event.SurfaceUpdatedListener to the end of the list.
 void addWindowListener(int index, WindowListener l)
          Inserts the given WindowListener at the specified position in the list.
 void addWindowListener(WindowListener l)
          Appends the given WindowListener to the end of the list.
protected abstract  void closeNativeImpl()
           
 boolean consumeEvent(NEWTEvent e)
          Consume the event
protected  void consumeKeyEvent(KeyEvent e)
           
protected  void consumeMouseEvent(MouseEvent e)
           
protected  void consumeWindowEvent(WindowEvent e)
           
static WindowImpl create(NativeWindow parentWindow, long parentWindowHandle, Screen screen, CapabilitiesImmutable caps)
           
static WindowImpl create(Object[] cstrArguments, Screen screen, CapabilitiesImmutable caps)
           
protected abstract  void createNativeImpl()
          The native implementation must set the native windowHandle.
The implementation should invoke the referenced java state callbacks to notify this Java object of state changes.
 void destroy()
          Destroy the Window and it's children, incl.
 void enqueueEvent(boolean wait, NEWTEvent event)
           
 void enqueueKeyEvent(boolean wait, int eventType, int modifiers, int keyCode, char keyChar)
           
 void enqueueMouseEvent(boolean wait, int eventType, int modifiers, int x, int y, int button, int rotation)
           
protected  void enqueueRequestFocus(boolean wait)
           
 void enqueueWindowEvent(boolean wait, int eventType)
           
protected  boolean focusAction()
           
protected  void focusChanged(boolean focusGained)
           
 CapabilitiesImmutable getChosenCapabilities()
          Gets an immutable set of chosen capabilities.
 int getDefaultCloseOperation()
           
 long getDisplayHandle()
          Convenience: Get display handle from AbstractGraphicsConfiguration .
 AbstractGraphicsConfiguration getGraphicsConfiguration()
          Returns the graphics configuration corresponding to this window.
 int getHeight()
          Returns the height of the client area of this window
 Insets getInsets()
          Returns the insets for this native window (the difference between the size of the toplevel window with the decorations and the client area).
 KeyListener getKeyListener(int index)
           
 KeyListener[] getKeyListeners()
           
 WindowImpl.LifecycleHook getLifecycleHook()
           
 Point getLocationOnScreen(Point storage)
          Returns the current absolute location of this window.
protected abstract  Point getLocationOnScreenImpl(int x, int y)
          Return screen coordinates of the given coordinates or null, in which case a NativeWindow traversal shall being used as demonstrated in getLocationOnScreen(javax.media.nativewindow.util.Point).
 MouseListener getMouseListener(int index)
           
 MouseListener[] getMouseListeners()
           
 NativeWindow getParent()
           
protected  long getParentWindowHandle()
           
 CapabilitiesImmutable getRequestedCapabilities()
          Gets an immutable set of requested capabilities.
 Screen getScreen()
           
 int getScreenIndex()
          Convenience: Get display handle from AbstractGraphicsConfiguration .
 long getSurfaceHandle()
          Returns the handle to the surface for this NativeSurface.
 Thread getSurfaceLockOwner()
          Return the locking owner's Thread, or null if not locked.
 SurfaceUpdatedListener getSurfaceUpdatedListener(int index)
           
 SurfaceUpdatedListener[] getSurfaceUpdatedListeners()
           
static String getThreadName()
           
 String getTitle()
           
 int getWidth()
          Returns the width of the client area of this window
 long getWindowHandle()
          Returns the window handle for this NativeWindow.
 WindowListener getWindowListener(int index)
           
 WindowListener[] getWindowListeners()
           
protected  int getWindowLockRecursionCount()
           
 Object getWrappedWindow()
          If this Window actually wraps one from another toolkit such as the AWT, this will return a non-null value.
 int getX()
          Returns the current x position of this window, relative to it's parent.
 int getY()
          Returns the current y position of this window, relative to it's parent.
 boolean hasDeviceChanged()
          If the implementation is capable of detecting a device change return true and clear the status/reason of the change.
 boolean hasFocus()
           
static void init(String type)
           
 void invalidate()
          Destroys the Window via Window.destroy() and clears all Object references, eg.
protected  void invalidate(boolean unrecoverable)
           
 boolean isFullscreen()
           
 boolean isNativeValid()
           
 boolean isSurfaceLocked()
          Return if surface is locked
 boolean isSurfaceLockedByOtherThread()
          Return if surface is locked by another thread, ie not the current one
 boolean isUndecorated()
           
 boolean isValid()
           
 boolean isVisible()
           
 int lockSurface()
          Lock the surface of this native window
protected  int lockSurfaceImpl()
           
protected  void positionChanged(int newX, int newY)
           
protected abstract  boolean reconfigureWindowImpl(int x, int y, int width, int height, boolean parentChange, int fullScreenChange, int decorationChange)
          The native implementation should invoke the referenced java state callbacks to notify this Java object of state changes.
 void removeAllSurfaceUpdatedListener()
           
 void removeChild(NativeWindow win)
           
 void removeKeyListener(KeyListener l)
           
 void removeMouseListener(MouseListener l)
           
 void removeSurfaceUpdatedListener(SurfaceUpdatedListener l)
           
 void removeWindowListener(WindowListener l)
           
 int reparentWindow(NativeWindow newParent)
          Change this window's parent window.
 int reparentWindow(NativeWindow newParent, boolean forceDestroyCreate)
           
 void requestFocus()
           
protected abstract  void requestFocusImpl(boolean force)
          The native implementation must invoke focusChanged(boolean) to change the focus state, if force == false.
 void runOnEDTIfAvail(boolean wait, Runnable task)
           
 void sendKeyEvent(int eventType, int modifiers, int keyCode, char keyChar)
           
 void sendMouseEvent(int eventType, int modifiers, int x, int y, int button, int rotation)
           
 void sendWindowEvent(int eventType)
           
 CapabilitiesChooser setCapabilitiesChooser(CapabilitiesChooser chooser)
          Set the CapabilitiesChooser to help determine the native visual type.
 int setDefaultCloseOperation(int op)
           
 void setFocusAction(Window.FocusRunnable focusAction)
          May set to a FocusRunnable, FocusRunnable#run() before Newt requests the native focus.
 boolean setFullscreen(boolean fullscreen)
           
 void setHandleDestroyNotify(boolean b)
          If set to true, the default value, this NEWT Window implementation will handle the destruction (ie destroy() call) within windowDestroyNotify() implementation.
If set to false, it's up to the caller/owner to handle destruction within windowDestroyNotify().
 WindowImpl.LifecycleHook setLifecycleHook(WindowImpl.LifecycleHook hook)
           
 void setPosition(int x, int y)
          Sets the location of the top left corner of the window, including decorations (so the client area will be placed at x+insets.left,y+insets.top.
This call is ignored if in fullscreen mode.
 void setSize(int width, int height)
          Sets the size of the client area of the window, excluding decorations Total size of the window will be width+insets.left+insets.right, height+insets.top+insets.bottom
 void setTitle(String title)
           
protected  void setTitleImpl(String title)
           
 void setUndecorated(boolean value)
           
 void setVisible(boolean visible)
           setVisible makes the window and children visible if visible is true, otherwise the window and children becomes invisible.
protected abstract  void setVisibleImpl(boolean visible, int x, int y, int width, int height)
          The native implementation must invoke visibleChanged(boolean) to change the visibility state.
protected  void setWindowHandle(long handle)
           
protected  void shouldNotCallThis()
           
protected  void sizeChanged(int newWidth, int newHeight, boolean force)
           
 boolean surfaceSwap()
          Provide a mechanism to utilize custom (pre-) swap surface code.
 void surfaceUpdated(Object updater, NativeSurface ns, long when)
          Notification of a surface update event.
static String toHexString(int hex)
           
static String toHexString(long hex)
           
 String toString()
           
 void unlockSurface()
          Unlock the surface of this native window Shall not modify the surface handle, see NativeSurface.lockSurface()
protected  void unlockSurfaceImpl()
           
protected  void visibleChanged(boolean visible)
           
protected  void windowDestroyNotify()
           
 void windowRepaint(int x, int y, int width, int height)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEBUG_TEST_REPARENT_INCOMPATIBLE

public static final boolean DEBUG_TEST_REPARENT_INCOMPATIBLE

config

protected AbstractGraphicsConfiguration config

capsRequested

protected CapabilitiesImmutable capsRequested

capabilitiesChooser

protected CapabilitiesChooser capabilitiesChooser

fullscreen

protected boolean fullscreen

visible

protected boolean visible

hasFocus

protected boolean hasFocus

width

protected int width

height

protected int height

x

protected int x

y

protected int y

nfs_width

protected int nfs_width

nfs_height

protected int nfs_height

nfs_x

protected int nfs_x

nfs_y

protected int nfs_y

title

protected String title

undecorated

protected boolean undecorated
Constructor Detail

WindowImpl

public WindowImpl()
Method Detail

init

public static void init(String type)

create

public static WindowImpl create(NativeWindow parentWindow,
                                long parentWindowHandle,
                                Screen screen,
                                CapabilitiesImmutable caps)

create

public static WindowImpl create(Object[] cstrArguments,
                                Screen screen,
                                CapabilitiesImmutable caps)

lockSurfaceImpl

protected int lockSurfaceImpl()

unlockSurfaceImpl

protected void unlockSurfaceImpl()

getDefaultCloseOperation

public int getDefaultCloseOperation()
Specified by:
getDefaultCloseOperation in interface WindowClosingProtocol
Returns:
the current close operation value
See Also:
WindowClosingProtocol.DISPOSE_ON_CLOSE, WindowClosingProtocol.DO_NOTHING_ON_CLOSE

setDefaultCloseOperation

public int setDefaultCloseOperation(int op)
Specified by:
setDefaultCloseOperation in interface WindowClosingProtocol
Parameters:
op - the new close operation value
Returns:
the previous close operation value
See Also:
WindowClosingProtocol.DISPOSE_ON_CLOSE, WindowClosingProtocol.DO_NOTHING_ON_CLOSE

createNativeImpl

protected abstract void createNativeImpl()
The native implementation must set the native windowHandle.
The implementation should invoke the referenced java state callbacks to notify this Java object of state changes.

See Also:
windowDestroyNotify(), focusChanged(boolean), visibleChanged(boolean), #sizeChanged(int,int), positionChanged(int,int), windowDestroyNotify()

closeNativeImpl

protected abstract void closeNativeImpl()

requestFocusImpl

protected abstract void requestFocusImpl(boolean force)
The native implementation must invoke focusChanged(boolean) to change the focus state, if force == false. This may happen asynchronous within Window.TIMEOUT_NATIVEWINDOW.

Parameters:
force - if true, bypass focusChanged(boolean) and force focus request

setVisibleImpl

protected abstract void setVisibleImpl(boolean visible,
                                       int x,
                                       int y,
                                       int width,
                                       int height)
The native implementation must invoke visibleChanged(boolean) to change the visibility state. This may happen asynchronous within Window.TIMEOUT_NATIVEWINDOW.


reconfigureWindowImpl

protected abstract boolean reconfigureWindowImpl(int x,
                                                 int y,
                                                 int width,
                                                 int height,
                                                 boolean parentChange,
                                                 int fullScreenChange,
                                                 int decorationChange)
The native implementation should invoke the referenced java state callbacks to notify this Java object of state changes.

Parameters:
x - -1 if no position change requested, otherwise greater than zero
y - -1 if no position change requested, otherwise greater than zero
width - -1 if no size change requested, otherwise greater than zero
height - -1 if no size change requested, otherwise greater than zero
parentChange - true if reparenting requested, otherwise false
fullScreenChange - 0 if unchanged, -1 fullscreen off, 1 fullscreen on
decorationChange - 0 if unchanged, -1 undecorated, 1 decorated
See Also:
#sizeChanged(int,int), positionChanged(int,int)

setTitleImpl

protected void setTitleImpl(String title)

getLocationOnScreenImpl

protected abstract Point getLocationOnScreenImpl(int x,
                                                 int y)
Return screen coordinates of the given coordinates or null, in which case a NativeWindow traversal shall being used as demonstrated in getLocationOnScreen(javax.media.nativewindow.util.Point).

Returns:
if not null, the screen location of the given coordinates

lockSurface

public final int lockSurface()
Description copied from interface: NativeSurface
Lock the surface of this native window

The surface handle, see NativeSurface.lockSurface(),
shall be valid after a successfull call, ie return a value other than NativeSurface.LOCK_SURFACE_NOT_READY.

This call is blocking until the surface has been locked or a timeout is reached. The latter will throw a runtime exception.

This call allows recursion from the same thread.

The implementation may want to aquire the application level RecursiveLock first before proceeding with a native surface lock.

The implementation shall also invoke AbstractGraphicsDevice.lock() for the initial lock (recursive count zero).

Specified by:
lockSurface in interface NativeSurface
Returns:
NativeSurface.LOCK_SUCCESS, NativeSurface.LOCK_SURFACE_CHANGED or NativeSurface.LOCK_SURFACE_NOT_READY.
See Also:
RecursiveLock

unlockSurface

public final void unlockSurface()
Description copied from interface: NativeSurface
Unlock the surface of this native window Shall not modify the surface handle, see NativeSurface.lockSurface()

The implementation shall also invoke AbstractGraphicsDevice.unlock() for the final unlock (recursive count zero).

Specified by:
unlockSurface in interface NativeSurface
See Also:
NativeSurface.lockSurface(), RecursiveLock

isSurfaceLockedByOtherThread

public final boolean isSurfaceLockedByOtherThread()
Description copied from interface: NativeSurface
Return if surface is locked by another thread, ie not the current one

Specified by:
isSurfaceLockedByOtherThread in interface NativeSurface

isSurfaceLocked

public final boolean isSurfaceLocked()
Description copied from interface: NativeSurface
Return if surface is locked

Specified by:
isSurfaceLocked in interface NativeSurface

getSurfaceLockOwner

public final Thread getSurfaceLockOwner()
Description copied from interface: NativeSurface
Return the locking owner's Thread, or null if not locked.

Specified by:
getSurfaceLockOwner in interface NativeSurface

getSurfaceHandle

public long getSurfaceHandle()
Description copied from interface: NativeSurface
Returns the handle to the surface for this NativeSurface.

The surface handle should be set/update by NativeSurface.lockSurface(), where NativeSurface.unlockSurface() is not allowed to modify it. After NativeSurface.unlockSurface() it is no more guaranteed that the surface handle is still valid. The surface handle shall reflect the platform one for all drawable surface operations, e.g. opengl, swap-buffer.

On X11 this returns an entity of type Window, since there is no differentiation of surface and window there.
On Microsoft Windows this returns an entity of type HDC.

Specified by:
getSurfaceHandle in interface NativeSurface

surfaceSwap

public boolean surfaceSwap()
Description copied from interface: NativeSurface
Provide a mechanism to utilize custom (pre-) swap surface code. This method is called before the render toolkit (e.g. JOGL) swaps the buffer/surface. The implementation may itself apply the swapping, in which case true shall be returned.

Specified by:
surfaceSwap in interface NativeSurface
Returns:
true if this method completed swapping the surface, otherwise false, in which case eg the GLDrawable implementation has to swap the code.

getGraphicsConfiguration

public AbstractGraphicsConfiguration getGraphicsConfiguration()
Description copied from interface: NativeSurface
Returns the graphics configuration corresponding to this window.

Specified by:
getGraphicsConfiguration in interface NativeSurface
See Also:
javax.media.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen)

getDisplayHandle

public final long getDisplayHandle()
Description copied from interface: NativeSurface
Convenience: Get display handle from AbstractGraphicsConfiguration . AbstractGraphicsScreen . AbstractGraphicsDevice

Specified by:
getDisplayHandle in interface NativeSurface

getScreenIndex

public final int getScreenIndex()
Description copied from interface: NativeSurface
Convenience: Get display handle from AbstractGraphicsConfiguration . AbstractGraphicsScreen

Specified by:
getScreenIndex in interface NativeSurface

getParent

public final NativeWindow getParent()
Specified by:
getParent in interface NativeWindow
Returns:
The parent NativeWindow, or null if this NativeWindow is top level.

getWindowHandle

public final long getWindowHandle()
Description copied from interface: NativeWindow
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.

Specified by:
getWindowHandle in interface NativeWindow

getLocationOnScreen

public Point getLocationOnScreen(Point storage)
Description copied from interface: NativeWindow
Returns the current absolute location of this window.

Specified by:
getLocationOnScreen in interface NativeWindow
Parameters:
storage - 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.

isNativeValid

public final boolean isNativeValid()
Specified by:
isNativeValid in interface Window
Returns:
true if the native window handle is valid and ready to operate, ie if the native window has been created, otherwise false.
See Also:
Window.setVisible(boolean), #destroy(boolean)

isValid

public final boolean isValid()
Specified by:
isValid in interface Window
Returns:
True if native window is valid, can be created or recovered. Otherwise false, ie this window is unrecoverable due to a destroy(true) call.
See Also:
#destroy(boolean), Window.setVisible(boolean)

getScreen

public final Screen getScreen()
Specified by:
getScreen in interface Window
Returns:
The associated Screen

setVisible

public void setVisible(boolean visible)
Description copied from interface: Window

setVisible makes the window and children visible if visible is true, otherwise the window and children becomes invisible.

The setVisible(true) is responsible to actual create the native window.

Zero size semantics are respected, see Window.setSize(int,int):

 if ( 0 == windowHandle && visible ) {
 this.visible = visible;
 if( 0

In case this window is a child window and a parent NativeWindow is being used,
the parent's NativeWindow handle is retrieved via NativeWindow.getWindowHandle().
If this action fails, ie if the parent NativeWindow is not valid yet,
no native window is created yet and setVisible(true) shall be repeated when it is.

Specified by:
setVisible in interface Window

setSize

public void setSize(int width,
                    int height)
Description copied from interface: Window
Sets the size of the client area of the window, excluding decorations Total size of the window will be width+insets.left+insets.right, height+insets.top+insets.bottom

Zero size semantics are respected, see Window.setVisible(boolean):

 if ( 0 != windowHandle && 0>=width*height && visible ) {
 setVisible(false);
 } else if ( 0 == windowHandle && 0

This call is ignored if in fullscreen mode.

Specified by:
setSize in interface Window
Parameters:
width - of the client area of the window
height - of the client area of the window

destroy

public void destroy()
Description copied from interface: Window
Destroy the Window and it's children, incl. native destruction.
The Window can be recreate via setVisible(true).

This method invokes Screen.removeReference() after it's own destruction,
which will issue Screen.destroy() if the reference count becomes 0.
This destruction sequence shall end up in Display.destroy(), if all reference counts become 0.

Specified by:
destroy in interface Window
Specified by:
destroy in interface NativeWindow
See Also:
Window.invalidate(), Window.setVisible(boolean)

invalidate

public final void invalidate()
Description copied from interface: Window
Destroys the Window via Window.destroy() and clears all Object references, eg. all states, size, position, parent handles, list of child Windows and reference to it's Screen.
This Window cannot be recreated after calling this method anymore.

Specified by:
invalidate in interface Window

invalidate

protected void invalidate(boolean unrecoverable)
Parameters:
unrecoverable - If true, all states, size, position, parent handles, reference to it's Screen are reset. Otherwise you can recreate the window, via setVisible(true).
See Also:
invalidate(), destroy(), #destroy(boolean)

reparentWindow

public final int reparentWindow(NativeWindow newParent)
Description copied from interface: Window
Change this window's parent window.

In case the old parent is not null and a Window, this window is removed from it's list of children.
In case the new parent is not null and a Window, this window is added to it's list of children.

Specified by:
reparentWindow in interface Window
Parameters:
newParent - The new parent NativeWindow. If null, this Window becomes a top level window.
Returns:
The issued reparent action type (strategy) as defined in Window.ReparentAction

reparentWindow

public int reparentWindow(NativeWindow newParent,
                          boolean forceDestroyCreate)
Specified by:
reparentWindow in interface Window

setCapabilitiesChooser

public CapabilitiesChooser setCapabilitiesChooser(CapabilitiesChooser chooser)
Description copied from interface: Window
Set the CapabilitiesChooser to help determine the native visual type.

Specified by:
setCapabilitiesChooser in interface Window
Parameters:
chooser - the new CapabilitiesChooser
Returns:
the previous CapabilitiesChooser

getChosenCapabilities

public final CapabilitiesImmutable getChosenCapabilities()
Description copied from interface: Window
Gets an immutable set of chosen capabilities.

Specified by:
getChosenCapabilities in interface Window
Returns:
the chosen capabilities

getRequestedCapabilities

public final CapabilitiesImmutable getRequestedCapabilities()
Description copied from interface: Window
Gets an immutable set of requested capabilities.

Specified by:
getRequestedCapabilities in interface Window
Returns:
the requested capabilities

getTitle

public String getTitle()
Specified by:
getTitle in interface Window

setTitle

public void setTitle(String title)
Specified by:
setTitle in interface Window

setUndecorated

public void setUndecorated(boolean value)
Specified by:
setUndecorated in interface Window

isUndecorated

public boolean isUndecorated()
Specified by:
isUndecorated in interface Window

requestFocus

public void requestFocus()
Specified by:
requestFocus in interface Window

hasFocus

public boolean hasFocus()
Specified by:
hasFocus in interface Window

getInsets

public Insets getInsets()
Description copied from interface: Window
Returns the insets for this native window (the difference between the size of the toplevel window with the decorations and the client area).

Specified by:
getInsets in interface Window
Returns:
insets for this platform window

getWidth

public final int getWidth()
Description copied from interface: Window
Returns the width of the client area of this window

Specified by:
getWidth in interface Window
Specified by:
getWidth in interface NativeSurface
Returns:
width of the client area

getHeight

public final int getHeight()
Description copied from interface: Window
Returns the height of the client area of this window

Specified by:
getHeight in interface Window
Specified by:
getHeight in interface NativeSurface
Returns:
height of the client area

getX

public final int getX()
Description copied from interface: NativeWindow
Returns the current x position of this window, relative to it's parent.

Specified by:
getX in interface Window
Specified by:
getX in interface NativeWindow

getY

public final int getY()
Description copied from interface: NativeWindow
Returns the current y position of this window, relative to it's parent.

Specified by:
getY in interface Window
Specified by:
getY in interface NativeWindow

isVisible

public final boolean isVisible()
Specified by:
isVisible in interface Window

isFullscreen

public final boolean isFullscreen()
Specified by:
isFullscreen in interface Window

hasDeviceChanged

public boolean hasDeviceChanged()
If the implementation is capable of detecting a device change return true and clear the status/reason of the change.


getLifecycleHook

public WindowImpl.LifecycleHook getLifecycleHook()

setLifecycleHook

public WindowImpl.LifecycleHook setLifecycleHook(WindowImpl.LifecycleHook hook)

getWrappedWindow

public Object getWrappedWindow()
If this Window actually wraps one from another toolkit such as the AWT, this will return a non-null value.


setHandleDestroyNotify

public void setHandleDestroyNotify(boolean b)
If set to true, the default value, this NEWT Window implementation will handle the destruction (ie destroy() call) within windowDestroyNotify() implementation.
If set to false, it's up to the caller/owner to handle destruction within windowDestroyNotify().


getParentWindowHandle

protected final long getParentWindowHandle()

toString

public String toString()
Overrides:
toString in class Object

setWindowHandle

protected final void setWindowHandle(long handle)

runOnEDTIfAvail

public void runOnEDTIfAvail(boolean wait,
                            Runnable task)
Specified by:
runOnEDTIfAvail in interface Window

enqueueRequestFocus

protected void enqueueRequestFocus(boolean wait)

setFocusAction

public void setFocusAction(Window.FocusRunnable focusAction)
May set to a FocusRunnable, FocusRunnable#run() before Newt requests the native focus. This allows notifying a covered window toolkit like AWT that the focus is requested, hence focus traversal can be made transparent.

Specified by:
setFocusAction in interface Window

focusAction

protected boolean focusAction()

setPosition

public void setPosition(int x,
                        int y)
Description copied from interface: Window
Sets the location of the top left corner of the window, including decorations (so the client area will be placed at x+insets.left,y+insets.top.
This call is ignored if in fullscreen mode.

Specified by:
setPosition in interface Window
Parameters:
x - coord of the top left corner
y - coord of the top left corner

setFullscreen

public boolean setFullscreen(boolean fullscreen)
Specified by:
setFullscreen in interface Window

removeChild

public final void removeChild(NativeWindow win)
Specified by:
removeChild in interface Window

addChild

public final void addChild(NativeWindow win)
Specified by:
addChild in interface Window

enqueueEvent

public void enqueueEvent(boolean wait,
                         NEWTEvent event)
Specified by:
enqueueEvent in interface Window

consumeEvent

public boolean consumeEvent(NEWTEvent e)
Description copied from interface: NEWTEventConsumer
Consume the event

Specified by:
consumeEvent in interface NEWTEventConsumer
Returns:
true if the event has been consumed, otherwise it returns false for later propagation.

addSurfaceUpdatedListener

public void addSurfaceUpdatedListener(SurfaceUpdatedListener l)
Description copied from interface: Window
Appends the given com.jogamp.newt.event.SurfaceUpdatedListener to the end of the list.

Specified by:
addSurfaceUpdatedListener in interface Window

addSurfaceUpdatedListener

public void addSurfaceUpdatedListener(int index,
                                      SurfaceUpdatedListener l)
                               throws IndexOutOfBoundsException
Description copied from interface: Window
Inserts the given com.jogamp.newt.event.SurfaceUpdatedListener at the specified position in the list.

Specified by:
addSurfaceUpdatedListener in interface Window
Parameters:
index - Position where the listener will be inserted. Should be within (0 <= index && index <= size()). An index value of -1 is interpreted as the end of the list, size().
l - The listener object to be inserted
Throws:
IndexOutOfBoundsException - If the index is not within (0 <= index && index <= size()), or -1

removeSurfaceUpdatedListener

public void removeSurfaceUpdatedListener(SurfaceUpdatedListener l)
Specified by:
removeSurfaceUpdatedListener in interface Window

removeAllSurfaceUpdatedListener

public void removeAllSurfaceUpdatedListener()
Specified by:
removeAllSurfaceUpdatedListener in interface Window

getSurfaceUpdatedListener

public SurfaceUpdatedListener getSurfaceUpdatedListener(int index)
Specified by:
getSurfaceUpdatedListener in interface Window

getSurfaceUpdatedListeners

public SurfaceUpdatedListener[] getSurfaceUpdatedListeners()
Specified by:
getSurfaceUpdatedListeners in interface Window

surfaceUpdated

public void surfaceUpdated(Object updater,
                           NativeSurface ns,
                           long when)
Description copied from interface: SurfaceUpdatedListener
Notification of a surface update event.

Specified by:
surfaceUpdated in interface SurfaceUpdatedListener
Parameters:
updater - is the caller object who updated the surface, e.g. a JOGL GLDrawable.
ns - the updated NativeSurface
when - the time in ms, when the surface was updated

sendMouseEvent

public void sendMouseEvent(int eventType,
                           int modifiers,
                           int x,
                           int y,
                           int button,
                           int rotation)

enqueueMouseEvent

public void enqueueMouseEvent(boolean wait,
                              int eventType,
                              int modifiers,
                              int x,
                              int y,
                              int button,
                              int rotation)

addMouseListener

public void addMouseListener(MouseListener l)
Description copied from interface: Window
Appends the given MouseListener to the end of the list.

Specified by:
addMouseListener in interface Window

addMouseListener

public void addMouseListener(int index,
                             MouseListener l)
Description copied from interface: Window
Inserts the given MouseListener at the specified position in the list.

Specified by:
addMouseListener in interface Window
Parameters:
index - Position where the listener will be inserted. Should be within (0 <= index && index <= size()). An index value of -1 is interpreted as the end of the list, size().
l - The listener object to be inserted

removeMouseListener

public void removeMouseListener(MouseListener l)
Specified by:
removeMouseListener in interface Window

getMouseListener

public MouseListener getMouseListener(int index)
Specified by:
getMouseListener in interface Window

getMouseListeners

public MouseListener[] getMouseListeners()
Specified by:
getMouseListeners in interface Window

consumeMouseEvent

protected void consumeMouseEvent(MouseEvent e)

sendKeyEvent

public void sendKeyEvent(int eventType,
                         int modifiers,
                         int keyCode,
                         char keyChar)

enqueueKeyEvent

public void enqueueKeyEvent(boolean wait,
                            int eventType,
                            int modifiers,
                            int keyCode,
                            char keyChar)

addKeyListener

public void addKeyListener(KeyListener l)
Description copied from interface: Window
Appends the given KeyListener to the end of the list.

Specified by:
addKeyListener in interface Window

addKeyListener

public void addKeyListener(int index,
                           KeyListener l)
Description copied from interface: Window
Inserts the given KeyListener at the specified position in the list.

Specified by:
addKeyListener in interface Window
Parameters:
index - Position where the listener will be inserted. Should be within (0 <= index && index <= size()). An index value of -1 is interpreted as the end of the list, size().
l - The listener object to be inserted

removeKeyListener

public void removeKeyListener(KeyListener l)
Specified by:
removeKeyListener in interface Window

getKeyListener

public KeyListener getKeyListener(int index)
Specified by:
getKeyListener in interface Window

getKeyListeners

public KeyListener[] getKeyListeners()
Specified by:
getKeyListeners in interface Window

consumeKeyEvent

protected void consumeKeyEvent(KeyEvent e)

sendWindowEvent

public void sendWindowEvent(int eventType)
Specified by:
sendWindowEvent in interface Window

enqueueWindowEvent

public void enqueueWindowEvent(boolean wait,
                               int eventType)

addWindowListener

public void addWindowListener(WindowListener l)
Description copied from interface: Window
Appends the given WindowListener to the end of the list.

Specified by:
addWindowListener in interface Window

addWindowListener

public void addWindowListener(int index,
                              WindowListener l)
                       throws IndexOutOfBoundsException
Description copied from interface: Window
Inserts the given WindowListener at the specified position in the list.

Specified by:
addWindowListener in interface Window
Parameters:
index - Position where the listener will be inserted. Should be within (0 <= index && index <= size()). An index value of -1 is interpreted as the end of the list, size().
l - The listener object to be inserted
Throws:
IndexOutOfBoundsException - If the index is not within (0 <= index && index <= size()), or -1

removeWindowListener

public final void removeWindowListener(WindowListener l)
Specified by:
removeWindowListener in interface Window

getWindowListener

public WindowListener getWindowListener(int index)
Specified by:
getWindowListener in interface Window

getWindowListeners

public WindowListener[] getWindowListeners()
Specified by:
getWindowListeners in interface Window

consumeWindowEvent

protected void consumeWindowEvent(WindowEvent e)

focusChanged

protected void focusChanged(boolean focusGained)
Parameters:
focusGained -

visibleChanged

protected void visibleChanged(boolean visible)

sizeChanged

protected void sizeChanged(int newWidth,
                           int newHeight,
                           boolean force)

positionChanged

protected void positionChanged(int newX,
                               int newY)

windowDestroyNotify

protected void windowDestroyNotify()

windowRepaint

public void windowRepaint(int x,
                          int y,
                          int width,
                          int height)
Specified by:
windowRepaint in interface Window

getWindowLockRecursionCount

protected int getWindowLockRecursionCount()

shouldNotCallThis

protected final void shouldNotCallThis()

getThreadName

public static String getThreadName()

toHexString

public static String toHexString(int hex)

toHexString

public static String toHexString(long hex)


Copyright 2010 JogAmp Community.