ewe.ui
Class Control

java.lang.Object
  extended byewe.ui.ControlBase
      extended byewe.ui.Control
All Implemented Interfaces:
CellConstants, ControlConstants, EventListener, ImageRefresher, TimerProc, UIConstants
Direct Known Subclasses:
AwtContainer, ButtonControl, ChoiceControl, Container, EditControl, mLabel, PanelSplitter, PhoneMenu, ProgressBar, TrackControl, UpDownInput, WindowContainer

public class Control
extends ControlBase
implements UIConstants, EventListener, TimerProc, CellConstants, ImageRefresher

Control is the base class for user-interface objects. Here are some common tasks you may need to do on all Controls.

To repaint a Control call the repaintNow() method.

To enable/disable a Control use the modify() method. This method will set/clear modifier flags (listed in the ewe.ui.ControlConstants interface) for the Control.


Field Summary
 boolean _debug
           
 Color backGround
           
protected static Object beforeRemoved
          A temporary holding spot for data in the process of being moved.
 Color borderColor
          The Color of the border of the Control (if a single line, non-3D border is used).
 int borderStyle
          The border style of the Control.
 int borderWidth
           
protected  Control children
          The children of the container.
 int columns
           
 int constraints
           
protected  Object DoPaintMethod
           
 DragContext dragging
           
 int dragResolution
          The minimum number of pixels that the Pen/Mouse has to move during a drag operation to be considered a drag to a new location.
 int dragTime
          Use this to control the resolution of the pen drags - it is the minimum delay in milliseconds between processing pen drags.
 int[] exitKeys
           
 FieldTransfer fieldTransfer
           
 Font font
           
 Color foreGround
           
protected static boolean haveNativePaint
           
protected  int height
          The control's height
 int holdDownPause
           
 int holdTick
           
 int hotKey
          This is the "HotKey" for the control - use setHotKey() to set it.
 IImage image
           
protected  MenuItem lastSelected
           
protected  Vector listeners
           
protected  int maxHeight
          Do not set this directly - use setMaximumSize() instead.
protected  int maxWidth
          Do not set this directly - use setMaximumSize() instead.
 MenuState menuState
          This holds a MenuState Object used for controlling the Menu associated with the Control.
protected  int minHeight
          Do not set this directly - use setMinimumSize() instead.
protected  int minWidth
          Do not set this directly - use setMinimumSize() instead.
protected  int modifiers
          Modifiers of the control.
protected  Object MyClass
           
 String name
           
protected  Control next
          The control's next sibling.
static Point np
           
protected  Container parent
          The parent of the control.
 int penStatus
           
static String popupSound
          This is the sound that is played when a popup-menu or pull-down menu is first shown.
static SoundClip popupSoundClip
           
protected  int preferredHeight
          Do not set this directly - use setPrefferedSize() instead.
protected  int preferredWidth
          Do not set this directly - use setPrefferedSize() instead.
protected  Control prev
          The control's previous sibling.
 String prompt
          This is an optional string that is used as a user informative prompt for the control.
 Control promptControl
          This is optional - if an mLabel is used as the on-screen prompt for this control, then set this value to be that control.
 int rows
           
protected  ScrollServer ss
           
static int standardBorder
           
static int standardEdge
           
 int startDragResolution
          The number of pixels that the Pen/Mouse has to move before it is considered the start of a drag operation.
 TagList tags
           
protected  Control tail
          The tail of the children list.
 String text
          The text associated with the control.
 Object toolTip
          The object's tool tip which should be a String, IImage, Control or ToolTip
protected  int width
          The control's width
protected  int x
          The control's x location
protected  int y
          The control's y location
 
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.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
Control()
           
 
Method Summary
 boolean acceptsData(Object data, DragContext how)
          This should indicate whether this control will accept the data either via a drag and drop or via a paste operation.
 void activate()
          This does NOT enable a disabled control - but tells it to put itself in an "active" state.
 void addListener(EventListener list)
           
 Timer addTimer(int millis)
          Deprecated. Use ewe.sys.Vm.requestTimer();
 boolean amOnTopFrame()
           
protected  void calculateSizes()
          Override this to calculate the preferred, minimum and maximum size of your control.
protected  Dimension calculateTextSize(int width, int height, Dimension dest)
           
static void cancelCut(Control forWho)
          If a Control is in the middle of a cut operation this will cancel the operation.
static void cancelHoldDown()
           
 boolean canEdit()
           
 void chainDataChange(Control other, String fieldName)
          This sets up the Control, such that if the "other" control generates a DataChangeEvent then this Control will also generate a DataChangeEvent.
 boolean change(int flagsToSet, int flagsToClear)
          This ensures that the specified flags are set or clear.
 boolean checkClipboardOperations(Menu m)
          This is called to enable/disable the clipboard options depending on the state of the Control.
protected  boolean checkExitKey(KeyEvent ev)
           
 boolean checkMenu(Menu m)
          This is called before a menu is displayed.
 boolean checkMenuKey(KeyEvent ev, Point where)
          This checks the incoming KeyEvent to see if it should cause this Control to show a menu.
 boolean checkModifiers(int flagsSet, int flagsClear)
          This checks if the specified flags are set or clear.
 boolean checkPenTransparent(PenEvent ev)
           
 Control clearTag(int tag)
           
 String clipboardToString(Object what)
           
 Object clipboardTransfer(Object clip, boolean toClipboard, boolean cut)
           
 void closeMenu()
          If a menu for the control is being displayed, this will close it.
 boolean contains(Control who)
           
 boolean contains(int x, int y)
          Returns true if the given x and y coordinate in the parent's coordinate system is contained within this control.
 Graphics createGraphics()
          Deprecated. Use getGraphics() instead.
protected  void dataAccepted(Control byWho, Object data, String action)
          This is called either when data that was cut from this control was pasted into another control, OR when data that was dragged from this control is dropped into another control.
protected  void dataBeingRemoved(Object data, DragContext dc)
          This tells the control that data is being removed from it either via a cut operation or by a drag operation that is not explicitly a copy operation.
 void dataDraggedOff(Object data)
          This is called when data that was previously dragged into the control has now been dragged off.
 void dataDraggedOver(Object data)
          This is called when data is being dragged into the control.
 void dataDraggedOver(Object data, Point p, PenEvent ev)
          This is called when data is being dragged into the control.
 boolean dataDroppedOn(Object data, Point p, DragContext dc)
          This is called by a drop from a drag and drop operation.
protected  void dataTransferCancelled(Object data)
          This gets called either when that was cut from this control was not placed into another control (either it was rejected by a paste or a subsequent copy/cut into the clipboard occured before the data was pasted) or a drag and drop was initiated but not completed.
 void deactivate()
          This does NOT disable a control - but tells it to put itself in a "non-active" state.
 Control defaultTo(int tag, Object value)
           
 void doAction(int how)
           
 void doActionKey(int key)
           
 void doBackground(Graphics g)
           
 void doBorder(Graphics g)
           
protected  boolean doHotKey(Control from, KeyEvent ev)
          This method checks to see if a KeyEvent should be considered the Control's hot-key.
 boolean doMenu(Point p)
          This is a request to display a menu based on the pen being held or the mouse being right clicked on the Control.
protected  void dontAcceptDrop()
          Should be called from the dataDraggedOver() method to indicate that the Control is willing to accept the data.
 void doPaint(Graphics g, Rect r)
           
static void doPaintChildren(Control who, int flags, Graphics g, Rect area)
           
protected static void doPaintChildren(Control who, int flags, Graphics g, Rect area, Rect clip)
           
 void doPaintChildren(Graphics g, int x, int y, int w, int h)
           
protected  void doPaintData()
          Repaint the "data" part of the Control.
protected  void doPaintData(Graphics g)
          Repaint the "data" part of the Control.
protected  boolean doShowMenu(Point pen)
          Used to show the menu associated with the Control.
 void dragged(DragContext dc)
          This is called during the drag operation.
 boolean exitEntry(int exitKey, int modifiers)
          If this returns false it means it is already in exitEntry.
 void fillBackground(Graphics g)
           
protected  void formClosing()
          This is called to indicate that the Form is about to close and it causes a FormClosed event to be posted.
 void fromClipboard()
          Paste the contents of the clipboard into the control, overwriting any exisiting selected area.
 void fromField()
           
 void fromField(FieldTransfer ft)
           
 Iterator getAllDescendants(boolean backwards)
          Get all the sub-controls for this Control and their sub-controls.
 Iterator getAllSubControls()
          Get all the sub-controls for this Control and their sub-controls.
 Color getBackground()
           
 Iterator getChildren()
          This iterator cycles through the components which are physically added to this Control
 Iterator getChildrenBackwards()
           
 Menu getClipboardMenu(Menu addTo)
          This adds the standard clipboard menu to a menu to be used by this control.
static Object getClipObject()
           
 Image getControlBuffer()
           
 Image getControlBuffer(Rect r)
           
protected  Rect getDataRect(Rect dest)
          Get the rectangle, relative to the Control, of the area considered to be the "data" part of the control.
protected  Object getDataToCopy()
          This is called to get data from the control to put into the clipboard.
protected  boolean getDataToDragAndDrop(DragContext dc)
          A quick way to provide DragAndDrop data.
 Rect getDim(Rect dest)
           
 String getDisplayText()
          By default getDisplayText() returns getText();
static DragContext getDragAndDropContext()
           
 Font getFont()
           
 FontMetrics getFontMetrics()
           
 FontMetrics getFontMetrics(Font font)
          Returns the font metrics for a given font.
 Color getForeground()
           
 Frame getFrame()
           
 Container getFrameOrContainer()
           
 Graphics getGraphics()
          Return a Graphics context for this control for drawing directly onto the window surface.
 IImage getImage()
           
 MenuItem getLastSelected()
          Find the menu item which was last selected.
 Point getLocation(Point dest)
           
 Dimension getMaximumSize(Dimension dest)
           
 Menu getMenu()
          Return the Menu associated with the Control if any.
 Dimension getMinimumSize(Dimension dest)
           
 int getModifiers(boolean shouldInherit)
          This will get the modifiers for this control.
 Control getNext()
          Returns the next child in the parent's list of controls.
 Control getNextKeyFocus(Control sourceChild, boolean forwards)
          Determine which sub-control should receive the keyboard focus.
 Container getParent()
          Returns the control's parent container.
 char getPasswordCharacter()
          If this Control represents the input of a password that must be kept hidden, then this method should return a password character (usually a '*').
 Point getPosInFrame()
           
 Point getPosInParent(Container parent)
           
 Dimension getPreferredSize(Dimension dest)
           
 String getPrompt()
           
 String getPromptText()
          This returns either the value of prompt, if it is not null and not an empty string, or the text value of promptControl, if that is not null and not an empty string.
 Rect getRect()
          Returns a copy of the control's rectangle.
 Rect getRect(Rect dest)
           
 ScrollServer getServer()
           
 Dimension getSize(Dimension dest)
           
 int[] getSizes(int[] values)
          This gets all of the control sizes.
 Iterator getSubControls()
           
 Object getTag(int tag, Object defaultValue)
           
 String getText()
           
 Object getToolTip(int x, int y)
          This should return an acceptable ToolTip object.
 Window getWindow()
           
 void gotFocus(int how)
           
 boolean hasModifier(int what, boolean shouldInherit)
          Check if the control has the specified modifier flags set.
 boolean hasPopupFormAttached()
          Returns true if a ControlPopupForm is attached to this Control.
 boolean hasTag(int tag)
           
 void inheritModifiers(Control fromWho, boolean inheritFromAll, int what, boolean setChildren)
          Get particular modifiers flags from another control and optionally set children flags.
 boolean isChildOf(Container who)
           
 boolean isModal()
          This determines if the Control is being displayed in a modal frame.
protected  boolean isOnMe(Point p)
          Checks if the Point p - which is relative to the top-left of this Control, is within the bounds of the Control.
protected  boolean isSomeonesHotKey(KeyEvent ev)
           
 void lostFocus(int how)
           
 void make(boolean reMake)
          This is used to "make" the control before being displayed.
 void makeFrameTopMost()
           
 String makeHot(String label)
          Format the String as a true Hotkey encoded string using the hotkey associated with this control (if any).
 boolean menuIsActive()
          Returns if the Menu associated with the Control is displayed.
 int modify(int flagsToSet, int flagsToClear)
          Set/Clear modifier flags for the Control.
 void modifyAll(int set, int clear)
          Modify this control and all child controls (and their children).
 void modifyAll(int set, int clear, boolean doThisOne)
          Modify all child controls (and their children).
 void notifyAction()
           
 void notifyDataChange()
          Generate and dispatch a new DataChangeEvent.
 void notifyDataChange(DataChangeEvent dce)
          Dispatch a new DataChangeEvent.
static void notNative_doPaintChildren(Control who, int flags, Graphics g, Rect area)
           
 void oldButWorksDoPaintChildren(Graphics g, int x, int y, int w, int h)
           
 void oldPaintChildren(Graphics g, int x, int y, int width, int height)
           
 void oldPostEvent(Event event)
          Deprecated.  
 void onControlEvent(ControlEvent ev)
           
 void onEvent(Event ev)
           
 void onKeyEvent(KeyEvent ev)
           
 void onLabelPenEvent(PenEvent ev)
           
 void onPaint(Graphics gr)
          Deprecated. Use doPaint() instead.
 void onPenEvent(PenEvent ev)
          Called to handle an incoming PenEvent.
 void paintBackground(Graphics g)
           
 void paintChildren(Graphics gr, int x, int y, int w, int h)
           
 void penClicked(Point p)
          Called if the Pen or Mouse button is quickly pressed and released.
 void penDoubleClicked(Point p)
          Called if the Pen or Mouse button is double clicked on the Control.
 void penHeld(Point p)
          Called when the Pen or Mouse button is held down on the control.
 void penPressed(Point p)
          Called when the Pen or Mouse button is pressed on the control.
 void penReleased(Point p)
          Called when the Pen or Mouse button is released on the control.
 void penRightReleased(Point p)
          Called when the right Mouse button is released on the control.
static void popupBeep()
          This is called when a popup-menu or pull-down menu is first shown.
protected  void popupMenuClosed(Menu m)
          This gets closed after the popup menu for the Control has closed.
 void popupMenuEvent(MenuEvent ev)
          This is called when the popup menu associated with the control generates an event.
 void popupMenuEvent(Object selectedItem)
          This is called when the user selects an item from the popup menu.
 void postEvent(Event ev)
           
 Dimension recalculatePreferredSize(Dimension dest)
           
 void redisplay()
          Do not use this to repaint a control - use repaintNow() instead.
 void refresh(IImage image, int options)
          The default version of this method simpy repaints the control - however for controls which may display multiple images a better refresh scheme would be needed.
 void removeListener(EventListener list)
           
 boolean removeTimer(Timer timer)
          Deprecated. Use ewe.sys.Vm.requestTimer() and ewe.sys.Vm.cancelTimer();
 void repaint()
          This calls a repaintNow() using a CallBack - it does not repaint immediately.
 void repaintDataNow()
          Repaint the "data" part of the Control now.
 void repaintNow()
          Repaint the Control now.
 void repaintNow(boolean yes)
          Repaint the Control now if the "yes" parameter is true.
 void repaintNow(Graphics gr, Rect where)
          Repaint a section of the Control now.
 boolean requestPaint()
          Call this if you are going to be painting all or a portion of the control at an arbitrary time.
 void requestResizeTo(int width, int height)
          This requests that the size be changed to the following dimensions but the control is free to ignore it or to change to a different value.
 void resetRect()
           
 void resizeTo(int width, int height)
          This will change the width and height values.
 void restore(int oldValue, int mask)
          Restore the modifier flags to their previous value.
 void scrollAndRepaint(int sx, int sy, int sw, int sh, int destX, int destY)
          This is called to update a Control on-screen after it has been scrolled.
 void sendToListeners(Event ev)
           
 int set(int flag, boolean status)
          Switch on or off a modifier depending on the status parameter.
 Control setBorder(int style, int width)
          This sets both the border style and width of the Control
 Control setCell(int val)
           
static void setClipObject(Object obj)
           
 Control setControl(int val)
           
 void setCursor(int cursor)
          Set the cursor for the control.
 Control setFixedSize(int width, int height)
           
 Control setFont(Font f)
          Set the Font for the control.
 Control setHotKey(int modifiers, char key)
          Set the hot-key for this Control.
 Control setHotKey(int modifiers, int key)
          Set the hot-key for this Control.
 void setLocation(int x, int y)
           
 Control setMaximumSize(int width, int height)
           
 void setMenu(Menu menu)
          Associate a context sensitive menu with the Control.
 Control setMinimumSize(int width, int height)
           
 Control setPreferredSize(int width, int height)
           
 void setPromptControl(Control prompt)
          On a normal Control this will set the promptControl variable to "prompt", but on a Container, the first child non-container will have "prompt" assigned to it.
 void setRect(int x, int y, int width, int height)
           
 void setRect(Rect r)
           
 void setServer(ScrollServer server)
           
 Control setTag(int tag, Object value)
           
 Control setTags(TagList tl)
           
 void setText(String what)
           
 Control setTextSize(int width, int height)
           
 Control setToolTip(Object tip)
          Set the tooltip of the object.
 void show(Rect where)
           
 void shown()
           
 void standardOnKeyEvent(KeyEvent ev)
          This is the standard Control onKeyEvent() - call this only after you have checked for other keys that your control definitely wants to trap.
protected  boolean startDragAndDrop(Object data, boolean isMultiple, boolean isCopy)
          Called by a Control from within the startDragging() method to indicate that a DragAndDrop operation should begin.
protected  boolean startDragAndDrop(Object data, int dragCursor, boolean isCopy)
          Called by a Control from within the startDragging() method to indicate that a DragAndDrop operation should begin.
 void startDragging(DragContext dc)
          This is called to indicate the start of a pen/mouse drag operation.
 void stopDragging(DragContext dc)
          Called when the pen was released during a drag operation.
 boolean takeData(Object data, DragContext how)
          This tells the Control to take the data which has either come from a clipboard operation or from a DragAndDrop.
 void takeFocus(int how)
           
protected  void takeFromClipboard(Object clip, String action)
          This calls takeData(data,null) and then calls dataAccepted(this,data,action) on the clipOwner.
protected  boolean takePromptControl(Control prompt)
           
protected  boolean testDim(Dimension dest, int w, int h)
           
 void ticked(int id, int elapsed)
           
 void toClipboard(boolean cut)
          Copy the selected contents of the control to clipboard.
 void toField()
           
 void toField(FieldTransfer ft)
           
 String toString()
          Return a String representation of this object.
static Object toTextData(Object data)
          This converts an object into either a String or an array of Strings.
 void transferPenPress(Control toChild)
          This is used to transfer a pen press to a Control that is contained within this child control tree of this Control.
 void transferPenPress(Control toWho, int dx, int dy)
          This is used to transfer a pen press to another Control.
protected  boolean tryDragAndDrop(DragContext dc)
          Call this from startDragging() if you want to try to do a drag and drop.
 boolean tryNext(boolean forwards)
           
 boolean tryStartMenu(Point pen)
          This attempts to display a Menu for the Control if one exists AND is not already displayed.
 void updateData()
          This tells the control to consider its current data to be unchanged.
protected  void willAcceptDrop()
          Should be called from the dataDraggedOver() method to indicate that the Control is not willing to accept the data.
 boolean willShowFrame(PenEvent ev)
          This is used to indicate that the control is going to show a pop-up Frame of some sort (e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode
 

Field Detail

x

protected int x
The control's x location


y

protected int y
The control's y location


width

protected int width
The control's width


height

protected int height
The control's height


parent

protected Container parent
The parent of the control.


next

protected Control next
The control's next sibling.


prev

protected Control prev
The control's previous sibling.


children

protected Control children
The children of the container.


tail

protected Control tail
The tail of the children list.


modifiers

protected int modifiers
Modifiers of the control.


DoPaintMethod

protected Object DoPaintMethod

MyClass

protected Object MyClass

hotKey

public int hotKey
This is the "HotKey" for the control - use setHotKey() to set it.


borderStyle

public int borderStyle
The border style of the Control. Should be one of the BDR_XXX or EDGE_XXX constants.


borderColor

public Color borderColor
The Color of the border of the Control (if a single line, non-3D border is used).


penStatus

public int penStatus

borderWidth

public int borderWidth

name

public String name

prompt

public String prompt
This is an optional string that is used as a user informative prompt for the control.


promptControl

public Control promptControl
This is optional - if an mLabel is used as the on-screen prompt for this control, then set this value to be that control. This ensures that if this control gets the focus and its container must scroll to make it visible, it will also attempt to make the prompt visible as well.


_debug

public boolean _debug

toolTip

public Object toolTip
The object's tool tip which should be a String, IImage, Control or ToolTip


preferredWidth

protected int preferredWidth
Do not set this directly - use setPrefferedSize() instead.


preferredHeight

protected int preferredHeight
Do not set this directly - use setPrefferedSize() instead.


minWidth

protected int minWidth
Do not set this directly - use setMinimumSize() instead.


minHeight

protected int minHeight
Do not set this directly - use setMinimumSize() instead.


maxWidth

protected int maxWidth
Do not set this directly - use setMaximumSize() instead.


maxHeight

protected int maxHeight
Do not set this directly - use setMaximumSize() instead.


backGround

public Color backGround

foreGround

public Color foreGround

font

public Font font

image

public IImage image

haveNativePaint

protected static boolean haveNativePaint

listeners

protected Vector listeners

np

public static final Point np

holdDownPause

public int holdDownPause

holdTick

public int holdTick

dragging

public DragContext dragging

exitKeys

public int[] exitKeys

dragResolution

public int dragResolution
The minimum number of pixels that the Pen/Mouse has to move during a drag operation to be considered a drag to a new location.


startDragResolution

public int startDragResolution
The number of pixels that the Pen/Mouse has to move before it is considered the start of a drag operation.


menuState

public MenuState menuState
This holds a MenuState Object used for controlling the Menu associated with the Control. You should not set this directly - it is set when you call setMenu()


dragTime

public int dragTime
Use this to control the resolution of the pen drags - it is the minimum delay in milliseconds between processing pen drags. Set it to zero to get the highest resolution for dragging - best for when creating applications for drawing on the screen. Set it to a higer value to get less drag events and improve response. By default it is 100.


beforeRemoved

protected static Object beforeRemoved
A temporary holding spot for data in the process of being moved.


text

public String text
The text associated with the control. You should use setText() to change it.


rows

public int rows

columns

public int columns

constraints

public int constraints

tags

public TagList tags

popupSound

public static String popupSound
This is the sound that is played when a popup-menu or pull-down menu is first shown. Set this to null to disable this sound, or change it for a different sound.


popupSoundClip

public static SoundClip popupSoundClip

lastSelected

protected MenuItem lastSelected

ss

protected ScrollServer ss

fieldTransfer

public FieldTransfer fieldTransfer

standardEdge

public static int standardEdge

standardBorder

public static int standardBorder
Constructor Detail

Control

public Control()
Method Detail

addTimer

public Timer addTimer(int millis)
Deprecated. Use ewe.sys.Vm.requestTimer();


removeTimer

public boolean removeTimer(Timer timer)
Deprecated. Use ewe.sys.Vm.requestTimer() and ewe.sys.Vm.cancelTimer();


getFontMetrics

public FontMetrics getFontMetrics(Font font)
Returns the font metrics for a given font.


getRect

public Rect getRect()
Returns a copy of the control's rectangle. A control's rectangle defines its location and size.


getParent

public Container getParent()
Returns the control's parent container.


getNext

public Control getNext()
Returns the next child in the parent's list of controls.


contains

public boolean contains(int x,
                        int y)
Returns true if the given x and y coordinate in the parent's coordinate system is contained within this control.


repaint

public void repaint()
This calls a repaintNow() using a CallBack - it does not repaint immediately.


createGraphics

public Graphics createGraphics()
Deprecated. Use getGraphics() instead.

Do not use this - it is for Waba compatibility only, use getGraphics() instead. Creates a Graphics object which can be used to draw in the control. This method finds the surface associated with the control, creates a graphics assoicated with it and translates the graphics to the origin of the control. It does not set a clipping rectangle on the graphics.


oldPostEvent

public void oldPostEvent(Event event)
Deprecated.  

Posts an event. The event pass will be posted to this control and all the parent controls of this control (all the containers this control is within).

See Also:
Event

setPromptControl

public void setPromptControl(Control prompt)
On a normal Control this will set the promptControl variable to "prompt", but on a Container, the first child non-container will have "prompt" assigned to it.

Parameters:
prompt - the Control acting as the prompt (usually an mLabel).

takePromptControl

protected boolean takePromptControl(Control prompt)

toString

public String toString()
Description copied from class: Object
Return a String representation of this object.

Overrides:
toString in class Object
Returns:
a String representing this object.

getChildren

public Iterator getChildren()
This iterator cycles through the components which are physically added to this Control


getChildrenBackwards

public Iterator getChildrenBackwards()

getAllDescendants

public Iterator getAllDescendants(boolean backwards)
Get all the sub-controls for this Control and their sub-controls.


getAllSubControls

public Iterator getAllSubControls()
Get all the sub-controls for this Control and their sub-controls.


getSubControls

public Iterator getSubControls()

activate

public void activate()
This does NOT enable a disabled control - but tells it to put itself in an "active" state. For example, a button in an active state looks as if the mouse/pen is being pressed down on it.

If you want to re-enable a disabled control do modify(0,Control.Disabled)


deactivate

public void deactivate()
This does NOT disable a control - but tells it to put itself in a "non-active" state. For example, a button that has is showing itself as being pressed, will show itself as not pressed when this is called.

If you want to disable a control do modify(Control.Disabled,0)


set

public final int set(int flag,
                     boolean status)
Switch on or off a modifier depending on the status parameter.

Parameters:
flag - The flags to set on or off.
status - if true the flags will be set on, if false they will be set off.
Returns:
the return value from the modify() call.

modify

public int modify(int flagsToSet,
                  int flagsToClear)
Set/Clear modifier flags for the Control. Examples of flags are Disabled, NotEditable, Invisible... Check ControlConstants for the complete list. The return value can be used to restore the modifiers to the original state like this:
        int old = myControl.modify(flagsSet,flagsClear);
        //do some processing...
        myControl.restore(old,flagsSet|flagsClear);
        

Parameters:
flagsToSet - The flags to set.
flagsToClear - The flags to clear.
Returns:
A value that can be use to restore the modifier to its original state using restore().

restore

public void restore(int oldValue,
                    int mask)
Restore the modifier flags to their previous value. An example use:
        int old = myControl.modify(flagsSet,flagsClear);
        //do some processing...
        myControl.restore(old,flagsSet|flagsClear);
        

Parameters:
oldValue - the value returned by modify().
mask - the paramters flagsToSet OR'ed with flagsToClear as used in the modify() method.

checkModifiers

public boolean checkModifiers(int flagsSet,
                              int flagsClear)
This checks if the specified flags are set or clear.

Parameters:
flagsSet - Flags to check for being set.
flagsClear - Flags to check for being clear.
Returns:
true if all the flags are set/cleared as specified.

change

public boolean change(int flagsToSet,
                      int flagsToClear)
This ensures that the specified flags are set or clear. Return true if a change was made. Returns false if no change was made.


hasModifier

public boolean hasModifier(int what,
                           boolean shouldInherit)
Check if the control has the specified modifier flags set.

Parameters:
what - The modifier flags to check for.
shouldInherit - if this is true then all parents of the control will also be checked.
Returns:
true if the flag is set in this control or in any of its ancestors (if should inherit is true).

getModifiers

public int getModifiers(boolean shouldInherit)
This will get the modifiers for this control. If shouldInherit is true, then all the ancestor modifiers will be OR'ed together.


inheritModifiers

public final void inheritModifiers(Control fromWho,
                                   boolean inheritFromAll,
                                   int what,
                                   boolean setChildren)
Get particular modifiers flags from another control and optionally set children flags.

Parameters:
fromWho - The control to get from.
inheritFromAll - if this is true then also check the ancestors of the control for the flags.
what - the flags to get (or'ed together).
setChildren - if this is true then modify my children.

modifyAll

public void modifyAll(int set,
                      int clear)
Modify this control and all child controls (and their children).

Parameters:
set - The flags to set.
clear - The flags to clear.

modifyAll

public void modifyAll(int set,
                      int clear,
                      boolean doThisOne)
Modify all child controls (and their children).

Parameters:
set - The flags to set.
clear - The flags to clear.
doThisOne - if this is true then this control will also be modified.

setToolTip

public Control setToolTip(Object tip)
Set the tooltip of the object.

Parameters:
tip - the tip which should be a String, IImage, Control or ToolTip
Returns:
this Control.

getToolTip

public Object getToolTip(int x,
                         int y)
This should return an acceptable ToolTip object. That is either a String, IImage, Control or ToolTip

Parameters:
x - The x location of the mouse in this control.
y - The y location of the mouse in this control.
Returns:
A suitable ToolTip or null.

recalculatePreferredSize

public final Dimension recalculatePreferredSize(Dimension dest)

testDim

protected boolean testDim(Dimension dest,
                          int w,
                          int h)

setFixedSize

public Control setFixedSize(int width,
                            int height)

setPreferredSize

public Control setPreferredSize(int width,
                                int height)

setTextSize

public Control setTextSize(int width,
                           int height)

setMinimumSize

public Control setMinimumSize(int width,
                              int height)

setMaximumSize

public Control setMaximumSize(int width,
                              int height)

getSizes

public int[] getSizes(int[] values)
This gets all of the control sizes. Currently it returns the preferredSize, minimumSize and maximumSize. They fit into the array as follows: preferredWidth,preferredHeight,minWidth,minHeight,maxWidth,maxHeight


getPreferredSize

public Dimension getPreferredSize(Dimension dest)

getMinimumSize

public Dimension getMinimumSize(Dimension dest)

getMaximumSize

public Dimension getMaximumSize(Dimension dest)

calculateSizes

protected void calculateSizes()
Override this to calculate the preferred, minimum and maximum size of your control. This is only called once unless the modifier flag AlwaysRecalculateSizes is true. During the calculation you will set the variables preferredWidth, preferredHeight, etc. directly.


calculateTextSize

protected Dimension calculateTextSize(int width,
                                      int height,
                                      Dimension dest)

make

public void make(boolean reMake)
This is used to "make" the control before being displayed. This is usually only overridden by containers.

Parameters:
reMake - if this is true then you should do a full re-make.

resizeTo

public void resizeTo(int width,
                     int height)
This will change the width and height values.


redisplay

public void redisplay()
Do not use this to repaint a control - use repaintNow() instead. This is used to cause a control to re-layout its components and re-calculate its preferred size.


requestResizeTo

public void requestResizeTo(int width,
                            int height)
This requests that the size be changed to the following dimensions but the control is free to ignore it or to change to a different value.


getRect

public Rect getRect(Rect dest)

setRect

public void setRect(Rect r)

setRect

public void setRect(int x,
                    int y,
                    int width,
                    int height)

getDim

public Rect getDim(Rect dest)

getSize

public Dimension getSize(Dimension dest)

getLocation

public Point getLocation(Point dest)

setLocation

public void setLocation(int x,
                        int y)

getDataRect

protected Rect getDataRect(Rect dest)
Get the rectangle, relative to the Control, of the area considered to be the "data" part of the control. This is only used for Controls with the HasData modifier. These are controls that distinguish between their data (e.g. contained text) and non-data (e.g. border) on-screen display.

Parameters:
dest - The destination rectangle.
Returns:
The destination rectangle or a new rectangle if the destination is null.

doPaintData

protected final void doPaintData()
Repaint the "data" part of the Control. This is only used for Controls with the HasData modifier. These are controls that distinguish between their data (e.g. contained text) and non-data (e.g. border) on-screen display.


doPaintData

protected void doPaintData(Graphics g)
Repaint the "data" part of the Control. This is only used for Controls with the HasData modifier. These are controls that distinguish between their data (e.g. contained text) and non-data (e.g. border) on-screen display.

Parameters:
g - The Graphics object to paint to.

repaintDataNow

public void repaintDataNow()
Repaint the "data" part of the Control now. This is only used for Controls with the HasData modifier. These are controls that distinguish between their data (e.g. contained text) and non-data (e.g. border) on-screen display. If the Control does not have the HasData modifier, then the entire control will be repainted via repaintNow().


repaintNow

public void repaintNow()
Repaint the Control now.


repaintNow

public void repaintNow(boolean yes)
Repaint the Control now if the "yes" parameter is true.


repaintNow

public void repaintNow(Graphics gr,
                       Rect where)
Repaint a section of the Control now.

Parameters:
gr - The Graphics to paint to. If this is null a new Graphics will be created.
where - The rectangle within the Control to paint. If this is null the entire Control will be painted.

onPaint

public void onPaint(Graphics gr)
Deprecated. Use doPaint() instead.

Do not use this - it is for Waba compatibility only.

Parameters:
gr - The graphics to paint to.

doBackground

public void doBackground(Graphics g)

getControlBuffer

public Image getControlBuffer(Rect r)
                       throws SystemResourceException
Throws:
SystemResourceException

getControlBuffer

public Image getControlBuffer()

doPaint

public void doPaint(Graphics g,
                    Rect r)

paintBackground

public void paintBackground(Graphics g)

getImage

public IImage getImage()

getFont

public Font getFont()

getBackground

public Color getBackground()

getForeground

public Color getForeground()

doBorder

public void doBorder(Graphics g)

oldButWorksDoPaintChildren

public void oldButWorksDoPaintChildren(Graphics g,
                                       int x,
                                       int y,
                                       int w,
                                       int h)

doPaintChildren

public void doPaintChildren(Graphics g,
                            int x,
                            int y,
                            int w,
                            int h)

doPaintChildren

public static void doPaintChildren(Control who,
                                   int flags,
                                   Graphics g,
                                   Rect area)

notNative_doPaintChildren

public static void notNative_doPaintChildren(Control who,
                                             int flags,
                                             Graphics g,
                                             Rect area)

doPaintChildren

protected static void doPaintChildren(Control who,
                                      int flags,
                                      Graphics g,
                                      Rect area,
                                      Rect clip)

oldPaintChildren

public void oldPaintChildren(Graphics g,
                             int x,
                             int y,
                             int width,
                             int height)

paintChildren

public void paintChildren(Graphics gr,
                          int x,
                          int y,
                          int w,
                          int h)

addListener

public void addListener(EventListener list)

removeListener

public void removeListener(EventListener list)

sendToListeners

public void sendToListeners(Event ev)

postEvent

public void postEvent(Event ev)

contains

public boolean contains(Control who)

onControlEvent

public void onControlEvent(ControlEvent ev)

onEvent

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

cancelHoldDown

public static void cancelHoldDown()

getDragAndDropContext

public static DragContext getDragAndDropContext()

ticked

public void ticked(int id,
                   int elapsed)
Specified by:
ticked in interface TimerProc

gotFocus

public void gotFocus(int how)

lostFocus

public void lostFocus(int how)

isChildOf

public final boolean isChildOf(Container who)

tryNext

public boolean tryNext(boolean forwards)

makeHot

public final String makeHot(String label)
Format the String as a true Hotkey encoded string using the hotkey associated with this control (if any).

Parameters:
label - The label to be displayed.
Returns:
A hotkey encoded label for display.

exitEntry

public final boolean exitEntry(int exitKey,
                               int modifiers)
If this returns false it means it is already in exitEntry.


checkExitKey

protected final boolean checkExitKey(KeyEvent ev)

isSomeonesHotKey

protected boolean isSomeonesHotKey(KeyEvent ev)

checkMenuKey

public boolean checkMenuKey(KeyEvent ev,
                            Point where)
This checks the incoming KeyEvent to see if it should cause this Control to show a menu. If it does then the Menu is shown and this returns true. Otherwise it returns false.


standardOnKeyEvent

public void standardOnKeyEvent(KeyEvent ev)
This is the standard Control onKeyEvent() - call this only after you have checked for other keys that your control definitely wants to trap. This method will check for an exit key, a menu key, will check for hot keys and check for keys that may cause a shift to another control.


onKeyEvent

public void onKeyEvent(KeyEvent ev)

setBorder

public final Control setBorder(int style,
                               int width)
This sets both the border style and width of the Control

Parameters:
style - The border style. One or more of the BDR_XXX or EDGE_XXX constants ORed together.
width - The distance between the edge of the Control and the data within it.
Returns:
this Control

setHotKey

public final Control setHotKey(int modifiers,
                               char key)
Set the hot-key for this Control.

Parameters:
modifiers - One or more of the IKeys.SHIFT, IKeys.CONTROL and IKeys.ONLY ORed together.
key - The character for the hot-key.
Returns:
this Control

setHotKey

public final Control setHotKey(int modifiers,
                               int key)
Set the hot-key for this Control.

Parameters:
modifiers - One or more of the IKeys.SHIFT, IKeys.CONTROL and IKeys.ONLY ORed together.
key - The KeyEvent key code for the hot-key.
Returns:
this Control

doHotKey

protected boolean doHotKey(Control from,
                           KeyEvent ev)
This method checks to see if a KeyEvent should be considered the Control's hot-key. If it is it calls doAction(ByKeyboard).

Parameters:
from - The Control (parent or sibling) that is passing the event to this Control.
ev - The KeyEvent representing the key press.
Returns:
true if the hot-key was accepted and handled.

doActionKey

public void doActionKey(int key)

doAction

public void doAction(int how)

checkPenTransparent

public boolean checkPenTransparent(PenEvent ev)

notifyAction

public void notifyAction()

notifyDataChange

public final void notifyDataChange()
Generate and dispatch a new DataChangeEvent.


notifyDataChange

public void notifyDataChange(DataChangeEvent dce)
Dispatch a new DataChangeEvent.

Parameters:
dce - The specific DataChangeEvent to send.

updateData

public void updateData()
This tells the control to consider its current data to be unchanged.


menuIsActive

public boolean menuIsActive()
Returns if the Menu associated with the Control is displayed.

Returns:
true if the Menu associated with the Control is displayed.

closeMenu

public void closeMenu()
If a menu for the control is being displayed, this will close it.


setMenu

public void setMenu(Menu menu)
Associate a context sensitive menu with the Control. If there is already a menu associated with the Control it will be replaced by this new one.

You can set a Menu for most Controls including Buttons.

Parameters:
menu - The Menu to set for the Control. This can be null.

getMenu

public Menu getMenu()
Return the Menu associated with the Control if any.

Returns:
the Menu associated with the Control if any.

tryStartMenu

public boolean tryStartMenu(Point pen)
This attempts to display a Menu for the Control if one exists AND is not already displayed.

By default it will call doShowMenu(pen) if the menu is not already active.

Parameters:
pen - The point where the pen/mouse was pressed - or null if you are requesting the control to show its menu at no particular point.
Returns:
true if the Menu was displayed by the method call.

doShowMenu

protected boolean doShowMenu(Point pen)
Used to show the menu associated with the Control. This will be called by tryStartMenu() which is what you should use instead.

Parameters:
pen - The point where the pen was pressed.
Returns:
true always.

transferPenPress

public final void transferPenPress(Control toChild)
This is used to transfer a pen press to a Control that is contained within this child control tree of this Control.

Parameters:
toChild - The child control to pass the pen press to.

transferPenPress

public final void transferPenPress(Control toWho,
                                   int dx,
                                   int dy)
This is used to transfer a pen press to another Control.

Parameters:
toWho - The Control to send it to.
dx - The change in the x co-ordinate for the event.
dy - The change in the y co-ordinate for the event.

willShowFrame

public boolean willShowFrame(PenEvent ev)
This is used to indicate that the control is going to show a pop-up Frame of some sort (e.g. for a Menu) in reaction to the specified PenEvent.


onPenEvent

public void onPenEvent(PenEvent ev)
Called to handle an incoming PenEvent. By default this dispatches the event to the various pen handling methods like penPressed()

Parameters:
ev - The incoming PenEvent.

isOnMe

protected boolean isOnMe(Point p)
Checks if the Point p - which is relative to the top-left of this Control, is within the bounds of the Control.

Parameters:
p - The point to check.
Returns:
true if the point is within the Control.

dataAccepted

protected void dataAccepted(Control byWho,
                            Object data,
                            String action)
This is called either when data that was cut from this control was pasted into another control, OR when data that was dragged from this control is dropped into another control.

Parameters:
byWho - The Control that accepted the data.
data - The data being transferred.
action - This is either "copy" or "move" indicating if the data is meant to be copied to the other control or moved to the other Control.

dataTransferCancelled

protected void dataTransferCancelled(Object data)
This gets called either when that was cut from this control was not placed into another control (either it was rejected by a paste or a subsequent copy/cut into the clipboard occured before the data was pasted) or a drag and drop was initiated but not completed.

Parameters:
data - The data that was being transferred. If it is null it indicates that this Control was a destination for a Drag and Drop operation, but the operation was cancelled by the user.

dataBeingRemoved

protected void dataBeingRemoved(Object data,
                                DragContext dc)
This tells the control that data is being removed from it either via a cut operation or by a drag operation that is not explicitly a copy operation. If the object is a Selectable object, then by default this will call delete selection. If you want more advanced operations (e.g. graying out the selection) you need to override this. If DragContext is null, it implies that it is via a "cut" operation, otherwise it is via a drag.


startDragAndDrop

protected boolean startDragAndDrop(Object data,
                                   int dragCursor,
                                   boolean isCopy)
Called by a Control from within the startDragging() method to indicate that a DragAndDrop operation should begin.

Parameters:
data - The data to drag.
dragCursor - The cursor code for the special cursor to use. This should be one of the ewe.sys.Vm.XXX_CURSOR constants OR a value returned by ewe.sys.Vm.createCursor().
isCopy - true if the operation is to be considered a copy operation. false if it is to be considered a move operation.
Returns:
true if successful.

startDragAndDrop

protected boolean startDragAndDrop(Object data,
                                   boolean isMultiple,
                                   boolean isCopy)
Called by a Control from within the startDragging() method to indicate that a DragAndDrop operation should begin.

Parameters:
data - The data to drag.
isMultiple - should be true if the data should be considered as multiple data. This will affect the cursor that is used.
isCopy - true if the operation is to be considered a copy operation. false if it is to be considered a move operation. This will affect the cursor that is used.
Returns:
true if successful.

penPressed

public void penPressed(Point p)
Called when the Pen or Mouse button is pressed on the control. This is called by the onPenEvent(PenEvent ev) method.

Within this method you can use the Control.currentPenEvent value to find out more about the PenEvent that caused this - including any modifiers (e.g. SHIFT keys) or determine if the left or right mouse button was pressed.

Parameters:
p - The point on the Control where the pen was pressed.

penHeld

public void penHeld(Point p)
Called when the Pen or Mouse button is held down on the control. This will only get called if the WantHoldDown modifier has been set for this control. This is called by the onPenEvent(PenEvent ev) method.

Within this method you can use the Control.currentPenEvent value to find out more about the PenEvent that caused this - including any modifiers (e.g. SHIFT keys) or determine if the left or right mouse button was pressed.

This method is usually used to display a context sensitive menu. In fact the default code for it is:

                if (!menuIsActive()) doMenu(p);
        

Parameters:
p - The point on the Control where the pen was held.

penRightReleased

public void penRightReleased(Point p)
Called when the right Mouse button is released on the control. This is called by the onPenEvent(PenEvent ev) method.

Within this method you can use the Control.currentPenEvent value to find out more about the PenEvent that caused this - including any modifiers (e.g. SHIFT keys) or determine if the left or right mouse button was pressed.

This method is usually used to display a context sensitive menu. In fact the default code for it is:

                if (!menuIsActive()) 
                        if (doMenu(p)) return;
                penReleased(p);
        

Parameters:
p - The point on the Control where the pen was released.

penReleased

public void penReleased(Point p)
Called when the Pen or Mouse button is released on the control. This is called by the onPenEvent(PenEvent ev) method.

Within this method you can use the Control.currentPenEvent value to find out more about the PenEvent that caused this - including any modifiers (e.g. SHIFT keys) or determine if the left or right mouse button was pressed.

Parameters:
p - The point on the Control where the pen was released.

penClicked

public void penClicked(Point p)
Called if the Pen or Mouse button is quickly pressed and released. This is called by the onPenEvent(PenEvent ev) method.

Within this method you can use the Control.currentPenEvent value to find out more about the PenEvent that caused this - including any modifiers (e.g. SHIFT keys) or determine if the left or right mouse button was pressed.

By default this method simply calls the penReleased() method.

Parameters:
p - The point on the Control where the pen was clicked.

penDoubleClicked

public void penDoubleClicked(Point p)
Called if the Pen or Mouse button is double clicked on the Control. This is called by the onPenEvent(PenEvent ev) method.

Within this method you can use the Control.currentPenEvent value to find out more about the PenEvent that caused this - including any modifiers (e.g. SHIFT keys) or determine if the left or right mouse button was pressed.

By default this method simply calls the penClicked() method.

Parameters:
p - The point on the Control where the pen was double-clicked.

doMenu

public boolean doMenu(Point p)
This is a request to display a menu based on the pen being held or the mouse being right clicked on the Control. By default this method calls tryStartMenu(p);

Parameters:
p - The point where the pen was pressed or held.
Returns:
true if a menu was displayed.

dataDroppedOn

public boolean dataDroppedOn(Object data,
                             Point p,
                             DragContext dc)
This is called by a drop from a drag and drop operation. By default it will call takeData() unless it is from itself, in which case the data is rejected and this returns false.


dataDraggedOff

public void dataDraggedOff(Object data)
This is called when data that was previously dragged into the control has now been dragged off.

Parameters:
data - the data being dragged.

dataDraggedOver

public void dataDraggedOver(Object data,
                            Point p,
                            PenEvent ev)
This is called when data is being dragged into the control. Within this method the control should call either willAcceptDrop() or dontAcceptDrop() to indicate its willingness to accept the data.

By default this method calls dataDraggedOver(Object data) - which itself by default calls acceptsData() to determine whether to call willAcceptDrop() or dontAcceptDrop().

Parameters:
data - The data being dragged.
p - The current location of the pen/mouse.
ev - The PenEvent that prompted this call.

dataDraggedOver

public void dataDraggedOver(Object data)
This is called when data is being dragged into the control. Within this method the control should call either willAcceptDrop() or dontAcceptDrop() to indicate its willingness to accept the data.

By default this method calls acceptsData() to determine whether to call willAcceptDrop() or dontAcceptDrop().

Parameters:
data - The data being dragged.

acceptsData

public boolean acceptsData(Object data,
                           DragContext how)
This should indicate whether this control will accept the data either via a drag and drop or via a paste operation.

Parameters:
data - The data to be transferred.
how - if the transfer is via DragAndDrop this will be a DragContext object, otherwise it will be null to indicate a clipboard operation.
Returns:
true if the data will be accepted by this control.

takeData

public boolean takeData(Object data,
                        DragContext how)
This tells the Control to take the data which has either come from a clipboard operation or from a DragAndDrop.

Parameters:
data - The data to accept.
how - if the transfer is via DragAndDrop this will be a DragContext object, otherwise it will be null to indicate a clipboard operation.
Returns:
true if the data was successfully accepted.

dontAcceptDrop

protected void dontAcceptDrop()
Should be called from the dataDraggedOver() method to indicate that the Control is willing to accept the data.


willAcceptDrop

protected void willAcceptDrop()
Should be called from the dataDraggedOver() method to indicate that the Control is not willing to accept the data.


getDataToDragAndDrop

protected boolean getDataToDragAndDrop(DragContext dc)
A quick way to provide DragAndDrop data. This will be called from tryDragAndDrop() which itself may be called from the startDragging() method.

To setup the DragContext you should set the dataToDrag, isMultiple and isCopy and (optionally) the dragCursor value.

Parameters:
dc - the DragContext to setup for the drag and drop operation.
Returns:
true if the data was successfully provided to drag and drop in the DragContext. false if there is no data to drag.

tryDragAndDrop

protected boolean tryDragAndDrop(DragContext dc)
Call this from startDragging() if you want to try to do a drag and drop.

Parameters:
dc - the DragContext to setup for the drag and drop operation.
Returns:

startDragging

public void startDragging(DragContext dc)
This is called to indicate the start of a pen/mouse drag operation. This will only get called if the WantDrag modifier has been set for this control. Within this method you can call startDragAndDrop() or tryDragAndDrop() to begin a data DragAndDrop operation.

Parameters:
dc - A DragContext indicating information about the dragging.

stopDragging

public void stopDragging(DragContext dc)
Called when the pen was released during a drag operation. This will only be called if a data DragAndDrop was not initiated and if the cancelled member of the DragContext was not set true during the operation.

Parameters:
dc - The DragContext for the dragging operation.

dragged

public void dragged(DragContext dc)
This is called during the drag operation. It is also called by default by the startDragging() method if you do not override it.

Parameters:
dc - The DragContext for the dragging operation.

fillBackground

public void fillBackground(Graphics g)

getGraphics

public Graphics getGraphics()
Return a Graphics context for this control for drawing directly onto the window surface.

Returns:
a Graphics context for this control.

getPosInParent

public Point getPosInParent(Container parent)

makeFrameTopMost

public void makeFrameTopMost()

resetRect

public void resetRect()

setText

public void setText(String what)

getText

public String getText()

getDisplayText

public String getDisplayText()
By default getDisplayText() returns getText();


getPrompt

public String getPrompt()

show

public void show(Rect where)

shown

public void shown()

formClosing

protected void formClosing()
This is called to indicate that the Form is about to close and it causes a FormClosed event to be posted. If you override it you should call super.formClosing(). There is no way of stopping the Form closing at this point.


isModal

public final boolean isModal()
This determines if the Control is being displayed in a modal frame.


getFrame

public Frame getFrame()

getWindow

public Window getWindow()

getFrameOrContainer

public Container getFrameOrContainer()

amOnTopFrame

public boolean amOnTopFrame()

getPosInFrame

public Point getPosInFrame()

getFontMetrics

public FontMetrics getFontMetrics()

onLabelPenEvent

public void onLabelPenEvent(PenEvent ev)

setControl

public Control setControl(int val)

setCell

public Control setCell(int val)

setTag

public Control setTag(int tag,
                      Object value)

getTag

public Object getTag(int tag,
                     Object defaultValue)

clearTag

public Control clearTag(int tag)

setTags

public Control setTags(TagList tl)

defaultTo

public Control defaultTo(int tag,
                         Object value)

hasTag

public boolean hasTag(int tag)

getNextKeyFocus

public Control getNextKeyFocus(Control sourceChild,
                               boolean forwards)
Determine which sub-control should receive the keyboard focus. This method is normally called when the user moves the focus off of one control using TAB or the cursor keys. A control which has no children should not look for sub controls.

Parameters:
sourceChild - the child control from which the call came from, or null if the call came from the parent of this control, or this control itself.
forwards - true if the user wants to go to the next control, false if the user wants to go to the previous one.
Returns:
the control (which may be this control) that should receive the focus, or null if none should.

setClipObject

public static void setClipObject(Object obj)

getClipObject

public static Object getClipObject()

getClipboardMenu

public Menu getClipboardMenu(Menu addTo)
This adds the standard clipboard menu to a menu to be used by this control.

Parameters:
addTo - The menu under construction or null for a new menu.
Returns:
the addTo parameter or a new Menu if it was null.

canEdit

public boolean canEdit()

checkMenu

public boolean checkMenu(Menu m)
This is called before a menu is displayed. You can use it to adjust the items in the menu. If it returns false the menu will not be displayed.


checkClipboardOperations

public boolean checkClipboardOperations(Menu m)
This is called to enable/disable the clipboard options depending on the state of the Control.

Parameters:
m - The Menu which contains the clipboard operations.
Returns:
always true.

getDataToCopy

protected Object getDataToCopy()
This is called to get data from the control to put into the clipboard.


takeFromClipboard

protected void takeFromClipboard(Object clip,
                                 String action)
This calls takeData(data,null) and then calls dataAccepted(this,data,action) on the clipOwner.


toTextData

public static final Object toTextData(Object data)
This converts an object into either a String or an array of Strings. If the Object cannot be converted into either, it will return null.


clipboardTransfer

public Object clipboardTransfer(Object clip,
                                boolean toClipboard,
                                boolean cut)

toClipboard

public void toClipboard(boolean cut)
Copy the selected contents of the control to clipboard. If cut is true the selected contents will be removed from the control if it is editable.


fromClipboard

public void fromClipboard()
Paste the contents of the clipboard into the control, overwriting any exisiting selected area. If exchange is true the selected area in the control will replace the current clipboard data.


popupMenuClosed

protected void popupMenuClosed(Menu m)
This gets closed after the popup menu for the Control has closed. You can clear the menu by doing setMenu(null).


popupMenuEvent

public void popupMenuEvent(MenuEvent ev)
This is called when the popup menu associated with the control generates an event. By default it calls popupMenuEvent(Object selectedItem) if the selectedItem is not null.

Parameters:
ev - The event.

popupMenuEvent

public void popupMenuEvent(Object selectedItem)
This is called when the user selects an item from the popup menu.

Parameters:
selectedItem - The item selected.

clipboardToString

public String clipboardToString(Object what)

cancelCut

public static void cancelCut(Control forWho)
If a Control is in the middle of a cut operation this will cancel the operation. If forWho is the source of the cut operation, OR forWho is null, then the operation will be cancelled.


popupBeep

public static void popupBeep()
This is called when a popup-menu or pull-down menu is first shown. It can also be called at any time for any other purpose. If you set popupSound to null, then no beep will be played at these times.


setCursor

public void setCursor(int cursor)
Set the cursor for the control.

Parameters:
cursor - Should be one of the ewe.sys.Vm.XXXX_CURSOR constants or a value returned from ewe.sys.Vm.createCursor().

getLastSelected

public MenuItem getLastSelected()
Find the menu item which was last selected. This may be from a sub menu.


setServer

public void setServer(ScrollServer server)

getServer

public ScrollServer getServer()

takeFocus

public void takeFocus(int how)

fromField

public void fromField(FieldTransfer ft)

toField

public void toField(FieldTransfer ft)

fromField

public final void fromField()

toField

public final void toField()

chainDataChange

public final void chainDataChange(Control other,
                                  String fieldName)
This sets up the Control, such that if the "other" control generates a DataChangeEvent then this Control will also generate a DataChangeEvent.

Parameters:
other - The Control to listen for DataChangeEvents.
fieldName - An optional name to give the chained control.

scrollAndRepaint

public void scrollAndRepaint(int sx,
                             int sy,
                             int sw,
                             int sh,
                             int destX,
                             int destY)
This is called to update a Control on-screen after it has been scrolled. In this case "being scrolled" means that the internal display co-ordinates of the Control have been altered but a repaint has not been done. This method attempts to do the most effecient repaint depending on the capabilities of the underlying graphics system.

If data can be moved directly on screen, then this will be done and only the newly exposed portion will be updated via a repaintNow() operation. If no moving is possible at all - or if the SIP may be covering the control then no scrolling will be done.

Parameters:
sx - The source x co-ordinate.
sy - The source y co-ordinate.
sw - The source width.
sh - The source height.
destX - The destination x co-ordinate.
destY - The destination y co-ordinate.

getPromptText

public String getPromptText()
This returns either the value of prompt, if it is not null and not an empty string, or the text value of promptControl, if that is not null and not an empty string. If no non-empty string prompt can be found, it will return null.


setFont

public Control setFont(Font f)
Set the Font for the control.

Parameters:
f - the Font to set.
Returns:
this Control.

requestPaint

public boolean requestPaint()
Call this if you are going to be painting all or a portion of the control at an arbitrary time. If it returns false then part of the control may be covered and you should therefore not do a paint at this time.

This method simply calls: Gui.requestPaint(this);

Returns:
true if it is OK to go ahead and paint, false if you should not paint now.

refresh

public void refresh(IImage image,
                    int options)
The default version of this method simpy repaints the control - however for controls which may display multiple images a better refresh scheme would be needed.

Specified by:
refresh in interface ImageRefresher
Parameters:
image - the image to refresh.
options -
Returns:

getPasswordCharacter

public char getPasswordCharacter()
If this Control represents the input of a password that must be kept hidden, then this method should return a password character (usually a '*'). If not then this should return (char)0.


hasPopupFormAttached

public boolean hasPopupFormAttached()
Returns true if a ControlPopupForm is attached to this Control.