|
FifeGUI 0.2.0
A C++ GUI library designed for games.
|
#include <mouseevent.hpp>
Public Types | |
| enum class | Button : std::uint8_t { Empty = 0 , Left , Middle , Right , X1 , X2 } |
| enum class | Type : std::uint8_t { Moved = 0 , Pressed , Released , WheelMovedDown , WheelMovedUp , WheelMovedRight , WheelMovedLeft , Clicked , Entered , Exited , Dragged } |
Public Member Functions | |
| MouseEvent::Button | getButton () const |
| int | getClickCount () const |
| MouseEvent::Type | getType () const |
| int | getX () const |
| int | getY () const |
| MouseEvent (Widget *source, Widget *distributor, bool isShiftPressed, bool isControlPressed, bool isAltPressed, bool isMetaPressed, MouseEvent::Type type, MouseEvent::Button button, int x, int y, int clickCount) | |
| Public Member Functions inherited from fcn::InputEvent | |
| void | consume () |
| Widget * | getDistributor () const |
| InputEvent (Widget *source, Widget *distributor, bool isShiftPressed, bool isControlPressed, bool isAltPressed, bool isMetaPressed) | |
| bool | isAltPressed () const |
| bool | isConsumed () const |
| bool | isControlPressed () const |
| bool | isMetaPressed () const |
| bool | isShiftPressed () const |
| Public Member Functions inherited from fcn::Event | |
| Event (Widget *source) | |
| Widget * | getSource () const |
Protected Attributes | |
| MouseEvent::Button | mButton |
| int | mClickCount |
| MouseEvent::Type | mType |
| int | mX = 0 |
| int | mY = 0 |
| Protected Attributes inherited from fcn::InputEvent | |
| bool | mAltPressed |
| bool | mControlPressed |
| Widget * | mDistributor |
| bool | mIsConsumed |
| bool | mMetaPressed |
| bool | mShiftPressed |
| Protected Attributes inherited from fcn::Event | |
| Widget * | mSource {nullptr} |
Friends | |
| class | Gui |
Represents a mouse event.
Definition at line 21 of file mouseevent.hpp.
|
strong |
Mouse button types.
Definition at line 45 of file mouseevent.hpp.
|
strong |
Mouse event types.
Definition at line 27 of file mouseevent.hpp.
| fcn::MouseEvent::MouseEvent | ( | Widget * | source, |
| Widget * | distributor, | ||
| bool | isShiftPressed, | ||
| bool | isControlPressed, | ||
| bool | isAltPressed, | ||
| bool | isMetaPressed, | ||
| MouseEvent::Type | type, | ||
| MouseEvent::Button | button, | ||
| int | x, | ||
| int | y, | ||
| int | clickCount ) |
Constructor.
| source | The widget the event concerns. |
| distributor | The distributor of the mouse event. |
| isShiftPressed | True if shift is pressed, false otherwise. |
| isControlPressed | True if control is pressed, false otherwise. |
| isAltPressed | True if alt is pressed, false otherwise. |
| isMetaPressed | True if meta is pressed, false otherwise. |
| type | The type of the mouse event. |
| button | The button of the mouse event. |
| x | The x coordinate of the event relative to the source widget. |
| y | The y coordinate of the event relative the source widget. |
| clickCount | The number of clicks generated with the same button. It's set to zero if another button is used. |
Definition at line 11 of file mouseevent.cpp.
References fcn::InputEvent::InputEvent(), fcn::InputEvent::isAltPressed(), fcn::InputEvent::isControlPressed(), fcn::InputEvent::isMetaPressed(), fcn::InputEvent::isShiftPressed(), mButton, mClickCount, mType, mX, and mY.
| MouseEvent::Button fcn::MouseEvent::getButton | ( | ) | const |
Gets the button of the mouse event.
Definition at line 32 of file mouseevent.cpp.
References mButton.
Referenced by fcn::CheckBox::mouseClicked(), fcn::Button::mousePressed(), fcn::DropDown::mousePressed(), fcn::ListBox::mousePressed(), fcn::Slider::mousePressed(), fcn::TabbedArea::mousePressed(), fcn::TextBox::mousePressed(), fcn::TextField::mousePressed(), fcn::Button::mouseReleased(), fcn::DropDown::mouseReleased(), and fcn::ToggleButton::mouseReleased().
| int fcn::MouseEvent::getClickCount | ( | ) | const |
Gets the number of clicks generated with the same button.
It's set to zero if another button is used.
Definition at line 47 of file mouseevent.cpp.
References mClickCount.
| MouseEvent::Type fcn::MouseEvent::getType | ( | ) | const |
Gets the type of the event.
Definition at line 52 of file mouseevent.cpp.
References mType.
Referenced by fcn::Gui::distributeMouseEvent().
| int fcn::MouseEvent::getX | ( | ) | const |
Gets the x coordinate of the mouse event.
The coordinate relative to widget the mouse listener receiving the events have registered to.
Definition at line 37 of file mouseevent.cpp.
References mX.
Referenced by fcn::ScrollArea::mouseDragged(), fcn::Slider::mouseDragged(), fcn::Window::mouseDragged(), fcn::DropDown::mousePressed(), fcn::ScrollArea::mousePressed(), fcn::Slider::mousePressed(), fcn::TabbedArea::mousePressed(), fcn::TextBox::mousePressed(), fcn::TextField::mousePressed(), fcn::Window::mousePressed(), and fcn::DropDown::mouseReleased().
| int fcn::MouseEvent::getY | ( | ) | const |
Gets the y coordinate of the mouse event.
The coordinate relative to widget the mouse listener receiving the events have registered to.
Definition at line 42 of file mouseevent.cpp.
References mY.
Referenced by fcn::ScrollArea::mouseDragged(), fcn::Slider::mouseDragged(), fcn::Window::mouseDragged(), fcn::DropDown::mousePressed(), fcn::ListBox::mousePressed(), fcn::ScrollArea::mousePressed(), fcn::Slider::mousePressed(), fcn::TabbedArea::mousePressed(), fcn::TextBox::mousePressed(), fcn::TextField::mousePressed(), fcn::Window::mousePressed(), and fcn::DropDown::mouseReleased().
|
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 161 of file mouseevent.hpp.
References Gui.
Referenced by Gui.
|
protected |
Holds the button of the mouse event.
Definition at line 135 of file mouseevent.hpp.
Referenced by getButton(), and MouseEvent().
|
protected |
The number of clicks generated with the same button.
It's set to zero if another button is used.
Definition at line 151 of file mouseevent.hpp.
Referenced by getClickCount(), and MouseEvent().
|
protected |
Holds the type of the mouse event.
Definition at line 130 of file mouseevent.hpp.
Referenced by getType(), and MouseEvent().
|
protected |
Holds the x-coordinate of the mouse event.
Definition at line 140 of file mouseevent.hpp.
Referenced by fcn::Gui::distributeMouseEvent(), getX(), and MouseEvent().
|
protected |
Holds the y-coordinate of the mouse event.
Definition at line 145 of file mouseevent.hpp.
Referenced by fcn::Gui::distributeMouseEvent(), getY(), and MouseEvent().