#pragma once

#include "holly/ta_parameter.hpp"
#include "ta_multiwriter.hpp"
#include "widget/widget.hpp"

namespace widget {
  struct button : widget {
    using widget::draw;

    void (* const on_click)();

    inline button(float _width, float _height, void (* const _on_click)())
      : widget(0, 0, _width, _height), on_click(_on_click)
    { }

    inline button(float _x, float _y, float _width, float _height, void (* const _on_click)())
      : widget(_x, _y, _width, _height), on_click(_on_click)
    { }

    void draw_shadow(ta_parameter_writer& writer) const;
    void draw_lowlight(ta_parameter_writer& writer) const;
    void draw_highlight(ta_parameter_writer& writer) const;
    void draw_background(ta_parameter_writer& writer) const;
    void draw(ta_multiwriter& multi) override;

    void click() override;
  };
}
