ladybird/Widgets/Button.h

28 lines
623 B
C
Raw Normal View History

2018-10-11 01:48:09 +02:00
#pragma once
#include "Widget.h"
#include <AK/AKString.h>
#include <AK/Function.h>
2018-10-11 01:48:09 +02:00
class Button final : public Widget {
public:
explicit Button(Widget* parent);
virtual ~Button() override;
String caption() const { return m_caption; }
void setCaption(String&&);
Function<void(Button&)> onClick;
2018-10-11 01:48:09 +02:00
private:
virtual void paintEvent(PaintEvent&) override;
virtual void mouseDownEvent(MouseEvent&) override;
virtual void mouseUpEvent(MouseEvent&) override;
2018-10-11 01:48:09 +02:00
2018-11-15 15:36:35 +01:00
virtual const char* class_name() const override { return "Button"; }
2018-10-11 01:48:09 +02:00
String m_caption;
2018-10-12 15:52:41 +02:00
bool m_beingPressed { false };
2018-10-11 01:48:09 +02:00
};