Ejemplo n.º 1
0
long PANEElement::getLeftOffset(){
	PANEElement * const parent = dynamic_cast< PANEElement * >( getParentNode() );
	if( NULL == parent ) return 0;

	PANEElement * const prevSibling = dynamic_cast< PANEElement * >( getPreviousSibling() );
	if( NULL == prevSibling )
		return parent->getLeftOffset();

	const unsigned long availableWidth = getAvailableWidth();
	if( availableWidth  < getActualWidth( availableWidth ) )
		return parent->getLeftOffset();

	return prevSibling->getRightOffset();
}
Ejemplo n.º 2
0
    void iWidgetSelectBox::draw()
    {
        _buttonRectangle.setX(static_cast<float32>(getActualWidth() - getActualHeight() - 1));
        _buttonRectangle.setY(0.0f);
        _buttonRectangle.setWidth(static_cast<float32>(getActualHeight()));
        _buttonRectangle.setHeight(static_cast<float32>(getActualHeight() - 1));

        if (isVisible())
        {
            iaString displayString;

            if (_currentSelection >= 0 && _currentSelection < _entries.size())
            {
                displayString = _entries[_currentSelection].first;
            }

            iWidgetManager::getInstance().getTheme()->drawSelectBox(getActualPosX(), getActualPosY(), getActualWidth(), getActualHeight(), displayString, _buttonAppearanceState, isActive());
        }
    }
Ejemplo n.º 3
0
    bool iWidgetSelectBox::handleMouseKeyUp(iKeyCode key)
    {
        if (!isActive())
        {
            return false;
        }

        if (_mouseOverButton)
        {
            if (key == iKeyCode::MouseLeft)
            {
                _buttonAppearanceState = iWidgetAppearanceState::Standby;

                if (_selectBox == nullptr)
                {
                    _selectBox = static_cast<iDialogMenu*>(iWidgetManager::getInstance().createDialog("DialogMenu"));
                }

                // TODO insuficcient if select box is within a iWidgetScroll
                _selectBox->setWidth(getActualWidth() - getActualHeight());
                _selectBox->setX(getActualPosX() + 2);
                _selectBox->setY(getActualPosY() + getActualHeight() + 2);

                vector<iaString> entries;
                for (auto entry : _entries)
                {
                    entries.push_back(entry.first);
                }

                _selectBox->show(entries, iDialogMenuCloseDelegate(this, &iWidgetSelectBox::onSelectionChanged));
            }

            setKeyboardFocus();
            return true;
        }

        return iWidget::handleMouseKeyUp(key);
    }
Ejemplo n.º 4
0
 void iWidgetCheckBox::draw()
 {
     if (isVisible())
     {
         iWidgetManager::getInstance().getTheme()->drawCheckBox(getActualPosX(), getActualPosY(), getActualWidth(), getActualHeight(), _text, _checked, getAppearanceState(), isActive());
     }
 }
Ejemplo n.º 5
0
long PANEElement::getRightOffset(){
	return getLeftOffset() + getActualWidth( getAvailableWidth() );
}