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);
    }
}
Esempio 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);
}
Esempio 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();
		}
	}
Esempio n. 4
0
	void HScrollBar::mouseUpCB( MouseEvent &mouseArgs )
	{
		if (mouseArgs.getSourceWidget() == pChildLeftArrow)
		{
			leftArrowDown = false;
			mouseArgs.consume();

		}

		if (mouseArgs.getSourceWidget() == pChildRightArrow)
		{
			rightArrowDown = false;
			mouseArgs.consume();
		}
	}
Esempio 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);
}
Esempio n. 6
0
    void Slider::mouseWheelMovedDown(MouseEvent& mouseEvent)
    {
        setValue(getValue() - getStepLength());
        distributeActionEvent();

        mouseEvent.consume();
    }
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;
            }
        }
    }
}
Esempio n. 8
0
	void Button::mouseLeave( MouseEvent &mouseEvent )
	{

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

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

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

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

		modifyRadioButtonState();
	}
Esempio n. 19
0
File: Events.cpp Progetto: 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);
 }
Esempio n. 20
0
	void Button::mouseDown( MouseEvent &mouseEvent )
	{
		if(mouseEvent.getButton() == MOUSE_BUTTON_LEFT)
		{
			mouseIsDown = true;
			mouseEvent.consume();
		}

		modifyButtonState();
	}
Esempio 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();
		}
	}
Esempio 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();
    }
}
Esempio n. 23
0
    void ScrollArea::mouseReleased(MouseEvent& mouseEvent)
    {
        mUpButtonPressed = false;
        mDownButtonPressed = false;
        mLeftButtonPressed = false;
        mRightButtonPressed = false;
        mIsHorizontalMarkerDragged = false;
        mIsVerticalMarkerDragged = false;

        mouseEvent.consume();
    }
Esempio 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));
	}
Esempio n. 25
0
    void ScrollArea::mouseWheelMovedDown(MouseEvent& mouseEvent)
    {
        if (mouseEvent.isConsumed())
        {
            return;
        }

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

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

            mouseEvent.consume();
        }
    }
Esempio 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()));
        }
    }
}
Esempio 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();
	}
Esempio 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();
    }
Esempio 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();
    }