#pragma once

#include "Widget.h"
#include "Color.h"

#include <functional>
#include <string>

class PaintEvent;
class MouseEvent;

class Button : public Widget
{
private:
    using clickFunc = std::function<void(Widget* self)>;
    std::string mLabel;
    clickFunc mClickFunc;
    Color mCachedColor;
    ColorUPtr mClickedColor;

public:
    Button();

    static std::unique_ptr<Button> Create();

    void SetLabel(const std::string& text);

    void SetOnClickFunction(clickFunc func);

    void OnPaintEvent(const PaintEvent* event) override;

protected:

    void OnMyMouseEvent(const MouseEvent* event) override;
};

using ButtonUPtr = std::unique_ptr<Button>;
