Exemplo n.º 1
0
void SpellShortcutContainer::mousePressed(MouseEvent &event)
{
    const int index = getIndexFromGrid(event.getX(), event.getY());

    if (index == -1)
        return;

    const MouseButtonT eventButton = event.getButton();
    if (eventButton == MouseButton::LEFT)
    {
        const int itemId = getItemByIndex(index);
        if (itemId > 0)
            mSpellClicked = true;
        event.consume();
    }
    else if (eventButton == MouseButton::MIDDLE)
    {
        if ((spellShortcut == nullptr) || (spellManager == nullptr))
            return;

        event.consume();
        const int itemId = getItemByIndex(index);
        spellManager->invoke(itemId);
    }
}
Exemplo n.º 2
0
void OutfitWindow::mousePressed(MouseEvent &event)
{
    const int index = getIndexFromGrid(event.getX(), event.getY());
    if (event.getButton() == MouseButton::RIGHT && popupMenu)
    {
        popupMenu->showOutfitsWindowPopup(viewport->mMouseX,
            viewport->mMouseY);
        event.consume();
        return;
    }
    else if (index == -1)
    {
        Window::mousePressed(event);
        return;
    }
    mMoved = false;
    event.consume();

    if (mItems[mCurrentOutfit][index] > 0)
    {
        mItemClicked = true;
    }
    else
    {
        if (dragDrop.isSelected())
        {
            mItems[mCurrentOutfit][index] = dragDrop.getSelected();
            mItemColors[mCurrentOutfit][index] = dragDrop.getSelectedColor();
            dragDrop.deselect();
            save();
        }
    }

    Window::mousePressed(event);
}
Exemplo n.º 3
0
	void ClickLabel::mouseReleased(MouseEvent& mouseEvent)
	{
		if (mouseEvent.getButton() == MouseEvent::LEFT && mMousePressed && mHasMouse) {
			mMousePressed = false;
			distributeActionEvent();
			mouseEvent.consume();
		} else if (mouseEvent.getButton() == MouseEvent::LEFT) {
			mMousePressed = false;
			mouseEvent.consume();
		}
	}
Exemplo n.º 4
0
	void HScrollBar::mouseUpCB( MouseEvent &mouseArgs )
	{
		if (mouseArgs.getSourceWidget() == pChildLeftArrow)
		{
			leftArrowDown = false;
			mouseArgs.consume();

		}

		if (mouseArgs.getSourceWidget() == pChildRightArrow)
		{
			rightArrowDown = false;
			mouseArgs.consume();
		}
	}
Exemplo n.º 5
0
void OutfitWindow::mouseReleased(MouseEvent &event)
{
    if (event.getButton() == MouseButton::LEFT)
    {
        if (mCurrentOutfit < 0 || mCurrentOutfit
            >= static_cast<signed int>(OUTFITS_COUNT))
        {
            return;
        }
        const int index = getIndexFromGrid(event.getX(), event.getY());
        if (index == -1)
        {
            dragDrop.clear();
            Window::mouseReleased(event);
            return;
        }
        mMoved = false;
        event.consume();
        if (!dragDrop.isEmpty())
        {
            if (dragDrop.isSourceItemContainer())
            {
                mItems[mCurrentOutfit][index] = dragDrop.getItem();
                mItemColors[mCurrentOutfit][index] = dragDrop.getItemColor();
                dragDrop.clear();
                dragDrop.deselect();
                save();
            }
        }
        if (mItemClicked)
            mItemClicked = false;
    }
    Window::mouseReleased(event);
}
Exemplo n.º 6
0
    void Slider::mouseWheelMovedDown(MouseEvent& mouseEvent)
    {
        setValue(getValue() - getStepLength());
        distributeActionEvent();

        mouseEvent.consume();
    }
Exemplo n.º 7
0
void SpellShortcutContainer::mouseDragged(MouseEvent &event)
{
    if (event.getButton() == MouseButton::LEFT)
    {
        if (dragDrop.isEmpty() && mSpellClicked)
        {
            mSpellClicked = false;
            const int index = getIndexFromGrid(event.getX(), event.getY());

            if (index == -1)
                return;

            const int itemId = getItemByIndex(index);
            if (itemId < 0)
                return;
            event.consume();
            TextCommand *const spell = spellManager->getSpell(itemId);
            if (spell != nullptr)
            {
                dragDrop.dragCommand(spell, DragDropSource::Spells, index);
                dragDrop.setItem(spell->getId() + SPELL_MIN_ID);
            }
            else
            {
                dragDrop.clear();
                mSpellClicked = false;
            }
        }
    }
}
Exemplo n.º 8
0
	void Button::mouseLeave( MouseEvent &mouseEvent )
	{

		mouseIsInside = false;
		modifyButtonState();
		mouseEvent.consume();
	}
Exemplo n.º 9
0
	void ScrollPane::mouseWheelUp( MouseEvent &mouseEvent )
	{

		pChildVScroll->setValue(pChildVScroll->getValue() - getWheelScrollRate() 
			- mouseEvent.getMouseWheelChange());
		mouseEvent.consume();
	}
Exemplo n.º 10
0
	void ClickLabel::mousePressed(MouseEvent& mouseEvent)
	{
		if (mouseEvent.getButton() == MouseEvent::LEFT) {
			mMousePressed = true;
			mouseEvent.consume();
		}
	}
Exemplo n.º 11
0
 void Button::mouseReleased(MouseEvent& mouseEvent)
 {
     if (mouseEvent.getButton() == MouseEvent::LEFT
         && mMousePressed
         && mHasMouse)
     {
         mMousePressed = false;
         generateAction();
         mouseEvent.consume();
     }
     else if (mouseEvent.getButton() == MouseEvent::LEFT)
     {
         mMousePressed = false;
         mouseEvent.consume();
     }
 }
Exemplo n.º 12
0
void GuiTable::mouseWheelMovedDown(MouseEvent& event)
{
    if (isFocused())
    {
        setSelectedRow(getSelectedRow() + 1);
        event.consume();
    }
}
Exemplo n.º 13
0
	void RadioButton::mouseClick( MouseEvent &mouseEvent )
	{
		if(mouseEvent.getButton() == MOUSE_BUTTON_LEFT)
		{
			nextCheckState();
			mouseEvent.consume();
		}
	}
Exemplo n.º 14
0
 void Button::mousePressed(MouseEvent& mouseEvent)
 {
     if (mouseEvent.GetButton() == MouseEvent::LEFT)
     {
         mMousePressed = true;
         mouseEvent.consume();
     }
 }
Exemplo n.º 15
0
 void TextBox::mousePressed(MouseEvent& mouseEvent)
 {
     if (mouseEvent.getButton() == MouseEvent::Left)
     {
         mText->setCaretPosition(mouseEvent.getX(), mouseEvent.getY(), getFont());
         mouseEvent.consume();
     }
 }
Exemplo n.º 16
0
    void DropDown::mouseWheelMovedDown(MouseEvent& mouseEvent)
    {
        if (isFocused() && mouseEvent.getSource() == this)
        {            
            mouseEvent.consume();

            mListBox->setSelected(mListBox->getSelected() + 1);
        }
    }
Exemplo n.º 17
0
    void ListBox::mouseWheelMovedDown(MouseEvent& mouseEvent)
    {
        if (isFocused())
        {
            setSelected(getSelected() + 1);

            mouseEvent.consume();
        }
    }
Exemplo n.º 18
0
	void RadioButton::mouseUp( MouseEvent &mouseEvent )
	{
		if(mouseEvent.getButton() == MOUSE_BUTTON_LEFT)
		{
			mouseIsDown = false;
			mouseEvent.consume();
		}

		modifyRadioButtonState();
	}
Exemplo n.º 19
0
Arquivo: Events.cpp Projeto: Jmos/vaca
 virtual void onDoubleClick(MouseEvent& ev)
 {
   if (ev.getButton() == MouseButton::Right) {
     m_console->println(L"onDoubleClick() consumed");
     ev.consume();
   }
   else
     m_console->println(L"onDoubleClick() not consumed (use right-button to consume it)");
   Widget::onDoubleClick(ev);
 }
Exemplo n.º 20
0
	void Button::mouseDown( MouseEvent &mouseEvent )
	{
		if(mouseEvent.getButton() == MOUSE_BUTTON_LEFT)
		{
			mouseIsDown = true;
			mouseEvent.consume();
		}

		modifyButtonState();
	}
Exemplo n.º 21
0
	void HScrollBar::mouseDragCB( MouseEvent &mouseArgs )
	{
		if(mouseArgs.getSourceWidget() == pChildThumb)
		{
			int mouseChange = mouseArgs.getX() + pChildThumb->getLocation().getX() - downMousePos;
			int thumbChange = downThumbPos + mouseChange;
			setValue(getValueFromPosition(thumbChange));
			mouseArgs.consume();
		}
	}
Exemplo n.º 22
0
void GuiTable::mouseWheelMovedUp(MouseEvent& event)
{
    if (isFocused())
    {
        const int selRow = getSelectedRow();
        if (selRow > 0 || (selRow == 0 && mWrappingEnabled))
            setSelectedRow(selRow - 1);
        event.consume();
    }
}
Exemplo n.º 23
0
    void ScrollArea::mouseReleased(MouseEvent& mouseEvent)
    {
        mUpButtonPressed = false;
        mDownButtonPressed = false;
        mLeftButtonPressed = false;
        mRightButtonPressed = false;
        mIsHorizontalMarkerDragged = false;
        mIsVerticalMarkerDragged = false;

        mouseEvent.consume();
    }
Exemplo n.º 24
0
	void Button::mouseClick( MouseEvent &mouseEvent )
	{
		if(isToggleButton() && mouseEvent.getButton() == MOUSE_BUTTON_LEFT)
		{
			handleToggleClick();
			mouseEvent.consume();
		}

		if(mouseEvent.getButton() == MOUSE_BUTTON_LEFT)
		dispatchActionEvent(ActionEvent(this));
	}
Exemplo n.º 25
0
    void ScrollArea::mouseWheelMovedDown(MouseEvent& mouseEvent)
    {
        if (mouseEvent.isConsumed())
        {
            return;
        }

        setVerticalScrollAmount(getVerticalScrollAmount() + getChildrenArea().height / 8);

        mouseEvent.consume();
    }
Exemplo n.º 26
0
    void ListBox::mouseWheelMovedUp(MouseEvent& mouseEvent)
    {
        if (isFocused())
        {
            if (getSelected() > 0 )
            {
                setSelected(getSelected() - 1);
            }

            mouseEvent.consume();
        }
    }
Exemplo n.º 27
0
void ServerDialog::mouseClicked(MouseEvent &event)
{
    if (event.getButton() == MouseButton::LEFT)
    {
        event.consume();
        if (event.getClickCount() == 2 &&
            event.getSource() == mServersList)
        {
            action(ActionEvent(mConnectButton,
                mConnectButton->getActionEventId()));
        }
    }
}
Exemplo n.º 28
0
	void TextField::mouseDown( MouseEvent &mouseEvent )
	{

		if(mouseEvent.getButton() != MOUSE_BUTTON_LEFT)
		{
			return;
		}
		dragged = false;
		int x = mouseEvent.getX() - getTextOffset() - getMargin(SIDE_LEFT);
		positionCaret(getFont()->getStringIndexFromPosition(getText(),x));

		internalSelStart = getCaretPosition();
		setSelection(0,0);
		mouseEvent.consume();
	}
Exemplo n.º 29
0
    void Window::mouseDragged(MouseEvent& mouseEvent)
    {
        if (mouseEvent.isConsumed() || mouseEvent.getSource() != this)
        {
            return;
        }

        if (isMovable() && mMoved)
        {
            setPosition(mouseEvent.getX() - mDragOffsetX + getX(),
                        mouseEvent.getY() - mDragOffsetY + getY());
        }

        mouseEvent.consume();
    }
Exemplo n.º 30
0
    void Slider::mouseDragged(MouseEvent& mouseEvent)
    {
        if (getOrientation() == HORIZONTAL)
        {
            setValue(markerPositionToValue(mouseEvent.getX() - getMarkerLength() / 2));
        }
        else
        {
            setValue(markerPositionToValue(getHeight() - mouseEvent.getY() - getMarkerLength() / 2));
        }

        distributeActionEvent();

        mouseEvent.consume();
    }