Tizen Native API  4.0
Dali::Toolkit::Ruler Class Reference

Abstracts class to define scroll axes. More...

Inheritance diagram for Dali::Toolkit::Ruler:
Dali::RefObject Dali::Toolkit::DefaultRuler Dali::Toolkit::FixedRuler

Public Types

enum  RulerType
 Enumeration for the type of the ruler. More...

Public Member Functions

 Ruler ()
 Constructs ruler, enabled by default, with limitless domain.
virtual float Snap (float x, float bias=0.5f) const =0
 Snaps (x) in accordance to the ruler settings.
virtual float GetPositionFromPage (unsigned int page, unsigned int &volume, bool wrap) const =0
 Returns position from page, based on whatever the ruler defines as a page.
virtual unsigned int GetPageFromPosition (float position, bool wrap) const =0
 Returns page from position, based on whatever the ruler defines as a page.
virtual unsigned int GetTotalPages () const =0
 Returns the total number of pages within this Ruler.
virtual RulerExtension * GetExtension ()
 Gets the extension interface of the Ruler.
Ruler::RulerType GetType () const
 Gets the ruler type.
bool IsEnabled () const
 Returns whether this axis has been enabled or not.
void Enable ()
 Enables ruler (ruler must be enabled in order to traverse along it).
void Disable ()
 Disables ruler.
void SetDomain (RulerDomain domain)
 Sets the Domain.
const RulerDomainGetDomain () const
 Gets the Domain.
void DisableDomain ()
 Disables Domain (minimum/maximum extents for this axis).
float Clamp (float x, float length=0.0f, float scale=1.0f) const
 Clamps value (x) from (min) to (max).
float Clamp (float x, float length, float scale, ClampState &clamped) const
 Clamps value (x) from (min) to (max).
float SnapAndClamp (float x, float bias=0.5f, float length=0.0f, float scale=1.0f) const
 Snaps and Clamps (x) in accordance to ruler settings.
float SnapAndClamp (float x, float bias, float length, float scale, ClampState &clamped) const
 Snaps and Clamps (x) in accordance to ruler settings.

Protected Member Functions

virtual ~Ruler ()
 Destructor - A reference counted object may only be deleted by calling Unreference().

Protected Attributes

RulerType mType
 Type of Ruler (Fixed or Free).
bool mEnabled
 If the ruler is enabled.
RulerDomain mDomain
 The domain of the ruler.

Detailed Description

Abstracts class to define scroll axes.

It can specify whether they are traversable, where their snap points are and their domain.

Since:
2.4, DALi version 1.0.0

Member Enumeration Documentation

Enumeration for the type of the ruler.

Since:
2.4, DALi version 1.0.0
Enumerator:
Fixed 

A fixed ruler.

Since:
2.4, DALi version 1.0.0
Free 

A free ruler.

Since:
2.4, DALi version 1.0.0

Constructor & Destructor Documentation

Constructs ruler, enabled by default, with limitless domain.

Since:
2.4, DALi version 1.0.0
virtual Dali::Toolkit::Ruler::~Ruler ( ) [protected, virtual]

Destructor - A reference counted object may only be deleted by calling Unreference().

Since:
2.4, DALi version 1.0.0

Member Function Documentation

float Dali::Toolkit::Ruler::Clamp ( float  x,
float  length = 0.0f,
float  scale = 1.0f 
) const

Clamps value (x) from (min) to (max).

An optional length parameter can be specified to suggest that the subject is not a point but a line that should be clamped.

Since:
2.4, DALi version 1.0.0
Parameters:
[in]xX point to be clamped between (min) and (max) extents
[in]length(optional) The Length of the line from (x) to (x + length) to be clamped
[in]scaleScaling parameter which treats domain as scaled in calculations
Returns:
The clamped value
float Dali::Toolkit::Ruler::Clamp ( float  x,
float  length,
float  scale,
ClampState clamped 
) const

Clamps value (x) from (min) to (max).

An optional length parameter can be specified to suggest that the subject is not a point but a line to that should be clamped.

Since:
2.4, DALi version 1.0.0
Parameters:
[in]xX point to be clamped between (min) and (max) extents
[in]length(optional) The Length of the line from (x) to (x + length) to be clamped
[in]scaleScaling parameter which treats domain as scaled in calculations
[out]clampedWhether clamping occurred and which size (None, Min or Max)
Returns:
The clamped value

Disables ruler.

Since:
2.4, DALi version 1.0.0

Disables Domain (minimum/maximum extents for this axis).

Since:
2.4, DALi version 1.0.0

Enables ruler (ruler must be enabled in order to traverse along it).

Since:
2.4, DALi version 1.0.0

Gets the Domain.

Since:
2.4, DALi version 1.0.0
Returns:
The domain
virtual RulerExtension* Dali::Toolkit::Ruler::GetExtension ( ) [virtual]

Gets the extension interface of the Ruler.

Since:
2.4, DALi version 1.0.0
Returns:
The extension interface of the Ruler
virtual unsigned int Dali::Toolkit::Ruler::GetPageFromPosition ( float  position,
bool  wrap 
) const [pure virtual]

Returns page from position, based on whatever the ruler defines as a page.

If (wrap) is true, then will return a page wrapped within the domain.

Since:
2.4, DALi version 1.0.0
Parameters:
[in]positionThe position on the domain
[in]wrapEnable wrap mode
Returns:
The page where this position resides

Implemented in Dali::Toolkit::FixedRuler, and Dali::Toolkit::DefaultRuler.

virtual float Dali::Toolkit::Ruler::GetPositionFromPage ( unsigned int  page,
unsigned int &  volume,
bool  wrap 
) const [pure virtual]

Returns position from page, based on whatever the ruler defines as a page.

If (wrap) is true, then will set volume to the number of times page has exceeded the domain's volume (volume being the number of pages within the domain), while wrapping the position within the domain.

Since:
2.4, DALi version 1.0.0
Parameters:
[in]pageThe page index
[out]volumeThe overflow volume when the page exceeds the domain (wrap must be enabled)
[in]wrapEnable wrap mode
Returns:
The position representing this page point

Implemented in Dali::Toolkit::FixedRuler, and Dali::Toolkit::DefaultRuler.

virtual unsigned int Dali::Toolkit::Ruler::GetTotalPages ( ) const [pure virtual]

Returns the total number of pages within this Ruler.

Since:
2.4, DALi version 1.0.0
Returns:
The number of pages in the Ruler

Implemented in Dali::Toolkit::FixedRuler, and Dali::Toolkit::DefaultRuler.

Gets the ruler type.

Since:
2.4, DALi version 1.0.0
Returns:
The ruler type

Returns whether this axis has been enabled or not.

Since:
2.4, DALi version 1.0.0
Returns:
true if axis is enabled

Sets the Domain.

Since:
2.4, DALi version 1.0.0
Parameters:
[in]domainRuler domain object
virtual float Dali::Toolkit::Ruler::Snap ( float  x,
float  bias = 0.5f 
) const [pure virtual]

Snaps (x) in accordance to the ruler settings.

Since:
2.4, DALi version 1.0.0
Parameters:
[in]xThe input value on the ruler to be snapped
[in]bias(optional) The biasing employed for snapping 0 floor input (floor x) "Used for Flick Left" 0.5 round input (floor x + 0.5) "Used for Release" 1 ceil input (floor x + 1.0) "Used for Flick Right"
Returns:
The position of the one dimensional point passed in once snapped.

Implemented in Dali::Toolkit::FixedRuler, and Dali::Toolkit::DefaultRuler.

float Dali::Toolkit::Ruler::SnapAndClamp ( float  x,
float  bias = 0.5f,
float  length = 0.0f,
float  scale = 1.0f 
) const

Snaps and Clamps (x) in accordance to ruler settings.

Since:
2.4, DALi version 1.0.0
Parameters:
[in]xX value to be snapped in accordance to ruler snap value, and clamped in accordance to the ruler's domain (if set)
[in]bias(optional) The biasing employed for snapping 0 floor input (floor x) "Used for Flick Left" 0.5 round input (floor x + 0.5) "Used for Release" 1 ceil input (floor x + 1.0) "Used for Flick Right"
[in]length(optional) The Length of the line from (x) to (x + length) to be clamped
[in]scaleScaling parameter which treats domain as scaled in calculations
Returns:
The clamped value after snapping
float Dali::Toolkit::Ruler::SnapAndClamp ( float  x,
float  bias,
float  length,
float  scale,
ClampState clamped 
) const

Snaps and Clamps (x) in accordance to ruler settings.

Since:
2.4, DALi version 1.0.0
Parameters:
[in]xX value to be snapped in accordance to ruler snap value, and clamped in accordance to the ruler's domain (if set)
[in]bias(optional) The biasing employed for snapping 0 floor input (floor x) "Used for Flick Left" 0.5 round input (floor x + 0.5) "Used for Release" 1 ceil input (floor x + 1.0) "Used for Flick Right"
[in]length(optional) The Length of the line from (x) to (x + length) to be clamped
[in]scaleScaling parameter which treats domain as scaled in calculations
[out]clampedWhether clamping occurred and which size (None, Min or Max)
Returns:
The clamped value after snapping