axmol/cocos/gui/UIPageView.cpp

633 lines
15 KiB
C++
Raw Normal View History

2013-09-13 22:20:20 +08:00
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "gui/UIPageView.h"
2013-09-13 22:20:20 +08:00
namespace gui {
2013-09-13 22:20:20 +08:00
UIPageView::UIPageView():
2013-09-16 20:54:13 +08:00
_curPageIdx(0),
2013-11-14 11:37:46 +08:00
_pages(nullptr),
2013-09-16 20:54:13 +08:00
_touchMoveDir(PAGEVIEW_TOUCHLEFT),
_touchStartLocation(0.0f),
_touchMoveStartLocation(0.0f),
2013-11-06 16:04:06 +08:00
_movePagePoint(cocos2d::Point::ZERO),
2013-11-14 11:37:46 +08:00
_leftChild(nullptr),
_rightChild(nullptr),
2013-09-16 20:54:13 +08:00
_leftBoundary(0.0f),
_rightBoundary(0.0f),
_isAutoScrolling(false),
_autoScrollDistance(0.0f),
_autoScrollSpeed(0.0f),
_autoScrollDir(0),
_childFocusCancelOffset(5.0f),
2013-11-14 11:37:46 +08:00
_pageViewEventListener(nullptr),
_pageViewEventSelector(nullptr)
2013-09-13 22:20:20 +08:00
{
}
UIPageView::~UIPageView()
{
2013-11-06 16:04:06 +08:00
_pages->removeAllObjects();
CC_SAFE_RELEASE(_pages);
2013-11-14 11:37:46 +08:00
_pageViewEventListener = nullptr;
_pageViewEventSelector = nullptr;
2013-09-13 22:20:20 +08:00
}
UIPageView* UIPageView::create()
{
UIPageView* widget = new UIPageView();
if (widget && widget->init())
{
widget->autorelease();
return widget;
}
CC_SAFE_DELETE(widget);
2013-11-14 11:37:46 +08:00
return nullptr;
2013-09-13 22:20:20 +08:00
}
bool UIPageView::init()
{
2013-11-06 16:04:06 +08:00
if (UILayout::init())
2013-09-13 22:20:20 +08:00
{
2013-11-06 16:04:06 +08:00
_pages = cocos2d::Array::create();
2013-09-16 20:54:13 +08:00
_pages->retain();
2013-09-13 22:20:20 +08:00
setClippingEnabled(true);
setUpdateEnabled(true);
2013-11-06 16:04:06 +08:00
setTouchEnabled(true);
2013-09-13 22:20:20 +08:00
return true;
}
return false;
}
void UIPageView::addWidgetToPage(UIWidget *widget, int pageIdx, bool forceCreate)
{
if (!widget)
{
return;
}
2013-11-06 16:04:06 +08:00
if (pageIdx < 0)
{
return;
}
2013-09-16 20:54:13 +08:00
int pageCount = _pages->count();
2013-09-13 22:20:20 +08:00
if (pageIdx < 0 || pageIdx >= pageCount)
{
if (forceCreate)
{
if (pageIdx > pageCount)
{
CCLOG("pageIdx is %d, it will be added as page id [%d]",pageIdx,pageCount);
}
2013-11-06 16:04:06 +08:00
UILayout* newPage = createPage();
2013-09-13 22:20:20 +08:00
newPage->addChild(widget);
addPage(newPage);
}
}
else
{
2013-11-06 16:04:06 +08:00
UILayout * page = dynamic_cast<UILayout*>(_pages->getObjectAtIndex(pageIdx));
2013-09-13 22:20:20 +08:00
if (page)
{
page->addChild(widget);
}
}
}
2013-11-06 16:04:06 +08:00
UILayout* UIPageView::createPage()
2013-09-13 22:20:20 +08:00
{
2013-11-06 16:04:06 +08:00
UILayout* newPage = UILayout::create();
2013-09-13 22:20:20 +08:00
newPage->setSize(getSize());
return newPage;
}
2013-11-06 16:04:06 +08:00
void UIPageView::addPage(UILayout* page)
2013-09-13 22:20:20 +08:00
{
if (!page)
{
return;
}
if (page->getWidgetType() != WidgetTypeContainer)
{
return;
}
2013-09-16 20:54:13 +08:00
if (_pages->containsObject(page))
2013-09-13 22:20:20 +08:00
{
return;
}
2013-11-06 16:04:06 +08:00
cocos2d::Size pSize = page->getSize();
cocos2d::Size pvSize = getSize();
2013-09-13 22:20:20 +08:00
if (!pSize.equals(pvSize))
{
CCLOG("page size does not match pageview size, it will be force sized!");
page->setSize(pvSize);
}
2013-11-06 16:04:06 +08:00
page->setPosition(cocos2d::Point(getPositionXByIndex(_pages->count()), 0));
2013-09-16 20:54:13 +08:00
_pages->addObject(page);
2013-09-13 22:20:20 +08:00
addChild(page);
updateBoundaryPages();
}
2013-11-06 16:04:06 +08:00
void UIPageView::insertPage(UILayout* page, int idx)
2013-09-13 22:20:20 +08:00
{
if (idx < 0)
{
return;
}
if (!page)
{
return;
}
if (page->getWidgetType() != WidgetTypeContainer)
{
return;
}
2013-09-16 20:54:13 +08:00
if (_pages->containsObject(page))
2013-09-13 22:20:20 +08:00
{
return;
}
2013-09-16 20:54:13 +08:00
int pageCount = _pages->count();
2013-09-13 22:20:20 +08:00
if (idx >= pageCount)
{
addPage(page);
}
else
{
2013-09-16 20:54:13 +08:00
_pages->insertObject(page, idx);
2013-11-06 16:04:06 +08:00
page->setPosition(cocos2d::Point(getPositionXByIndex(idx), 0));
2013-09-13 22:20:20 +08:00
addChild(page);
2013-11-06 16:04:06 +08:00
cocos2d::Size pSize = page->getSize();
cocos2d::Size pvSize = getSize();
2013-09-13 22:20:20 +08:00
if (!pSize.equals(pvSize))
{
CCLOG("page size does not match pageview size, it will be force sized!");
page->setSize(pvSize);
}
2013-11-06 16:04:06 +08:00
cocos2d::ccArray* arrayPages = _pages->data;
2013-09-13 22:20:20 +08:00
int length = arrayPages->num;
for (int i=(idx+1); i<length; i++) {
UIWidget* behindPage = dynamic_cast<UIWidget*>(arrayPages->arr[i]);
2013-11-06 16:04:06 +08:00
cocos2d::Point formerPos = behindPage->getPosition();
behindPage->setPosition(cocos2d::Point(formerPos.x+getSize().width, 0));
2013-09-13 22:20:20 +08:00
}
updateBoundaryPages();
}
}
2013-11-06 16:04:06 +08:00
void UIPageView::removePage(UILayout* page)
2013-09-13 22:20:20 +08:00
{
if (!page)
{
return;
}
removeChild(page);
updateChildrenPosition();
updateBoundaryPages();
}
void UIPageView::removePageAtIndex(int index)
{
2013-09-16 20:54:13 +08:00
if (index < 0 || index >= (int)(_pages->count()))
2013-09-13 22:20:20 +08:00
{
return;
}
2013-11-06 16:04:06 +08:00
UILayout* page = dynamic_cast<UILayout*>(_pages->getObjectAtIndex(index));
2013-09-13 22:20:20 +08:00
if (page)
{
removePage(page);
}
}
2013-11-13 20:01:57 +08:00
void UIPageView::removeAllPages()
{
removeAllChildren();
}
2013-09-13 22:20:20 +08:00
void UIPageView::updateBoundaryPages()
{
2013-09-16 20:54:13 +08:00
if (_pages->count() <= 0)
2013-09-13 22:20:20 +08:00
{
2013-11-14 11:37:46 +08:00
_leftChild = nullptr;
_rightChild = nullptr;
2013-11-06 16:04:06 +08:00
return;
2013-09-13 22:20:20 +08:00
}
2013-09-16 20:54:13 +08:00
_leftChild = dynamic_cast<UIWidget*>(_pages->getObjectAtIndex(0));
_rightChild = dynamic_cast<UIWidget*>(_pages->getLastObject());
2013-09-13 22:20:20 +08:00
}
float UIPageView::getPositionXByIndex(int idx)
{
2013-09-16 20:54:13 +08:00
return (getSize().width*(idx-_curPageIdx));
2013-09-13 22:20:20 +08:00
}
bool UIPageView::addChild(UIWidget* widget)
{
2013-11-06 16:04:06 +08:00
return UILayout::addChild(widget);
2013-09-13 22:20:20 +08:00
}
bool UIPageView::removeChild(UIWidget* widget)
{
2013-09-16 20:54:13 +08:00
if (_pages->containsObject(widget))
2013-09-13 22:20:20 +08:00
{
2013-09-16 20:54:13 +08:00
_pages->removeObject(widget);
2013-09-13 22:20:20 +08:00
}
2013-11-13 20:01:57 +08:00
return UILayout::removeChild(widget);
2013-09-13 22:20:20 +08:00
}
void UIPageView::onSizeChanged()
{
2013-11-06 16:04:06 +08:00
UILayout::onSizeChanged();
2013-09-16 20:54:13 +08:00
_rightBoundary = getSize().width;
2013-09-13 22:20:20 +08:00
updateChildrenSize();
updateChildrenPosition();
}
void UIPageView::updateChildrenSize()
{
2013-09-16 20:54:13 +08:00
if (!_pages)
2013-09-13 22:20:20 +08:00
{
return;
}
2013-11-06 16:04:06 +08:00
cocos2d::Size selfSize = getSize();
for (long i=0; i<_pages->count(); i++)
2013-09-13 22:20:20 +08:00
{
2013-11-06 16:04:06 +08:00
UILayout* page = dynamic_cast<UILayout*>(_pages->getObjectAtIndex(i));
2013-09-13 22:20:20 +08:00
page->setSize(selfSize);
}
}
void UIPageView::updateChildrenPosition()
{
2013-09-16 20:54:13 +08:00
if (!_pages)
2013-09-13 22:20:20 +08:00
{
return;
}
2013-09-16 20:54:13 +08:00
int pageCount = _pages->data->num;
2013-09-13 22:20:20 +08:00
if (pageCount <= 0)
{
2013-09-16 20:54:13 +08:00
_curPageIdx = 0;
2013-09-13 22:20:20 +08:00
return;
}
2013-09-16 20:54:13 +08:00
if (_curPageIdx >= pageCount)
2013-09-13 22:20:20 +08:00
{
2013-09-16 20:54:13 +08:00
_curPageIdx = pageCount-1;
2013-09-13 22:20:20 +08:00
}
float pageWidth = getSize().width;
2013-11-06 16:04:06 +08:00
cocos2d::ccArray* arrayPages = _pages->data;
2013-09-13 22:20:20 +08:00
for (int i=0; i<pageCount; i++)
{
2013-11-06 16:04:06 +08:00
UILayout* page = dynamic_cast<UILayout*>(arrayPages->arr[i]);
page->setPosition(cocos2d::Point((i-_curPageIdx)*pageWidth, 0));
2013-09-13 22:20:20 +08:00
}
}
void UIPageView::removeAllChildren()
{
2013-09-16 20:54:13 +08:00
_pages->removeAllObjects();
2013-11-06 16:04:06 +08:00
UILayout::removeAllChildren();
2013-09-13 22:20:20 +08:00
}
void UIPageView::scrollToPage(int idx)
{
2013-09-16 20:54:13 +08:00
if (idx < 0 || idx >= (int)(_pages->count()))
2013-09-13 22:20:20 +08:00
{
return;
}
2013-09-16 20:54:13 +08:00
_curPageIdx = idx;
UIWidget* curPage = dynamic_cast<UIWidget*>(_pages->getObjectAtIndex(idx));
_autoScrollDistance = -(curPage->getPosition().x);
_autoScrollSpeed = fabs(_autoScrollDistance)/0.2f;
_autoScrollDir = _autoScrollDistance > 0 ? 1 : 0;
_isAutoScrolling = true;
2013-09-13 22:20:20 +08:00
}
void UIPageView::update(float dt)
{
2013-09-16 20:54:13 +08:00
if (_isAutoScrolling)
2013-09-13 22:20:20 +08:00
{
2013-09-16 20:54:13 +08:00
switch (_autoScrollDir)
2013-09-13 22:20:20 +08:00
{
case 0:
{
2013-09-16 20:54:13 +08:00
float step = _autoScrollSpeed*dt;
if (_autoScrollDistance + step >= 0.0f)
2013-09-13 22:20:20 +08:00
{
2013-09-16 20:54:13 +08:00
step = -_autoScrollDistance;
_autoScrollDistance = 0.0f;
_isAutoScrolling = false;
2013-09-13 22:20:20 +08:00
}
else
{
2013-09-16 20:54:13 +08:00
_autoScrollDistance += step;
2013-09-13 22:20:20 +08:00
}
scrollPages(-step);
2013-11-06 16:04:06 +08:00
if (!_isAutoScrolling)
{
pageTurningEvent();
}
2013-09-13 22:20:20 +08:00
break;
}
break;
case 1:
{
2013-09-16 20:54:13 +08:00
float step = _autoScrollSpeed*dt;
if (_autoScrollDistance - step <= 0.0f)
2013-09-13 22:20:20 +08:00
{
2013-09-16 20:54:13 +08:00
step = _autoScrollDistance;
_autoScrollDistance = 0.0f;
_isAutoScrolling = false;
2013-09-13 22:20:20 +08:00
}
else
{
2013-09-16 20:54:13 +08:00
_autoScrollDistance -= step;
2013-09-13 22:20:20 +08:00
}
scrollPages(step);
2013-11-06 16:04:06 +08:00
if (!_isAutoScrolling)
{
pageTurningEvent();
}
2013-09-13 22:20:20 +08:00
break;
}
default:
break;
}
}
}
2013-11-06 16:04:06 +08:00
bool UIPageView::onTouchBegan(const cocos2d::Point &touchPoint)
2013-09-13 22:20:20 +08:00
{
2013-11-06 16:04:06 +08:00
bool pass = UILayout::onTouchBegan(touchPoint);
2013-09-13 22:20:20 +08:00
handlePressLogic(touchPoint);
return pass;
}
2013-11-06 16:04:06 +08:00
void UIPageView::onTouchMoved(const cocos2d::Point &touchPoint)
2013-09-13 22:20:20 +08:00
{
2013-09-16 15:32:52 +08:00
_touchMovePos.x = touchPoint.x;
_touchMovePos.y = touchPoint.y;
2013-09-13 22:20:20 +08:00
handleMoveLogic(touchPoint);
2013-09-16 15:32:52 +08:00
if (_widgetParent)
2013-09-13 22:20:20 +08:00
{
2013-09-16 15:32:52 +08:00
_widgetParent->checkChildInfo(1,this,touchPoint);
2013-09-13 22:20:20 +08:00
}
moveEvent();
if (!hitTest(touchPoint))
{
setFocused(false);
onTouchEnded(touchPoint);
}
}
2013-11-06 16:04:06 +08:00
void UIPageView::onTouchEnded(const cocos2d::Point &touchPoint)
2013-09-13 22:20:20 +08:00
{
2013-11-06 16:04:06 +08:00
UILayout::onTouchEnded(touchPoint);
2013-09-13 22:20:20 +08:00
handleReleaseLogic(touchPoint);
}
void UIPageView::movePages(float offset)
{
2013-11-06 16:04:06 +08:00
cocos2d::ccArray* arrayPages = _pages->data;
2013-09-13 22:20:20 +08:00
int length = arrayPages->num;
for (int i = 0; i < length; i++)
{
UIWidget* child = (UIWidget*)(arrayPages->arr[i]);
2013-09-16 20:54:13 +08:00
_movePagePoint.x = child->getPosition().x + offset;
_movePagePoint.y = child->getPosition().y;
child->setPosition(_movePagePoint);
2013-09-13 22:20:20 +08:00
}
}
bool UIPageView::scrollPages(float touchOffset)
{
2013-09-16 20:54:13 +08:00
if (_pages->count() <= 0)
2013-09-13 22:20:20 +08:00
{
return false;
}
2013-09-16 20:54:13 +08:00
if (!_leftChild || !_rightChild)
2013-09-13 22:20:20 +08:00
{
return false;
}
float realOffset = touchOffset;
2013-09-16 20:54:13 +08:00
switch (_touchMoveDir)
2013-09-13 22:20:20 +08:00
{
case PAGEVIEW_TOUCHLEFT: // left
2013-09-16 20:54:13 +08:00
if (_rightChild->getRightInParent() + touchOffset <= _rightBoundary)
2013-09-13 22:20:20 +08:00
{
2013-09-16 20:54:13 +08:00
realOffset = _rightBoundary - _rightChild->getRightInParent();
2013-09-13 22:20:20 +08:00
movePages(realOffset);
return false;
}
break;
case PAGEVIEW_TOUCHRIGHT: // right
2013-09-16 20:54:13 +08:00
if (_leftChild->getLeftInParent() + touchOffset >= _leftBoundary)
2013-09-13 22:20:20 +08:00
{
2013-09-16 20:54:13 +08:00
realOffset = _leftBoundary - _leftChild->getLeftInParent();
2013-09-13 22:20:20 +08:00
movePages(realOffset);
return false;
}
break;
default:
break;
}
movePages(realOffset);
return true;
}
2013-11-06 16:04:06 +08:00
void UIPageView::onTouchCancelled(const cocos2d::Point &touchPoint)
2013-09-13 22:20:20 +08:00
{
2013-11-06 16:04:06 +08:00
UILayout::onTouchCancelled(touchPoint);
2013-09-13 22:20:20 +08:00
}
2013-11-06 16:04:06 +08:00
void UIPageView::handlePressLogic(const cocos2d::Point &touchPoint)
2013-09-13 22:20:20 +08:00
{
2013-11-06 16:04:06 +08:00
cocos2d::Point nsp = _renderer->convertToNodeSpace(touchPoint);
2013-09-16 20:54:13 +08:00
_touchMoveStartLocation = nsp.x;
_touchStartLocation = nsp.x;
2013-09-13 22:20:20 +08:00
}
2013-11-06 16:04:06 +08:00
void UIPageView::handleMoveLogic(const cocos2d::Point &touchPoint)
2013-09-13 22:20:20 +08:00
{
2013-11-06 16:04:06 +08:00
cocos2d::Point nsp = _renderer->convertToNodeSpace(touchPoint);
2013-09-13 22:20:20 +08:00
float offset = 0.0;
float moveX = nsp.x;
2013-09-16 20:54:13 +08:00
offset = moveX - _touchMoveStartLocation;
_touchMoveStartLocation = moveX;
2013-09-13 22:20:20 +08:00
if (offset < 0)
{
2013-09-16 20:54:13 +08:00
_touchMoveDir = PAGEVIEW_TOUCHLEFT;
2013-09-13 22:20:20 +08:00
}
else if (offset > 0)
{
2013-09-16 20:54:13 +08:00
_touchMoveDir = PAGEVIEW_TOUCHRIGHT;
2013-09-13 22:20:20 +08:00
}
scrollPages(offset);
}
2013-11-06 16:04:06 +08:00
void UIPageView::handleReleaseLogic(const cocos2d::Point &touchPoint)
2013-09-13 22:20:20 +08:00
{
2013-11-06 16:04:06 +08:00
if (_pages->count() <= 0)
{
return;
}
2013-09-16 20:54:13 +08:00
UIWidget* curPage = dynamic_cast<UIWidget*>(_pages->getObjectAtIndex(_curPageIdx));
2013-09-13 22:20:20 +08:00
if (curPage)
{
2013-11-06 16:04:06 +08:00
cocos2d::Point curPagePos = curPage->getPosition();
2013-09-16 20:54:13 +08:00
int pageCount = _pages->count();
2013-09-13 22:20:20 +08:00
float curPageLocation = curPagePos.x;
float pageWidth = getSize().width;
float boundary = pageWidth/2.0f;
if (curPageLocation <= -boundary)
{
2013-09-16 20:54:13 +08:00
if (_curPageIdx >= pageCount-1)
2013-09-13 22:20:20 +08:00
{
scrollPages(-curPageLocation);
}
else
{
2013-09-16 20:54:13 +08:00
scrollToPage(_curPageIdx+1);
2013-09-13 22:20:20 +08:00
}
}
else if (curPageLocation >= boundary)
{
2013-09-16 20:54:13 +08:00
if (_curPageIdx <= 0)
2013-09-13 22:20:20 +08:00
{
scrollPages(-curPageLocation);
}
else
{
2013-09-16 20:54:13 +08:00
scrollToPage(_curPageIdx-1);
2013-09-13 22:20:20 +08:00
}
}
else
{
2013-09-16 20:54:13 +08:00
scrollToPage(_curPageIdx);
2013-09-13 22:20:20 +08:00
}
}
}
2013-11-06 16:04:06 +08:00
void UIPageView::checkChildInfo(int handleState,UIWidget* sender, const cocos2d::Point &touchPoint)
2013-09-13 22:20:20 +08:00
{
interceptTouchEvent(handleState, sender, touchPoint);
}
2013-11-06 16:04:06 +08:00
void UIPageView::interceptTouchEvent(int handleState, UIWidget *sender, const cocos2d::Point &touchPoint)
2013-09-13 22:20:20 +08:00
{
switch (handleState)
{
case 0:
handlePressLogic(touchPoint);
break;
case 1:
{
float offset = 0;
offset = fabs(sender->getTouchStartPos().x - touchPoint.x);
2013-09-16 20:54:13 +08:00
if (offset > _childFocusCancelOffset)
2013-09-13 22:20:20 +08:00
{
sender->setFocused(false);
handleMoveLogic(touchPoint);
}
}
break;
case 2:
handleReleaseLogic(touchPoint);
break;
case 3:
break;
}
}
void UIPageView::pageTurningEvent()
{
2013-11-08 18:43:06 +08:00
if (_pageViewEventListener && _pageViewEventSelector)
2013-09-13 22:20:20 +08:00
{
2013-11-08 18:43:06 +08:00
(_pageViewEventListener->*_pageViewEventSelector)(this, PAGEVIEW_EVENT_TURNING);
2013-09-13 22:20:20 +08:00
}
}
2013-11-08 18:43:06 +08:00
void UIPageView::addEventListenerPageView(cocos2d::Object *target, SEL_PageViewEvent selector)
2013-09-13 22:20:20 +08:00
{
2013-11-08 18:43:06 +08:00
_pageViewEventListener = target;
_pageViewEventSelector = selector;
2013-09-13 22:20:20 +08:00
}
int UIPageView::getCurPageIndex() const
{
2013-09-16 20:54:13 +08:00
return _curPageIdx;
2013-09-13 22:20:20 +08:00
}
2013-11-06 16:04:06 +08:00
cocos2d::Array* UIPageView::getPages()
{
return _pages;
}
2013-11-13 20:01:57 +08:00
UILayout* UIPageView::getPage(int index)
{
if (index < 0 || index >= (int)(_pages->count()))
{
2013-11-14 11:37:46 +08:00
return nullptr;
2013-11-13 20:01:57 +08:00
}
return (UILayout*)_pages->getObjectAtIndex(index);
}
2013-11-06 16:04:06 +08:00
2013-09-17 17:59:20 +08:00
const char* UIPageView::getDescription() const
{
return "PageView";
}
2013-11-06 16:04:06 +08:00
UIWidget* UIPageView::createCloneInstance()
{
return UIPageView::create();
}
void UIPageView::copyClonedWidgetChildren(UIWidget* model)
{
cocos2d::ccArray* arrayPages = dynamic_cast<UIPageView*>(model)->getPages()->data;
int length = arrayPages->num;
for (int i=0; i<length; i++)
{
UILayout* page = (UILayout*)(arrayPages->arr[i]);
addPage(dynamic_cast<UILayout*>(page->clone()));
}
}
void UIPageView::copySpecialProperties(UIWidget *widget)
{
UIPageView* pageView = dynamic_cast<UIPageView*>(widget);
if (pageView)
{
UILayout::copySpecialProperties(widget);
}
}
}