#pragma once

#include "widget/container.hpp"

namespace widget {

  struct left_aligned : container {

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