Serenity Operating System
at master 34 lines 823 B view raw
1/* 2 * Copyright (c) 2020, Hüseyin Aslıtürk <asliturk@hotmail.com> 3 * Copyright (c) 2022, the SerenityOS developers. 4 * 5 * SPDX-License-Identifier: BSD-2-Clause 6 */ 7 8#pragma once 9 10#include <LibGUI/AbstractButton.h> 11 12class KeyButton final : public GUI::AbstractButton { 13 C_OBJECT(KeyButton) 14 15public: 16 virtual ~KeyButton() override = default; 17 18 void set_pressed(bool value) { m_pressed = value; } 19 20 Function<void()> on_click; 21 22protected: 23 virtual void click(unsigned modifiers = 0) override; 24 virtual void leave_event(Core::Event&) override; 25 virtual void mousemove_event(GUI::MouseEvent&) override; 26 virtual void paint_event(GUI::PaintEvent&) override; 27 28private: 29 KeyButton() = default; 30 31 bool m_pressed { false }; 32 bool m_face_hovered { false }; 33 void set_face_hovered(bool value); 34};