ewe.ui
Class Window

java.lang.Object
  extended byewe.ui.ControlBase
      extended byewe.ui.Control
          extended byewe.ui.Container
              extended byewe.ui.Window
All Implemented Interfaces:
CellConstants, ControlConstants, EventListener, HasProperties, ImageRefresher, ISurface, TimerProc, UIConstants, WindowConstants
Direct Known Subclasses:
MainWindow, TaskbarWindow

public class Window
extends Container
implements ISurface, WindowConstants, HasProperties

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.WindowConstants
FLAG_ALWAYS_ON_TOP, FLAG_CAN_MAXIMIZE, FLAG_CAN_MINIMIZE, FLAG_CAN_RESIZE, FLAG_DONT_CLEAR_BACKGROUND, FLAG_FULL_SCREEN, FLAG_HAS_CLOSE_BUTTON, FLAG_HAS_TASKBAR_ENTRY, FLAG_HAS_TITLE, FLAG_IS_DEFAULT_SIZE, FLAG_IS_ICONIZED, FLAG_IS_MODAL, FLAG_IS_VISIBLE, FLAG_MAIN_WINDOW_COUNTER_ROTATED, FLAG_MAIN_WINDOW_ROTATED, FLAG_MAXIMIZE, FLAG_MAXIMIZE_ON_PDA, FLAG_MINIMIZE, FLAG_RESTORE, FLAG_SHOW_SIP_BUTTON, FLAG_STATE_KNOWN, FLAG_VISIBLE_ON_TO_FRONT, GUI_FLAG_HAS_TASKBAR, GUI_FLAG_REVERSE_OK_CANCEL, INFO_ACCEPT_DROPPED_FILES, INFO_CLIENT_RECT, INFO_DROPPED_DATA, INFO_FLAGS_FOR_SIZE, INFO_FONT, INFO_GUI_FLAGS, INFO_NATIVE_WINDOW, INFO_PARENT_RECT, INFO_POSITION_IN_NATIVE_DRAWING_SURFACE, INFO_SCREEN_RECT, INFO_TASKBAR_ICON, INFO_TITLE, INFO_WINDOW_FLAGS, INFO_WINDOW_ICON, INFO_WINDOW_RECT, NATIVE_WINDOW_GET_CONTAINING_WINDOW, NATIVE_WINDOW_GET_DRAWING_SURFACE, OPTION_FLAG_CLEAR, OPTION_FLAG_SET, OPTION_TASKBAR_ICON_MODIFY_ICON, OPTION_TASKBAR_ICON_MODIFY_TIP, SPECIAL_MOUSE_CAPTURE, SPECIAL_MOUSE_MOVE, SPECIAL_MOUSE_RELEASE, SPECIAL_MOUSE_RESIZE, SPECIAL_RESTART_GUI, SPECIAL_ROTATE_SCREEN, STATE_MAXIMIZED, STATE_MINIMIZED, STATE_NORMAL, STATE_UNKNOWN
 
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 ewe.ui.Control
acceptsData, activate, addListener, addTimer, amOnTopFrame, calculateSizes, calculateTextSize, cancelCut, cancelHoldDown, canEdit, chainDataChange, change, checkClipboardOperations, checkExitKey, checkMenu, checkMenuKey, checkModifiers, checkPenTransparent, clearTag, clipboardToString, clipboardTransfer, closeMenu, contains, contains, createGraphics, dataAccepted, dataBeingRemoved, dataDraggedOff, dataDraggedOver, dataDraggedOver, dataDroppedOn, dataTransferCancelled, deactivate, defaultTo, doAction, doActionKey, doBackground, doBorder, doMenu, dontAcceptDrop, doPaint, doPaintChildren, doPaintChildren, doPaintChildren, doPaintData, doPaintData, doShowMenu, dragged, exitEntry, fillBackground, formClosing, fromClipboard, fromField, fromField, getAllDescendants, getAllSubControls, getBackground, getClipboardMenu, getClipObject, getControlBuffer, getControlBuffer, getDataRect, getDataToCopy, getDataToDragAndDrop, getDim, getDisplayText, getDragAndDropContext, getFont, getFontMetrics, getFontMetrics, getForeground, getFrame, getFrameOrContainer, getGraphics, getImage, getLastSelected, getLocation, getMaximumSize, getMenu, getMinimumSize, getModifiers, getNext, getParent, getPasswordCharacter, getPosInFrame, getPosInParent, getPreferredSize, getPrompt, getPromptText, getRect, getRect, getServer, getSize, getSizes, getSubControls, getTag, getText, getToolTip, getWindow, hasModifier, hasPopupFormAttached, hasTag, inheritModifiers, isChildOf, isModal, isOnMe, isSomeonesHotKey, make, makeFrameTopMost, makeHot, menuIsActive, modify, modifyAll, modifyAll, notifyAction, notifyDataChange, notifyDataChange, notNative_doPaintChildren, oldButWorksDoPaintChildren, oldPaintChildren, oldPostEvent, onControlEvent, onKeyEvent, onLabelPenEvent, onPaint, onPenEvent, paintBackground, paintChildren, penClicked, penDoubleClicked, penHeld, penPressed, penReleased, penRightReleased, popupBeep, popupMenuClosed, popupMenuEvent, popupMenuEvent, postEvent, recalculatePreferredSize, redisplay, refresh, removeListener, removeTimer, repaint, repaintNow, repaintNow, repaintNow, requestPaint, requestResizeTo, resetRect, restore, scrollAndRepaint, sendToListeners, set, setBorder, setCell, setClipObject, setControl, setCursor, setFixedSize, setFont, setHotKey, setHotKey, setLocation, setMaximumSize, setMenu, setMinimumSize, setPreferredSize, setPromptControl, setRect, setRect, setServer, setTag, setTags, setTextSize, setToolTip, show, shown, standardOnKeyEvent, startDragAndDrop, startDragAndDrop, startDragging, stopDragging, takeData, takeFromClipboard, testDim, ticked, toClipboard, toField, toField, toString, toTextData, transferPenPress, transferPenPress, tryDragAndDrop, tryNext, tryStartMenu, updateData, willAcceptDrop, willShowFrame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode
 

Field Detail

creationData

public WindowCreationData creationData

_keyEvent

protected static KeyEvent _keyEvent

_penEvent

protected static PenEvent _penEvent

_controlEvent

protected static ControlEvent _controlEvent

contents

public Frame contents

canDisplay

public boolean canDisplay

firstDisplay

public boolean firstDisplay

_sipEvent

protected static SIPEvent _sipEvent

dragAndDropData

public static Object dragAndDropData

dragAndDropSource

public static Object dragAndDropSource

dragAndDropCursor

public static int dragAndDropCursor

inFront

protected static Window inFront

lastWindow

protected static Window lastWindow

downPoint

public static Point downPoint
This is the point at which the mouse was first pressed in a current press and hold/drag operation.


inEventThread

public static boolean inEventThread
Called by the VM to post key and pen events.


wasPainted

public boolean wasPainted
This gets set to be true when the VM calls _doPaint() on the Window.


closeLock

protected Lock closeLock

currentCursor

public Object currentCursor
Constructor Detail

Window

public Window()
Constructs a window.

Method Detail

getProperties

public PropertyList getProperties()
Description copied from interface: HasProperties
Get the PropertyList object associated with this object.

Specified by:
getProperties in interface HasProperties

inNativeInput

public static boolean inNativeInput()
This returns whether the system is within a native input or native dialog. If this is the case, then no Gui input will be sent to the Ewe Gui system.


textInput

public boolean textInput(TextInputParameters tip)
                  throws NoSuchMethodError
This starts a native text input for a control.

Parameters:
tip - the TextInputParameters to use.
Returns:
true if the input started successfully, false if it could not start because another native input is already active.
Throws:
NoSuchMethodError - if native text input is not possible at all.

getOpenWindows

public static Iterator getOpenWindows()
This gets all the open windows, wether they are visible or not.


isCreated

public boolean isCreated()
This returns true if the Window has been created (its native component has been created) and has not been closed.


getContainingWindow

public Window getContainingWindow()
If this Window is contained in another Window, this will return the containing Window. Calling getParent() on a Window should always return null.


create

public boolean create(Rect location,
                      String title,
                      int flagsToSet,
                      int flagsToClear,
                      Object extra)
This creates the native window associated with this Window object.


close

public boolean close()
This closes the window and destroys the native Window component. Do not re-use the window after closing it.


shutdownAll

protected void shutdownAll()

getActiveWindow

public static Window getActiveWindow()
This returns the currently active window.


toFront

public boolean toFront()
This brings this window to the front.


applicationToFront

public static boolean applicationToFront()
This will attempt to bring the topmost window of the application to the front.

Returns:
true if successful.

shutdown

protected void shutdown()
This is called either before the window is closed or before the application exits.


createNativeWindow

protected boolean createNativeWindow(Rect location,
                                     String title,
                                     int flagsToSet,
                                     int flagsToClear,
                                     Object extra)

closeWindow

protected boolean closeWindow()

windowToFront

protected boolean windowToFront()

captureAppKeys

public static int captureAppKeys(int options)
This will capture the WindowCE special App keys (the non-cursor buttons generally found on the bottom). Calling this with options set to 1 will cause WinCE to not capture the App keys as ordinary keypresses, instead of special application launch buttons. These keypresses are then passed via a normal key event to your application with the APP0 to APP15 key codes. Calling this with options set to 0 will cause WinCE to no longer capture these keys and they will be re-associated with their application launch functionality.

Parameters:
options - A value of 1 causes WinCE to capture the keys. A value of 0 cause WinCE to release the keys.
Returns:
The same value as options.

setFocus

public void setFocus(Control c)
This is only to be used by the Window itself or the Gui class. To set the focus for a Control you should call Gui.takeFocus(Control c,int how).


getFocus

public Control getFocus()
Returns the focus control for this window.

See Also:
setFocus(ewe.ui.Control)

damageRect

protected void damageRect(int x,
                          int y,
                          int width,
                          int height)
Adds a damage rectangle to the current list of areas that need repainting.


releaseMouseCapture

public void releaseMouseCapture()

beginDragAndDrop

public boolean beginDragAndDrop(Control source,
                                Object data,
                                int dragCursor)
This is called by a control to start a drag and drop operation. You should not call this directly, rather you should call Control.startDragAndDrop() from Control


beginDragAndDrop

public boolean beginDragAndDrop(Control source,
                                Object data,
                                boolean isMultiple,
                                boolean isCopy)
This is called by a control to start a drag and drop operation. You should not call this directly, rather you should call Control.startDragAndDrop() from Control


tryWindow

protected Window tryWindow(Window win,
                           int x,
                           int y,
                           Point where)

transferPenPress

public void transferPenPress(PenEvent ev,
                             Control toWho,
                             int dx,
                             int dy)

enterNativeDialog

public static void enterNativeDialog()

exitNativeDialog

public static void exitNativeDialog()

nextMouseIsMove

public static boolean nextMouseIsMove()

clearQueuedMoves

public static void clearQueuedMoves()

mobileWindowEvent

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. This can be used to trap, say a WindowEvent.CLOSE message from the mobile OS and allow for the application to save its state. This is needed because WinCE will automatically close applications if memory starts to run low. It will also forcibly terminate the application if it does not exit immediately. By default this will call the closeMobileApp() of the main mApp of the application if the message is a CLOSE message.


iconPressed

public void iconPressed()
This is called directly by the VM within a native Window Message handler. It will be called if the icon placed by the window is pressed. By default this brings the application to the front.


_textEvent

public void _textEvent(int type,
                       int flags,
                       Object text,
                       int timeStamp)

_postEvent

public 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. It is therefore in the same thread as the message queue. This will then queue the event in the mThread responsible for dispatching events. However if the event is a WindowEvent type, and the application is a mobile application, it will also call mobileWindowEvent() before queueing the event.


doPostEvent

public void doPostEvent(int type,
                        int key,
                        int x,
                        int y,
                        int modifiers,
                        int timeStamp)

doPostEvent

public void doPostEvent(int type,
                        int key,
                        int x,
                        int y,
                        int modifiers,
                        int timeStamp,
                        Object data)

waitUntilPainted

public boolean waitUntilPainted(int timeOut)
Wait until the Window receives its first Paint message. This will only work correctly from an mThread.

Parameters:
timeOut - The length of time in milliseconds to wait.
Returns:
true if the paint message was received within the timeOut period, false if not.

_doPaint

public void _doPaint(int x,
                     int y,
                     int width,
                     int height)
Called by the VM to repaint an area.


getInfo

public 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. It is used with the INFO_ specifiers and options. It will return the resultDestination on success or null on failure. See interface WindowConstants for values for infoCode and options.


getGuiInfo

public static Object getGuiInfo(int infoCode,
                                Object sourceParameter,
                                Object resultDestination,
                                int options)

nativeGetGuiInfo

public static Object nativeGetGuiInfo(int infoCode,
                                      Object sourceParameter,
                                      Object resultDestination,
                                      int options)

setInfo

public 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. It is used with the INFO_ specifiers and options. It will return true on success, false on failure. See interface WindowConstants for values for infoCode and options.

See Also:
WindowConstants

setText

public void setText(String text)
This has the same effect as setTitle().

Overrides:
setText in class Control

setTitle

public void setTitle(String title)

setIcon

public void setIcon(Object icon)

getTitle

public String getTitle()

resizeTo

public void resizeTo(int newWidth,
                     int newHeight)
Description copied from class: Control
This will change the width and height values.

Overrides:
resizeTo in class Control

appResized

public void appResized(int newWidth,
                       int newHeight,
                       int type)
This will be called if the main window is resized.


onEvent

public void onEvent(Event ev)
Specified by:
onEvent in interface EventListener
Overrides:
onEvent in class Control

centerWindow

public Rect centerWindow(int width,
                         int height)
This centers the window on the screen or within its containing window.


centerWindow

public boolean centerWindow(int width,
                            int height,
                            boolean showIt)
Center the main window. If width or height is -1 then the screen will not be resized.


getWindowRect

public Rect getWindowRect(Rect dest,
                          boolean clientArea)
Get the window full or client rectangle. Do not pass a null destination rectangle.


setWindowRect

public void setWindowRect(Rect where,
                          boolean clientArea)
Set the window full or client rectangle. Do not pass a null destination rectangle.


getWindowFlags

public int getWindowFlags()
Get the window flags. This is only meaningful after a create() call.


setWindowFlags

public boolean setWindowFlags(int flags)
Set specified window flags. This is only meaningful after a create() call.


clearWindowFlags

public boolean clearWindowFlags(int flags)
Clear specified window flags. This is only meaningful after a create() call.


checkSipCoverage

public Rect checkSipCoverage(Control who)
This returns null if the control is not covered by the SIP. If it is covered it returns a Rect representing the uncovered area of the screen.


handleSipEvent

public void handleSipEvent(SIPEvent ev)

doSpecialOp

public boolean doSpecialOp(int operationAndOptions,
                           Object data)
This handles special features like dragging/resizing the window by a Ewe DragPanel. This is necessary if you create a window which does not have a native title bar.


supportsMultiple

public static boolean supportsMultiple()
Returns whether multiple windows are supported on this platform.


setState

public void setState(int state)
Set the Maximize\Minimized\Normal state of the window.

Parameters:
state - Use one of STATE_MAXIMIZED, STATE_MINIMIZED or STATE_NORMAL.

getState

public int getState()
Return the Maximize\Minimized\Normal state of the window.

Returns:
one of STATE_MAXIMIZED, STATE_MINIMIZED, STATE_NORMAL or STATE_UNKNOWN

getNativeWindow

public Object getNativeWindow()
This provides access to the underlying native Window.

Returns:

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.


handleNativeMessage

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. If the method returns true then the Ewe VM will not handle the message. This method will only be called for messages that have been identified by wantToHandle(int nativeMessage).

Parameters:
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.
Returns:
true if you don't want the Ewe VM to handle the message.

wantToHandle

protected final boolean wantToHandle(int nativeMessage)
Call this method to request that a parti Additional verbose

Parameters:
nativeMessage -
Returns: