예제 #1
0
int KCommonDecoration::buttonContainerWidth(const ButtonContainer &btnContainer, bool countHidden) const
{
    int explicitSpacer = layoutMetric(LM_ExplicitButtonSpacer);

    int shownElementsCount = 0;

    int w = 0;
    for (ButtonContainer::const_iterator it = btnContainer.begin(); it != btnContainer.end(); ++it) {
        if (*it) {
            if (countHidden || !(*it)->isHidden() ) {
                w += (*it)->width();
                ++shownElementsCount;
            }
        } else {
            w += explicitSpacer;
            ++shownElementsCount;
        }
    }
    w += layoutMetric(LM_ButtonSpacing)*(shownElementsCount-1);

    return w;
}
예제 #2
0
static inline ButtonContainer::iterator FindButton( Qt::MouseButton value )
{
    return std::find( buttonInstances.begin(), buttonInstances.end(), value );
}
예제 #3
0
void Input::registerMousePress( Qt::MouseButton btn )
{
    ButtonContainer::iterator it = FindButton( btn );
    if( it == buttonInstances.end() )
        buttonInstances.push_back( ButtonInstance( btn, InputRegistered ) );
}
예제 #4
0
void Input::registerMouseRelease( Qt::MouseButton btn )
{
    ButtonContainer::iterator it = FindButton( btn );
    if( it != buttonInstances.end() )
        it->second = InputUnregistered;
}
예제 #5
0
Input::InputState Input::buttonState( Qt::MouseButton k )
{
    ButtonContainer::iterator it = FindButton( k );
    return ( it != buttonInstances.end() ) ? it->second : InputInvalid;
}