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