Пример #1
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;
	}
Пример #2
0
bool MgCmdDrawLines::click(const MgMotion* sender)
{
    return (m_step == 0 ? _click(sender)
            : touchBegan(sender) && touchEnded(sender));
}