public abstract class WindowSurface extends Object implements ISurface, WindowConstants, SIPConstants
The WindowSurface also is responsible for generating UI events like keyboard and pen/mouse events as well as paint and resize events.
Modifier and Type | Class and Description |
---|---|
static interface |
WindowSurface.RawEventFilter
RawEventFilter objects form a chain of filters.
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
amClosed |
protected boolean |
amCreated |
Object |
applicationWindow |
static Object |
defaultIcon |
static String |
defaultWindowTitle |
static boolean |
invisibleMousePointer |
protected static WindowSurface |
mainSurface
MainSurface should be the first surface created.
|
protected static int |
nativeDialogCount |
static boolean |
noCloseButtons |
protected Overlayer |
overlayer |
protected int |
screenId |
IMAGE_SURFACE, PRINTERJOB_SURFACE, WINDOW_SURFACE
FLAG_ACCEPTS_DROPPED_FILES, FLAG_ALWAYS_ENABLED, FLAG_ALWAYS_ON_TOP, FLAG_CAN_MAXIMIZE, FLAG_CAN_MINIMIZE, FLAG_CAN_RESIZE, FLAG_DONT_CLEAR_BACKGROUND, FLAG_FOR_SIZE_NO_CLOSE_BUTTON, FLAG_FOR_SIZE_NO_TITLE, FLAG_FULL_SCREEN, FLAG_HAS_CLOSE_BUTTON, FLAG_HAS_TASKBAR_ENTRY, FLAG_HAS_TITLE, FLAG_IS_DEFAULT_SIZE, FLAG_IS_DEFAULT_SURFACE, FLAG_IS_ICONIZED, FLAG_IS_MODAL, FLAG_IS_NOT_DEFAULT_SURFACE, FLAG_IS_VISIBLE, FLAG_MAXIMIZE, FLAG_MAXIMIZE_ON_PDA, FLAG_MINIMIZE, FLAG_SHOW_SIP_BUTTON, FLAG_VISIBLE_ON_TO_FRONT, GUI_FLAG_DONT_REPAINT_ON_RESIZE, GUI_FLAG_HAS_TASKBAR, GUI_FLAG_REPAINT_FULL_CONTROL, GUI_FLAG_REVERSE_OK_CANCEL, SPECIAL_MOUSE_MOVE, SPECIAL_MOUSE_RELEASE_CAPTURE, SPECIAL_MOUSE_RESIZE, STATE_ACCEPT_DROPPED_FILES, STATE_FULL_SCREEN, STATE_MAXIMIZED, STATE_MINIMIZED, STATE_NORMAL, STATE_REJECT_DROPPED_FILES, STATE_RESTORE, STATE_TO_FRONT, STATE_UNKNOWN
SIP_CURRENT, SIP_FREEZE, SIP_IS_ON, SIP_LEAVE_BUTTON, SIP_LOCK, SIP_ON, SIP_OVERRIDE_USE_SIP, SIP_REMOVE_BUTTON, SIP_UNFREEZE
Modifier | Constructor and Description |
---|---|
protected |
WindowSurface() |
Modifier and Type | Method and Description |
---|---|
void |
acceptDroppedFiles(boolean accept)
Use this to enable or disable the accepting of dropped files.
|
void |
addRawEventFilter(WindowSurface.RawEventFilter filter,
boolean toBottom) |
static boolean |
canCopyFrom()
Returns if it is possible to copy pixel data from a window.
|
abstract int |
captureAppKeys(int options) |
boolean |
captureMouse(boolean doGrab)
For every call with doGrab is true there must be a matching one with
doGrab being false.
|
static void |
checkModalActive(WindowSurface who) |
abstract void |
clearCursorRegions()
Remove all set cursor regions.
|
void |
clearScreenSizeInInches() |
static void |
clearScreenSizeInInches(int screen) |
void |
close() |
void |
create(WindowCreationData wco)
This will create the actual system Window.
|
static int |
createCursor(ImageData[] images,
int hotspotX,
int hotspotY)
This is used to create a custom cursor where an alpha-blended and non-alpha blended version
is available.
|
static int |
createCursor(ImageData image,
int hotspotX,
int hotspotY)
Create a Cursor that can be used with WindowSurface.setCursor().
|
protected void |
createDefault() |
static WindowSurface |
createDefaultWindow() |
ITaskbarEntry |
createTaskbarEntry() |
protected abstract boolean |
doCaptureMouse(boolean doGrab) |
protected abstract void |
doClose() |
protected abstract void |
doCreate(WindowCreationData wcd) |
abstract ITaskbarEntry |
doCreateTaskbarEntry() |
protected abstract boolean |
doGetDPI(double[] dest) |
protected int |
doStartNativeInput(NativeInputParameters nip) |
static void |
enterNativeDialog()
Call this if you are calling a method that brings up a non-blocking native dialog.
|
static void |
eveMain(String[] args) |
static void |
exitNativeDialog()
Call this when a native dialog box has been closed.
|
void |
expectRepaintIn(int milliseconds) |
abstract int |
getAsyncKeyState(int whichKey)
Return the current press state of a particular key or mouse button at this instant
in time.
|
abstract boolean |
getBounds(Rect dest)
Get the bounds of the full window in the screen.
|
abstract boolean |
getClientRect(Rect dest)
Get the rect of the client area within the full window.
|
Image |
getCompatibleImagePoints(double widthInPoints,
double heightInPoints)
Get an Image that is optimized for display on the surface and which covers a specific size in points (1/72 of an inch)
when rendered on the surface.
|
boolean |
getDPI(double[] dest)
Get the dots per inch resolution of the surface if possible.
|
abstract Object |
getDroppedData(int dataID) |
int |
getFlags()
Get the Flags for a Window.
|
abstract int |
getFlagsForSize(int requestedWidth,
int requestedHeight,
int requestedSetFlags,
int requestedClearFlags)
This is used during Window creation.
|
abstract Font |
getFont() |
FontMetrics |
getFontMetrics(Font f)
Return a FontMetrics for the surface.
|
int |
getGuiFlags()
Get the GUI Flags for the device.
|
abstract Object |
getInfo(int infoCode,
Object parameters,
Object destination,
int options) |
static WindowSurface |
getMainSurface()
This returns the MainSurface to be used by the application.
|
static WindowSurface |
getModal() |
WindowSurface |
getModalWindow() |
static int |
getNativeDialogCount() |
Object |
getNativeDrawable()
This is used internally and should not be used.
|
static WindowSurface |
getNew()
Create a new native WindowSurface.
|
abstract boolean |
getParentSize(Dimension dest)
If the Window is a child window, this returns the size of the
parent Window.
|
protected abstract boolean |
getRawEvent(long howLongToWait,
RawEvent destination) |
RawEvent |
getRawEvent(TimeOut howLongToWait)
This returns a re-used RawEvent.
|
SurfaceEvent |
getReusedSurfaceEvent(TimeOut howLongToWait) |
static boolean |
getScreenDPI(double[] dest) |
static boolean |
getScreenDPI(int screenId,
double[] dest) |
int[] |
getScreenIds()
Get the IDs of all the screens supported on the device.
|
boolean |
getScreenRect(Dimension dest)
Get the size of the screen this Window is displayed in.
|
abstract boolean |
getScreenRect(int screenId,
Rect dest,
boolean desktopOnly) |
boolean |
getScreenRect(Rect dest,
boolean desktopOnly)
Get the size of the screen this Window is displayed in.
|
boolean |
getScreenSizeInInches(double[] sizeInInches) |
static boolean |
getScreenSizeInInches(int screen,
double[] sizeInInches) |
int |
getSIP() |
int |
getSIP(WindowSurface win) |
abstract int |
getState() |
int |
getSurfaceType()
This returns one of the XXX_SURFACE values.
|
abstract String |
getTitle()
Get the title text of the window.
|
static Gate |
getWindowsLock() |
abstract boolean |
hasPendingEvents() |
static boolean |
inNativeDialog()
Returns whether enterNativeDialog() has been called but no matching exitNativeDialog()
has been called.
|
static boolean |
inNativeTextInput() |
boolean |
isClosed()
Returns if this Window has been closed.
|
boolean |
isVisible() |
static void |
main(String[] args) |
static boolean |
modalWindowHasPendingEvents() |
protected int |
nativeGetSetSIP(WindowSurface win,
int sipValue)
If no SIP is supported this should throw a runtime exception or error.
|
void |
postEvent(Event ev) |
abstract void |
postRawEvent(RawEvent event)
This posts a copy of the data in the RawEvent.
|
abstract void |
removeCursorRegion(int regionID)
Remove the specified cursor region.
|
void |
removeRawEventFilter(WindowSurface.RawEventFilter filter) |
abstract void |
requestRepaint(int x,
int y,
int width,
int height,
boolean dontMerge) |
abstract boolean |
setBounds(int x,
int y,
int width,
int height) |
abstract boolean |
setClientRect(int x,
int y,
int width,
int height) |
boolean |
setCursor(int cursor)
Set the mouse pointer to be a particular cursor.
|
int |
setCursorRegion(int regionID,
int x,
int y,
int width,
int height,
int cursor)
Modify or create an area in the window that will be assigned a specific cursor
(mouse pointer).
|
abstract int |
setFlags(int flagsToSet,
int flagsToClear)
Set or get the Flags for a Window.
|
abstract boolean |
setFont(Font font) |
abstract int |
setGuiFlags(int flagsToset,
int flagsToClear)
Set or get the GUI Flags for the device.
|
abstract boolean |
setIcon(DeviceIcon icon)
Get the mouse pointer state at this point in time.
|
abstract boolean |
setInfo(int infoCode,
Object parameters,
int options) |
void |
setModal(boolean modalOn) |
void |
setOverlays(IOverlay[] overlays) |
void |
setScreenSizeInInches(double width,
double height) |
static void |
setScreenSizeInInches(int screen,
double width,
double height)
Set the size of the screen in inches.
|
void |
setSIP(int value) |
void |
setSIP(int mode,
WindowSurface win) |
void |
setSIP(int mode,
WindowSurface win,
RawEvent getEvent) |
abstract void |
setState(int newState) |
abstract boolean |
setTaskbarIcon(DeviceIcon icon) |
abstract void |
setTitle(String title)
Set the title text of the window.
|
void |
setVisible(boolean visible) |
static void |
shutdown() |
abstract boolean |
specialOperation(int which,
Object data) |
boolean |
startNativeInput(NativeInputParameters nip) |
static boolean |
supportsMultiple()
Returns if the underlying system supports multiple windows for an application.
|
protected abstract void |
takeKeyFocus() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canCapture, canMove, captureImage, drawImage, getCompatibleImage, getGraphics, moveImage
protected int screenId
protected Overlayer overlayer
protected boolean amClosed
protected boolean amCreated
public static boolean noCloseButtons
public static boolean invisibleMousePointer
public Object applicationWindow
protected static WindowSurface mainSurface
public static String defaultWindowTitle
protected static int nativeDialogCount
public static Object defaultIcon
public static void shutdown()
public Object getNativeDrawable()
ISurface
getNativeDrawable
in interface ISurface
public int getSurfaceType()
ISurface
getSurfaceType
in interface ISurface
public static WindowSurface getMainSurface()
protected void createDefault()
public static WindowSurface createDefaultWindow()
public static Gate getWindowsLock()
public abstract void postRawEvent(RawEvent event)
event
- the event to post.public abstract void requestRepaint(int x, int y, int width, int height, boolean dontMerge)
public abstract boolean hasPendingEvents()
protected abstract boolean getRawEvent(long howLongToWait, RawEvent destination) throws InterruptedException
InterruptedException
public void expectRepaintIn(int milliseconds)
public void removeRawEventFilter(WindowSurface.RawEventFilter filter)
public void addRawEventFilter(WindowSurface.RawEventFilter filter, boolean toBottom)
public RawEvent getRawEvent(TimeOut howLongToWait) throws InterruptedException
howLongToWait
- how long to wait before returning.InterruptedException
- if the thread was interrupted.protected abstract void takeKeyFocus()
public SurfaceEvent getReusedSurfaceEvent(TimeOut howLongToWait) throws InterruptedException
InterruptedException
public void postEvent(Event ev)
public static int getNativeDialogCount()
public static void enterNativeDialog()
public static void exitNativeDialog()
public static boolean inNativeDialog()
public static boolean supportsMultiple()
public static boolean canCopyFrom()
public static WindowSurface getNew()
public boolean isClosed()
public static WindowSurface getModal()
public static boolean modalWindowHasPendingEvents()
public WindowSurface getModalWindow()
public void setModal(boolean modalOn)
public static void checkModalActive(WindowSurface who)
protected abstract void doCreate(WindowCreationData wcd)
public void create(WindowCreationData wco)
wco
- parameters for creation.protected abstract void doClose()
public final void close()
public abstract void setState(int newState)
public abstract int getState()
public void setVisible(boolean visible)
public boolean isVisible()
public abstract boolean getBounds(Rect dest)
dest
- a non-null destination Rect.public abstract boolean getClientRect(Rect dest)
dest
- a non-null destination Rect.public abstract boolean setBounds(int x, int y, int width, int height)
public abstract boolean setClientRect(int x, int y, int width, int height)
public abstract boolean getScreenRect(int screenId, Rect dest, boolean desktopOnly)
public abstract boolean getParentSize(Dimension dest)
dest
- a non-null destination Dimension object.public abstract int setFlags(int flagsToSet, int flagsToClear)
flagsToSet
- Flags to set.flagsToClear
- Flags to clear.public int getFlags()
public abstract int getFlagsForSize(int requestedWidth, int requestedHeight, int requestedSetFlags, int requestedClearFlags)
requestedWidth
- the desired width of the Window.requestedHeight
- the desired height of the Window.requestedSetFlags
- the Flags to be set.requestedClearFlags
- the Flags to be cleared.public abstract int getAsyncKeyState(int whichKey)
keyCode
- One of the eve.fx.gui.IKeys constants.IKeys
public abstract boolean setIcon(DeviceIcon icon)
destination
- a destination SurfacePointerEvent to hold the current mouse state.public abstract boolean setTaskbarIcon(DeviceIcon icon)
public abstract Object getDroppedData(int dataID)
public abstract Font getFont()
public abstract boolean setFont(Font font)
public abstract int setGuiFlags(int flagsToset, int flagsToClear)
flagsToSet
- flags to set.flagsToClear
- flags to clear.public int getGuiFlags()
public abstract String getTitle()
public abstract void setTitle(String title)
title
- the new title for the window.public final boolean getScreenRect(Rect dest, boolean desktopOnly)
dest
- a non-null destination Rect.desktopOnly
- true to get the Rect representing the desktop area of the screen.public final boolean getScreenRect(Dimension dest)
dest
- a non-null destination Dimension.public int[] getScreenIds()
public abstract Object getInfo(int infoCode, Object parameters, Object destination, int options)
public abstract boolean setInfo(int infoCode, Object parameters, int options)
public int getSIP()
public void setSIP(int value)
public abstract int captureAppKeys(int options)
protected abstract boolean doCaptureMouse(boolean doGrab)
public boolean captureMouse(boolean doGrab)
doGrab
- true to capture the mouse, false to release it.public boolean setCursor(int cursor)
cursor
- one of the Cursor.XXX_CURSOR values or a value returned by Device.createCursor().public static int createCursor(ImageData[] images, int hotspotX, int hotspotY)
images
- the images to attempt to make the cursor from. This should either contain
one alpha-blended and one non-alpha blended cursor of the same size and same hotspot locations.
Or a single non-alpha blended cursor. Providing a single alpha-blended cursor may fail on systems that
don't support such cursors.hotspotX
- the x location of the cursor hotspot.hotspotY
- the y location of the cursor hotspot.public static int createCursor(ImageData image, int hotspotX, int hotspotY)
image
- an image to be used as the cursor.hotspotX
- the x location of the cursor hotspot.hotspotY
- the y location of the cursor hotspot.public int setCursorRegion(int regionID, int x, int y, int width, int height, int cursor)
regionID
- set this to zero to add a new cursor region - the value returned
will be the new ID for this region.x
- the x-location in the client area of the Window.y
- the y-location in the client area of the Window.width
- the width of the area.height
- the height of the area.cursor
- the cursor to use for the area.public abstract void clearCursorRegions()
public abstract void removeCursorRegion(int regionID)
regionID
- the ID of the cursor region as returned by setCursorRegion.protected int nativeGetSetSIP(WindowSurface win, int sipValue)
win
- the window to get/set the sip for.sipValue
- a SIP value - if this is -1 it is a getSIP() operation.public int getSIP(WindowSurface win)
public abstract ITaskbarEntry doCreateTaskbarEntry()
public ITaskbarEntry createTaskbarEntry()
public void setSIP(int mode, WindowSurface win)
public void setSIP(int mode, WindowSurface win, RawEvent getEvent)
public FontMetrics getFontMetrics(Font f)
ISurface
getFontMetrics
in interface ISurface
f
- the Font to use.public static boolean inNativeTextInput()
public abstract boolean specialOperation(int which, Object data)
protected int doStartNativeInput(NativeInputParameters nip) throws Exception
Exception
public boolean startNativeInput(NativeInputParameters nip)
public void acceptDroppedFiles(boolean accept)
accept
- true to enable, false to disable.public static void eveMain(String[] args)
public static void main(String[] args)
public static void setScreenSizeInInches(int screen, double width, double height)
screen
- width
- height
- public static void clearScreenSizeInInches(int screen)
public static boolean getScreenSizeInInches(int screen, double[] sizeInInches)
public final void setScreenSizeInInches(double width, double height)
public final boolean getScreenSizeInInches(double[] sizeInInches)
public final void clearScreenSizeInInches()
protected abstract boolean doGetDPI(double[] dest)
public final boolean getDPI(double[] dest)
ISurface
public static final boolean getScreenDPI(double[] dest)
public static final boolean getScreenDPI(int screenId, double[] dest)
public Image getCompatibleImagePoints(double widthInPoints, double heightInPoints) throws IllegalArgumentException
ISurface
getCompatibleImagePoints
in interface ISurface
widthInPoints
- the width of the image int points (1/72 of an inch). This must be greater than 0.heightInPoints
- the height of the image int points (1/72 of an inch). This must be greater than 0.IllegalArgumentException
- if the width or height is less than or is zero.public void setOverlays(IOverlay[] overlays)