Skip to content
9miao edited this page Sep 28, 2014 · 2 revisions

CAControl

Class Description

CAButton, button’s base class, is mainly used to define button’s status and callback event, and respond to button’s touch event. Generally button has normal, highlight, selected, click prohibited and full status these five statuses; and has six type button callback event trigger conditions including click, repetitive click, slide in button range after click, slide outside button range after click, release in button range after click, and release at anywhere after click.

Base Class

CAView

Attribute

Access modifier

Attribute name

Description

protected

ControlState

button status

Method

Access modifier

Attribute name

Description

public

setControlStateNormal

set as normal status

public

setControlStateHighlighted

set as highlight status

public

setControlStateDisabled

set as disabled status

public

setControlStateSelected

set as selected status

public

addTarget

add callback event

public

removeTarget

remove callback event

Attribute Description

ControlState
Type: CAControlState
Descripiton: button status, enumeration type, it has five type status including normal, highlight, disabled, selected and full status. Here the ‘full status’ means that when operating buttons we do not need to set every status of button, but conveniently apply current operations to button’s all statuses by setting a full status, get/set{}.

typedef enum
{
CAControlStateNormal = 0,
CAControlStateHighlighted,
CAControlStateDisabled,
CAControlStateSelected,
CAControlStateAll
}CAControlState;

Method Description

void setControlStateNormal()
Return value:void
Description set button as normal status which is also the button’s status by default.

void setControlStateHighlighted()
Return value:void
Description set button as highlight status

void setControlStateDisabled()
Return value:void
Description set button as disabled status

void setControlStateSelected()
Return value:void
Description set button as selected status

virtual void addTarget(CAObject target, SEL_CAControl selector, CAControlEvents event)*
Return value:void
Description add callback event for button
Parameter:

Type

Parameter name

Description

CAObject*

target

current object

 

SEL_CAControl

selector

function callback which responds to button’s click event

CAControlEvents

event

event trigger condition, enumeration type, including 6 type trigger conditions.

virtual void removeTarget(CAObject target, SEL_CAControl selector, CAControlEvents event)*
Return value:void
Parameter:

Type

Parameter name

Description

CAObject*

target

current object

 

SEL_CAControl

selector

function callback which responds to button’s click event

CAControlEvents

event

event trigger condition, enumeration type, including 6 type trigger conditions.

Description remove button’s callback event

virtual void removeAllTargets()
Return value:void
Description remove button’s all callback event

Clone this wiki locally