ManaPlus
Public Member Functions | Protected Attributes | Friends
MouseEvent Class Reference

#include <mouseevent.h>

Inheritance diagram for MouseEvent:
InputGuiEvent Event

Public Member Functions

 MouseEvent (Widget *const source, const MouseEventTypeT type, const MouseButtonT button, const int x, const int y, const int clickCount)
 
MouseButtonT getButton () const
 
int getX () const
 
int getY () const
 
int getClickCount () const
 
MouseEventTypeT getType () const
 
void setX (int n)
 
void setY (int n)
 
- Public Member Functions inherited from InputGuiEvent
 InputGuiEvent (Widget *const source)
 
void consume ()
 
bool isConsumed () const
 
- Public Member Functions inherited from Event
 Event (Widget *const source)
 
virtual ~Event ()
 
WidgetgetSource () const
 

Protected Attributes

MouseEventTypeT mType
 
MouseButtonT mButton
 
int mX
 
int mY
 
int mClickCount
 
- Protected Attributes inherited from InputGuiEvent
bool mIsConsumed
 
- Protected Attributes inherited from Event
WidgetmSource
 

Friends

class Gui
 

Detailed Description

Represents a mouse event.

Author
Olof Naessén

Definition at line 80 of file mouseevent.h.

Constructor & Destructor Documentation

◆ MouseEvent()

MouseEvent::MouseEvent ( Widget *const  source,
const MouseEventTypeT  type,
const MouseButtonT  button,
const int  x,
const int  y,
const int  clickCount 
)
inline

Constructor.

Parameters
sourceThe source widget of the mouse event.
typeThe type of the mouse event.
buttonThe button of the mouse event.
xThe x coordinate of the event relative to the source widget.
yThe y coordinate of the event relative the source widget.
clickCountThe number of clicks generated with the same button. It's set to zero if another button is used.

Definition at line 94 of file mouseevent.h.

99  :
100  InputGuiEvent(source),
101  mType(type),
102  mButton(button),
103  mX(x),
104  mY(y),
105  mClickCount(clickCount)
106  {
107  }
InputGuiEvent(Widget *const source)
Definition: inputguievent.h:83
int mClickCount
Definition: mouseevent.h:189
MouseEventTypeT mType
Definition: mouseevent.h:168
MouseButtonT mButton
Definition: mouseevent.h:173

Member Function Documentation

◆ getButton()

MouseButtonT MouseEvent::getButton ( ) const
inline

◆ getClickCount()

int MouseEvent::getClickCount ( ) const
inline

Gets the number of clicks generated with the same button. It's set to zero if another button is used.

Returns
The number of clicks generated with the same button.

Definition at line 147 of file mouseevent.h.

148  { return mClickCount; }

References mClickCount.

Referenced by MailWindow::mouseClicked(), ServerDialog::mouseClicked(), CharacterDisplay::mousePressed(), and ListBox::mouseReleased().

◆ getType()

MouseEventTypeT MouseEvent::getType ( ) const
inline

Gets the type of the event.

Returns
The type of the event.

Definition at line 155 of file mouseevent.h.

156  { return mType; }

References mType.

Referenced by ItemContainer::mouseReleased(), and ShopListBox::mouseReleased().

◆ getX()

int MouseEvent::getX ( ) const
inline

◆ getY()

int MouseEvent::getY ( ) const
inline

Gets the y coordinate of the mouse event. The coordinate relative to widget the mouse listener receiving the events have registered to.

Returns
The y coordinate of the mouse event.
See also
Widget::addMouseListener, Widget::removeMouseListener

Definition at line 138 of file mouseevent.h.

139  { return mY; }

References mY.

Referenced by Window::getResizeHandles(), GuiTable::mouseDragged(), ItemShortcutContainer::mouseDragged(), ListBox::mouseDragged(), Slider::mouseDragged(), SpellShortcutContainer::mouseDragged(), VirtShortcutContainer::mouseDragged(), Window::mouseDragged(), ChatWindow::mouseDragged(), OutfitWindow::mouseDragged(), ShortcutWindow::mouseDragged(), Viewport::mouseDragged(), BrowserBox::mouseMoved(), ItemContainer::mouseMoved(), ItemShortcutContainer::mouseMoved(), SpellShortcutContainer::mouseMoved(), StaticBrowserBox::mouseMoved(), VirtShortcutContainer::mouseMoved(), BrowserBox::mousePressed(), EmotePage::mousePressed(), GuiTable::mousePressed(), ItemContainer::mousePressed(), ItemShortcutContainer::mousePressed(), ListBox::mousePressed(), PopupList::mousePressed(), SpellShortcutContainer::mousePressed(), StaticBrowserBox::mousePressed(), TabbedArea::mousePressed(), VirtShortcutContainer::mousePressed(), OutfitWindow::mousePressed(), ItemContainer::mouseReleased(), ItemShortcutContainer::mouseReleased(), ListBox::mouseReleased(), PopupList::mouseReleased(), ShopListBox::mouseReleased(), SpellShortcutContainer::mouseReleased(), VirtShortcutContainer::mouseReleased(), OutfitWindow::mouseReleased(), and ListBox::mouseReleased1().

◆ setX()

void MouseEvent::setX ( int  n)
inline

Definition at line 158 of file mouseevent.h.

159  { mX = n; }

References mX.

◆ setY()

void MouseEvent::setY ( int  n)
inline

Definition at line 161 of file mouseevent.h.

162  { mY = n; }

References mY.

Friends And Related Function Documentation

◆ Gui

friend class Gui
friend

Gui is a friend of this class in order to be able to manipulate the protected member variables of this class and at the same time keep the MouseEvent class as const as possible. Gui needs to update the x och y coordinates for the coordinates to be relative to widget the mouse listener receiving the events have registered to.

Definition at line 199 of file mouseevent.h.

Field Documentation

◆ mButton

MouseButtonT MouseEvent::mButton
protected

Holds the button of the mouse event.

Definition at line 173 of file mouseevent.h.

Referenced by getButton().

◆ mClickCount

int MouseEvent::mClickCount
protected

The number of clicks generated with the same button. It's set to zero if another button is used.

Definition at line 189 of file mouseevent.h.

Referenced by getClickCount().

◆ mType

MouseEventTypeT MouseEvent::mType
protected

Holds the type of the mouse event.

Definition at line 168 of file mouseevent.h.

Referenced by getType().

◆ mX

int MouseEvent::mX
protected

Holds the x-coordinate of the mouse event.

Definition at line 178 of file mouseevent.h.

Referenced by getX(), and setX().

◆ mY

int MouseEvent::mY
protected

Holds the y-coordinate of the mouse event.

Definition at line 183 of file mouseevent.h.

Referenced by getY(), and setY().


The documentation for this class was generated from the following file: