#pragma once

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

namespace widget {

  constexpr inline int str_length(const char * s)
  {
    int l = 0;
    while (*s++) {
      l += 1;
    }
    return l;
  }

  struct button_label : button {
    const char * const label;
    const int label_length;

    inline button_label(float _width, float _height, const char * label, void (* const _on_click)())
      : button(0, 0, _width, _height, _on_click), label(label), label_length(str_length(label))
    { }

    inline button_label(float _x, float _y, float _width, float _height, const char * label, void (* const _on_click)())
      : button(_x, _y, _width, _height, _on_click), label(label), label_length(str_length(label))
    { }

    void draw_label(ta_parameter_writer& writer) const;
    void draw(ta_multiwriter& multi) override;
  };
}
