|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.nokia.mid.ui.CanvasItem
public abstract class CanvasItem
Field Summary | |
---|---|
static int |
SCALE_AVERAGE
Constant used to indicate the SCALE_AVERAGE mode of a CanvasItem. |
static int |
SCALE_NEAREST
Constant used to indicate the SCALE_NEAREST mode of a CanvasItem. |
static int |
SCALE_NOT_ALLOWED
Constant used to indicate the SCALE_NOT_ALLOWED mode of a CanvasItem. |
Method Summary | |
---|---|
int |
getHeight()
Gets the height of this CanvasItem in pixels. |
java.lang.Object |
getParent()
Gets the current parent of this CanvasItem |
int |
getPositionX()
Gets the rendering position of this CanvasItem . |
int |
getPositionY()
Sets the rendering position of this CanvasItem . |
int |
getWidth()
Gets the width of this CanvasItem in pixels. |
int |
getZPosition()
Returns the Z-position, or the elevation, of the item. |
protected static boolean |
isValidImageAnchor(int anchor)
Tests whether anchor has valid values |
boolean |
isVisible()
Returns the current visibility of this CanvasItem |
void |
scale(int width,
int height)
Scales CanvasItem to the specified size as per current scaling mode. |
void |
scale(int x,
int y,
int width,
int height)
Scales CanvasItem to the specified size as per current scaling mode and resets the
current anchor position. |
void |
setParent(java.lang.Object theParent)
Set the parent object of this CanvasItem. |
void |
setPosition(int x,
int y)
Sets the rendering position of this CanvasItem . |
void |
setScalingMode(int scaleMode,
boolean aspectRatioPreserved,
int anchor)
This method is called to define how size change / scaling should be performed. |
void |
setSize(int width,
int height)
Sets the size of this Window in pixels. |
void |
setSize(int x,
int y,
int width,
int height)
Sets the size of this CanvasItem in pixels and resets the current anchor position. |
void |
setVisible(boolean visible)
Sets the visibility value of CanvasItem . |
void |
setZPosition(int z)
Sets the Z-position, or the elevation, of the item. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int SCALE_NOT_ALLOWED
Constant used to indicate the SCALE_NOT_ALLOWED mode of a CanvasItem.
This might be passed as a parameter to #setScalingMode(int, boolean)
if window is intended not to allow scaling.
Constant value 0x0 is set to SCALE_NOT_ALLOWED.
public static final int SCALE_NEAREST
Constant used to indicate the SCALE_NEAREST mode of a CanvasItem.
This might be passed as a parameter to #setScalingMode(int, boolean)
if window is intended be in a nearest neighbor scaling mode.
Constant value 0x1 is set to SCALE_NEAREST.
public static final int SCALE_AVERAGE
Constant used to indicate the SCALE_AVERAGE mode of a CanvasItem.
This might be passed as a parameter to #setScalingMode(int, boolean)
if window is intended to be in a "interpolate using average" scaling mode .
Constant value 0x2 is set to SCALE_AVERAGE.
Method Detail |
---|
public void setParent(java.lang.Object theParent)
theParent
- the parent object
java.lang.IllegalArgumentException
- if parent
is not a valid object with which a
TextEditor can be associated, or if CanvasItem is already set to
another another parentpublic void setSize(int width, int height) throws java.lang.IllegalArgumentException
Window
in pixels.
width
- width in pixelsheight
- height in pixels
java.lang.IllegalArgumentException
- if the width or height is less than one pixelfor more details
public void setSize(int x, int y, int width, int height)
CanvasItem
in pixels and resets the current anchor position.
This call has the same effect as calling consecutively the following two methods
setSize(int, int)
and setPosition(int, int)
.
x
- the x coordinate of the anchor pointy
- the y coordinate of the anchor pointwidth
- the new width in pixelsheight
- the new height in pixels
java.lang.IllegalArgumentException
- if the width or height is less than one pixelsetPosition(int, int)
,
setSize(int, int)
public int getHeight()
CanvasItem
in pixels.
public int getWidth()
CanvasItem
in pixels.
public void setPosition(int x, int y)
Sets the rendering position of this CanvasItem
. The origin is
relative to the coordinate system of parent.
The CanvasItem
may be placed partially or fully off of the visible area
of the parent by the setPosition
method; in this case the CanvasItem is just not fully visible.
x
- the x coordinate of the anchor point, in pixels.y
- the y coordinate of the anchor point, in pixels.public void setZPosition(int z) throws java.lang.IllegalArgumentException
Sets the Z-position, or the elevation, of the item. The elevation decides the stacking order of neighboring items. An item of high Z-position will be drawn on top of an item with a lower Z-position if they share the same parent item. Other items that share the same Z-position will be drawn in an undefined order, although the order will stay the same for as long as the items live. The Z-position does not affect the item's size in any way. When items are added with setParent they will get a Z-position that is increased by 1 from the previously added item.
z
- the z position of the item.
java.lang.IllegalArgumentException
- If z
< 0getZPosition()
public int getPositionX()
Gets the rendering position of this CanvasItem
. The origin is
relative to the coordinate system of parent.
public int getPositionY()
Sets the rendering position of this CanvasItem
. The origin is
relative to the coordinate system of parent.
The CanvasItem
may be placed partially or fully off of the visible area
of the parent by the setPosition
method; in this case the CanvasItem is just not fully visible.
public int getZPosition()
Returns the Z-position, or the elevation, of the item. The Z-position decides the stacking order of neighboring items.
#getZPosition(int)
public void setVisible(boolean visible)
Sets the visibility value of CanvasItem
. Initially
CanvasItem is not visible so it must be explicitly set to visible
in order it to appear on UI.
If the editor is already visible calling setVisible(true) does nothing. If the item is not visible calling setVisible(false) does nothing.
java.lang.IllegalStateException
- If its visibility is locked by the platform.public boolean isVisible()
public void scale(int width, int height)
CanvasItem
to the specified size as per current scaling mode.
width
- the new width in pixelsheight
- the new height in pixelsscalling mode settings
public void scale(int x, int y, int width, int height)
CanvasItem
to the specified size as per current scaling mode and resets the
current anchor position.
x
- the x coordinate of the anchor pointy
- the y coordinate of the anchor pointwidth
- the new width in pixelsheight
- the new height in pixelsscaling mode settings
,
setPosition(int, int)
,
scale(int, int)
public void setScalingMode(int scaleMode, boolean aspectRatioPreserved, int anchor)
scaleMode
- scaling mode: SCALE_NEAREST or SCALE_AVERAGE or SCALE_NOT_ALLOWEDaspectRatioPreserved
- set to true to preserve aspect ration when scalinganchor
- the anchor point for positioning the window
java.lang.IllegalArgumentException
- if scaleMode or/and anchor are not a legal values.for more details
public java.lang.Object getParent()
protected static boolean isValidImageAnchor(int anchor)
anchor
- anchor value to be tested
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |