|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.ui.ControlBase
ewe.ui.Control
ewe.ui.Container
ewe.ui.Window
Window is a "floating" or "child" top-level window, it is associated with a "native" window instance. Under Java the native window will be an instance of a java.awt.Window, under Win32 it will be Win32 Window.
A native window is not created in the constructor, but by the create() method - in which case it is considered open. It is closed using the close() method and must not be re-opened after closing. A Window's visible state may be changed dynamically using setWindowFlags() as needed.
mApp is an instance of MainWindow which itself is an instanceof Window. The main mApp window (the one created when your application starts) should never be closed, although it may be made invisible and you do not need to add controls to it.
During window creation certain window flags are set or cleared by default depending on the native platform. However you can explicitly specify which flags should be set and cleared using the flagsToSet and flagsToClear parameters in the create() method.
The easiest way to display a new pop-up window is to create a Form object and call Form.exec(Gui.NEW_WINDOW) or Form.show(Gui.NEW_WINDOW). This sizes the window to fit the form an displays the window and form. You can select the window flags to set and clear with the windowFlagsToSet and windowFlagsToClear variables in the Form object.
In reality, a Window is used to display multiple Frames within it. Any control to be displayed must be placed in a Frame and that Frame must be displayed by the Gui class using the Gui.execFrame() or Gui.showFrame() methods. The Gui class displays a Frame by making it the child of a currently on-screen Frame. If the parent on-screen Frame is null then it is made the child of the contents Frame object of a Window. This effectively makes it the top-level Frame within that Window. This scheme allows for multiple-frames (which look like native windows) within a single Window (native window) object. This allows for multiple-frame application to be run on a platform which may not support multiple-windows (e.g. OS'es like PalmOS).
Calling the Form.show() or Form.exec() methods prompts the Form to create its own Frame and it then uses Gui to show the Frame in the destination Window. If it specifies no parent then it will be made the top-level Frame in the destination Window. If Gui.NEW_WINDOW is specified as an option for show() or exec() then a new Window will be created and the Form's Frame will be displayed in the new Window.
A Window always contains a contents Frame object which is used as the parent frame for any other Frames to be displayed within it. A Window is always the top level control in any on-screen control tree. That is to say, calling getParent() on a Window will always return null. To iterate through all the open (on-screen, visible or invisible) Windows in an application you must call Window.getOpenWindows().
On some platforms like Win32 (but not on Java) it is possible to place a native window within another native window and that is supported in Ewe. The create() method takes an extra Object parameter which, if set to a Window object, will create the new native window as a native child window of the native window represented by the Window object. The new window that is created will NOT have the parent Window object as the parent control (i.e. calling getParent() on the new window will NOT return the old window). In this case you must call getContainingWindow() to get the containing window.
Creating a Window that is embedded in another Window is best achieved using a WindowContainer object. This Control is associated with a new Window which is always sized to be the same size as the WindowContainer object itself. You can then create a Form object and specify Gui.NEW_WINDOW as the exec()/show() options AND specify WindowContainer.getContinedWindowFrame() as the parent frame. However you should call WindowContainer.isSupported() to see if this is supported on the running platform first.
| Nested Class Summary | |
static class |
Window.TaskBarIconInfo
|
| Field Summary | |
protected static ControlEvent |
_controlEvent
|
protected static KeyEvent |
_keyEvent
|
protected static PenEvent |
_penEvent
|
protected static SIPEvent |
_sipEvent
|
boolean |
canDisplay
|
protected Lock |
closeLock
|
Frame |
contents
|
WindowCreationData |
creationData
|
Object |
currentCursor
|
static Point |
downPoint
This is the point at which the mouse was first pressed in a current press and hold/drag operation. |
static int |
dragAndDropCursor
|
static Object |
dragAndDropData
|
static Object |
dragAndDropSource
|
boolean |
firstDisplay
|
static boolean |
inEventThread
Called by the VM to post key and pen events. |
protected static Window |
inFront
|
protected static Window |
lastWindow
|
boolean |
wasPainted
This gets set to be true when the VM calls _doPaint() on the Window. |
| Fields inherited from class ewe.ui.Container |
closedFocus, cycleFocus, dontAutoScroll, dontFocusOnChildren |
| Fields inherited from class ewe.ui.Control |
_debug, backGround, beforeRemoved, borderColor, borderStyle, borderWidth, children, columns, constraints, DoPaintMethod, dragging, dragResolution, dragTime, exitKeys, fieldTransfer, font, foreGround, haveNativePaint, height, holdDownPause, holdTick, hotKey, image, lastSelected, listeners, maxHeight, maxWidth, menuState, minHeight, minWidth, modifiers, MyClass, name, next, np, parent, penStatus, popupSound, popupSoundClip, preferredHeight, preferredWidth, prev, prompt, promptControl, rows, ss, standardBorder, standardEdge, startDragResolution, tags, tail, text, toolTip, width, x, y |
| Fields inherited from class ewe.ui.ControlBase |
clipItems, clipObject, clipOwner, curPoint, currentPenEvent, debugControl, debugFlag, DidHoldDown, doubleBuffer, doubleClickTime, firstPress, globalDrawFlat, globalEditable, globalEnabled, globalPalmStyle, globalSmallControls, GotPenDown, PenIsOn, pressPoint, TAG_LAST_USER_DATA, TAG_USER_DATA, TAKE_FIRST_PRESS, unnamed, useNativeTextInput |
| Fields inherited from interface ewe.fx.ISurface |
IMAGE_SURFACE, PRINTERJOB_SURFACE, WINDOW_SURFACE |
| Fields inherited from interface ewe.ui.UIConstants |
BDR_DOTTED, BDR_INNER, BDR_NOBORDER, BDR_OUTER, BDR_OUTLINE, BDR_RAISEDINNER, BDR_RAISEDOUTER, BDR_SUNKENINNER, BDR_SUNKENOUTER, BF_BOTTOM, BF_BOTTOMLEFT, BF_BOTTOMRIGHT, BF_BUTTON, BF_DIAGONAL, BF_DIAGONAL_ENDBOTTOMLEFT, BF_DIAGONAL_ENDBOTTOMRIGHT, BF_DIAGONAL_ENDTOPLEFT, BF_DIAGONAL_ENDTOPRIGHT, BF_EXACT, BF_FLAT, BF_LEFT, BF_MIDDLE, BF_MONO, BF_PALM, BF_RECT, BF_RIGHT, BF_SOFT, BF_SQUARE, BF_TOP, BF_TOPLEFT, BF_TOPRIGHT, EDGE_BUMP, EDGE_ETCHED, EDGE_RAISED, EDGE_SUNKEN |
| Fields inherited from interface ewe.ui.CellConstants |
BORDER, BOTTOM, CELLFLAG, CELLMASK, CENTER, CONTROLMASK, DONTCHANGE, DONTFILL, DONTSTRETCH, EAST, FILL, FIXEDSIZE, GROW, HCENTER, HCONTRACT, HEXPAND, HFILL, HGROW, HSHRINK, HSTRETCH, INITIALLY_CLOSED, INITIALLY_MINIMIZED, INITIALLY_PREFERRED_SIZE, INSETS, LEFT, MAXIMUMSIZE, MINIMUMSIZE, NORTH, NORTHEAST, NORTHWEST, PREFERREDSIZE, RECT, RIGHT, SHRINK, SOUTH, SOUTHEAST, SOUTHWEST, SPAN, STRETCH, TEXTSIZE, TOP, VCENTER, VCONTRACT, VEXPAND, VFILL, VGROW, VSHRINK, VSTRETCH, WEST |
| Fields inherited from interface ewe.ui.ControlConstants |
All, AlwaysEnabled, AlwaysRecalculateSizes, ByDeferredMouse, ByDeferredPen, ByFrameChange, ByKeyboard, ByMouse, ByPen, ByRequest, CalculatedSizes, Disabled, DisablePopupMenu, DisplayOnly, Down, DrawFlat, Flag, ForceResize, HasData, Invisible, KeepImage, KeepSIP, Left, MakeMenuAtLeastAsWide, Maximize, Minimize, MouseSensitive, NoFocus, NotAnEditor, NotEditable, PaintDataOnly, PaintOutsideOnly, PenTransparent, PreferredSizeOnly, Right, SendUpKeyEvents, SendUpPenEvents, ShowSIP, ShrinkToNothing, SmallControl, SpecialBackground, TakeControlEvents, TakesKeyFocus, Transparent, Up, WantDrag, WantHoldDown |
| Fields inherited from interface ewe.fx.ImageRefresher |
KEEP_VISIBLE |
| Constructor Summary | |
Window()
Constructs a window. |
|
| Method Summary | |
void |
_doPaint(int x,
int y,
int width,
int height)
Called by the VM to repaint an area. |
void |
_postEvent(int type,
int key,
int x,
int y,
int modifiers,
int timeStamp)
This is called directly by the VM within a native Window Message handler. |
void |
_textEvent(int type,
int flags,
Object text,
int timeStamp)
|
static boolean |
applicationToFront()
This will attempt to bring the topmost window of the application to the front. |
void |
appResized(int newWidth,
int newHeight,
int type)
This will be called if the main window is resized. |
boolean |
beginDragAndDrop(Control source,
Object data,
boolean isMultiple,
boolean isCopy)
This is called by a control to start a drag and drop operation. |
boolean |
beginDragAndDrop(Control source,
Object data,
int dragCursor)
This is called by a control to start a drag and drop operation. |
static int |
captureAppKeys(int options)
This will capture the WindowCE special App keys (the non-cursor buttons generally found on the bottom). |
Rect |
centerWindow(int width,
int height)
This centers the window on the screen or within its containing window. |
boolean |
centerWindow(int width,
int height,
boolean showIt)
Center the main window. |
Rect |
checkSipCoverage(Control who)
This returns null if the control is not covered by the SIP. |
static void |
clearQueuedMoves()
|
boolean |
clearWindowFlags(int flags)
Clear specified window flags. |
boolean |
close()
This closes the window and destroys the native Window component. |
protected boolean |
closeWindow()
|
boolean |
create(Rect location,
String title,
int flagsToSet,
int flagsToClear,
Object extra)
This creates the native window associated with this Window object. |
protected boolean |
createNativeWindow(Rect location,
String title,
int flagsToSet,
int flagsToClear,
Object extra)
|
protected void |
damageRect(int x,
int y,
int width,
int height)
Adds a damage rectangle to the current list of areas that need repainting. |
void |
doPostEvent(int type,
int key,
int x,
int y,
int modifiers,
int timeStamp)
|
void |
doPostEvent(int type,
int key,
int x,
int y,
int modifiers,
int timeStamp,
Object data)
|
boolean |
doSpecialOp(int operationAndOptions,
Object data)
This handles special features like dragging/resizing the window by a Ewe DragPanel. |
static void |
enterNativeDialog()
|
static void |
exitNativeDialog()
|
static Window |
getActiveWindow()
This returns the currently active window. |
Window |
getContainingWindow()
If this Window is contained in another Window, this will return the containing Window. |
Control |
getFocus()
Returns the focus control for this window. |
static Object |
getGuiInfo(int infoCode,
Object sourceParameter,
Object resultDestination,
int options)
|
Object |
getInfo(int infoCode,
Object sourceParameter,
Object resultDestination,
int options)
This method is used to get extended information about the Window or the GUI system in general. |
Object |
getNativeWindow()
This provides access to the underlying native Window. |
static Iterator |
getOpenWindows()
This gets all the open windows, wether they are visible or not. |
PropertyList |
getProperties()
Get the PropertyList object associated with this object. |
int |
getState()
Return the Maximize\Minimized\Normal state of the window. |
String |
getTitle()
|
int |
getWindowFlags()
Get the window flags. |
Rect |
getWindowRect(Rect dest,
boolean clientArea)
Get the window full or client rectangle. |
protected boolean |
handleNativeMessage(int nativeWindowHandle,
int nativeMessage,
int wParam,
int lParam)
Override this to handle specific native window events before the EweVM event handler does. |
void |
handleSipEvent(SIPEvent ev)
|
void |
iconPressed()
This is called directly by the VM within a native Window Message handler. |
static boolean |
inNativeInput()
This returns whether the system is within a native input or native dialog. |
boolean |
isCreated()
This returns true if the Window has been created (its native component has been created) and has not been closed. |
protected void |
mobileWindowEvent(int type,
int key,
int x,
int y,
int modifiers,
int timeStamp)
This is called when a WindowEvent occurs on a mobile device. |
static Object |
nativeGetGuiInfo(int infoCode,
Object sourceParameter,
Object resultDestination,
int options)
|
static boolean |
nextMouseIsMove()
|
void |
onEvent(Event ev)
|
void |
releaseMouseCapture()
|
void |
resizeTo(int newWidth,
int newHeight)
This will change the width and height values. |
void |
setFocus(Control c)
This is only to be used by the Window itself or the Gui class. |
void |
setIcon(Object icon)
|
boolean |
setInfo(int infoCode,
Object sourceParameter,
Object resultDestination,
int options)
This method is used to set extended information about the Window or the GUI system in general. |
void |
setState(int state)
Set the Maximize\Minimized\Normal state of the window. |
void |
setText(String text)
This has the same effect as setTitle(). |
void |
setTitle(String title)
|
boolean |
setWindowFlags(int flags)
Set specified window flags. |
void |
setWindowRect(Rect where,
boolean clientArea)
Set the window full or client rectangle. |
protected void |
shutdown()
This is called either before the window is closed or before the application exits. |
protected void |
shutdownAll()
|
static boolean |
supportsMultiple()
Returns whether multiple windows are supported on this platform. |
boolean |
textInput(TextInputParameters tip)
This starts a native text input for a control. |
boolean |
toFront()
This brings this window to the front. |
void |
transferPenPress(PenEvent ev,
Control toWho,
int dx,
int dy)
|
protected Window |
tryWindow(Window win,
int x,
int y,
Point where)
|
boolean |
waitUntilPainted(int timeOut)
Wait until the Window receives its first Paint message. |
protected boolean |
wantToHandle(int nativeMessage)
Call this method to request that a parti Additional verbose |
protected boolean |
windowToFront()
|
| Methods inherited from class ewe.ui.Container |
_paintChildren, add, addDirectly, containerHasFocus, dismantle, dismantle, doHotKey, findChild, focusFirst, focusFirst, focusOnContainer, focusOnData, getChildren, getChildrenBackwards, getFirstFocus, getNextKeyFocus, gotFocus, lostFocus, remove, removeAll, repaintDataNow, scrollToVisible, takeFocus, takePromptControl |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode |
| Field Detail |
public WindowCreationData creationData
protected static KeyEvent _keyEvent
protected static PenEvent _penEvent
protected static ControlEvent _controlEvent
public Frame contents
public boolean canDisplay
public boolean firstDisplay
protected static SIPEvent _sipEvent
public static Object dragAndDropData
public static Object dragAndDropSource
public static int dragAndDropCursor
protected static Window inFront
protected static Window lastWindow
public static Point downPoint
public static boolean inEventThread
public boolean wasPainted
protected Lock closeLock
public Object currentCursor
| Constructor Detail |
public Window()
| Method Detail |
public PropertyList getProperties()
HasProperties
getProperties in interface HasPropertiespublic static boolean inNativeInput()
public boolean textInput(TextInputParameters tip)
throws NoSuchMethodError
tip - the TextInputParameters to use.
NoSuchMethodError - if native text input is not possible at all.public static Iterator getOpenWindows()
public boolean isCreated()
public Window getContainingWindow()
public boolean create(Rect location,
String title,
int flagsToSet,
int flagsToClear,
Object extra)
public boolean close()
protected void shutdownAll()
public static Window getActiveWindow()
public boolean toFront()
public static boolean applicationToFront()
protected void shutdown()
protected boolean createNativeWindow(Rect location,
String title,
int flagsToSet,
int flagsToClear,
Object extra)
protected boolean closeWindow()
protected boolean windowToFront()
public static int captureAppKeys(int options)
options - A value of 1 causes WinCE to capture the keys. A value of 0 cause WinCE to
release the keys.
public void setFocus(Control c)
public Control getFocus()
setFocus(ewe.ui.Control)
protected void damageRect(int x,
int y,
int width,
int height)
public void releaseMouseCapture()
public boolean beginDragAndDrop(Control source,
Object data,
int dragCursor)
public boolean beginDragAndDrop(Control source,
Object data,
boolean isMultiple,
boolean isCopy)
protected Window tryWindow(Window win,
int x,
int y,
Point where)
public void transferPenPress(PenEvent ev,
Control toWho,
int dx,
int dy)
public static void enterNativeDialog()
public static void exitNativeDialog()
public static boolean nextMouseIsMove()
public static void clearQueuedMoves()
protected void mobileWindowEvent(int type,
int key,
int x,
int y,
int modifiers,
int timeStamp)
public void iconPressed()
public void _textEvent(int type,
int flags,
Object text,
int timeStamp)
public void _postEvent(int type,
int key,
int x,
int y,
int modifiers,
int timeStamp)
public void doPostEvent(int type,
int key,
int x,
int y,
int modifiers,
int timeStamp)
public void doPostEvent(int type,
int key,
int x,
int y,
int modifiers,
int timeStamp,
Object data)
public boolean waitUntilPainted(int timeOut)
timeOut - The length of time in milliseconds to wait.
public void _doPaint(int x,
int y,
int width,
int height)
public Object getInfo(int infoCode,
Object sourceParameter,
Object resultDestination,
int options)
public static Object getGuiInfo(int infoCode,
Object sourceParameter,
Object resultDestination,
int options)
public static Object nativeGetGuiInfo(int infoCode,
Object sourceParameter,
Object resultDestination,
int options)
public boolean setInfo(int infoCode,
Object sourceParameter,
Object resultDestination,
int options)
WindowConstantspublic void setText(String text)
setText in class Controlpublic void setTitle(String title)
public void setIcon(Object icon)
public String getTitle()
public void resizeTo(int newWidth,
int newHeight)
Control
resizeTo in class Control
public void appResized(int newWidth,
int newHeight,
int type)
public void onEvent(Event ev)
onEvent in interface EventListeneronEvent in class Control
public Rect centerWindow(int width,
int height)
public boolean centerWindow(int width,
int height,
boolean showIt)
public Rect getWindowRect(Rect dest,
boolean clientArea)
public void setWindowRect(Rect where,
boolean clientArea)
public int getWindowFlags()
public boolean setWindowFlags(int flags)
public boolean clearWindowFlags(int flags)
public Rect checkSipCoverage(Control who)
public void handleSipEvent(SIPEvent ev)
public boolean doSpecialOp(int operationAndOptions,
Object data)
public static boolean supportsMultiple()
public void setState(int state)
state - Use one of STATE_MAXIMIZED, STATE_MINIMIZED or STATE_NORMAL.public int getState()
public Object getNativeWindow()
Under Java, this will return the Window Component - which is either a java.awt.Window or java.awt.Frame or a Canvas within the Applet (if it is being displayed in an Applet).
Under Win32, it will return a ewe.sys.Long object which has its value set to be HWND value for the Window.
Under Linux/Zaurus (Qt or other library) it will return a pointer to whatever structure represents a Window.
protected boolean handleNativeMessage(int nativeWindowHandle,
int nativeMessage,
int wParam,
int lParam)
nativeWindowHandle - The native window handle.nativeMessage - The native message sent to the window.wParam - The wParam of the message.lParam - The lParam of the message.
protected final boolean wantToHandle(int nativeMessage)
nativeMessage -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||