|
PulpCore | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pulpcore.sprite.Sprite pulpcore.sprite.Slider
public class Slider
A Slider is a widget that lets the user select a value by sliding a knob.
Field Summary | |
---|---|
static int |
HORIZONTAL
Horizontal orientation. |
Fixed |
value
The value of this Slider, initially set to 50. |
static int |
VERTICAL
Vertical orientation. |
Fields inherited from class pulpcore.sprite.Sprite |
---|
alpha, anchorX, anchorY, angle, CENTER, DEFAULT, EAST, enabled, height, NORTH, NORTH_EAST, NORTH_WEST, pixelSnapping, SOUTH, SOUTH_EAST, SOUTH_WEST, visible, WEST, width, x, y |
Constructor Summary | |
---|---|
Slider(CoreImage backgroundImage,
CoreImage knobImage,
int x,
int y)
Creates a Slider with a background image and a knob image. |
|
Slider(String backgroundImage,
String knobImage,
int x,
int y)
Creates a Slider with a background image and a knob image. |
Method Summary | |
---|---|
protected void |
drawSprite(CoreGraphics g)
Draws the sprite. |
int |
getExtent()
Gets the extent (inner range) of the internal data model of this Slider. |
int |
getMax()
Gets the maximum value of the internal data model of this Slider. |
int |
getMin()
Gets the minimum value of the internal data model of this Slider. |
protected int |
getNaturalHeight()
Gets the fixed-point value of the Sprite's natural height. |
protected int |
getNaturalWidth()
Gets the fixed-point value of the Sprite's natural width. |
int |
getOrientation()
Gets the orientation of this Slider. |
boolean |
isAdjusting()
|
void |
propertyChange(Property property)
On a property change this Sprite is marked as dirty. |
void |
scroll(int units)
Changes the value by the specified number of units,
animating the change if the unit animation duration is defined. |
void |
scrollDown()
Increases the value by 1, animating the change if the unit animation duration
is defined. |
void |
scrollEnd()
Sets the value to (maximum - extent). |
void |
scrollHome()
Sets the value to the minimum. |
void |
scrollPageDown()
Decreases the value by the extent, animating the change if the page animation
duration is defined. |
void |
scrollPageUp()
Decreases the value by the extent, animating the change if the page animation
duration is defined. |
void |
scrollUp()
Decreases the value by 1, animating the change if the unit animation duration
is defined. |
void |
setAnimationDuration(int unitDuration,
int pageDuration)
Sets the duration, in milliseconds, to animate when the value is changed when the gutter (the background of the Slider outside the knob) is clicked or when the scrollUp() , scrollDown() ,
scrollPageUp() , or scrollPageDown() methods are called. |
void |
setInsets(int top,
int left,
int bottom,
int right)
Sets the visual insets that the knob image is bound to. |
void |
setKnob(CoreImage knobImage)
Sets the knob image. |
void |
setOrientation(int orientation)
Sets the orientation of this Slider: either HORIZONTAL or VERTICAL . |
void |
setRange(int min,
int max)
Sets the internal data model for this Slider. |
void |
setRange(int min,
int max,
int extent)
Sets the internal data model for this Slider. |
void |
update(int elapsedTime)
Updates all of this Sprite's properties. |
Methods inherited from class pulpcore.sprite.Sprite |
---|
bindLocationTo, bindSizeTo, clearCursor, clearDirtyRect, contains, draw, getBlendMode, getCursor, getDirtyRect, getFilter, getLocalX, getLocalY, getParent, getPixelLevelChecks, getRoot, getScene2D, getTag, getViewX, getViewX, getViewY, getViewY, intersects, isDirty, isEnabled, isEnabledAndVisible, isMouseDoubleClicked, isMouseDown, isMouseHover, isMouseOver, isMousePressed, isMouseReleased, isMouseTripleClicked, isMouseWheelRotated, isOpaque, isPick, isPickEnabledAndVisible, isTransparent, move, move, move, move, move, move, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, removeFromParent, scale, scale, scale, scale, scale, scale, scaleTo, scaleTo, scaleTo, scaleTo, scaleTo, scaleTo, setAnchor, setAnchor, setBlendMode, setCursor, setDirty, setFilter, setLocation, setLocation, setSize, setSize, setTag, translate, translate, updateDirtyRect |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int HORIZONTAL
public static final int VERTICAL
public final Fixed value
Constructor Detail |
---|
public Slider(String backgroundImage, String knobImage, int x, int y)
public Slider(CoreImage backgroundImage, CoreImage knobImage, int x, int y)
Method Detail |
---|
public boolean isAdjusting()
public void propertyChange(Property property)
Sprite
propertyChange
in interface PropertyListener
propertyChange
in class Sprite
property
- the property whose value has changed.public void update(int elapsedTime)
Sprite
update
in class Sprite
protected int getNaturalWidth()
Sprite
ImageSprite
, the natural width is the
width of the image.
getNaturalWidth
in class Sprite
protected int getNaturalHeight()
Sprite
ImageSprite
, the natural height is the
height of the image.
getNaturalHeight
in class Sprite
public void setKnob(CoreImage knobImage)
public void setInsets(int top, int left, int bottom, int right)
If an inset is positive, it is used as inner boundry within the background image. If an inset is negative, the the knob can extend outisde the background image by that amount.
For horizontal sliders, the left and right insets are use as boundaries, and the knob is centered vertically between the top and bottom insets.
For vertical sliders, the top and bottom insets are use as boundaries, and the knob is centered horizontally between the left and right insets.
protected void drawSprite(CoreGraphics g)
Sprite
This method may be called multiple times for each dirty rectangle. The clip of the graphics context will be set to the current dirty rectangle.
When the contents of this sprite change (in another words, the graphic output of this method
will be different from the last time it is called), subclasses should call
setDirty(true)
.
Implementors should not save a reference to the graphics context as it can change between calls to this method.
drawSprite
in class Sprite
public void setOrientation(int orientation)
HORIZONTAL
or VERTICAL
.
By default, the Slider is horizontal.
public int getOrientation()
HORIZONTAL
or VERTICAL
.public void setRange(int min, int max)
The minimum and maximum can be any integer, and do not correspond to any pixel value. By default, the minimum is 0, the maximum is 100, and the extent is 0.
value
,
setRange(int, int, int)
public void setRange(int min, int max, int extent)
minimum <= value <= value+extent <= maximum
The minimum, maximum, and extent can be any integer, and do not correspond to any pixel value. By default, the minimum is 0, the maximum is 100, and the extent is 0.
value
,
setRange(int, int)
public int getMin()
setRange(int, int)
,
setRange(int, int, int)
public int getMax()
setRange(int, int)
,
setRange(int, int, int)
public int getExtent()
setRange(int, int)
,
setRange(int, int, int)
public void setAnimationDuration(int unitDuration, int pageDuration)
scrollUp()
, scrollDown()
,
scrollPageUp()
, or scrollPageDown()
methods are called.
The page duration is only used if the extent is non-zero. By default, both animation durations are set to zero.
public void scrollHome()
value
to the minimum. No animation is performed.
public void scrollEnd()
value
to (maximum - extent). No animation is performed.
public void scroll(int units)
value
by the specified number of units,
animating the change if the unit animation duration is defined.
setAnimationDuration(int, int)
public void scrollUp()
value
by 1, animating the change if the unit animation duration
is defined.
setAnimationDuration(int, int)
public void scrollDown()
value
by 1, animating the change if the unit animation duration
is defined.
setAnimationDuration(int, int)
public void scrollPageUp()
value
by the extent, animating the change if the page animation
duration is defined. If the extent is zero, this method does nothing.
setAnimationDuration(int, int)
public void scrollPageDown()
value
by the extent, animating the change if the page animation
duration is defined. If the extent is zero, this method does nothing.
setAnimationDuration(int, int)
|
PulpCore | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |