serenity/Widgets/Button.h
Andreas Kling 9963da9005 Start refactoring graphics system to have per-window backing stores.
It was fun for everyone to share a single framebuffer but it was also
kinda really awful. Let's move towards having a "GraphicsBitmap" as the
backing store for each Window.

This is going to need a lot of refactoring so let's get started.
2019-01-09 02:06:04 +01:00

27 lines
623 B
C++

#pragma once
#include "Widget.h"
#include <AK/AKString.h>
#include <AK/Function.h>
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;
private:
virtual void paintEvent(PaintEvent&) override;
virtual void mouseDownEvent(MouseEvent&) override;
virtual void mouseUpEvent(MouseEvent&) override;
virtual const char* class_name() const override { return "Button"; }
String m_caption;
bool m_beingPressed { false };
};