Ejemplo n.º 1
0
void ScrollView::copySpecialProperties(Widget *widget)
{
    ScrollView* scrollView = dynamic_cast<ScrollView*>(widget);
    if (scrollView)
    {
        Layout::copySpecialProperties(widget);
        setDirection(scrollView->_direction);
        setInnerContainerPosition(scrollView->getInnerContainerPosition());
        setInnerContainerSize(scrollView->getInnerContainerSize());
        _topBoundary = scrollView->_topBoundary;
        _bottomBoundary = scrollView->_bottomBoundary;
        _leftBoundary = scrollView->_leftBoundary;
        _rightBoundary = scrollView->_rightBoundary;
        _bePressed = scrollView->_bePressed;
        _childFocusCancelOffsetInInch = scrollView->_childFocusCancelOffsetInInch;
        setInertiaScrollEnabled(scrollView->_inertiaScrollEnabled);
        _inertiaScrolling = scrollView->_inertiaScrolling;
        _inertiaInitiVelocity = scrollView->_inertiaInitiVelocity;
        _inertiaTouchDisplacements = scrollView->_inertiaTouchDisplacements;
        _inertiaTouchTimeDeltas = scrollView->_inertiaTouchTimeDeltas;
        _inertiaPrevTouchTimestamp = scrollView->_inertiaPrevTouchTimestamp;
        _inertiaScrollExpectedTime = scrollView->_inertiaScrollExpectedTime;
        _inertiaScrollElapsedTime = scrollView->_inertiaScrollElapsedTime;
        _autoScrolling = scrollView->_autoScrolling;
        _autoScrollAttenuate = scrollView->_autoScrollAttenuate;
        _autoScrollStartPosition = scrollView->_autoScrollStartPosition;
        _autoScrollTargetDelta = scrollView->_autoScrollTargetDelta;
        _autoScrollDuration = scrollView->_autoScrollDuration;
        _autoScrollAccumulatedTime = scrollView->_autoScrollAccumulatedTime;
        setBounceEnabled(scrollView->_bounceEnabled);
        _bouncingBack = scrollView->_bouncingBack;
        _scrollViewEventListener = scrollView->_scrollViewEventListener;
        _scrollViewEventSelector = scrollView->_scrollViewEventSelector;
        _eventCallback = scrollView->_eventCallback;
        _ccEventCallback = scrollView->_ccEventCallback;
        
        setScrollBarEnabled(scrollView->isScrollBarEnabled());
        if(isScrollBarEnabled())
        {
            if(_direction != Direction::HORIZONTAL)
            {
                setScrollBarPositionFromCornerForVertical(scrollView->getScrollBarPositionFromCornerForVertical());
            }
            if(_direction != Direction::VERTICAL)
            {
                setScrollBarPositionFromCornerForHorizontal(scrollView->getScrollBarPositionFromCornerForHorizontal());
            }
            setScrollBarWidth(scrollView->getScrollBarWidth());
            setScrollBarColor(scrollView->getScrollBarColor());
            setScrollBarAutoHideEnabled(scrollView->isScrollBarAutoHideEnabled());
            setScrollBarAutoHideTime(scrollView->getScrollBarAutoHideTime());
        }
    }
}