示例#1
0
void Layout::setClippingType(ClippingType type)
{
    if (type == _clippingType)
    {
        return;
    }
    bool clippingEnabled = isClippingEnabled();
    setClippingEnabled(false);
    _clippingType = type;
    setClippingEnabled(clippingEnabled);
}
示例#2
0
bool UIListView::init()
{
    if (Layout::init())
    {
        setUpdateEnabled(true);
        setTouchEnabled(true);
        setClippingEnabled(true);
        
        _childPool = CCArray::create();
        _updatePool = CCArray::create();
        CC_SAFE_RETAIN(_childPool);
        CC_SAFE_RETAIN(_updatePool);
        _overTopArray = cocos2d::CCArray::create();
        _overBottomArray = cocos2d::CCArray::create();
        _overLeftArray = cocos2d::CCArray::create();
        _overRightArray = cocos2d::CCArray::create();
        CC_SAFE_RETAIN(_overTopArray);
        CC_SAFE_RETAIN(_overBottomArray);
        CC_SAFE_RETAIN(_overLeftArray);
        CC_SAFE_RETAIN(_overRightArray);
        
        return true;
    }
    return false;
}
示例#3
0
bool PageView::init()
{
    if (Layout::init())
    {
        setClippingEnabled(true);
        return true;
    }
    return false;
}
示例#4
0
bool UIDragPanel::init()
{
    if (Layout::init())
    {
        setUpdateEnabled(true);
        setTouchEnabled(true);
        setClippingEnabled(true);
        return true;
    }
    return false;
}
示例#5
0
bool UIScrollViewP::init()
{
    if (Layout::init())
    {
        setUpdateEnabled(true);
        setTouchEnabled(true);
        setClippingEnabled(true);
        m_pInnerContainer->setTouchEnabled(false);
        return true;
    }
    return false;
}
示例#6
0
bool UIPageView::init()
{
    if (Layout::init())
    {
        m_pages = CCArray::create();
        m_pages->retain();
        setClippingEnabled(true);
        setUpdateEnabled(true);
        return true;
    }
    return false;
}
示例#7
0
bool ScrollView::init()
{
    if (Layout::init())
    {
        setClippingEnabled(true);
        _innerContainer->setTouchEnabled(false);
        if(_scrollBarEnabled)
        {
            initScrollBar();
        }
        return true;
    }
    return false;
}
示例#8
0
void UILayout::copySpecialProperties(UIWidget *widget)
{
    UILayout* layout = dynamic_cast<UILayout*>(widget);
    if (layout)
    {
        setBackGroundImageScale9Enabled(layout->m_bBackGroundScale9Enabled);
        setBackGroundImage(layout->m_strBackGroundImageFileName.c_str(),layout->m_eBGImageTexType);
        setBackGroundImageCapInsets(layout->m_backGroundImageCapInsets);
        setBackGroundColorType(layout->m_colorType);
        setBackGroundColor(layout->m_cColor);
        setBackGroundColor(layout->m_gStartColor, layout->m_gEndColor);
        setBackGroundColorOpacity(layout->m_nCOpacity);
        setBackGroundColorVector(layout->m_AlongVector);
        setLayoutType(layout->m_eLayoutType);
        setClippingEnabled(layout->m_bClippingEnabled);
    }
}
示例#9
0
void Layout::copySpecialProperties(Widget *widget)
{
    Layout* layout = dynamic_cast<Layout*>(widget);
    if (layout)
    {
        setBackGroundImageScale9Enabled(layout->_backGroundScale9Enabled);
        setBackGroundImage(layout->_backGroundImageFileName,layout->_bgImageTexType);
        setBackGroundImageCapInsets(layout->_backGroundImageCapInsets);
        setBackGroundColorType(layout->_colorType);
        setBackGroundColor(layout->_cColor);
        setBackGroundColor(layout->_gStartColor, layout->_gEndColor);
        setBackGroundColorOpacity(layout->_cOpacity);
        setBackGroundColorVector(layout->_alongVector);
        setLayoutType(layout->_layoutType);
        setClippingEnabled(layout->_clippingEnabled);
        setClippingType(layout->_clippingType);
        _loopFocus = layout->_loopFocus;
        _passFocusToChild = layout->_passFocusToChild;
        _isInterceptTouch = layout->_isInterceptTouch;
    }
}
示例#10
0
文件: Mx.cpp 项目: mx2014/mx_game
Layout * Mx::createDialog(Node* child, Node * parent, Size innerSize, DialogBtn buttonStyle, string background){
    auto layout = Layout::create();
    auto size = parent->getContentSize();
    auto dialogSize = Size(innerSize.width + 30, innerSize.height + 30);
    parent->addChild(layout, 999);
    layout->setContentSize(size);
    layout->setBackGroundColorType(cocos2d::ui::Layout::BackGroundColorType::SOLID);
    layout->setBackGroundColor(Color3B::BLACK);
    layout->setBackGroundColorOpacity(150);
    layout->setTouchEnabled(true);

    auto diaLayout = Layout::create();
    layout->addChild(diaLayout);
    diaLayout->setContentSize(innerSize);
    diaLayout->setClippingEnabled(false);
    diaLayout->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
    diaLayout->setPosition(Vec2(dialogSize.width/2, dialogSize.height/2));
    diaLayout->setScale(0);
    diaLayout->setBackGroundImageScale9Enabled(true);
    if (background == "") {
        diaLayout->setBackGroundImage("sys_toast_b.png");
    }else{
        diaLayout->setBackGroundImage(background);
    }
    
    diaLayout->setPosition(size/2);
    
    if (child != nullptr) {
        diaLayout->addChild(child);
    }
    
    // set button;
    {
        if (buttonStyle.buttonNum != 0) {
        
            if (buttonStyle.closeText == "") {
                buttonStyle.closeText = this->getStrValue("close");
            }
            auto buttonConfirm = this->createDialogButton(buttonStyle, buttonStyle.confirmText);
            auto buttonClose = this->createDialogButton(buttonStyle, buttonStyle.closeText);

            if (buttonStyle.buttonNum == 1) {
                buttonConfirm->setPosition(Vec2((dialogSize/2).width, 0));
                diaLayout->addChild(buttonConfirm);
            }else{
            
                Size size = buttonConfirm->getContentSize()/2;
                Size center = dialogSize/2;
                buttonConfirm->setPosition(Vec2(center.width - size.width, 0));
                buttonClose->setPosition(Vec2(center.width + size.width, 0));
                diaLayout->addChild(buttonConfirm);
                diaLayout->addChild(buttonClose);
            }
        }
        if (buttonStyle.isVisibleClose) {
            auto buttonClose = this->createDialogCloseButton(buttonStyle, buttonStyle.closeText, layout, diaLayout);
            diaLayout->addChild(buttonClose);
            buttonClose->setPosition(diaLayout->getContentSize() - buttonClose->getContentSize()/2 + Size(25, 25));
        }
    }
    auto action = EaseBackOut::create(ScaleTo::create(.3, 1));
    diaLayout->runAction(action);
    return layout;
}