Example #1
0
void Widget::setBrightStyle(BrightStyle style)
{
    if (_brightStyle == style)
    {
        return;
    }
    _brightStyle = style;
    switch (_brightStyle)
    {
        case BrightStyle::NORMAL:
            onPressStateChangedToNormal();
            break;
        case BrightStyle::HIGHLIGHT:
            onPressStateChangedToPressed();
            break;
        default:
            break;
    }
}
Example #2
0
void UIWidget::setBrightStyle(BrightStyle style)
{
    if (m_eBrightStyle == style)
    {
        return;
    }
    m_eBrightStyle = style;
    switch (m_eBrightStyle)
    {
        case BRIGHT_NORMAL:
            onPressStateChangedToNormal();
            break;
        case BRIGHT_HIGHLIGHT:
            onPressStateChangedToPressed();
            break;
        default:
            break;
    }
}
Example #3
0
void ButtonEx::updateTexture() {
    int counter = 0;

    if (_normalTextureAdaptDirty && isBright() &&
        _brightStyle == BrightStyle::NORMAL) {
        onPressStateChangedToNormal();
        ++counter;
    }
    if (_pressedTextureAdaptDirty && isBright() &&
        _brightStyle == BrightStyle::HIGHLIGHT) {
        onPressStateChangedToPressed();
        ++counter;
    }
    if (_disabledTextureAdaptDirty && not isBright()) {
        onPressStateChangedToDisabled();
        ++counter;
    }

    CC_ASSERT(counter <= 1);
}
void UIWidget::setPressState(WidgetState state)
{
    if (m_nCurPressState == state)
    {
        return;
    }
    m_nPrevPressstate = m_nCurPressState;
    m_nCurPressState = state;
    switch (m_nCurPressState)
    {
        case WidgetStateNormal:
            onPressStateChangedToNormal();
            break;
        case WidgetStateSelected:
            onPressStateChangedToPressed();
            break;
        case WidgetStateDisabled:
            onPressStateChangedToDisabled();
            break;
        default:
            break;
            
    }
}