Ejemplo n.º 1
0
void LLFocusMgr::releaseFocusIfNeeded( const LLView* view )
{
	if( childHasMouseCapture( view ) )
	{
		setMouseCapture( NULL );
	}

	if( childHasKeyboardFocus( view ))
	{
		if (view == mLockedView)
		{
			mLockedView = NULL;
			setKeyboardFocus( NULL );
		}
		else
		{
			setKeyboardFocus( mLockedView );
		}
	}

	if( childIsTopCtrl( view ) )
	{
		setTopCtrl( NULL );
	}
}
Ejemplo n.º 2
0
bool Fortyeight::newCards()
{
    if ( talon->isEmpty() )
    {
        if ( lastdeal )
        {
            return false;
        }
        else
        {
            lastdeal = true;
            flipCardsToPile( pile->cards(), talon, DURATION_MOVE );
        }
    }
    else
    {
        flipCardToPile( talon->topCard(), pile, DURATION_MOVE );
        setKeyboardFocus( pile->topCard() );
    }

    if ( talon->isEmpty() && lastdeal )
        emit newCardsPossible( false );

    return true;
}
Ejemplo n.º 3
0
	bool iWidget::handleMouseDoubleClick(iKeyCode key)
	{
		if (isActive())
		{
			if (_isMouseOver)
			{
				vector<iWidget*> widgets = _children;
				bool result = false;

				for (auto widget : widgets)
				{
					if (widget->handleMouseDoubleClick(key))
					{
						result = true;
					}
				}

				if (result)
				{
					return true;
				}
				else
				{
					if (key == iKeyCode::MouseLeft)
					{
						_widgetAppearanceState = iWidgetAppearanceState::DoubleClicked;
						setKeyboardFocus();
						_doubleClick(this);
						return true;
					}
				}
			}
		}
		return false;
	}
Ejemplo n.º 4
0
void LLFocusMgr::restoreKeyboardFocus(LLFocusableElement* current_focus)
{
	if (current_focus && mKeyboardFocus == current_focus)
	{
		setKeyboardFocus(mLastKeyboardFocus);
		mLastKeyboardFocus = NULL;
	}
}
Ejemplo n.º 5
0
/** Call this to distribute a touch down event to the stage.
	* @param x the x coordinate of the touch in screen coordinates
	* @param y the y coordinate of the touch in screen coordinates
	* @param pointer the pointer index
	* @param button the button that's been pressed
	* @return whether an {@link Actor} in the scene processed the event or not */
bool Stage::touchDown( int x, int y, int pointer, int button) 
{
	setKeyboardFocus( NULL);
	Actor* actor = touchFocus[pointer];
	if( actor == NULL) actor = root;
	toStageCoordinates( x, y, coords);
	Group::toChildCoordinates( actor, coords.x, coords.y, point);
	return actor->touchDown( point.x, point.y, pointer);
}
Ejemplo n.º 6
0
void LLFocusMgr::releaseFocusIfNeeded( LLView* view )
{
	if( childHasMouseCapture( view ) )
	{
		setMouseCapture( NULL );
	}

	if( childHasKeyboardFocus( view ))
	{
		if (view == mLockedView)
		{
			mLockedView = NULL;
			setKeyboardFocus( NULL );
		}
		else
		{
			setKeyboardFocus( mLockedView );
		}
	}

	LLUI::removePopup(view);
}
Ejemplo n.º 7
0
	bool iWidget::handleMouseKeyUp(iKeyCode key)
	{
		if (isActive())
		{
			if (_isMouseOver)
			{
				vector<iWidget*> widgets = _children;
				bool result = false;

				for (auto widget : widgets)
				{
					if (widget->handleMouseKeyUp(key))
					{
						result = true;
					}
				}

				if (result)
				{
					return true;
				}
				else
				{
					if (key == iKeyCode::MouseLeft ||
                        key == iKeyCode::MouseRight)
					{
						if (_widgetAppearanceState == iWidgetAppearanceState::Pressed)
						{
							_widgetAppearanceState = iWidgetAppearanceState::Clicked;
							setKeyboardFocus();

							_click(this);

                            if (key == iKeyCode::MouseRight)
                            {
                                _contextMenu(this);
                            }

							return true;
						}
					}
				}
			}
            else if (_acceptOutOfBoundsClicks)
            {
                _mouseOffClick(this);
            }
		}
		return false;
	}
Ejemplo n.º 8
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);
    }