ewe.ui
Class TaskbarWindow

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

public class TaskbarWindow
extends Window

This is a window that you can use to place and react to an icon in the taskbar under Win32. The window will be invisible but can receive mouse press events when the icon is pressed. Override iconPressed() to handle the event (by default it will bring the application to the front).

Note that all icons are specified as Objects and not any kind of Image or IImage. This is because the icon must be a native icon as created by Image.toIcon(Image mask). This method converts an image to a native icon using a mask Image. That mask Image must have been loaded as a monochrome .bmp file otherwise this will not work correctly under Win32.


Nested Class Summary
 
Nested classes inherited from class ewe.ui.Window
Window.TaskBarIconInfo
 
Field Summary
protected  Handle animation
           
protected  Object currentIcon
           
 Hashtable icons
          The icons are stored in here.
 
Fields inherited from class ewe.ui.Window
_controlEvent, _keyEvent, _penEvent, _sipEvent, canDisplay, closeLock, contents, creationData, currentCursor, downPoint, dragAndDropCursor, dragAndDropData, dragAndDropSource, firstDisplay, inEventThread, inFront, lastWindow, wasPainted
 
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
TaskbarWindow(String title)
          Create a new TaskbarWindow with a specific title.
TaskbarWindow(String title, Dimension imageSizeIfNotSupported, int textLengthIfNotSupported)
          This creates a new TaskbarWindow, but if Taskbar icons are not supported, then a window will be displayed that will display the icon and tip.
TaskbarWindow(String title, Object icon, String tip)
          Create a TaskbarWindow with a specific icon and tip.
TaskbarWindow(String title, String pathOfImageFile, String pathOfImageMask, String tip)
          This creates a TaskbarWindow, which then immediately shows the specified icon and tip.
 
Method Summary
 boolean addIcon(String name, Object icon)
           
 boolean addIcon(String name, String pathOfImageFile, String pathOfImageMask)
           
 Handle animate(String iconsAndTimes, String tip)
          Animate the icon on the taskbar.
 boolean clearIcon()
           
 boolean close()
          This closes the window and destroys the native Window component.
 Object getIcon()
          Get an object representing the of the icon and tip currently displayed.
static void main(String[] args)
           
 void restoreIcon(Object was)
          Restore the icon according to the value that was returned by getIcon().
 boolean setIcon(String name)
           
 boolean setIconAndTip(String name, String tip)
           
 boolean setTip(String tip)
           
 void stopAnimation()
           
static boolean supportsTaskbar()
          Call this to find out if the current platform supports showing an icon in the Taskbar.
 
Methods inherited from class ewe.ui.Window
_doPaint, _postEvent, _textEvent, applicationToFront, appResized, beginDragAndDrop, beginDragAndDrop, captureAppKeys, centerWindow, centerWindow, checkSipCoverage, clearQueuedMoves, clearWindowFlags, closeWindow, create, createNativeWindow, damageRect, doPostEvent, doPostEvent, doSpecialOp, enterNativeDialog, exitNativeDialog, getActiveWindow, getContainingWindow, getFocus, getGuiInfo, getInfo, getNativeWindow, getOpenWindows, getProperties, getState, getTitle, getWindowFlags, getWindowRect, handleNativeMessage, handleSipEvent, iconPressed, inNativeInput, isCreated, mobileWindowEvent, nativeGetGuiInfo, nextMouseIsMove, onEvent, releaseMouseCapture, resizeTo, setFocus, setIcon, setInfo, setState, setText, setTitle, setWindowFlags, setWindowRect, shutdown, shutdownAll, supportsMultiple, textInput, toFront, transferPenPress, tryWindow, waitUntilPainted, wantToHandle, 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

icons

public Hashtable icons
The icons are stored in here.


currentIcon

protected Object currentIcon

animation

protected Handle animation
Constructor Detail

TaskbarWindow

public TaskbarWindow(String title)
Create a new TaskbarWindow with a specific title. Note that the Window will be invisible.


TaskbarWindow

public TaskbarWindow(String title,
                     Dimension imageSizeIfNotSupported,
                     int textLengthIfNotSupported)
This creates a new TaskbarWindow, but if Taskbar icons are not supported, then a window will be displayed that will display the icon and tip.


TaskbarWindow

public TaskbarWindow(String title,
                     String pathOfImageFile,
                     String pathOfImageMask,
                     String tip)
This creates a TaskbarWindow, which then immediately shows the specified icon and tip.

Parameters:
title - The title for the window. This will not be displayed since it is invisible.
pathOfImageFile - image file (must be a ".bmp")
pathOfImageMask - image mask (must be a monochrome ".bmp")
tip - An optional tip to display.

TaskbarWindow

public TaskbarWindow(String title,
                     Object icon,
                     String tip)
Create a TaskbarWindow with a specific icon and tip. Additional verbose

Parameters:
title - The title to display.
icon - The icon as returned by Image.toIcon(Image mask).
tip - A tip to display along with the icon.
Method Detail

supportsTaskbar

public static boolean supportsTaskbar()
Call this to find out if the current platform supports showing an icon in the Taskbar.


close

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

Overrides:
close in class Window

addIcon

public boolean addIcon(String name,
                       String pathOfImageFile,
                       String pathOfImageMask)

addIcon

public boolean addIcon(String name,
                       Object icon)

getIcon

public Object getIcon()
Get an object representing the of the icon and tip currently displayed. If you change the icon being displayed after calling this, you can restore it by calling restoreIcon().

Returns:
the name of the icon currently displayed.

restoreIcon

public void restoreIcon(Object was)
Restore the icon according to the value that was returned by getIcon().

Parameters:
was - The value returned by getIcon().

setIcon

public boolean setIcon(String name)

setTip

public boolean setTip(String tip)

setIconAndTip

public boolean setIconAndTip(String name,
                             String tip)

clearIcon

public boolean clearIcon()

stopAnimation

public void stopAnimation()

animate

public Handle animate(String iconsAndTimes,
                      String tip)
Animate the icon on the taskbar. This will sequence the taskbar icons through the specified icons, pausing for the specified times in between. The icons must have been added using addIcon() before. If an animation is already running, this will be stopped.

Parameters:
iconsAndTimes - Concatenation of icon names and pause times in milliseconds, separated by '|' characters. e.g. "icon1|250|icon2|500|icon3|100"
Returns:
a Handle that you can use to stop the animation by calling stop() on the handle.

main

public static void main(String[] args)