danger.ui
Class IconPicker

java.lang.Object
  extended by danger.app.Listener
      extended by danger.ui.View
          extended by danger.ui.Container
              extended by danger.ui.Control
                  extended by danger.ui.IconPicker
All Implemented Interfaces:
ToolTipOwner


public class IconPicker
extends Control

An IconPicker is a control that provides a way for the user to select from a set of icons. It is used, for example, in the address book application to allow the user to assign an icon to a contact.


Field Summary
protected static int ARROW_HEIGHT
          Deprecated.  
protected static int ARROW_WIDTH
          Deprecated.  
protected static int DEFAULT_ICONS_COUNT
          Deprecated.  
protected static int LARGE_ICON_CELL_SIZE
          Deprecated. Unused.
protected static int MAX_COLUMNS
          Deprecated.  
protected static int MAX_ROWS
          Deprecated.  
protected  int mCurrentSelection
          Deprecated. Use getCurrentSelection() instead.
protected  Object mEventArg
          Deprecated. Use Control.setEvent(danger.app.Event) instead.
protected  int mEventData
          Deprecated. Use Control.setEvent(danger.app.Event) instead.
protected  Listener mEventListener
          Deprecated. Use Control.setEvent(danger.app.Event) instead.
protected  int mEventType
          Deprecated. Use Control.setEvent(danger.app.Event) instead.
protected  int mIconCellHeight
          Deprecated. Use setIconCellSize(int) and getIconCellHeight() instead.
protected  int mIconCellWidth
          Deprecated. Use setIconCellSize(int) and getIconCellWidth() instead.
protected  Vector mItems
          Deprecated. Use addIcon(danger.ui.Bitmap), removeIcon(int), and getIconAt(int) instead.
protected  int mMaxColumns
          Deprecated. Use setMaxColumns(int) and getMaxColumns() instead.
protected  int mMaxRows
          Deprecated. Use setMaxRows(int) and getMaxRows() instead.
protected  IconPickerWindow mOpenWindow
          Deprecated.  
protected  Bitmap mPhotoPickerIcon
          Deprecated. Use setPhotoPickerIconAndTitle(danger.ui.Bitmap, java.lang.String) instead.
protected  boolean mPhotoPickerSelected
          Deprecated. Use getPhotoPickerSelected() instead.
protected  String mPhotoPickerTitle
          Deprecated. Use setPhotoPickerIconAndTitle(danger.ui.Bitmap, java.lang.String) instead.
protected  PhotoRecord mPhotoRecord
          Deprecated. Use getPhotoRecord() instead.
protected static int SMALL_ICON_CELL_SIZE
          Deprecated. Unused.
 
Fields inherited from class danger.ui.Control
mValue
 
Fields inherited from class danger.ui.View
DEFAULT_SCROLL_FOCUS_MARGIN, FOCUS_DEFAULT, FOCUS_DOWNWARD, FOCUS_LEFTWARD, FOCUS_NONE, FOCUS_RIGHTWARD, FOCUS_UPWARD, mOriginX, mOriginY, mStyle, POSITION_ABOVE, POSITION_ALIGN_BASELINE, POSITION_ALIGN_BOTTOM, POSITION_ALIGN_HORIZONTALLY, POSITION_ALIGN_LEFT, POSITION_ALIGN_PARENT_BOTTOM, POSITION_ALIGN_PARENT_RIGHT, POSITION_ALIGN_RIGHT, POSITION_ALIGN_TOP, POSITION_ALIGN_VERTICALLY, POSITION_BELOW, POSITION_CENTER_HORIZONTALLY, POSITION_CENTER_VERTICALLY, POSITION_TO_LEFT, POSITION_TO_RIGHT, PREFER_DIRECTION_NONE, PREFER_HORIZONTAL_DIRECTION, PREFER_VERTICAL_DIRECTION, STATE_AT_AND_SPACE_PAGE, STATE_CAN_FOCUS, STATE_DEBUG_BOUNDS, STATE_ENABLED, STATE_FOCUSED, STATE_MAKE_DING, STATE_PARTIAL_FOCUS_OK, STATE_TRANSPARENT, STATE_VISIBLE, WIDTH_FILL_TO_RIGHT
 
Constructor Summary
IconPicker()
          Create an IconPicker with default number of columns and icon size.
IconPicker(int maxColumns)
          Create an IconPicker with the specifed number of columns and icon size.
IconPicker(int maxColumns, int iconCellSize)
          Create an IconPicker with the specifed number of columns and icon size.
 
Method Summary
 boolean addDefaultIcon(Bitmap inIcon)
          Add a default icon to the picker.
 boolean addIcon(Bitmap inIcon)
          Add an icon to the picker.
 boolean addIcon(Bitmap inIcon, int inIconType)
          Add an icon to the picker with a specified type.
 boolean addPhotoIcon(Bitmap inIcon)
          Add a photo icon to the picker.
 boolean addPhotoPickerIcon()
          Add a photo picker icon to the picker.
 boolean addPhotoPickerIcon(Bitmap inIcon)
          Add a photo picker icon to the picker.
 void drawClosedIconPicker(Pen p)
           
 void enterPicker()
           
 boolean eventKeyUp(char inChar, Event event)
          Processes key releases directed at this container.
 boolean eventWidgetUp(int inWhichWidget, Event event)
          Handle the release of a device widget
 boolean getAllowDuplicates()
           
 Bitmap getClippedPhoto()
          Get the selected photo clipped to be square.
 int getCurrentSelection()
          Get the index of the currently selected icon.
 int getDefaultIconIndex()
          Get the index of the default icon.
 Listener getEventListener()
           
 int getFirstNormalIconIndex()
          Get the index of the first normal icon.
 Bitmap getIconAt(int inIndex)
          Get the icon at the specified index.
 int getIconCellHeight()
          Get the icon height for the picker icons.
 int getIconCellWidth()
          Get the icon width for the picker icons.
 int getIconCount()
          Get the number of icons currently in the picker.
 int getIconIndex(int inIconType)
          Get the index of the icon of specified type.
 int getIconTypeAt(int inIndex)
          Get the type of the icon at the specified index.
 int getMaxColumns()
          Get the maximum number of columns per row for the picker.
 int getMaxRows()
          Get the maximum number of rows before scrolling.
 int getNormalIconIndex()
          Get the normal icon index.
 Bitmap getPhoto()
          Get the selected photo.
 int getPhotoIconIndex()
          Get the index of the photo icon.
 int getPhotoPickerIconIndex()
          Get the index of the photo picker icon.
protected  boolean getPhotoPickerSelected()
          Determine whether the photo picker was selected.
 PhotoRecord getPhotoRecord()
          Get the selected photo record.
 Bitmap getScaledPhoto(int width, int height)
          Get selected photo scaled to specified width and height.
protected  void handlePhotoSelect(PhotoRecordIPCPayload records)
           
 int iconCount()
          Deprecated. use getIconCount()
 void insertIcon(Bitmap inIcon, int inIndex)
          Insert an icon before icon at index.
 void insertIcon(Bitmap inIcon, int inIndex, int inIconType)
          Insert an icon of specified type before icon at index.
protected  void onHandleSelect()
           
 void paint(Pen p)
          Draw the contents of this View.
 boolean photoChanged()
          Get the state of the photo icon.
 boolean receiveEvent(Event e)
          Entry point for event processing.
 void removeAllItems()
          Remove all icons from the picker.
 void removeIcon(Bitmap inIcon)
          Remove specified icon.
 void removeIcon(int index)
          Remove icon at index.
 void setAllowDuplicates(boolean allow)
           
 void setIcon(Bitmap inIcon, int inIndex)
          Replace the icon at index.
 void setIcon(Bitmap inIcon, int inIndex, int inIconType)
          Replace the icon and type at index.
 void setIconCellSize(int iconCellSize)
          Set the icon size for the picker icons.
 void setIconCellSize(int cellWidth, int cellHeight)
          Set the icon height and width for the picker icons.
 void setMaxColumns(int maxColumns)
          Set the maximum number of columns per row for the picker.
 void setMaxRows(int maxRows)
          Set the maximum number of rows before scrolling.
 void setPhotoPickerIconAndTitle(Bitmap inIcon, String inTitle)
          Set photo picker icon and title.
 void showPhotoPicker(Bitmap inIcon, String inTitle)
          Show the photo picker.
 
Methods inherited from class danger.ui.Control
drawFocusBox, drawIdleBox, drawIdleBox, getBaseline, getEvent, getEventType, getHasBorder, getMaxToolTipLines, getTitle, getTitleSequence, getToolTip, getValue, hasToolTip, loseFocus, onSetHasBorder, onSetTitle, sendEvent, setEvent, setEvent, setEvent, setEvent, setEvent, setEventArg, setEventListener, setHasBorder, setMaxToolTipLines, setTitle, setTitle, setToolTip, setValue, showToolTip, takeFocus
 
Methods inherited from class danger.ui.Container
addChild, addChild, addChildAt, addChildAt, addFromContainerResource, addFromContainerResource, addFromContainerResource, addFromDialogResource, addFromDialogResource, advanceFocus, advanceFocusInWindow, childCount, childIsOnScreen, disable, enable, eventKeyDown, eventKeyHeld, eventKeyRepeat, eventPeriodicPulse, eventRawKeyDown, eventRawKeyHeld, eventRawKeyRepeat, eventRawKeyUp, eventShortcut, eventWidgetDown, eventWidgetHeld, focusedDescendantIsValid, getBottomChild, getBottomChild, getChildAt, getChildIndex, getChildWithID, getControlWithID, getDescendantWithID, getFirstChild, getFirstFocusableChild, getFocusableChildInWindow, getFocusedChild, getFocusedLeaf, getInterestingRect, getLastChild, getLastFocusableChild, getLeftMostChild, getNextFocusableChild, getNextFocusableChild, getPageHeight, getPrevFocusableChild, getPrevFocusableChild, getRightMostChild, getRightMostChild, handleButtonShortcut, hideAllChildren, isDescendant, keepRectInView, moveChildToIndex, onChildPositionChanged, onChildSizeChanged, onChildVisibilityChanged, pageToEnd, pageToHome, paintChildren, reflowChildren, removeAllChildren, removeChild, reverseFocus, setFocusedChild, setFocusedChild, setFocusedChild, setFocusedDescendant, setFocusedDescendant, setFocusedDescendant, setFocusToFirstDescendant, setFormatDateForControlWithID, setFormatDateForTextControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setListenerForAllControls, setReflowAdjustHeight, setWindow, showAllChildren, snapHeightToChildren, snapHeightToChildren, snapToChildren, snapWidthToChildren, snapWidthToChildren, willFocusWithin, willFocusWithin
 
Methods inherited from class danger.ui.View
boundsIntersect, boundsIntersect, canLoseFocus, clear, clear, copyStyle, getAcceptFocus, getBackgroundColor, getBottom, getBounds, getBounds, getFocusTraversalDirection, getFocusTraversalFrom, getFocusTraversalPolicy, getFrame, getFrame, getGlobalBottom, getGlobalLeft, getGlobalRight, getGlobalTop, getHeight, getID, getInterestingRect, getLabelFont, getLabelFont, getLeft, getOrigin, getOrigin, getOriginX, getOriginY, getParent, getParentContainer, getPartialFocusOK, getRight, getScrollFocusMargin, getSibling, getState, getStyle, getStyleColor, getStyleFont, getTop, getWidth, getWindow, globalToLocal, globalToLocalH, globalToLocalV, hide, invalidate, invalidate, invalidate, invalidateIndependentOfOrigin, invalidateIndependentOfOrigin, isEnabled, isFocusable, isFocused, isOnScreen, isTransparent, isVisible, isVisibleInHierarchy, isVisibleOnScreen, justSetVisible, localToGlobal, localToGlobal, localToGlobalH, localToGlobalV, localToWindow, moveBy, notifyWhenParentSizeChanges, notifyWhenPositionChanges, notifyWhenSizeChanges, offsetOrigin, offsetOrigin, onAddedToParent, onDecoded, onEnabledStateChanged, onHide, onPeriodicPulse, onPositionChanged, onRemovedFromParent, onShortcut, onShortcut, onShortcutConsumed, onShow, onSizeChanged, onStyleChanged, onViewPositionChanged, onViewSizeChanged, onWindowPaint, playLimitSound, receiveEventInternal, resetOrigin, sendEventToWindow, setAcceptFocus, setAtAndSpacePage, setBackground, setBackgroundColor, setBottom, setDebugBounds, setDynamicPosition, setDynamicWidth, setEnabled, setFocusTraversalDirection, setFocusTraversalFrom, setFocusTraversalPolicy, setFrame, setHeight, setKeyedValue, setLabelFont, setLeft, setMakeLimitNoise, setOrigin, setOrigin, setPartialFocusOK, setPosition, setPreferredDirection, setRight, setScrollFocusMargin, setSize, setStyle, setStyleColor, setStyleFont, setStyleFrameColor, setTop, setTransparent, setVisible, setWidth, shouldDropEvent, show, showContextMenu, styleIsDefault, swapStyleColors, windowToLocal
 
Methods inherited from class danger.app.Listener
cancelEvents, childEventPump, childEventPumpDone, eventProblem, isDispatchingThread, sendEvent, sendEvent, sendEvent, sendEvent, sendEvent, sendLowPriorityEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mOpenWindow

protected IconPickerWindow mOpenWindow
Deprecated. 

mItems

protected Vector mItems
Deprecated. Use addIcon(danger.ui.Bitmap), removeIcon(int), and getIconAt(int) instead.

mCurrentSelection

protected int mCurrentSelection
Deprecated. Use getCurrentSelection() instead.

mMaxColumns

protected int mMaxColumns
Deprecated. Use setMaxColumns(int) and getMaxColumns() instead.

mMaxRows

protected int mMaxRows
Deprecated. Use setMaxRows(int) and getMaxRows() instead.

mIconCellWidth

protected int mIconCellWidth
Deprecated. Use setIconCellSize(int) and getIconCellWidth() instead.

mIconCellHeight

protected int mIconCellHeight
Deprecated. Use setIconCellSize(int) and getIconCellHeight() instead.

mPhotoRecord

protected PhotoRecord mPhotoRecord
Deprecated. Use getPhotoRecord() instead.

mPhotoPickerIcon

protected Bitmap mPhotoPickerIcon
Deprecated. Use setPhotoPickerIconAndTitle(danger.ui.Bitmap, java.lang.String) instead.

mPhotoPickerTitle

protected String mPhotoPickerTitle
Deprecated. Use setPhotoPickerIconAndTitle(danger.ui.Bitmap, java.lang.String) instead.

mPhotoPickerSelected

protected boolean mPhotoPickerSelected
Deprecated. Use getPhotoPickerSelected() instead.

mEventType

protected int mEventType
Deprecated. Use Control.setEvent(danger.app.Event) instead.

mEventData

protected int mEventData
Deprecated. Use Control.setEvent(danger.app.Event) instead.

mEventArg

protected Object mEventArg
Deprecated. Use Control.setEvent(danger.app.Event) instead.

mEventListener

protected Listener mEventListener
Deprecated. Use Control.setEvent(danger.app.Event) instead.

LARGE_ICON_CELL_SIZE

protected static final int LARGE_ICON_CELL_SIZE
Deprecated. Unused.
See Also:
Constant Field Values

SMALL_ICON_CELL_SIZE

protected static final int SMALL_ICON_CELL_SIZE
Deprecated. Unused.
See Also:
Constant Field Values

DEFAULT_ICONS_COUNT

protected static final int DEFAULT_ICONS_COUNT
Deprecated. 
See Also:
Constant Field Values

MAX_COLUMNS

protected static final int MAX_COLUMNS
Deprecated. 
See Also:
Constant Field Values

MAX_ROWS

protected static final int MAX_ROWS
Deprecated. 
See Also:
Constant Field Values

ARROW_WIDTH

protected static final int ARROW_WIDTH
Deprecated. 
See Also:
Constant Field Values

ARROW_HEIGHT

protected static final int ARROW_HEIGHT
Deprecated. 
See Also:
Constant Field Values
Constructor Detail

IconPicker

public IconPicker()
Create an IconPicker with default number of columns and icon size.


IconPicker

public IconPicker(int maxColumns)
Create an IconPicker with the specifed number of columns and icon size.

Parameters:
maxColumns - Maximum number of columns per row.

IconPicker

public IconPicker(int maxColumns,
                  int iconCellSize)
Create an IconPicker with the specifed number of columns and icon size.

Parameters:
maxColumns - Maximum number of columns per row.
iconCellSize - Height and width (in pixels) of icons in picker.
Method Detail

setMaxColumns

public void setMaxColumns(int maxColumns)

Set the maximum number of columns per row for the picker.

The default number of columns is 4.

Parameters:
maxColumns - Maximum number of columns per row.

setMaxRows

public void setMaxRows(int maxRows)

Set the maximum number of rows before scrolling.

The default number of rows is 4.

Parameters:
maxRows - Maximum number of rows before scrolling.

getMaxRows

public final int getMaxRows()
Get the maximum number of rows before scrolling.

Since:
3.0
See Also:
setMaxRows(int)

getMaxColumns

public final int getMaxColumns()
Get the maximum number of columns per row for the picker.

Since:
3.0
See Also:
setMaxColumns(int)

setIconCellSize

public void setIconCellSize(int iconCellSize)
Set the icon size for the picker icons.

Parameters:
iconCellSize - Height and width of icons in pixels.

setIconCellSize

public void setIconCellSize(int cellWidth,
                            int cellHeight)
Set the icon height and width for the picker icons.

Parameters:
cellWidth - Width of icons in pixels.
cellHeight - Height of icon in pixels.

getIconCellWidth

public int getIconCellWidth()
Get the icon width for the picker icons.

Returns:
Width of icons in pixels.

getIconCellHeight

public int getIconCellHeight()
Get the icon height for the picker icons.

Returns:
Height of icons in pixels.

setAllowDuplicates

public void setAllowDuplicates(boolean allow)

getAllowDuplicates

public boolean getAllowDuplicates()

getIconCount

public int getIconCount()
Get the number of icons currently in the picker.

Returns:
Number of icons.

iconCount

public int iconCount()
Deprecated. use getIconCount()

Get the number of icons currently in the picker.

Returns:
Number of icons.

addIcon

public final boolean addIcon(Bitmap inIcon)
Add an icon to the picker. Returns false if the icon size was too large or the icon is a duplicate.

Parameters:
inIcon - Icon to be added.
Returns:
true if icon was added successfully.

addIcon

public final boolean addIcon(Bitmap inIcon,
                             int inIconType)
Add an icon to the picker with a specified type. Returns false if the icon size was too large or the icon is a duplicate.

Parameters:
inIcon - Icon to be added.
inIconType - Type of icon to be added.
Returns:
true if icon was added successfully.

addPhotoIcon

public final boolean addPhotoIcon(Bitmap inIcon)
Add a photo icon to the picker. This icon represents a photo that has been chosen from the gallery. Only one photo icon is allowed in the picker at one time and it is generally the first icon in the list. Returns false if the icon size was too large or the icon is a duplicate.

Parameters:
inIcon - Icon to be added.
Returns:
true if icon was added successfully.

addPhotoPickerIcon

public final boolean addPhotoPickerIcon()
Add a photo picker icon to the picker. This icon represents the icon for the photo picker. When selected, the icon picker will display the photopicker and allow the user to choose a photo from the gallery. This method uses a system icon that is the default icon size. If you're picker is a different size, you may want to call the version of this method that allows you to specify the icon to be used. There can only be one photo picker icon in a picker. Returns false if the icon size was too large or the icon is a duplicate.

Returns:
true if icon was added successfully.

addPhotoPickerIcon

public final boolean addPhotoPickerIcon(Bitmap inIcon)
Add a photo picker icon to the picker. This icon represents the icon for the photo picker. When selected, the icon picker will display the photopicker and allow the user to choose a photo from the gallery. This method allows you to specify the icon to be used. There can only be one photo picker icon in a picker. Returns false if the icon size was too large or the icon is a duplicate. XXX: should this be deprecated in favor of the XXX: other zero-parameter version?

Parameters:
inIcon - The icon to be used.
Returns:
true if icon was added successfully.

addDefaultIcon

public final boolean addDefaultIcon(Bitmap inIcon)
Add a default icon to the picker. This icon represents the default icon. When selected, the methods that return a photo icon will return null. There can only be one default icon in a picker. Returns false if the icon size was too large or the icon is a duplicate.

Parameters:
inIcon - The icon to be used.
Returns:
true if icon was added successfully.

setIcon

public final void setIcon(Bitmap inIcon,
                          int inIndex)
Replace the icon at index. This method assumes the icon is a normal icon (i.e. not the photo or photo picker icon).

Parameters:
inIcon - New icon to use.
inIndex - Index of icon to replace.

setIcon

public final void setIcon(Bitmap inIcon,
                          int inIndex,
                          int inIconType)
Replace the icon and type at index.

Parameters:
inIcon - New icon to use.
inIndex - Index of icon to replace.
inIconType - Type of icon.

insertIcon

public final void insertIcon(Bitmap inIcon,
                             int inIndex)
Insert an icon before icon at index. This method assumes the icon is a normal icon (i.e. not the photo or photo picker icon).

Parameters:
inIcon - Icon to insert.
inIndex - Index of icon to insert before.

insertIcon

public final void insertIcon(Bitmap inIcon,
                             int inIndex,
                             int inIconType)
Insert an icon of specified type before icon at index.

Parameters:
inIcon - Icon to insert.
inIndex - Index of icon to insert before.
inIconType - Type of icon to be inserted.

removeIcon

public final void removeIcon(int index)
Remove icon at index.

Parameters:
index - Index of icon to be removed.

removeIcon

public final void removeIcon(Bitmap inIcon)
Remove specified icon.

Parameters:
inIcon - Icon to be removed.

removeAllItems

public final void removeAllItems()
Remove all icons from the picker.


getIconAt

public final Bitmap getIconAt(int inIndex)
Get the icon at the specified index.

Parameters:
inIndex - Index of icon.
Returns:
The icon at index.

getIconTypeAt

public final int getIconTypeAt(int inIndex)
Get the type of the icon at the specified index.

Parameters:
inIndex - Index of icon.
Returns:
Type of icon at index.

getIconIndex

public final int getIconIndex(int inIconType)
Get the index of the icon of specified type. If no icon of the specified type is found, -1 is returned. If multiple icons of the type exist, the index of the first one is returned.

Parameters:
inIconType - Type of icon.
Returns:
Index of icon or -1.

getDefaultIconIndex

public int getDefaultIconIndex()
Get the index of the default icon. Returns -1 if default icon is not found.

Returns:
Index of default icon or -1.

getPhotoIconIndex

public int getPhotoIconIndex()
Get the index of the photo icon. Returns -1 if a photo icon is not found.

Returns:
Index of photo icon or -1.

getPhotoPickerIconIndex

public int getPhotoPickerIconIndex()
Get the index of the photo picker icon. Returns -1 if a photo picker icon is not found.

Returns:
Index of photo picker icon or -1.

getNormalIconIndex

public int getNormalIconIndex()
Get the normal icon index. The normal icon index is 0 based starting with the first normal icon in the picker. Unlike getValue, it excludes the special default, photo, and photo picker icons if they exist.

Returns:
Index of selected normal icon.

getFirstNormalIconIndex

public int getFirstNormalIconIndex()
Get the index of the first normal icon. Returns the index of the first normal icon excluding the special default, photo, and photo picker icons if they exist. This index is independent of the currently selected icon.

Returns:
Index of the first normal icon.

onHandleSelect

protected void onHandleSelect()

getPhotoPickerSelected

protected final boolean getPhotoPickerSelected()

Determine whether the photo picker was selected.

You can call this method from within onHandleSelect() to determine if the user has selected the photo picker.

Since:
3.0

handlePhotoSelect

protected void handlePhotoSelect(PhotoRecordIPCPayload records)

photoChanged

public boolean photoChanged()
Get the state of the photo icon. This method is used to determine whether the photo icon added by an application has been replaced by a new photo record from the gallery.

Returns:
true if a new photo icon has been selected.

getPhotoRecord

public PhotoRecord getPhotoRecord()
Get the selected photo record. If the photo icon is currently selected, return the associated photo record (if any) or null.

Returns:
Selected photo record or null.

getPhoto

public Bitmap getPhoto()
Get the selected photo. If the photo icon is currently selected, return the associated photo (if any), or null.

Returns:
Selected photo or null.

getClippedPhoto

public Bitmap getClippedPhoto()
Get the selected photo clipped to be square. If the photo icon is currently selected, return the associated photo (if any) clipped so that width and height are the same, or null.

Returns:
Selected photo or null.

getScaledPhoto

public Bitmap getScaledPhoto(int width,
                             int height)
Get selected photo scaled to specified width and height. If the photo icon is currently selected, return the associated photo (if any) scaled to the specified width and height, or null.

Parameters:
width - Width in pixels of returned photo.
height - Height in pixels of returned photo.
Returns:
Scaled photo or null.

paint

public void paint(Pen p)
Description copied from class: View
Draw the contents of this View. This method is called by the graphics system when the View needs to be repainted. A Pen will be provided which is appropriately clipped and translated for drawing on this View.

The implementation of this method in this class will merely call clear() pen, if this View is opaque (not transparent), and will do nothing otherwise. If you don't need this behavior, then there is no point in calling super.paint() in an overriding method.

Overrides:
paint in class Container
Parameters:
p - non-null; the pen to use for drawing operations

receiveEvent

public boolean receiveEvent(Event e)
Description copied from class: Listener
Entry point for event processing. This method is called from a Dispatcher when it reads an Event in its queue that is targetted at this instance. The default behavior is to do nothing and return false. Subclasses are expected to override this method to do something more useful.

Overrides:
receiveEvent in class Container
Parameters:
e - non-null; the event to process
Returns:
whether (true) or not (false) this method actually handled the event to completion

drawClosedIconPicker

public void drawClosedIconPicker(Pen p)

eventWidgetUp

public boolean eventWidgetUp(int inWhichWidget,
                             Event event)
Description copied from class: Container
Handle the release of a device widget

Overrides:
eventWidgetUp in class Container
Parameters:
inWhichWidget - the widget that went down
Returns:
whether or not the event was consumed

eventKeyUp

public boolean eventKeyUp(char inChar,
                          Event event)
Description copied from class: Container
Processes key releases directed at this container.

Overrides:
eventKeyUp in class Container
Parameters:
inChar - the character being released.

enterPicker

public final void enterPicker()

getCurrentSelection

public final int getCurrentSelection()
Get the index of the currently selected icon.

Since:
3.0

getEventListener

public Listener getEventListener()
Overrides:
getEventListener in class Control

setPhotoPickerIconAndTitle

public void setPhotoPickerIconAndTitle(Bitmap inIcon,
                                       String inTitle)
Set photo picker icon and title. Set the icon and title to be displayed in the titlebar of the photo picker.

Parameters:
inIcon - Icon to be displayed (default is application icon).
inTitle - Title to be displayed.

showPhotoPicker

public void showPhotoPicker(Bitmap inIcon,
                            String inTitle)
Show the photo picker.

Parameters:
inIcon - Icon to be displayed (default is application icon).
inTitle - Title to be displayed.