|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jogamp.newt.Window
public abstract class Window
Field Summary | |
---|---|
protected Capabilities |
caps
|
static int |
ClickTimeout
|
protected AbstractGraphicsConfiguration |
config
|
static boolean |
DEBUG_IMPLEMENTATION
|
static boolean |
DEBUG_KEY_EVENT
|
static boolean |
DEBUG_MOUSE_EVENT
|
static boolean |
DEBUG_WINDOW_EVENT
|
protected boolean |
fullscreen
|
protected int |
height
|
protected int |
nfs_height
|
protected int |
nfs_width
|
protected int |
nfs_x
|
protected int |
nfs_y
|
protected NativeWindow |
parentNativeWindow
|
protected long |
parentWindowHandle
|
protected Screen |
screen
|
protected String |
title
|
protected boolean |
undecorated
|
protected boolean |
visible
|
protected int |
width
|
protected long |
windowHandle
|
protected RecursiveToolkitLock |
windowLock
|
protected int |
x
|
protected int |
y
|
Fields inherited from interface javax.media.nativewindow.NativeWindow |
---|
LOCK_SUCCESS, LOCK_SURFACE_CHANGED, LOCK_SURFACE_NOT_READY, LOCK_SURFACE_UNLOCKED |
Constructor Summary | |
---|---|
Window()
|
Method Summary | |
---|---|
protected 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 |
addPaintListener(int index,
PaintListener l)
Inserts the given PaintListener at the
specified position in the list. |
void |
addPaintListener(PaintListener l)
Appends the given PaintListener 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 |
closeNative()
|
protected static Window |
create(String type,
NativeWindow parentNativeWindow,
long parentWindowHandle,
Screen screen,
Capabilities caps,
boolean undecorated)
|
protected static Window |
create(String type,
Object[] cstrArguments,
Screen screen,
Capabilities caps,
boolean undecorated)
|
protected abstract void |
createNativeImpl()
Create native windowHandle, ie creates a new native invisible window. |
void |
destroy()
destroys the window and children and releases windowing related resources. |
void |
destroy(boolean deep)
|
protected void |
enqueueKeyEvent(int eventType,
int modifiers,
int keyCode,
char keyChar)
|
protected void |
enqueueMouseEvent(int eventType,
int modifiers,
int x,
int y,
int button,
int rotation)
|
protected void |
enqueueWindowEvent(int eventType)
|
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 |
Window |
getInnerWindow()
Returns the most inner Window instance. Currently only GLWindow
has an aggregation to an inner Window instance. |
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()
|
Exception |
getLockedStack()
Return the lock-exception, or null if not locked. |
MouseListener |
getMouseListener(int index)
|
MouseListener[] |
getMouseListeners()
|
PaintListener |
getPaintListener(int index)
|
NativeWindow |
getParentNativeWindow()
|
Capabilities |
getRequestedCapabilities()
|
Screen |
getScreen()
|
int |
getScreenIndex()
Convenience: Get display handle from AbstractGraphicsConfiguration . |
long |
getSurfaceHandle()
Returns the handle to the surface for this NativeWindow. |
Thread |
getSurfaceLockOwner()
|
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 RecursiveToolkitLock |
getWindowLock()
|
Object |
getWrappedWindow()
If this Window actually wraps one from another toolkit such as the AWT, this will return a non-null value. |
int |
getX()
|
int |
getY()
|
boolean |
hasDeviceChanged()
If the implementation is capable of detecting a device change return true and clear the status/reason of the change. |
void |
invalidate()
render all native window information invalid, as if the native window was destroyed. |
void |
invalidate(boolean deep)
|
boolean |
isDestroyed()
|
boolean |
isFullscreen()
|
boolean |
isNativeWindowValid()
|
boolean |
isSurfaceLocked()
Return if surface is locked |
boolean |
isUndecorated()
|
boolean |
isUndecorated(boolean fullscreen)
|
boolean |
isVisible()
|
int |
lockSurface()
Recursive and blocking lockSurface() implementation |
void |
removeAllSurfaceUpdatedListener()
|
protected void |
removeChild(NativeWindow win)
|
void |
removeKeyListener(KeyListener l)
|
void |
removeMouseListener(MouseListener l)
|
void |
removePaintListener(PaintListener l)
|
void |
removeSurfaceUpdatedListener(SurfaceUpdatedListener l)
|
void |
removeWindowListener(WindowListener l)
|
void |
reparentWindow(NativeWindow newParent,
Screen newScreen)
Change this window's parent window. |
protected boolean |
reparentWindowImpl()
|
void |
requestFocus()
|
protected void |
requestFocusImpl()
|
void |
runOnEDTIfAvail(boolean wait,
Runnable task)
|
void |
sendEvent(NEWTEvent e)
|
protected void |
sendKeyEvent(KeyEvent e)
|
protected void |
sendMouseEvent(MouseEvent e)
|
protected void |
sendPaintEvent(int eventType,
int x,
int y,
int w,
int h)
|
protected void |
sendPaintEvent(PaintEvent e)
|
protected void |
sendWindowEvent(WindowEvent e)
|
boolean |
setFullscreen(boolean fullscreen)
|
protected abstract boolean |
setFullscreenImpl(boolean fullscreen,
int x,
int y,
int widht,
int height)
|
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() . |
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. |
protected abstract void |
setPositionImpl(int x,
int y)
|
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 |
protected abstract void |
setSizeImpl(int width,
int height)
|
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)
|
protected void |
shouldNotCallThis()
|
boolean |
surfaceSwap()
Provide a mechanism to utilize custom (pre-) swap surface code. |
void |
surfaceUpdated(Object updater,
NativeWindow window,
long when)
Notification of a surface update event. |
static String |
toHexString(int hex)
|
static String |
toHexString(long hex)
|
String |
toString()
|
void |
unlockSurface()
Recursive and unblocking unlockSurface() implementation |
protected void |
windowDestroyed()
|
protected void |
windowDestroyNotify()
|
protected boolean |
windowIsLocked()
|
protected void |
windowLock()
|
protected void |
windowUnlock()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final boolean DEBUG_MOUSE_EVENT
public static final boolean DEBUG_KEY_EVENT
public static final boolean DEBUG_WINDOW_EVENT
public static final boolean DEBUG_IMPLEMENTATION
protected Screen screen
protected NativeWindow parentNativeWindow
protected long parentWindowHandle
protected Capabilities caps
protected AbstractGraphicsConfiguration config
protected long windowHandle
protected boolean fullscreen
protected boolean visible
protected int width
protected int height
protected int x
protected int y
protected int nfs_width
protected int nfs_height
protected int nfs_x
protected int nfs_y
protected String title
protected boolean undecorated
public static final int ClickTimeout
protected RecursiveToolkitLock windowLock
Constructor Detail |
---|
public Window()
Method Detail |
---|
protected static Window create(String type, NativeWindow parentNativeWindow, long parentWindowHandle, Screen screen, Capabilities caps, boolean undecorated)
protected static Window create(String type, Object[] cstrArguments, Screen screen, Capabilities caps, boolean undecorated)
public void runOnEDTIfAvail(boolean wait, Runnable task)
protected abstract void createNativeImpl()
protected abstract void closeNative()
public Capabilities getRequestedCapabilities()
public NativeWindow getParentNativeWindow()
public Screen getScreen()
public String toString()
toString
in class Object
public String getTitle()
public void setTitle(String title)
protected void setTitleImpl(String title)
public void setUndecorated(boolean value)
public boolean isUndecorated(boolean fullscreen)
public boolean isUndecorated()
public void requestFocus()
protected void requestFocusImpl()
public int lockSurface()
lockSurface
in interface NativeWindow
NativeWindow.LOCK_SUCCESS
, NativeWindow.LOCK_SURFACE_CHANGED
or NativeWindow.LOCK_SURFACE_NOT_READY
.ToolkitLock
public void unlockSurface() throws NativeWindowException
unlockSurface
in interface NativeWindow
NativeWindowException
- if surface is not lockedNativeWindow.lockSurface()
,
ToolkitLock
public boolean isSurfaceLocked()
NativeWindow
isSurfaceLocked
in interface NativeWindow
public Thread getSurfaceLockOwner()
public Exception getLockedStack()
NativeWindow
NativeWindow.lockSurface()
and hence holds the locker's call stack.
getLockedStack
in interface NativeWindow
public final void destroy()
destroys the window and children and releases
windowing related resources.
all other resources and states are kept intact,
ie listeners, parent handles and size, position etc.
destroy
in interface NativeWindow
destroy(boolean)
,
invalidate()
public void destroy(boolean deep)
deep
- If true, all resources, ie listeners, parent handles, size, position
and the referenced NEWT screen and display, will be destroyed as well. Be aware that if you call
this method with deep = true, you will not be able to regenerate the Window.destroy()
,
invalidate(boolean)
public void invalidate()
render all native window information invalid,
as if the native window was destroyed.
all other resources and states are kept intact,
ie listeners, parent handles and size, position etc.
invalidate
in interface NativeWindow
destroy()
,
destroy(boolean)
,
invalidate(boolean)
public void invalidate(boolean deep)
deep
- if false only the native window handle is invalidated, otherwise all
states (references and properties) are reset. Be aware that if you call
this method with deep = true, you will not be able to regenerate the Window.invalidate()
,
destroy()
,
destroy(boolean)
public boolean isNativeWindowValid()
public boolean isDestroyed()
public boolean surfaceSwap()
NativeWindow
surfaceSwap
in interface NativeWindow
public long getDisplayHandle()
NativeWindow
getDisplayHandle
in interface NativeWindow
public int getScreenIndex()
NativeWindow
getScreenIndex
in interface NativeWindow
public long getWindowHandle()
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.
getWindowHandle
in interface NativeWindow
public long getSurfaceHandle()
NativeWindow
The surface handle should be set/update by NativeWindow.lockSurface()
,
where NativeWindow.unlockSurface()
is not allowed to modify it.
After NativeWindow.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.
getSurfaceHandle
in interface NativeWindow
public AbstractGraphicsConfiguration getGraphicsConfiguration()
NativeWindow
getGraphicsConfiguration
in interface NativeWindow
GraphicsConfigurationFactory.chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen)
public int getWidth()
getWidth
in interface NativeWindow
public int getHeight()
getHeight
in interface NativeWindow
public Insets getInsets()
public Window getInnerWindow()
GLWindow
has an aggregation to an inner Window instance.
public Object getWrappedWindow()
public int getX()
public int getY()
public boolean isVisible()
public boolean isFullscreen()
public boolean hasDeviceChanged()
public void setHandleDestroyNotify(boolean b)
destroy()
call) within windowDestroyNotify()
implementation.windowDestroyNotify()
.
protected void windowDestroyNotify()
protected void windowDestroyed()
protected boolean reparentWindowImpl()
public void reparentWindow(NativeWindow newParent, Screen newScreen)
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.newScreen
- if not null and this window handle is not yet set
this Screen is being used.public 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( 0In case this window is a child window and a parent
NativeWindow
is being used,
the parent'sNativeWindow
handle is retrieved viaNativeWindow.getWindowHandle()
.
If this action fails, ie if the parentNativeWindow
is not valid yet,
no native window is created yet andsetVisible(true)
shall be repeated when it is.
protected abstract void setVisibleImpl(boolean visible)
public void setSize(int width, int height)
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 && 0This call is ignored if in fullscreen mode.
- Parameters:
width
- of the client area of the windowheight
- of the client area of the window
protected abstract void setSizeImpl(int width, int height)
public void setPosition(int x, int y)
x+insets.left,y+insets.top
.
x
- coord of the top left cornery
- coord of the top left cornerprotected abstract void setPositionImpl(int x, int y)
public boolean setFullscreen(boolean fullscreen)
protected abstract boolean setFullscreenImpl(boolean fullscreen, int x, int y, int widht, int height)
protected void removeChild(NativeWindow win)
protected void addChild(NativeWindow win)
public void sendEvent(NEWTEvent e)
public void addSurfaceUpdatedListener(SurfaceUpdatedListener l)
com.jogamp.newt.event.SurfaceUpdatedListener
to the end of
the list.
public void addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l) throws IndexOutOfBoundsException
com.jogamp.newt.event.SurfaceUpdatedListener
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 inserted
IndexOutOfBoundsException
- If the index is not within (0 <= index && index <= size()), or -1public void removeSurfaceUpdatedListener(SurfaceUpdatedListener l)
public void removeAllSurfaceUpdatedListener()
public SurfaceUpdatedListener getSurfaceUpdatedListener(int index)
public SurfaceUpdatedListener[] getSurfaceUpdatedListeners()
public void surfaceUpdated(Object updater, NativeWindow window, long when)
SurfaceUpdatedListener
surfaceUpdated
in interface SurfaceUpdatedListener
updater
- is the caller object who updated the surface,
e.g. a JOGL GLDrawable.window
- the NativeWindow, which surface is updatedwhen
- the time in ms, when the surface was updatedprotected void enqueueMouseEvent(int eventType, int modifiers, int x, int y, int button, int rotation)
public void addMouseListener(MouseListener l)
MouseListener
to the end of
the list.
public 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 inserted
IndexOutOfBoundsException
- If the index is not within (0 <= index && index <= size()), or -1public void removeMouseListener(MouseListener l)
public MouseListener getMouseListener(int index)
public MouseListener[] getMouseListeners()
protected void sendMouseEvent(MouseEvent e)
protected void enqueueKeyEvent(int eventType, int modifiers, int keyCode, char keyChar)
public void addKeyListener(KeyListener l)
KeyListener
to the end of
the list.
public 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 inserted
IndexOutOfBoundsException
- If the index is not within (0 <= index && index <= size()), or -1public void removeKeyListener(KeyListener l)
public KeyListener getKeyListener(int index)
public KeyListener[] getKeyListeners()
protected void sendKeyEvent(KeyEvent e)
protected void enqueueWindowEvent(int eventType)
public void addWindowListener(WindowListener l)
WindowListener
to the end of
the list.
public 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 inserted
IndexOutOfBoundsException
- If the index is not within (0 <= index && index <= size()), or -1public void removeWindowListener(WindowListener l)
public WindowListener getWindowListener(int index)
public WindowListener[] getWindowListeners()
protected void sendWindowEvent(WindowEvent e)
public void addPaintListener(PaintListener l)
PaintListener
to the end of
the list.
public void addPaintListener(int index, PaintListener l)
PaintListener
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 inserted
IndexOutOfBoundsException
- If the index is not within (0 <= index && index <= size()), or -1public void removePaintListener(PaintListener l)
public PaintListener getPaintListener(int index)
protected void sendPaintEvent(int eventType, int x, int y, int w, int h)
protected void sendPaintEvent(PaintEvent e)
protected final void windowLock()
protected final void windowUnlock()
protected final boolean windowIsLocked()
protected RecursiveToolkitLock getWindowLock()
protected final void shouldNotCallThis()
public static String getThreadName()
public static String toHexString(int hex)
public static String toHexString(long hex)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |