#pragma once

#include "widget.h"
#include "core/corefactory.h"

class Button : public Widget
{
public:
    explicit Button(const std::string& text, const std::shared_ptr<kku::CoreFactory>& factory, unsigned int font_size);

    virtual void input(const kku::SystemEvent& event) override = 0;
    virtual void update(const kku::microsec& dt) override final;
    virtual void display() const override final;
    virtual void move(const kku::Vector2<float>& delta) override final;
    virtual bool isUnderMouse(const kku::Point& position) const override final;

    virtual void setRect(const kku::Area<float>& rect) override;
    virtual kku::Area<float> getRect() const override;

    virtual void setPosition(const kku::Point& position) override;
    virtual kku::Point getPosition() const override;

    virtual void setText(const std::string& text);

protected:
    std::shared_ptr<kku::Rectangle> _button_content;
    std::shared_ptr<kku::Text> _button_text;

    const std::shared_ptr<kku::CoreFactory> _core_factory;
};

