|
FifeGUI 0.2.0
A C++ GUI library designed for games.
|
#include <inputevent.hpp>
Public Member Functions | |
| 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 | |
| bool | mAltPressed |
| bool | mControlPressed |
| Widget * | mDistributor |
| bool | mIsConsumed |
| bool | mMetaPressed |
| bool | mShiftPressed |
| Protected Attributes inherited from fcn::Event | |
| Widget * | mSource {nullptr} |
Friends | |
| class | Gui |
Base class for all input-related events (keyboard, mouse).
Definition at line 18 of file inputevent.hpp.
| fcn::InputEvent::InputEvent | ( | Widget * | source, |
| Widget * | distributor, | ||
| bool | isShiftPressed, | ||
| bool | isControlPressed, | ||
| bool | isAltPressed, | ||
| bool | isMetaPressed ) |
Constructor.
| source | The widget the event concerns. |
| distributor | The distributor of the 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. |
Definition at line 11 of file inputevent.cpp.
References fcn::Event::Event(), isAltPressed(), isControlPressed(), isMetaPressed(), isShiftPressed(), mAltPressed, mControlPressed, mDistributor, mIsConsumed, mMetaPressed, and mShiftPressed.
Referenced by fcn::KeyEvent::KeyEvent(), and fcn::MouseEvent::MouseEvent().
| void fcn::InputEvent::consume | ( | ) |
Marks the event as consumed.
Input event listeners may discard consumed input or act on consumed input. An example of a widget that discards consumed input is the ScrollArea widget that discards consumed mouse wheel events so the ScrollArea will not scroll if for instance a Slider's value inside the ScrollArea was changed with the mouse wheel.
Definition at line 48 of file inputevent.cpp.
References mIsConsumed.
Referenced by fcn::Button::keyPressed(), fcn::CheckBox::keyPressed(), fcn::DropDown::keyPressed(), fcn::ListBox::keyPressed(), fcn::PasswordField::keyPressed(), fcn::Slider::keyPressed(), fcn::TabbedArea::keyPressed(), fcn::TextBox::keyPressed(), fcn::TextField::keyPressed(), fcn::Button::keyReleased(), fcn::CheckBox::keyReleased(), fcn::ToggleButton::keyReleased(), fcn::CheckBox::mouseClicked(), fcn::Button::mouseDragged(), fcn::DropDown::mouseDragged(), fcn::ListBox::mouseDragged(), fcn::ScrollArea::mouseDragged(), fcn::Slider::mouseDragged(), fcn::TextBox::mouseDragged(), fcn::TextField::mouseDragged(), fcn::Window::mouseDragged(), fcn::Button::mousePressed(), fcn::CheckBox::mousePressed(), fcn::TextBox::mousePressed(), fcn::Button::mouseReleased(), fcn::CheckBox::mouseReleased(), fcn::ScrollArea::mouseReleased(), fcn::ToggleButton::mouseReleased(), fcn::DropDown::mouseWheelMovedDown(), fcn::ListBox::mouseWheelMovedDown(), fcn::ScrollArea::mouseWheelMovedDown(), fcn::Slider::mouseWheelMovedDown(), fcn::ScrollArea::mouseWheelMovedLeft(), fcn::Slider::mouseWheelMovedLeft(), fcn::ScrollArea::mouseWheelMovedRight(), fcn::Slider::mouseWheelMovedRight(), fcn::DropDown::mouseWheelMovedUp(), fcn::ListBox::mouseWheelMovedUp(), fcn::ScrollArea::mouseWheelMovedUp(), and fcn::Slider::mouseWheelMovedUp().
| Widget * fcn::InputEvent::getDistributor | ( | ) | const |
Gets the distributor of the event.
The function is used to tell which widget actually distributed the event. As input events bubbles up, the source of the event may not be the same as the distributor of the event.
Definition at line 58 of file inputevent.cpp.
References mDistributor.
| bool fcn::InputEvent::isAltPressed | ( | ) | const |
Checks if alt is pressed.
Definition at line 38 of file inputevent.cpp.
References mAltPressed.
Referenced by InputEvent(), fcn::KeyEvent::KeyEvent(), and fcn::MouseEvent::MouseEvent().
| bool fcn::InputEvent::isConsumed | ( | ) | const |
Checks if the input event is consumed.
Definition at line 53 of file inputevent.cpp.
References mIsConsumed.
Referenced by fcn::Gui::distributeKeyEventToGlobalKeyListeners(), fcn::Gui::handleKeyInput(), fcn::DropDown::keyPressed(), fcn::TabbedArea::keyPressed(), fcn::Window::mouseDragged(), fcn::ScrollArea::mouseWheelMovedDown(), fcn::ScrollArea::mouseWheelMovedLeft(), fcn::ScrollArea::mouseWheelMovedRight(), and fcn::ScrollArea::mouseWheelMovedUp().
| bool fcn::InputEvent::isControlPressed | ( | ) | const |
Checks if control is pressed.
Definition at line 33 of file inputevent.cpp.
References mControlPressed.
Referenced by InputEvent(), fcn::KeyEvent::KeyEvent(), and fcn::MouseEvent::MouseEvent().
| bool fcn::InputEvent::isMetaPressed | ( | ) | const |
Checks whether meta is pressed.
Definition at line 43 of file inputevent.cpp.
References mMetaPressed.
Referenced by InputEvent(), fcn::KeyEvent::KeyEvent(), and fcn::MouseEvent::MouseEvent().
| bool fcn::InputEvent::isShiftPressed | ( | ) | const |
Checks if shift is pressed.
Definition at line 28 of file inputevent.cpp.
References mShiftPressed.
Referenced by InputEvent(), fcn::KeyEvent::KeyEvent(), and fcn::MouseEvent::MouseEvent().
|
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 distributer of this class whenever the distributer changes as events bubble up.
Definition at line 139 of file inputevent.hpp.
References Gui.
Referenced by Gui.
|
protected |
True if alt is pressed, false otherwise.
Definition at line 114 of file inputevent.hpp.
Referenced by InputEvent(), and isAltPressed().
|
protected |
True if control is pressed, false otherwise.
Definition at line 109 of file inputevent.hpp.
Referenced by InputEvent(), and isControlPressed().
|
protected |
Holds the distributor of the event.
Definition at line 130 of file inputevent.hpp.
Referenced by fcn::Gui::distributeKeyEvent(), fcn::Gui::distributeMouseEvent(), getDistributor(), and InputEvent().
|
protected |
True if the input event is consumed, false otherwise.
Definition at line 125 of file inputevent.hpp.
Referenced by consume(), InputEvent(), and isConsumed().
|
protected |
True if meta is pressed, false otherwise.
Definition at line 119 of file inputevent.hpp.
Referenced by InputEvent(), and isMetaPressed().
|
protected |
True if shift is pressed, false otherwise.
Definition at line 104 of file inputevent.hpp.
Referenced by InputEvent(), and isShiftPressed().