Class CCScrollView

#include <Geode/cocos/extensions/GUI/CCScrollView/CCScrollView.h>
classCCScrollView:publiccocos2d::CCLayer{ ... }

ScrollView support for cocos2d for iphone. It provides scroll view functionalities to cocos2d projects natively.

Examples0
Public static methods2
staticcocos2d::extension::CCScrollView*create(,)

Returns an autoreleased scroll view object.

Parameters

size

view size

container

parent object
Return value
autoreleased scroll view object
staticcocos2d::extension::CCScrollView*create()

Returns an autoreleased scroll view object.

Parameters

size

view size

container

parent object
Return value
autoreleased scroll view object
Public member functions44
virtualboolinit()
No description provided
virtualvoidregisterWithTouchDispatcher()
No description provided
boolinitWithViewSize(,)

Returns a scroll view object

Parameters

size

view size

container

parent object
Return value
scroll view object
voidsetContentOffset(,
boolanimated
)

Sets a new content offset. It ignores max/min offset. It just sets what’s given. (just like UIKit’s UIScrollView)

Parameters

offset

new offset

If

YES, the view scrolls to the new offset
cocos2d::CCPointgetContentOffset()
No description provided
voidsetContentOffsetInDuration(,)

Sets a new content offset. It ignores max/min offset. It just sets what’s given. (just like UIKit’s UIScrollView) You can override the animation duration with this method.

Parameters

offset

new offset

animation

duration
voidsetZoomScale()
No description provided
voidsetZoomScale(,
boolanimated
)

Sets a new scale and does that for a predefined duration.

Parameters

s

a new scale vale

animated

if YES, scaling is animated
floatgetZoomScale()
No description provided
voidsetZoomScaleInDuration(,)

Sets a new scale for container in a given duration.

Parameters

s

a new scale value

animation

duration
cocos2d::CCPointminContainerOffset()

Returns the current container’s minimum offset. You may want this while you animate scrolling by yourself

cocos2d::CCPointmaxContainerOffset()

Returns the current container’s maximum offset. You may want this while you animate scrolling by yourself

boolisNodeVisible()

Determines if a given node’s bounding box is in visible bounds

Return value
YES if it is in visible bounds
voidpause()

Provided to make scroll view compatible with SWLayer’s pause method

voidresume()

Provided to make scroll view compatible with SWLayer’s resume method

boolisDragging()
No description provided
boolisTouchMoved()
No description provided
boolisBounceable()
No description provided
voidsetBounceable(
boolbBounceable
)
No description provided
cocos2d::CCSizegetViewSize()

size to clip. CCNode boundingBox uses contentSize directly. It’s semantically different what it actually means to common scroll views. Hence, this scroll view will use a separate size property.

voidsetViewSize()
No description provided
cocos2d::CCNode*getContainer()
No description provided
voidsetContainer()
No description provided
cocos2d::extension::CCScrollViewDirectiongetDirection()

direction allowed to scroll. CCScrollViewDirectionBoth by default.

virtualvoidsetDirection()
No description provided
cocos2d::extension::CCScrollViewDelegate*getDelegate()
No description provided
voidsetDelegate()
No description provided
virtualboolccTouchBegan(,)

override functions

virtualvoidccTouchMoved(,)
No description provided
virtualvoidccTouchEnded(,)
No description provided
virtualvoidccTouchCancelled(,)
No description provided
virtualvoidsetContentSize()
No description provided
virtualcocos2d::CCSizeconst&getContentSize()const
No description provided
voidupdateInset()
No description provided
boolisClippingToBounds()

Determines whether it clips its children or not.

voidsetClippingToBounds(
boolbClippingToBounds
)
No description provided
virtualvoidvisit()
No description provided
virtualvoidaddChild(,
intzOrder
,
inttag
)
No description provided
virtualvoidaddChild(,
intzOrder
)
No description provided
virtualvoidaddChild()
No description provided
virtualvoidsetTouchEnabled()
No description provided
voidregisterScriptHandler(
intnFunID
,
intnScriptEventType
)
No description provided
voidunregisterScriptHandler(
intnScriptEventType
)
No description provided
intgetScriptHandler(
intnScriptEventType
)
No description provided
Fields23
floatm_fZoomScale
;

current zoom scale

floatm_fMinZoomScale
;

min zoom scale

floatm_fMaxZoomScale
;

max zoom scale

;

scroll view delegate

;
No description provided
boolm_bDragging
;

If YES, the view is being dragged.

cocos2d::CCPointm_tContentOffset
;

Content offset. Note that left-bottom point is the origin

cocos2d::CCNode*m_pContainer
;

Container holds scroll view contents, Sets the scrollable container object of the scroll view

boolm_bTouchMoved
;

Determiens whether user touch is moved after begin phase.

cocos2d::CCPointm_fMaxInset
;

max inset point to limit scrolling by touch

cocos2d::CCPointm_fMinInset
;

min inset point to limit scrolling by touch

boolm_bBounceable
;

Determines whether the scroll view is allowed to bounce or not.

boolm_bClippingToBounds
;
No description provided
cocos2d::CCPointm_tScrollDistance
;

scroll speed

cocos2d::CCPointm_tTouchPoint
;

Touch point

floatm_fTouchLength
;

length between two fingers

;

UITouch objects to detect multitouch

cocos2d::CCSizem_tViewSize
;

size to clip. CCNode boundingBox uses contentSize directly. It’s semantically different what it actually means to common scroll views. Hence, this scroll view will use a separate size property.

floatm_fMinScale
;

max and min scale

floatm_fMaxScale
;

max and min scale

cocos2d::CCRectm_tParentScissorRect
;

scissor rect for parent, just for restoring GL_SCISSOR_BOX

boolm_bScissorRestored
;
No description provided
std::map<int,int>m_mapScriptHandler
;
No description provided
Protected member functions1
cocos2d::CCRectgetViewRect()
No description provided
Protected fields0
Derived classes1