AppEasy Core SDK  1.5.0
Cross platform mobile and desktop app and game development SDK - The easy way to make apps
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
CzUISlider Class Reference

#include <CzUISlider.h>

Inheritance diagram for CzUISlider:
CzUIBase CzActorImage CzActor IzXomlResource IzAnimTarget

List of all members.

Public Types

enum  eSliderType { SliderType_Horizontal, SliderType_Vertical }

Public Member Functions

void setValue (float pos, bool affect_thumb)
float getValue () const
void setValueRange (CzVec2 &range)
CzVec2 getValueRange () const
void setSliderType (eSliderType type)
eSliderType getSliderType () const
void setSliderSize (int size)
int getSliderSize () const
bool setProperty (unsigned int property_name, const CzXomlProperty &data, bool delta)
 Sets the named property of the UISlider.
bool setProperty (unsigned int property_name, const CzString &data, bool delta)
 Sets the named property of the actor.
bool getProperty (unsigned int property_name, CzXomlProperty &prop)
 Gets the named property of the actor.
 CzUISlider ()
bool Update (float dt)
 Updates this actors logic.
void NotifyOrientationChange (CzScene::eOrientation old_orientation, CzScene::eOrientation new_orientation)
 Handles the orientation change event.
void NotifyBeginTouch (int index, int x, int y, bool allow_bubble=true)
 OnBeginTouch event handler.
void NotifyEndTouch (int index, int x, int y, bool allow_bubble=true)
 OnEndTouch event handler.
virtual void NotifyValueChanged (float old_value, float new_value)
int LoadFromXoml (IzXomlResource *parent, bool load_children, CzXmlNode *node)
 Creates an instance of this class from XML.
bool UpdateFromAnimation (CzAnimInstance *animation)
 Updates actor property from supplied animation.

Static Public Member Functions

static void InitClass ()
 Initialises the class.
static void ReleaseClass ()
static bool _setSliderType (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getSliderType (IzXomlResource *target)
static bool _setValue (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getValue (IzXomlResource *target)
static bool _setValueRange (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getValueRange (IzXomlResource *target)
static bool _setSliderSize (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getSliderSize (IzXomlResource *target)
static bool _setOnValueChanged (IzXomlResource *target, const CzXomlProperty &prop, bool add)

Protected Member Functions

bool UpdateBinding (unsigned int property_name, CzXomlVariable *var)
 Updates an actor property from the supplied XOML variable.
void UpdateSliderSize ()

Protected Attributes

eSliderType SliderType
float Value
CzVec2 ValueRange
int OriginalSliderSize
int SliderSize
bool ThumbChanged

Static Protected Attributes

static CzXomlClassDefUISliderClassDef = NULL

Member Enumeration Documentation

Enumerator:
SliderType_Horizontal 
SliderType_Vertical 

Constructor & Destructor Documentation

CzUISlider::CzUISlider ( ) [inline]

Member Function Documentation

bool CzUISlider::_setOnValueChanged ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUISlider::_setSliderSize ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUISlider::_setSliderType ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUISlider::_setValue ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUISlider::_setValueRange ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUISlider::getProperty ( unsigned int  property_name,
CzXomlProperty prop 
) [virtual]

Gets the named property of the actor.

Returns the named property of the actor. The properties value is returned in a CzXomlProperty which is a structure that contains a union of all possible property types. Note that as CzUISlider is derived from CzUIBase, all CzUIBase properties will also be checked against.

Parameters:
property_nameName of the property.
[out]propThe property data that.
Returns:
true if it succeeds, false if property does not exist.

Reimplemented from CzUIBase.

int CzUISlider::getSliderSize ( ) const [inline]
float CzUISlider::getValue ( ) const [inline]
CzVec2 CzUISlider::getValueRange ( ) const [inline]
void CzUISlider::InitClass ( ) [static]

Initialises the class.

Sets up the classes avaiiable properties. Used by the XOML system to find, set amd get class properties.

Reimplemented from CzUIBase.

int CzUISlider::LoadFromXoml ( IzXomlResource parent,
bool  load_children,
CzXmlNode node 
) [virtual]

Creates an instance of this class from XML.

LoadFromXoml is the main method used by all classes that can be instantiated from XOML mark-up. This method creates an instance of this class from the supplied XML node structure specified by node. if parent is not NULL then the created instance will utilise the supplied parent to determine where it should live within the app. For example, if the parent is a scene then the actor will be placed in that scene. if the parent is another actor then this actor will be placed into the scene of the supplied actor and linked as a child to the parent actor. If load_chlldren is true then any child nodes contained within the actor will also be loaded. Note that as CzUIBase is derived from CzActorImage, CzActorImage::LoadFromXoml() will also be called to load CzActor specific properties.

Parameters:
[in]parentIf non-null, the parent.
load_childrentrue to load child nodes.
[in]nodeIf non-null, the XOML markup node that defines this object
Returns:
negative value for error. if 0 then processing of further XOML will stop.

Reimplemented from CzUIBase.

void CzUISlider::NotifyBeginTouch ( int  index,
int  x,
int  y,
bool  allow_bubble = true 
) [virtual]

OnBeginTouch event handler.

The OnBeginTouch event handler is called whenever the user begins to touch the actor. Actors can process up to 5 simultaneous touch events OnBeginTouch to OnBeginTouch5. if event bubbling is enabled then the event will also be passed up to the parent.

This version of this method enables actors to utilise a selected state

Parameters:
indexIndex of the touch.
xThe touched x coordinate.
yThe touched y coordinate.
allow_bubbletrue to allow event bubbling, false to deny event bubbling.

Reimplemented from CzUIBase.

void CzUISlider::NotifyEndTouch ( int  index,
int  x,
int  y,
bool  allow_bubble = true 
) [virtual]

OnEndTouch event handler.

The OnEndTouch event handler is called whenever the user stops touching the actor. This can occur for a number fo reasons including:

  • if the user lifts their finger off the actor
  • If the user moves their finger too from the actor (loses focus)
  • if the user scrolls the container (list boc for example)
  • The scene is switched

Actors can process up to 5 simultaneous touch events OnEndTouch to OnEndTouch5. if event bubbling is enabled then the event will also be passed up to the parent.

This version of this method enables actors to utilise a selected state

Parameters:
indexIndex of the touch.
xThe touched x coordinate.
yThe touched y coordinate.
allow_bubbletrue to allow event bubbling, false to deny event bubbling.

Reimplemented from CzUIBase.

void CzUISlider::NotifyOrientationChange ( CzScene::eOrientation  old_orientation,
CzScene::eOrientation  new_orientation 
) [virtual]

Handles the orientation change event.

When a screen orientation or size change occurs all actors will receive this event emabling them to modify themselves to take advantage of the new screen orientation / size. the default implementation for CzActorImage updates margin and visual sizes if they are precentage based. It also calls CzActor::NotifyOrientationChange() to update the position.

Parameters:
old_orientationThe old orientation.
new_orientationThe new orientation.

Reimplemented from CzUIBase.

void CzUISlider::NotifyValueChanged ( float  old_value,
float  new_value 
) [virtual]
void CzUISlider::ReleaseClass ( ) [static]

Reimplemented from CzUIBase.

bool CzUISlider::setProperty ( unsigned int  property_name,
const CzXomlProperty data,
bool  delta 
) [virtual]

Sets the named property of the UISlider.

Sets the named property of this UISlider. The properties value supplied will be converted. If delta is set to true then the existing value of the property will be added to instead of replaced.

Parameters:
property_nameName of the property as a string hash (faster searching).
[in]dataThe property data.
deltatrue if property should be added to instead of replaced.
Returns:
true if it succeeds, false if property does not exist.

Reimplemented from CzUIBase.

bool CzUISlider::setProperty ( unsigned int  property_name,
const CzString data,
bool  delta 
) [virtual]

Sets the named property of the actor.

Sets the named property of this actor. The properties value (data) is supplied as a string and will be converted. If delta is set to true then the existing value of the property will be added to instead of replaced. Note that as CzUISlider is derived from CzUIBase, all CzUIBase properties will also be checked against.

Parameters:
property_nameName of the property as a string hash (faster searching).
[in]dataThe property data.
deltatrue to property should be added to instead of replaced.
Returns:
true if it succeeds, false if property does not exist.

Reimplemented from CzUIBase.

void CzUISlider::setSliderSize ( int  size)
void CzUISlider::setValue ( float  pos,
bool  affect_thumb 
)
void CzUISlider::setValueRange ( CzVec2 range)
bool CzUISlider::Update ( float  dt) [virtual]

Updates this actors logic.

Updates the UI actors logic, including:

  • Processing event actions
  • Processing any attached modifiers
  • Updating dragging state
  • Updating physics
  • Updating the attached timeline
  • Updating any show / hide timelines
  • Updating the scroller
  • Checking for an updating layout if dirty

This method should be overriden by derived actors to provide the UI actor specific logic.

Note that dt is used to scale actor internals that rely on time. This value enables the actor run in an environment where time (the frame rate of the device) can vary allowing animation to keep up without slowing down or speeding up when the frame rate varies.

Note that if an actor returns false then it will automatically be removed from the scene.

Parameters:
dtThe number of seconds since the app was last updated
Returns:
true if it succeeds, false if it fails.

Reimplemented from CzUIBase.

bool CzUISlider::UpdateBinding ( unsigned int  property_name,
CzXomlVariable var 
) [protected, virtual]

Updates an actor property from the supplied XOML variable.

Updates a single property from the value of the bound XOML variable. Note that as CzUISlider is derived from CzUIBase, all CzUIBase properties will also be checked against.

Parameters:
property_nameName of the property.
[in,out]varIf non-null, the variable.
Returns:
true if it succeeds, false if property does not exist.

Reimplemented from CzUIBase.

bool CzUISlider::UpdateFromAnimation ( CzAnimInstance animation) [virtual]

Updates actor property from supplied animation.

Updates the actors property that is specified by the supplied animation. When a timeline animation targets the property of an actor this method will be called by the animation to move the animations frame data into its target property. Note that as CzUISlider is derived from CzUIBase, all CzUIBase properties will also be checked against.

Parameters:
[in]animationIf non-null, the animation.
Returns:
true if it succeeds, false if property does not exist.

Reimplemented from CzUIBase.

void CzUISlider::UpdateSliderSize ( ) [protected]

Member Data Documentation

int CzUISlider::SliderSize [protected]
bool CzUISlider::ThumbChanged [protected]
float CzUISlider::Value [protected]

The documentation for this class was generated from the following files: