20 , realtime(Timer::getTime())
28 :
TimedEvent(type_), keyCode(keyCode_), scanCode(scanCode_), unicode(unicode_)
52 bool KeyEvent::equalImpl(
const Event& other)
const
55 const auto& o = checked_cast<const KeyEvent&>(other);
72 bool MouseButtonEvent::equalImpl(
const Event& other)
const
74 const auto& o = checked_cast<const MouseButtonEvent&>(other);
118 bool MouseWheelEvent::equalImpl(
const Event& other)
const
120 const auto& o = checked_cast<const MouseWheelEvent&>(other);
121 return std::tuple(
getX(),
getY()) ==
122 std::tuple(o.getX(), o.getY());
130 , xrel(xrel_), yrel(yrel_)
131 , xabs(xabs_), yabs(yabs_)
140 bool MouseMotionEvent::equalImpl(
const Event& other)
const
142 const auto& o = checked_cast<const MouseMotionEvent&>(other);
144 std::tuple(o.getX(), o.getY(), o.getAbsX(), o.getAbsY());
164 EventType type_,
unsigned joystick_,
unsigned button_)
176 bool JoystickButtonEvent::equalImpl(
const Event& other)
const
178 const auto& o = checked_cast<const JoystickButtonEvent&>(other);
180 std::tuple(o.getJoystick(), o.getButton());
213 unsigned joystick_,
unsigned axis_,
int value_)
215 , axis(axis_), value(value_)
226 bool JoystickAxisMotionEvent::equalImpl(
const Event& other)
const
228 const auto& o = checked_cast<const JoystickAxisMotionEvent&>(other);
230 std::tuple(o.getJoystick(), o.getAxis(), o.getValue());
238 , hat(hat_), value(value_)
245 const char* str = [&] {
247 case SDL_HAT_UP:
return "up";
248 case SDL_HAT_RIGHT:
return "right";
249 case SDL_HAT_DOWN:
return "down";
250 case SDL_HAT_LEFT:
return "left";
251 case SDL_HAT_RIGHTUP:
return "rightup";
252 case SDL_HAT_RIGHTDOWN:
return "rightdown";
253 case SDL_HAT_LEFTUP:
return "leftup";
254 case SDL_HAT_LEFTDOWN:
return "leftdown";
255 default:
return "center";
262 bool JoystickHatEvent::equalImpl(
const Event& other)
const
264 const auto& o = checked_cast<const JoystickHatEvent&>(other);
266 std::tuple(o.getJoystick(), o.getHat(), o.getValue());
282 bool FocusEvent::equalImpl(
const Event& other)
const
284 const auto& o = checked_cast<const FocusEvent&>(other);
285 return getGain() == o.getGain();
301 bool ResizeEvent::equalImpl(
const Event& other)
const
303 const auto& o = checked_cast<const ResizeEvent&>(other);
304 return std::tuple(
getX(),
getY()) ==
305 std::tuple(o.getX(), o.getY());
321 bool FileDropEvent::equalImpl(
const Event& other)
const
323 const auto& o = checked_cast<const FileDropEvent&>(other);
339 bool QuitEvent::equalImpl(
const Event& )
const
348 std::shared_ptr<const Event> origEvent_)
349 :
TimedEvent(type_), origEvent(std::move(origEvent_)), button(button_)
357 if (origEvent.get() == &other)
return false;
371 static constexpr
const char*
const names[] = {
372 "LEFT",
"RIGHT",
"UP",
"DOWN",
"A",
"B"
377 bool OsdControlEvent::equalImpl(
const Event& other)
const
379 const auto& o = checked_cast<const OsdControlEvent&>(other);
387 unsigned button_,
const std::shared_ptr<const Event>& origEvent_)
401 unsigned button_,
const std::shared_ptr<const Event>& origEvent_)
416 , typesToMatch(std::move(typesToMatch_))
417 , tclListComponents(std::move(tclListComponents_))
423 return tclListComponents;
426 bool GroupEvent::equalImpl(
const Event& )
const
432 bool GroupEvent::matches(
const Event& other)
const
434 return contains(typesToMatch, other.getType());
FileDropEvent(std::string fileName)
TclObject toTclList() const override
Similar to toString(), but retains the structure of the event.
const std::string & getFileName() const
TclObject toTclList() const override
Similar to toString(), but retains the structure of the event.
TclObject toTclList() const override
Similar to toString(), but retains the structure of the event.
GroupEvent(EventType type, std::vector< EventType > typesToMatch, TclObject tclListComponents)
TclObject toTclList() const override
Similar to toString(), but retains the structure of the event.
JoystickAxisMotionEvent(unsigned joystick, unsigned axis, int value)
JoystickEvent(EventType type, unsigned joystick)
TclObject toTclHelper() const
unsigned getJoystick() const
unsigned getValue() const
JoystickHatEvent(unsigned joystick, unsigned hat, unsigned value)
TclObject toTclList() const override
Similar to toString(), but retains the structure of the event.
Keys::KeyCode getKeyCode() const
uint32_t getUnicode() const
KeyEvent(EventType type, Keys::KeyCode keyCode, Keys::KeyCode scanCode, uint32_t unicode)
MouseMotionEvent(int xrel, int yrel, int xabs, int yabs)
TclObject toTclList() const override
Similar to toString(), but retains the structure of the event.
TclObject toTclList() const override
Similar to toString(), but retains the structure of the event.
MouseWheelEvent(int x, int y)
OSD events are triggered by other events.
TclObject toTclHelper(std::string_view direction) const
bool isRepeatStopper(const Event &other) const final
Get the event that actually triggered the creation of this event.
unsigned getButton() const
OsdControlEvent(EventType type, unsigned button_, std::shared_ptr< const Event > origEvent)
TclObject toTclList() const override
Similar to toString(), but retains the structure of the event.
OsdControlPressEvent(unsigned button, const std::shared_ptr< const Event > &origEvent)
OsdControlReleaseEvent(unsigned button, const std::shared_ptr< const Event > &origEvent)
TclObject toTclList() const override
Similar to toString(), but retains the structure of the event.
TclObject toTclList() const override
Similar to toString(), but retains the structure of the event.
ResizeEvent(unsigned x, unsigned y)
TclObject toTclList() const override
Similar to toString(), but retains the structure of the event.
TimedEvent(EventType type)
KeyCode
Constants that identify keys and key modifiers.
string getName(KeyCode keyCode)
Translate key code to key name.
This file implemented 3 utility functions:
@ OPENMSX_OSD_CONTROL_PRESS_EVENT
@ OPENMSX_MOUSE_BUTTON_DOWN_EVENT
@ OPENMSX_MOUSE_BUTTON_UP_EVENT
@ OPENMSX_OSD_CONTROL_RELEASE_EVENT
@ OPENMSX_MOUSE_WHEEL_EVENT
@ OPENMSX_MOUSE_MOTION_EVENT
@ OPENMSX_JOY_BUTTON_UP_EVENT
@ OPENMSX_JOY_BUTTON_DOWN_EVENT
@ OPENMSX_JOY_AXIS_MOTION_EVENT
constexpr KeyMatrixPosition x
Keyboard bindings.
TclObject makeTclList(Args &&... args)
constexpr bool contains(ITER first, ITER last, const VAL &val)
Check if a range contains a given value, using linear search.
TemporaryString tmpStrCat(Ts &&... ts)