public interface Window extends NativeWindow, WindowClosingProtocol
GLWindow
.Modifier and Type | Interface and Description |
---|---|
static interface |
Window.FocusRunnable |
static interface |
Window.ReparentAction
Defining ids for the reparenting strategy
|
Modifier and Type | Field and Description |
---|---|
static boolean |
DEBUG_IMPLEMENTATION |
static boolean |
DEBUG_KEY_EVENT |
static boolean |
DEBUG_MOUSE_EVENT |
static long |
TIMEOUT_NATIVEWINDOW
A 1s timeout while waiting for a native action response, ie
setVisible(boolean) . |
LOCK_SUCCESS, LOCK_SURFACE_CHANGED, LOCK_SURFACE_NOT_READY, LOCK_SURFACE_UNLOCKED
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE
Modifier and Type | Method and Description |
---|---|
boolean |
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 |
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 |
confinePointer(boolean confine)
Confine the pointer to this window, ie.
|
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.
|
Window |
getDelegatedWindow()
If the implementation uses delegation, return the delegated
Window instance,
otherwise return this instance. |
KeyListener |
getKeyListener(int index) |
KeyListener[] |
getKeyListeners() |
MouseListener |
getMouseListener(int index) |
MouseListener[] |
getMouseListeners() |
CapabilitiesImmutable |
getRequestedCapabilities()
Gets an immutable set of requested capabilities.
|
Screen |
getScreen() |
String |
getTitle() |
WindowListener |
getWindowListener(int index) |
WindowListener[] |
getWindowListeners() |
boolean |
isAlwaysOnTop() |
boolean |
isFullscreen() |
boolean |
isNativeValid() |
boolean |
isPointerConfined() |
boolean |
isPointerVisible() |
boolean |
isUndecorated() |
boolean |
isVisible() |
boolean |
removeChild(NativeWindow win) |
void |
removeKeyListener(KeyListener l) |
void |
removeMouseListener(MouseListener l) |
void |
removeWindowListener(WindowListener l) |
int |
reparentWindow(NativeWindow newParent)
Change this window's parent window.
|
int |
reparentWindow(NativeWindow newParent,
boolean forceDestroyCreate) |
void |
requestFocus()
Request focus for this native window
|
void |
requestFocus(boolean wait)
Request focus for this native window
|
void |
runOnEDTIfAvail(boolean wait,
Runnable task) |
void |
sendWindowEvent(int eventType) |
void |
setAlwaysOnTop(boolean value) |
CapabilitiesChooser |
setCapabilitiesChooser(CapabilitiesChooser chooser)
Set the CapabilitiesChooser to help determine the native visual type.
|
void |
setFocusAction(Window.FocusRunnable focusAction)
Sets a
Window.FocusRunnable ,
which Window.FocusRunnable.run() method is executed before the native focus is requested. |
boolean |
setFullscreen(boolean fullscreen) |
void |
setKeyboardFocusHandler(KeyListener l)
Sets a
KeyListener allowing focus traversal with a covered window toolkit like AWT. |
void |
setPointerVisible(boolean pointerVisible)
Makes the pointer visible or invisible.
|
void |
setPosition(int x,
int y)
Sets the location of the window's client area, excluding insets (window decorations).
This call is ignored if in fullscreen mode. |
void |
setSize(int width,
int height)
Sets the size of the window's client area, excluding decorations.
|
void |
setTitle(String title) |
void |
setTopLevelPosition(int x,
int y)
Sets the location of the top-level window inclusive insets (window decorations).
|
void |
setTopLevelSize(int width,
int height)
Sets the size of the top-level window including insets (window decorations).
|
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 |
warpPointer(int x,
int y)
Moves the pointer to x/y relative to this window's origin.
|
void |
windowRepaint(int x,
int y,
int width,
int height) |
getInsets, getLocationOnScreen, getParent, getWindowHandle, getX, getY, hasFocus
addSurfaceUpdatedListener, addSurfaceUpdatedListener, getDisplayHandle, getGraphicsConfiguration, getHeight, getScreenIndex, getSurfaceHandle, getSurfaceLockOwner, getWidth, isSurfaceLocked, isSurfaceLockedByOtherThread, lockSurface, removeSurfaceUpdatedListener, surfaceSwap, unlockSurface
surfaceUpdated
getDefaultCloseOperation, setDefaultCloseOperation
static final boolean DEBUG_MOUSE_EVENT
static final boolean DEBUG_KEY_EVENT
static final boolean DEBUG_IMPLEMENTATION
static final long TIMEOUT_NATIVEWINDOW
setVisible(boolean)
.boolean isNativeValid()
setVisible(true)
, otherwise false.setVisible(boolean)
,
#destroy(boolean)
Screen getScreen()
CapabilitiesChooser setCapabilitiesChooser(CapabilitiesChooser chooser)
chooser
- the new CapabilitiesChooserCapabilitiesImmutable getRequestedCapabilities()
CapabilitiesImmutable getChosenCapabilities()
void destroy()
setVisible(true)
.
Visibility is set to false.
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.
destroy
in interface NativeWindow
destroy()
,
setVisible(boolean)
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 < width*height ) { createNative(); } } else if ( this.visible != visible ) { this.visible = visible; setNativeSizeImpl(); }
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.
boolean isVisible()
Window getDelegatedWindow()
Window
instance,
otherwise return this
instance.boolean addChild(NativeWindow win)
boolean removeChild(NativeWindow win)
void setSize(int width, int height)
Zero size semantics are respected, see setVisible(boolean)
:
if ( 0 != windowHandle && 0 ≥ width*height && visible ) { setVisible(false); } else if ( 0 == windowHandle && 0 < width*height && visible ) { setVisible(true); } else { // as expected .. }
This call is ignored if in fullscreen mode.
width
- of the window's client areaheight
- of the window's client areaNativeWindow.getInsets()
void setTopLevelSize(int width, int height)
Note: Insets (if supported) are available only after the window is set visible and hence has been created.
width
- of the top-level window areaheight
- of the top-level window areasetSize(int, int)
,
NativeWindow.getInsets()
void setPosition(int x, int y)
x
- coord of the client-area's top left cornery
- coord of the client-area's top left cornerNativeWindow.getInsets()
void setTopLevelPosition(int x, int y)
Note: Insets (if supported) are available only after the window is set visible and hence has been created.
This call is ignored if in fullscreen mode.x
- coord of the top-level left cornery
- coord of the top-level left cornersetPosition(int, int)
,
NativeWindow.getInsets()
void setUndecorated(boolean value)
boolean isUndecorated()
void setAlwaysOnTop(boolean value)
boolean isAlwaysOnTop()
void setTitle(String title)
String getTitle()
boolean isPointerVisible()
void setPointerVisible(boolean pointerVisible)
pointerVisible
- defaults to true
for platforms w/ visible pointer,
otherwise defaults to true
, eg. Android.confinePointer(boolean)
boolean isPointerConfined()
void confinePointer(boolean confine)
Before jailing the mouse pointer, the window request the focus and the pointer is centered in the window.
In combination w/ warpPointer(int, int)
and maybe setPointerVisible(boolean)
a simple mouse
navigation can be realized.
confine
- defaults to false
.void warpPointer(int x, int y)
x
- relative pointer x position within this windowy
- relative pointer y position within this windowconfinePointer(boolean)
int reparentWindow(NativeWindow newParent)
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.
newParent
- The new parent NativeWindow. If null, this Window becomes a top level window.int reparentWindow(NativeWindow newParent, boolean forceDestroyCreate)
boolean setFullscreen(boolean fullscreen)
boolean isFullscreen()
void setFocusAction(Window.FocusRunnable focusAction)
Window.FocusRunnable
,
which Window.FocusRunnable.run()
method is executed before the native focus is requested.
This allows notifying a covered window toolkit like AWT that the focus is requested, hence focus traversal can be made transparent.
void setKeyboardFocusHandler(KeyListener l)
KeyListener
allowing focus traversal with a covered window toolkit like AWT.
The KeyListener
methods are invoked prior to all other KeyListener
's
allowing to suppress the KeyEvent
via the InputEvent.consumedTag
.
l
- void requestFocus()
The request is handled on this Window EDT and blocked until finished.
requestFocus(boolean)
void requestFocus(boolean wait)
The request is handled on this Window EDT.
wait
- true if waiting until the request is executed, otherwise falserequestFocus()
void windowRepaint(int x, int y, int width, int height)
void enqueueEvent(boolean wait, NEWTEvent event)
void runOnEDTIfAvail(boolean wait, Runnable task)
void sendWindowEvent(int eventType)
void addWindowListener(WindowListener l)
WindowListener
to the end of
the list.void addWindowListener(int index, WindowListener l) throws IndexOutOfBoundsException
WindowListener
at the
specified position in the list.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 insertedIndexOutOfBoundsException
- If the index is not within (0 <= index && index <= size()), or -1void removeWindowListener(WindowListener l)
WindowListener getWindowListener(int index)
WindowListener[] getWindowListeners()
void addKeyListener(KeyListener l)
KeyListener
to the end of
the list.void addKeyListener(int index, KeyListener l)
KeyListener
at the
specified position in the list.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 insertedIndexOutOfBoundsException
- If the index is not within (0 <= index && index <= size()), or -1void removeKeyListener(KeyListener l)
KeyListener getKeyListener(int index)
KeyListener[] getKeyListeners()
void addMouseListener(MouseListener l)
MouseListener
to the end of
the list.void addMouseListener(int index, MouseListener l)
MouseListener
at the
specified position in the list.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 insertedIndexOutOfBoundsException
- If the index is not within (0 <= index && index <= size()), or -1void removeMouseListener(MouseListener l)
MouseListener getMouseListener(int index)
MouseListener[] getMouseListeners()
Copyright 2010 JogAmp Community.