com.jogamp.newt
Interface Window

All Superinterfaces:
NativeSurface, NativeWindow, SurfaceUpdatedListener
All Known Implementing Classes:
GLWindow

public interface Window
extends NativeWindow

Specifying the public Window functionality for the using a Window and for shadowing one like GLWindow.


Nested Class Summary
static interface Window.FocusRunnable
           
static interface Window.ReparentAction
          Defining ids for the reparenting strategy
 
Field Summary
static boolean DEBUG_IMPLEMENTATION
           
static boolean DEBUG_KEY_EVENT
           
static boolean DEBUG_MOUSE_EVENT
           
static boolean DEBUG_WINDOW_EVENT
           
static long TIMEOUT_NATIVEWINDOW
          A 1s timeout while waiting for a native action response, ie setVisible(boolean).
 
Fields inherited from interface javax.media.nativewindow.NativeSurface
LOCK_SUCCESS, LOCK_SURFACE_CHANGED, LOCK_SURFACE_NOT_READY, LOCK_SURFACE_UNLOCKED
 
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.
 void destroy()
          Destroy the Window and it's children, incl.
 void enqueueEvent(boolean wait, NEWTEvent event)
           
 CapabilitiesImmutable getChosenCapabilities()
          Gets an immutable set of chosen capabilities.
 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()
           
 MouseListener getMouseListener(int index)
           
 MouseListener[] getMouseListeners()
           
 CapabilitiesImmutable getRequestedCapabilities()
          Gets an immutable set of requested capabilities.
 Screen getScreen()
           
 SurfaceUpdatedListener getSurfaceUpdatedListener(int index)
           
 SurfaceUpdatedListener[] getSurfaceUpdatedListeners()
           
 String getTitle()
           
 int getWidth()
          Returns the width of the client area of this window
 WindowListener getWindowListener(int index)
           
 WindowListener[] getWindowListeners()
           
 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 hasFocus()
           
 void invalidate()
          Destroys the Window via destroy() and clears all Object references, eg.
 boolean isFullscreen()
           
 boolean isNativeValid()
           
 boolean isUndecorated()
           
 boolean isValid()
           
 boolean isVisible()
           
 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()
           
 void runOnEDTIfAvail(boolean wait, Runnable task)
           
 void sendWindowEvent(int eventType)
           
 CapabilitiesChooser setCapabilitiesChooser(CapabilitiesChooser chooser)
          Set the CapabilitiesChooser to help determine the native visual type.
 void setFocusAction(Window.FocusRunnable focusAction)
          May set to a Window.FocusRunnable, Window.FocusRunnable.run() before Newt requests the native focus.
 boolean setFullscreen(boolean fullscreen)
           
 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)
           
 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.
 void windowRepaint(int x, int y, int width, int height)
           
 
Methods inherited from interface javax.media.nativewindow.NativeWindow
getLocationOnScreen, getParent, getWindowHandle
 
Methods inherited from interface javax.media.nativewindow.NativeSurface
getDisplayHandle, getGraphicsConfiguration, getScreenIndex, getSurfaceHandle, getSurfaceLockOwner, isSurfaceLocked, isSurfaceLockedByOtherThread, lockSurface, surfaceSwap, unlockSurface
 
Methods inherited from interface javax.media.nativewindow.SurfaceUpdatedListener
surfaceUpdated
 

Field Detail

DEBUG_MOUSE_EVENT

static final boolean DEBUG_MOUSE_EVENT

DEBUG_KEY_EVENT

static final boolean DEBUG_KEY_EVENT

DEBUG_WINDOW_EVENT

static final boolean DEBUG_WINDOW_EVENT

DEBUG_IMPLEMENTATION

static final boolean DEBUG_IMPLEMENTATION

TIMEOUT_NATIVEWINDOW

static final long TIMEOUT_NATIVEWINDOW
A 1s timeout while waiting for a native action response, ie setVisible(boolean).

See Also:
Constant Field Values
Method Detail

isValid

boolean isValid()
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), setVisible(boolean)

isNativeValid

boolean isNativeValid()
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:
setVisible(boolean), #destroy(boolean)

getScreen

Screen getScreen()
Returns:
The associated Screen

setCapabilitiesChooser

CapabilitiesChooser setCapabilitiesChooser(CapabilitiesChooser chooser)
Set the CapabilitiesChooser to help determine the native visual type.

Parameters:
chooser - the new CapabilitiesChooser
Returns:
the previous CapabilitiesChooser

getRequestedCapabilities

CapabilitiesImmutable getRequestedCapabilities()
Gets an immutable set of requested capabilities.

Returns:
the requested capabilities

getChosenCapabilities

CapabilitiesImmutable getChosenCapabilities()
Gets an immutable set of chosen capabilities.

Returns:
the chosen capabilities

destroy

void destroy()
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 NativeWindow
See Also:
invalidate(), setVisible(boolean)

invalidate

void invalidate()
Destroys the Window via 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.


setVisible

void setVisible(boolean visible)

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


isVisible

boolean isVisible()

addChild

void addChild(NativeWindow win)

removeChild

void removeChild(NativeWindow win)

setSize

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

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

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

This call is ignored if in fullscreen mode.

Parameters:
width - of the client area of the window
height - of the client area of the window

getWidth

int getWidth()
Returns the width of the client area of this window

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

getHeight

int getHeight()
Returns the height of the client area of this window

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

reparentWindow

int reparentWindow(NativeWindow newParent)
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.

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

int reparentWindow(NativeWindow newParent,
                   boolean forceDestroyCreate)

setFullscreen

boolean setFullscreen(boolean fullscreen)

isFullscreen

boolean isFullscreen()

setPosition

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.

Parameters:
x - coord of the top left corner
y - coord of the top left corner

getX

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 NativeWindow

getY

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 NativeWindow

getInsets

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

Returns:
insets for this platform window

setUndecorated

void setUndecorated(boolean value)

isUndecorated

boolean isUndecorated()

setTitle

void setTitle(String title)

getTitle

String getTitle()

setFocusAction

void setFocusAction(Window.FocusRunnable focusAction)
May set to a Window.FocusRunnable, Window.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.


requestFocus

void requestFocus()

hasFocus

boolean hasFocus()

windowRepaint

void windowRepaint(int x,
                   int y,
                   int width,
                   int height)

enqueueEvent

void enqueueEvent(boolean wait,
                  NEWTEvent event)

runOnEDTIfAvail

void runOnEDTIfAvail(boolean wait,
                     Runnable task)

addSurfaceUpdatedListener

void addSurfaceUpdatedListener(SurfaceUpdatedListener l)
Appends the given com.jogamp.newt.event.SurfaceUpdatedListener to the end of the list.


addSurfaceUpdatedListener

void addSurfaceUpdatedListener(int index,
                               SurfaceUpdatedListener l)
                               throws IndexOutOfBoundsException
Inserts the given com.jogamp.newt.event.SurfaceUpdatedListener at the specified position in the list.

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

removeAllSurfaceUpdatedListener

void removeAllSurfaceUpdatedListener()

removeSurfaceUpdatedListener

void removeSurfaceUpdatedListener(SurfaceUpdatedListener l)

getSurfaceUpdatedListener

SurfaceUpdatedListener getSurfaceUpdatedListener(int index)

getSurfaceUpdatedListeners

SurfaceUpdatedListener[] getSurfaceUpdatedListeners()

sendWindowEvent

void sendWindowEvent(int eventType)

addWindowListener

void addWindowListener(WindowListener l)
Appends the given WindowListener to the end of the list.


addWindowListener

void addWindowListener(int index,
                       WindowListener l)
                       throws IndexOutOfBoundsException
Inserts the given WindowListener at the specified position in the list.

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

void removeWindowListener(WindowListener l)

getWindowListener

WindowListener getWindowListener(int index)

getWindowListeners

WindowListener[] getWindowListeners()

addKeyListener

void addKeyListener(KeyListener l)
Appends the given KeyListener to the end of the list.


addKeyListener

void addKeyListener(int index,
                    KeyListener l)
Inserts the given KeyListener at the specified position in the list.

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

removeKeyListener

void removeKeyListener(KeyListener l)

getKeyListener

KeyListener getKeyListener(int index)

getKeyListeners

KeyListener[] getKeyListeners()

addMouseListener

void addMouseListener(MouseListener l)
Appends the given MouseListener to the end of the list.


addMouseListener

void addMouseListener(int index,
                      MouseListener l)
Inserts the given MouseListener at the specified position in the list.

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

removeMouseListener

void removeMouseListener(MouseListener l)

getMouseListener

MouseListener getMouseListener(int index)

getMouseListeners

MouseListener[] getMouseListeners()


Copyright 2010 JogAmp Community.