1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:07:47 +00:00

LibGUI: Allow specifying the mouse buttons able to press down a button

This patch adds the ability to modify the set of mouse buttons able to
press down a button
This commit is contained in:
networkException 2022-07-10 17:03:22 +02:00 committed by Andreas Kling
parent 37b4133c51
commit 18c84d2e63
2 changed files with 21 additions and 5 deletions

View file

@ -35,6 +35,9 @@ public:
bool is_hovered() const { return m_hovered; }
bool is_being_pressed() const { return m_being_pressed; }
unsigned allowed_mouse_buttons_for_pressing() const { return m_allowed_mouse_buttons_for_pressing; }
void set_allowed_mouse_buttons_for_pressing(unsigned allowed_buttons) { m_allowed_mouse_buttons_for_pressing = allowed_buttons; }
virtual void click(unsigned modifiers = 0) = 0;
virtual bool is_uncheckable() const { return true; }
@ -65,6 +68,9 @@ private:
bool m_being_keyboard_pressed { false };
bool m_exclusive { false };
MouseButton m_pressed_mouse_button { MouseButton::None };
unsigned m_allowed_mouse_buttons_for_pressing { MouseButton::Primary };
int m_auto_repeat_interval { 0 };
RefPtr<Core::Timer> m_auto_repeat_timer;
};