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
CzUIBase Class Reference

Base class of all UI components. More...

#include <CzUIBase.h>

Inheritance diagram for CzUIBase:
CzActorImage CzActor IzXomlResource IzAnimTarget CzUIGrid CzUIIcon CzUIImageView CzUILabel CzUIListBox CzUIPanel CzUISlider CzUIVideoOverlay CzUIWebView

List of all members.

Public Types

enum  eSelectType { SelectType_Normal, SelectType_Toggle, SelectType_Sticky }
 Values that represent different types of selection modes. More...
enum  eAxis { Axis_None, Axis_X, Axis_Y, Axis_XY }
 Values that represent horizonal, vertical and both axis. More...

Public Member Functions

void setVisible (bool visible, bool force_set=false)
 Makes an actor visible.
void setBackgroundBrush (IzBrush *brush)
 Sets background brush of the actor.
IzBrushgetBackgroundBrush () const
void setBackgroundColour (const CzColour &colour)
 Sets background colour of the actor.
CzColour getBackgroundColour () const
void setSelectedBackgroundBrush (IzBrush *brush)
 Sets selected background brush of the actor.
IzBrushgetSelectedBackgroundBrush () const
void setSelectedBackgroundColour (const CzColour &colour)
 Sets selected background colour of the actor.
CzColour getSelectedBackgroundColour () const
void setDisabledBackgroundBrush (IzBrush *brush)
 Sets disabled background brush of the actor.
IzBrushgetDisabledBackgroundBrush () const
void setDisabledBackgroundColour (const CzColour &colour)
 Sets disabled background colour of the actor.
CzColour getDisabledBackgroundColour () const
void setSelectType (eSelectType type)
eSelectType getSelectType () const
void setSelected (bool selected, bool force_select=false)
 Sets actors selected state.
bool isSelected () const
virtual void setEnabled (bool enabled)
 Enables or disables the actor.
bool isEnabled () const
bool setProperty (unsigned int property_name, const CzXomlProperty &data, bool delta)
 Sets the named property of the actor.
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.
void setLayoutDirty (bool dirty)
 Sets layout as dirty.
bool isLayoutDirty () const
void setClippingMargin (int x, int y, int w, int h)
CzIRect getClippingMargin ()
void setScrollPos (float x, float y)
 Sets scroll position.
CzVec2 getScrollPos () const
CzVec2 getPreviousScrollPos () const
void setScrollVelocity (float x, float y)
CzVec2 getScrollVelocity () const
void setScrollRange (int x, int y, int w, int h)
CzIRect getScrollRange () const
void setToggledOn (bool toggled_on)
 Sets actores toggled state.
bool isToggledOn () const
void setShowTimeline (CzAnimTimeline *timeline)
 Sets show timeline deleting any previously assigned none managed show timeline.
CzAnimTimelinegetShowTimeline () const
void setHideTimeline (CzAnimTimeline *timeline)
 Sets hide timeline deleting any previously assigned none managed hide timeline.
CzAnimTimelinegetHideTimeline () const
void setNeedsResize (bool resize)
bool getNeedsResize () const
void setSizeToContentAxis (eAxis axis)
eAxis getSizeToContentAxis () const
void NotifyParentsResize ()
 Notifies the parent to resize its layout.
void setColourOffset (const CzIRect &offset)
void resetColourOffset ()
CzIRect getColourOffset () const
void setShowTimeline (const char *timeline_name)
void setHideTimeline (const char *timeline_name)
 Sets hide timeline to the named timeline.
void setEnableSpring (bool enable)
bool getEnableSpring () const
 CzUIBase ()
virtual ~CzUIBase ()
bool Init (IzBrush *brush, int width, int height)
 Initialises this UI actor.
bool Update (float dt)
 Updates this actors logic.
virtual void ResizeToContent ()
 Resizes the actor to fit its content.
void NotifyTapped (int index, int x, int y, bool allow_bubble)
 OnTapped event handler.
void NotifyBeginTouch (int index, int x, int y, bool allow_bubble)
 OnBeginTouch event handler.
void NotifyEndTouch (int index, int x, int y, bool allow_bubble)
 OnEndTouch event handler.
virtual void NotifyToggledOn ()
 Handles the toggled on event.
virtual void NotifyToggledOff ()
 Handles the toggled off event.
virtual void NotifyBackKey ()
 Handles the back key press evente.
virtual void NotifyMenuKey ()
 Handles the menu key press evente.
void NotifyOrientationChange (CzScene::eOrientation old_orientation, CzScene::eOrientation new_orientation)
 Handles the orientation change event.
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 InitPresetAnimations ()
 Initialises the preset animations.
static void ReleasePresetAnimations ()
 Initialises the preset animations.
static void UpdatePresetAnimations ()
 Updates the preset animations.
static CzAnimFindPresetAnimation (unsigned int name_hash)
 Searches for the first preset animation.
static void InitClass ()
 Initialises the class.
static void ReleaseClass ()
static bool _setSize (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getSize (IzXomlResource *target)
static bool _setBackground (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getBackground (IzXomlResource *target)
static bool _setSelectedBackground (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getSelectedBackground (IzXomlResource *target)
static bool _setDisabledBackground (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getDisabledBackground (IzXomlResource *target)
static bool _setBackgroundColour (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getBackgroundColour (IzXomlResource *target)
static bool _setSelectedColour (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getSelectedColour (IzXomlResource *target)
static bool _setDisabledColour (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getDisabledColour (IzXomlResource *target)
static bool _setEnabled (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getEnabled (IzXomlResource *target)
static bool _setSelected (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getSelected (IzXomlResource *target)
static bool _setScrollPos (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getScrollPos (IzXomlResource *target)
static bool _setSelectType (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getSelectType (IzXomlResource *target)
static bool _setSpring (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getSpring (IzXomlResource *target)
static bool _setOnToggledOn (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static bool _setOnToggledOff (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static bool _setOnBackKey (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static bool _setOnMenuKey (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static bool _setClipMargin (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getClipMargin (IzXomlResource *target)
static bool _setScrollRange (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getScrollRange (IzXomlResource *target)
static bool _setShowTimeline (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getShowTimeline (IzXomlResource *target)
static bool _setHideTimeline (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getHideTimeline (IzXomlResource *target)
static bool _setSizeToContentAxis (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getSizeToContentAxis (IzXomlResource *target)
static bool _setKeyFocus (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getKeyFocus (IzXomlResource *target)
static bool _setToggledOn (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getToggledOn (IzXomlResource *target)
static bool _setColourOffset (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getColourOffset (IzXomlResource *target)

Static Public Attributes

static CzList< CzAnim * > PresetAnimations

Protected Member Functions

bool UpdateBinding (unsigned int property_name, CzXomlVariable *var)
 Updates an actor property from the supplied XOML variable.
virtual bool UpdateLayout ()
 Updates the actors layout.
bool ScrollRangeCheck ()
 Prevents scroll position from giong out of bounds.

Protected Attributes

bool PrevSelected
 Previous Selected status.
bool ToggledOn
 ToggledOn state.
bool Selected
 Selected status.
IzBrushBackgroundBrush
 Default none selected brush.
CzColour BackgroundColour
 Default none selected colour.
IzBrushSelectedBackgroundBrush
 Selected brush.
CzColour SelectedBackgroundColour
 Selected colour.
IzBrushDisabledBackgroundBrush
 Disabled brush.
CzColour DisabledBackgroundColour
 Disabled colour.
bool Enabled
 Enabled state.
bool LayoutDirty
 When true the layout of this element and any children is re-calculated.
eSelectType SelectType
 Selection method used for this UI element.
CzIRect OriginalClippingMargin
 Original margin that is used to adjust the clipping rectangle.
CzIRect ClippingMargin
 Margin that is used to adjust the clipping rectangle.
CzVec2 PreviousScrollPos
 Previous scroll position.
CzVec2 ScrollPos
 Current scroll position.
CzVec2 ScrollVelocity
 Current scroll velocity.
CzIRect ScrollRange
 X and Y ranges of scroll.
bool EnableSpring
 Enables drag release spring.
eAxis SizeToContentAxis
 Determines if and how an element should size to its content.
CzAnimTimelineShowTimeline
 Timeline to play when this UI element is made visible.
CzAnimTimelineHideTimeline
 Timeline to play when this UI element is made invisible.
bool NeedsResize
 Set to true when child actors sizes have changed.
CzIRect ColourOffset
 Amount to offset the current colour of the actor.
bool Tapped
CzVec2 InitialScrollPos

Static Protected Attributes

static CzXomlClassDefUIBaseClassDef = NULL

Detailed Description

Base class of all UI components.

CzUIBase is the basic class that all UI actors are derived from. CzUIBase appends additional functionality to the normal image actor such as:

  • Selected, normal and disabled states
  • Individual brushes amd colours for each of the 3 states
  • Toggle state
  • Hide and show timelines
  • Automatic re-sizing to contents
  • Content scrolling
  • Content clipping
  • Colour offsetting

All new user interface actors should be derived from this class or a derivative of this class.

The following UI classes are derived from this base class:

  • CzUIIcon - An icon / image based button
  • CzUILabel - A text label that can display text and an image based background
  • CzUIGrid - A grid container that organises content in a columns and rows. Supports data binding
  • CzUIImageView - An image container with support for pinch zoom / pan
  • CzUIListBox - A list box container that stacks selectable content either vertically or horizontally that can be scrolled. Supports data binding
  • CzUICanvas - A container that organises docked and undocked content onto a 2D canvas that can be scrolled
  • CzUIStackPanel - A container that stacks content either vertically or horizontally
  • CzUIWrapPanel - A container that stacks content either vertically or horizontally, wrapping over hanging content to thenext row or column
  • CzUISlider - Enables the user to select a value by sliding a thumb either up / down or left / right
  • CzUITabBar - Enables navigation of a number of different views (container UI components such as the Canvas).
  • CzUITextBox - A text entry box with a background
  • CzUITextView - A text based container with support for pinch zoom / pan
  • CzUIVideoOverlay - Displays video overlays
  • CzUIWebView - Displays web content

Member Enumeration Documentation

Values that represent horizonal, vertical and both axis.

Enumerator:
Axis_None 

Affects no axis.

Axis_X 

Affects x axis.

Axis_Y 

Affects y axis.

Axis_XY 

Affects both x and y axis.

Values that represent different types of selection modes.

Enumerator:
SelectType_Normal 

Normal selection mode, the actor will remasin selected whilst it has touch focus.

SelectType_Toggle 

Toggle selection mode, the actors sekected state will toggle on and off each time it is selected.

SelectType_Sticky 

Sticky selection mode, the actors sekected state will remain selected once selected.


Constructor & Destructor Documentation

CzUIBase::~CzUIBase ( ) [virtual]

Member Function Documentation

static CzXomlProperty CzUIBase::_getSize ( IzXomlResource target) [static]

Reimplemented from CzActorImage.

bool CzUIBase::_setBackground ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUIBase::_setBackgroundColour ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUIBase::_setClipMargin ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUIBase::_setColourOffset ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUIBase::_setDisabledBackground ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUIBase::_setDisabledColour ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUIBase::_setEnabled ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUIBase::_setHideTimeline ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUIBase::_setKeyFocus ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUIBase::_setOnBackKey ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUIBase::_setOnMenuKey ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUIBase::_setOnToggledOff ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUIBase::_setOnToggledOn ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUIBase::_setScrollPos ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUIBase::_setScrollRange ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUIBase::_setSelected ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUIBase::_setSelectedBackground ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUIBase::_setSelectedColour ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUIBase::_setSelectType ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUIBase::_setShowTimeline ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
static bool CzUIBase::_setSize ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]

Reimplemented from CzActorImage.

bool CzUIBase::_setSizeToContentAxis ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUIBase::_setSpring ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzUIBase::_setToggledOn ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
CzAnim * CzUIBase::FindPresetAnimation ( unsigned int  name_hash) [static]

Searches for the first preset animation.

Parameters:
name_hashThe animation name as a string hash.
Returns:
null if it fails, else the found preset animation.
CzIRect CzUIBase::getColourOffset ( ) const [inline]
bool CzUIBase::getEnableSpring ( ) const [inline]
bool CzUIBase::getNeedsResize ( ) const [inline]
bool CzUIBase::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 CzUIBase is derived from CzActorImage, all CzActorImage 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 CzActorImage.

Reimplemented in CzUITabBar, CzUIGrid, CzUIListBox, CzUIImageView, CzUISlider, CzUILabel, CzUITextView, CzUIWebView, CzUITab, CzUITextBox, CzUIVideoOverlay, CzUIStackPanel, and CzUIWrapPanel.

CzVec2 CzUIBase::getScrollPos ( ) const [inline]
CzIRect CzUIBase::getScrollRange ( ) const [inline]
CzVec2 CzUIBase::getScrollVelocity ( ) const [inline]
bool CzUIBase::Init ( IzBrush brush,
int  width,
int  height 
) [virtual]

Initialises this UI actor.

Carries out some basic UI actor initialisation. Also assigns a brush and render size to the actor.

Parameters:
[in]brushIf non-null, the brush.
widthThe width of the UI actor.
heightThe height of the UI actor.
Returns:
true if it succeeds, false if it fails.

Reimplemented from CzActorImage.

void CzUIBase::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 CzActorImage.

Reimplemented in CzUITabBar, CzUIGrid, CzUIListBox, CzUIWebView, CzUIImageView, CzUISlider, CzUITextView, CzUILabel, CzUITab, CzUIVideoOverlay, CzUITextBox, CzUIStackPanel, and CzUIWrapPanel.

void CzUIBase::InitPresetAnimations ( ) [static]

Initialises the preset animations.

Static method that creates a group of preset animations.

bool CzUIBase::isEnabled ( ) const [inline]
bool CzUIBase::isLayoutDirty ( ) const [inline]
bool CzUIBase::isSelected ( ) const [inline]
bool CzUIBase::isToggledOn ( ) const [inline]
int CzUIBase::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 CzActorImage.

Reimplemented in CzUITabBar, CzUIGrid, CzUIListBox, CzUITabs, CzUIWebView, CzUIImageView, CzUISlider, CzUITextView, CzUILabel, CzUITab, CzUITextBox, CzUIVideoOverlay, CzUIStackPanel, CzUIWrapPanel, and CzUICanvas.

void CzUIBase::NotifyBackKey ( ) [virtual]

Handles the back key press evente.

void CzUIBase::NotifyBeginTouch ( int  index,
int  x,
int  y,
bool  allow_bubble 
) [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 CzActor.

Reimplemented in CzUIImageView, CzUITextView, and CzUISlider.

void CzUIBase::NotifyEndTouch ( int  index,
int  x,
int  y,
bool  allow_bubble 
) [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 CzActor.

Reimplemented in CzUIImageView, CzUITextView, and CzUISlider.

void CzUIBase::NotifyMenuKey ( ) [virtual]

Handles the menu key press evente.

void CzUIBase::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 CzActorImage.

Reimplemented in CzUIGrid, CzUIWebView, CzUISlider, and CzUITab.

Notifies the parent to resize its layout.

Used when this actor changes in a way that could potentially change the parents layout.

void CzUIBase::NotifyTapped ( int  index,
int  x,
int  y,
bool  allow_bubble 
) [virtual]

OnTapped event handler.

The OnTapped event handler is called whenever the actor is tapped on by the user. Actors can process up to 5 simultaneous touch events OnTapped to OnTapped5. 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 and toggled 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 CzActor.

Reimplemented in CzUITextBox.

void CzUIBase::NotifyToggledOff ( ) [virtual]

Handles the toggled off event.

Reimplemented in CzUITab.

void CzUIBase::NotifyToggledOn ( ) [virtual]

Handles the toggled on event.

Reimplemented in CzUITab.

Initialises the preset animations.

Static method that detroys a group of preset animations.

void CzUIBase::resetColourOffset ( ) [inline]
void CzUIBase::ResizeToContent ( ) [virtual]

Resizes the actor to fit its content.

Recalculates docking and dirties the layout. Used mainly by layout actors to resize themselves to fit their new content. This method is usually overridden by a derived class in order to calculate the new size based on the containers children. See CzUIStackPanel::ResizeToContent() for a simple example.

Reimplemented in CzUIStackPanel.

bool CzUIBase::ScrollRangeCheck ( ) [protected]

Prevents scroll position from giong out of bounds.

Checks to see if scroll position has gone out of the scroll range. If so then it is snapped back into place. If spring is enabled then the scroller will spring back into place instead of snapping back into place.

Returns:
true if the scroll position was changed, false if not.

Sets background brush of the actor.

The background brush is the normal background that will be displayed when the actor is not selected or disabled.

Parameters:
[in]brushIf non-null, the brush.
void CzUIBase::setBackgroundColour ( const CzColour colour)

Sets background colour of the actor.

The background colour is the normal background colour that will be displayed when the actor is not selected or disabled. Note that the background colour will be used to tint the background brush.

Parameters:
colourThe colour.
void CzUIBase::setClippingMargin ( int  x,
int  y,
int  w,
int  h 
) [inline]
void CzUIBase::setColourOffset ( const CzIRect offset) [inline]

Sets disabled background brush of the actor.

The disabled background brush is the background that will be displayed when the actor is disabled.

Parameters:
[in]brushIf non-null, the brush.

Sets disabled background colour of the actor.

The disabled background colour is the background colour that will be displayed when the actor is disabled. Note that the background colour will be used to tint the disabled background brush.

Parameters:
colourThe colour.
void CzUIBase::setEnabled ( bool  enabled) [virtual]

Enables or disables the actor.

When the actor is in a disabled state it cannot be selected and it will not receive touch input.

setEnabled() is also used to set the correct current brush and colour by calling with the currently Enabled state.

Parameters:
enabledtrue to enable, false to disable.

Reimplemented in CzUILabel.

void CzUIBase::setEnableSpring ( bool  enable) [inline]

Sets hide timeline deleting any previously assigned none managed hide timeline.

Parameters:
[in]timelineIf non-null, the timeline.
void CzUIBase::setHideTimeline ( const char *  timeline_name)

Sets hide timeline to the named timeline.

Note that the timeline name can also include one of the preset timelines that are defined by PresetAnimations

Parameters:
timeline_nameName of the timeline.
void CzUIBase::setLayoutDirty ( bool  dirty)

Sets layout as dirty.

Settinge the layout dirty focres contained actors to recalculate their layouts

Parameters:
dirtytrue to dirty.
void CzUIBase::setNeedsResize ( bool  resize)
bool CzUIBase::setProperty ( unsigned int  property_name,
const CzXomlProperty data,
bool  delta 
) [virtual]

Sets the named property of the actor.

Sets the named property of this actor. 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 CzActorImage.

Reimplemented in CzUITabBar, CzUIGrid, CzUIListBox, CzUIImageView, CzUISlider, CzUILabel, CzUITextView, CzUIWebView, CzUITab, CzUITextBox, CzUIVideoOverlay, CzUIStackPanel, and CzUIWrapPanel.

bool CzUIBase::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 CzUIBase is derived from CzActorImage, all CzActorImage 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 CzActorImage.

Reimplemented in CzUITabBar, CzUIGrid, CzUIListBox, CzUIImageView, CzUISlider, CzUILabel, CzUITextView, CzUIWebView, CzUITab, CzUITextBox, CzUIVideoOverlay, CzUIStackPanel, and CzUIWrapPanel.

void CzUIBase::setScrollPos ( float  x,
float  y 
)

Sets scroll position.

Sets the scroll position of the content within the actor. UI actors can scroll their content around, for example, when a grids data is larger than the available space assigned to the grid then scrolling can be used to enable the user to pan / scroll around the content.

Parameters:
xThe x coordinate.
yThe y coordinate.
void CzUIBase::setScrollRange ( int  x,
int  y,
int  w,
int  h 
) [inline]
void CzUIBase::setScrollVelocity ( float  x,
float  y 
) [inline]
void CzUIBase::setSelected ( bool  selected,
bool  force_select = false 
)

Sets actors selected state.

Parameters:
selectedtrue if selected.
force_selecttrue to force select.

Sets selected background brush of the actor.

The selected background brush is the background that will be displayed when the actor is selected.

Parameters:
[in]brushIf non-null, the brush.

Sets selected background colour of the actor.

The selected background colour is the background colour that will be displayed when the actor is selected. Note that the background colour will be used to tint the selected background brush.

Parameters:
colourThe colour.
void CzUIBase::setSelectType ( eSelectType  type) [inline]

Sets show timeline deleting any previously assigned none managed show timeline.

Sets show timeline to the named timeline.

Parameters:
[in]timelineIf non-null, the timeline.

Note that the timeline name can also include one of the preset timelines that are defined by PresetAnimations

Parameters:
[in]timelineIf non-null, the timeline.
void CzUIBase::setShowTimeline ( const char *  timeline_name)
void CzUIBase::setSizeToContentAxis ( eAxis  axis) [inline]
void CzUIBase::setToggledOn ( bool  toggled_on)

Sets actores toggled state.

If the toggle state changes then the OnToggledOn or OnToggledOff events will be raised

Parameters:
toggled_ontrue to toggle on, false to toggle off
void CzUIBase::setVisible ( bool  visible,
bool  force_set = false 
) [virtual]

Makes an actor visible.

Actors can be made visible / invisible by setting their visibility. An invisible actor will not be displayed but will still be processed if it is active.

CzUIBase augments the original CzActor::setVisible() method by adding support for starting and stopping show and hide timelines. Show and hide timelines are timelines that can if assigned to an actor will automatically call those timelines each time the actor is made visible or hidden. Any UI actor can be assigned show and hide timelines, for example:

XOML Example:
<Label Font="serif" Background="Button1Brush" Text="Im a label" ShowTimeline="show_timeline" HideTimeline="hide_timeline" />
Parameters:
visibletrue to show, false to hide.
force_setunused at this time

Reimplemented from CzActor.

bool CzUIBase::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 CzActor.

Reimplemented in CzUITabBar, CzUIGrid, CzUIListBox, CzUIImageView, CzUITextView, CzUILabel, CzUISlider, CzUIVideoOverlay, CzUIWrapPanel, and CzUICanvas.

bool CzUIBase::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 CzUIBase is derived from CzActorImage, all CzActorImage 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 CzActorImage.

Reimplemented in CzUITabBar, CzUIGrid, CzUIListBox, CzUIImageView, CzUITextView, CzUISlider, CzUILabel, CzUIWebView, CzUITab, CzUITextBox, CzUIVideoOverlay, CzUIStackPanel, and CzUIWrapPanel.

bool CzUIBase::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 CzUIBase is derived from CzActorImage, all CzActorImage 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 CzActorImage.

Reimplemented in CzUITabBar, CzUIGrid, CzUIListBox, CzUIWebView, CzUIImageView, CzUISlider, CzUITextView, CzUILabel, CzUITab, CzUITextBox, CzUIStackPanel, CzUIVideoOverlay, and CzUIWrapPanel.

bool CzUIBase::UpdateLayout ( ) [protected, virtual]

Updates the actors layout.

Recalculates the actors layout. Used mainly by container actors to modify the layout of their child content. This method is usually overridden by a derived class in order to update the layout of its children.. See CzUIStackPanel::UpdateLayout() for a simple example.

Returns:
true if it succeeds, false if it fails.

Reimplemented in CzUITabBar, CzUIGrid, CzUIListBox, CzUIStackPanel, CzUIWrapPanel, and CzUICanvas.

Updates the preset animations.

Static method that updates a group of preset animations.


Member Data Documentation

Default none selected brush.

Default none selected colour.

Margin that is used to adjust the clipping rectangle.

Amount to offset the current colour of the actor.

Disabled brush.

Disabled colour.

bool CzUIBase::Enabled [protected]

Enabled state.

bool CzUIBase::EnableSpring [protected]

Enables drag release spring.

Timeline to play when this UI element is made invisible.

bool CzUIBase::LayoutDirty [protected]

When true the layout of this element and any children is re-calculated.

bool CzUIBase::NeedsResize [protected]

Set to true when child actors sizes have changed.

Original margin that is used to adjust the clipping rectangle.

Previous scroll position.

bool CzUIBase::PrevSelected [protected]

Previous Selected status.

Current scroll position.

X and Y ranges of scroll.

Current scroll velocity.

bool CzUIBase::Selected [protected]

Selected status.

Selected brush.

Selected colour.

Selection method used for this UI element.

Timeline to play when this UI element is made visible.

Determines if and how an element should size to its content.

bool CzUIBase::Tapped [protected]
bool CzUIBase::ToggledOn [protected]

ToggledOn state.

CzXomlClassDef * CzUIBase::UIBaseClassDef = NULL [static, protected]

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