You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
805B

  1. #pragma once
  2. #include <widget/Widget.hpp>
  3. #include <ui/common.hpp>
  4. namespace rack {
  5. namespace ui {
  6. /** Positions children in a row/column based on their widths/heights */
  7. struct SequentialLayout : widget::Widget {
  8. enum Orientation {
  9. HORIZONTAL_ORIENTATION,
  10. VERTICAL_ORIENTATION,
  11. };
  12. enum Alignment {
  13. LEFT_ALIGNMENT,
  14. CENTER_ALIGNMENT,
  15. RIGHT_ALIGNMENT,
  16. TOP_ALIGNMENT = LEFT_ALIGNMENT,
  17. MIDDLE_ALIGNMENT = CENTER_ALIGNMENT,
  18. BOTTOM_ALIGNMENT = RIGHT_ALIGNMENT,
  19. };
  20. Orientation orientation = HORIZONTAL_ORIENTATION;
  21. Alignment alignment = LEFT_ALIGNMENT;
  22. bool wrap = true;
  23. /** Space between box bounds. */
  24. math::Vec margin;
  25. /** Space between adjacent elements, and adjacent lines if wrapped. */
  26. math::Vec spacing;
  27. void step() override;
  28. };
  29. } // namespace ui
  30. } // namespace rack