|
FifeGUI 0.3.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 |
| uint16_t | getModMask () 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 | |
| Widget * | mDistributor |
| bool | mIsConsumed |
| uint16_t | mModMask {0} |
| Protected Attributes inherited from fcn::Event | |
| Widget * | mSource {nullptr} |
Friends | |
| class | Gui |
Additional Inherited Members | |
| Static Public Attributes inherited from fcn::InputEvent | |
| static constexpr uint16_t | ModAlt = 1 << 2 |
| static constexpr uint16_t | ModControl = 1 << 1 |
| static constexpr uint16_t | ModMeta = 1 << 3 |
| static constexpr uint16_t | ModShift = 1 << 0 |
Represents a mouse event.
Definition at line 25 of file mouseevent.hpp.
|
strong |
Mouse button types.
Definition at line 49 of file mouseevent.hpp.
|
strong |
Mouse event types.
Definition at line 31 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 19 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 53 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 68 of file mouseevent.cpp.
References mClickCount.
| MouseEvent::Type fcn::MouseEvent::getType | ( | ) | const |
Gets the type of the event.
Definition at line 73 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 58 of file mouseevent.cpp.
References mX.
Referenced by fcn::Widget::isMouseInside(), fcn::ScrollArea::mouseDragged(), fcn::Slider::mouseDragged(), fcn::Window::mouseDragged(), fcn::MenuBar::mousePressed(), fcn::ScrollArea::mousePressed(), fcn::Slider::mousePressed(), fcn::TabbedArea::mousePressed(), fcn::TextBox::mousePressed(), fcn::TextField::mousePressed(), and fcn::Window::mousePressed().
| 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 63 of file mouseevent.cpp.
References mY.
Referenced by fcn::Widget::isMouseInside(), fcn::ScrollArea::mouseDragged(), fcn::Slider::mouseDragged(), fcn::Window::mouseDragged(), fcn::DropDown::mousePressed(), fcn::ListBox::mousePressed(), fcn::MenuBar::mousePressed(), fcn::Panel::mousePressed(), fcn::ScrollArea::mousePressed(), fcn::Slider::mousePressed(), fcn::TabbedArea::mousePressed(), fcn::TextBox::mousePressed(), fcn::TextField::mousePressed(), and fcn::Window::mousePressed().
|
friend |
Grants Gui privileged access to internal state.
Gui is declared as a friend 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 updates the x and y coordinates so they are relative to the widget that the mouse listener is registered to.
Definition at line 169 of file mouseevent.hpp.
References Gui.
Referenced by Gui.
|
protected |
Holds the button of the mouse event.
Definition at line 142 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 158 of file mouseevent.hpp.
Referenced by getClickCount(), and MouseEvent().
|
protected |
Holds the type of the mouse event.
Definition at line 137 of file mouseevent.hpp.
Referenced by getType(), and MouseEvent().
|
protected |
Holds the x-coordinate of the mouse event.
Definition at line 147 of file mouseevent.hpp.
Referenced by fcn::Gui::distributeMouseEvent(), getX(), and MouseEvent().
|
protected |
Holds the y-coordinate of the mouse event.
Definition at line 152 of file mouseevent.hpp.
Referenced by fcn::Gui::distributeMouseEvent(), getY(), and MouseEvent().