ewe.ui
Class ImageControl

java.lang.Object
  extended byewe.ui.ControlBase
      extended byewe.ui.Control
          extended byewe.ui.Container
              extended byewe.ui.Canvas
                  extended byewe.ui.ImageControl
All Implemented Interfaces:
CellConstants, ControlConstants, EventListener, ImageRefresher, IScroll, ScrollClient, TimerProc, UIConstants

public class ImageControl
extends Canvas


Field Summary
static int FIT
          If an image is being stretched or shrunk, this option tells it not to change the aspect ration.
static int LIMIT_DECODED_SIZE
          When the setData() method is called with the encoded image bytes, this option tells the ImageControl to limit the decoded size if possible.
 int options
          By default this is STRETCH|SHRINK|FIT - telling the control to stretch or shrink the image into the display, but preserve the aspect ration.
static int ROUGH_SCALING
          This options tells the ImageControl to scale the image using a rough scaling instead of smooth scaling.
 boolean showImageBackground
          If this is true then the control will have a background equal to the image background IF the image has a background color associated with it (e.g.
static int SHRINK
          If an image is larger than the control, this option will shrink it.
static int STRETCH
          If an image is smaller than the control, this option will expand it.
 
Fields inherited from class ewe.ui.Canvas
isFullScrollClient, origin, scrollPercent, virtualSize
 
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, 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.ui.IScroll
Higher, Horizontal, Lower, OPTION_INDICATOR_ONLY, PageHigher, PageLower, ScrollHigher, ScrollLower, TrackTo, Vertical
 
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, SOUTH, SOUTHEAST, SOUTHWEST, SPAN, 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
ImageControl(IImage what)
           
 
Method Summary
protected  void calculateSizes()
          Override this to calculate the preferred, minimum and maximum size of your control.
 void doPaint(Graphics g, Rect area)
           
protected  void formClosing()
          This is called to indicate that the Form is about to close and it causes a FormClosed event to be posted.
 IImage getImage()
           
 void setData(Object data)
           
 void setImage(IImage im)
           
 void shown()
           
 
Methods inherited from class ewe.ui.Canvas
canGo, canScreenScroll, checkScrolls, doBorder, doScroll, fixOrigin, getActual, getBuffer, getCurrent, getDisplayedSize, getMySize, getPercent, getScrollablePanel, getScrollClient, getVisible, getVisibleArea, needScrollBar, onScroll, onSetOrigin, reduceClip, scroll, scroll, scrollToVisible, setOrigin, updateScrollServer
 
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, takeFocus, takePromptControl
 
Methods inherited from class ewe.ui.Control
acceptsData, activate, addListener, addTimer, amOnTopFrame, 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, doMenu, dontAcceptDrop, doPaintChildren, doPaintChildren, doPaintChildren, doPaintData, doPaintData, doShowMenu, dragged, exitEntry, fillBackground, fromClipboard, fromField, fromField, getAllDescendants, getAllSubControls, getBackground, getClipboardMenu, getClipObject, getControlBuffer, getControlBuffer, getDataRect, getDataToCopy, getDataToDragAndDrop, getDim, getDisplayText, getDragAndDropContext, getFont, getFontMetrics, getFontMetrics, getForeground, getFrame, getFrameOrContainer, getGraphics, 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, onEvent, 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, resizeTo, restore, scrollAndRepaint, sendToListeners, set, setBorder, setCell, setClipObject, setControl, setCursor, setFixedSize, setFont, setHotKey, setHotKey, setLocation, setMaximumSize, setMenu, setMinimumSize, setPreferredSize, setPromptControl, setRect, setRect, setServer, setTag, setTags, setText, setTextSize, setToolTip, show, 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
 
Methods inherited from interface ewe.ui.ScrollClient
getServer, setServer
 

Field Detail

STRETCH

public static final int STRETCH
If an image is smaller than the control, this option will expand it.

See Also:
Constant Field Values

SHRINK

public static final int SHRINK
If an image is larger than the control, this option will shrink it.

See Also:
Constant Field Values

FIT

public static final int FIT
If an image is being stretched or shrunk, this option tells it not to change the aspect ration.

See Also:
Constant Field Values

LIMIT_DECODED_SIZE

public static final int LIMIT_DECODED_SIZE
When the setData() method is called with the encoded image bytes, this option tells the ImageControl to limit the decoded size if possible.

See Also:
Constant Field Values

ROUGH_SCALING

public static final int ROUGH_SCALING
This options tells the ImageControl to scale the image using a rough scaling instead of smooth scaling. Rough scaling is faster than smooth scaling.

See Also:
Constant Field Values

options

public int options
By default this is STRETCH|SHRINK|FIT - telling the control to stretch or shrink the image into the display, but preserve the aspect ration.


showImageBackground

public boolean showImageBackground
If this is true then the control will have a background equal to the image background IF the image has a background color associated with it (e.g. PNG images allow a background color to be specified).

Constructor Detail

ImageControl

public ImageControl(IImage what)
Method Detail

getImage

public IImage getImage()
Overrides:
getImage in class Control

setImage

public void setImage(IImage im)

shown

public void shown()
Overrides:
shown in class Control

formClosing

protected void formClosing()
Description copied from class: Control
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.

Overrides:
formClosing in class Control

setData

public void setData(Object data)

doPaint

public void doPaint(Graphics g,
                    Rect area)
Overrides:
doPaint in class Control

calculateSizes

protected void calculateSizes()
Description copied from class: Control
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.

Overrides:
calculateSizes in class Control