#pragma once

#include "widget/container.hpp"

namespace widget {

  struct top_aligned : container {

    inline top_aligned(float _x, float _y, float gap, widget ** _children, int _length)
      : container(_x, _y, 0, 0, _children, _length)
    {
      float yi = 0;
      for (int i = 0; i < length; i++) {
        children[i]->_x = 0;
        children[i]->_y = yi;
        yi += children[i]->height + gap;
        if (children[i]->width > width)
          width = children[i]->width;
      }
      height = yi;
    }
  };
}
