2020-06-02 17:59:30 +00:00
|
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2020, Hüseyin Aslıtürk <asliturk@hotmail.com>
|
2022-02-10 19:28:48 +00:00
|
|
|
|
* Copyright (c) 2022, the SerenityOS developers.
|
2020-06-02 17:59:30 +00:00
|
|
|
|
*
|
2021-04-22 08:24:48 +00:00
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-06-02 17:59:30 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <LibGUI/AbstractButton.h>
|
|
|
|
|
|
2021-10-31 22:38:04 +00:00
|
|
|
|
class KeyButton final : public GUI::AbstractButton {
|
2020-06-02 17:59:30 +00:00
|
|
|
|
C_OBJECT(KeyButton)
|
|
|
|
|
|
|
|
|
|
public:
|
2022-02-10 19:28:48 +00:00
|
|
|
|
virtual ~KeyButton() override = default;
|
2020-06-02 17:59:30 +00:00
|
|
|
|
|
|
|
|
|
void set_pressed(bool value) { m_pressed = value; }
|
|
|
|
|
|
|
|
|
|
Function<void()> on_click;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual void click(unsigned modifiers = 0) override;
|
2020-06-12 19:01:09 +00:00
|
|
|
|
virtual void leave_event(Core::Event&) override;
|
|
|
|
|
virtual void mousemove_event(GUI::MouseEvent&) override;
|
2020-06-02 17:59:30 +00:00
|
|
|
|
virtual void paint_event(GUI::PaintEvent&) override;
|
|
|
|
|
|
|
|
|
|
private:
|
2021-10-31 22:38:04 +00:00
|
|
|
|
KeyButton() = default;
|
|
|
|
|
|
2020-06-02 17:59:30 +00:00
|
|
|
|
bool m_pressed { false };
|
2021-12-16 13:17:39 +00:00
|
|
|
|
bool m_face_hovered { false };
|
|
|
|
|
void set_face_hovered(bool value);
|
2020-06-02 17:59:30 +00:00
|
|
|
|
};
|