diff options
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibGUI/Button.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Button.h | 4 |
2 files changed, 11 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGUI/Button.cpp b/Userland/Libraries/LibGUI/Button.cpp index 0eb7ac9042..e75b041364 100644 --- a/Userland/Libraries/LibGUI/Button.cpp +++ b/Userland/Libraries/LibGUI/Button.cpp @@ -55,7 +55,7 @@ void Button::paint_event(PaintEvent& event) Painter painter(*this); painter.add_clip_rect(event.rect()); - bool paint_pressed = is_being_pressed() || (m_menu && m_menu->is_visible()); + bool paint_pressed = is_being_pressed() || is_mimic_pressed() || (m_menu && m_menu->is_visible()); Gfx::StylePainter::paint_button(painter, rect(), palette(), m_button_style, paint_pressed, is_hovered(), is_checked(), is_enabled(), is_focused(), is_default() && !another_button_has_focus()); @@ -222,4 +222,10 @@ void Button::set_default(bool default_button) }); } +void Button::set_mimic_pressed(bool mimic_pressed) +{ + m_mimic_pressed = mimic_pressed; + update(); +} + } diff --git a/Userland/Libraries/LibGUI/Button.h b/Userland/Libraries/LibGUI/Button.h index 20472c90b4..5cb06ef25d 100644 --- a/Userland/Libraries/LibGUI/Button.h +++ b/Userland/Libraries/LibGUI/Button.h @@ -53,6 +53,9 @@ public: bool another_button_has_focus() const { return m_another_button_has_focus; } + void set_mimic_pressed(bool mimic_pressed); + bool is_mimic_pressed() const { return m_mimic_pressed; }; + protected: explicit Button(String text = {}); virtual void mousedown_event(MouseEvent&) override; @@ -67,6 +70,7 @@ private: WeakPtr<Action> m_action; int m_icon_spacing { 4 }; bool m_another_button_has_focus { false }; + bool m_mimic_pressed { false }; }; } |