From 94007a1c541cd5e46b46baa0e1daf53cd1bdd8e2 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Fri, 6 Aug 2021 21:34:08 -0400 Subject: [PATCH] Add ability to disable SequentialLayout wrapping. --- include/ui/SequentialLayout.hpp | 7 ++++++- src/ui/SequentialLayout.cpp | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/ui/SequentialLayout.hpp b/include/ui/SequentialLayout.hpp index fefc1751..617b9aad 100644 --- a/include/ui/SequentialLayout.hpp +++ b/include/ui/SequentialLayout.hpp @@ -17,13 +17,18 @@ struct SequentialLayout : widget::Widget { LEFT_ALIGNMENT, CENTER_ALIGNMENT, RIGHT_ALIGNMENT, + + TOP_ALIGNMENT = LEFT_ALIGNMENT, + MIDDLE_ALIGNMENT = CENTER_ALIGNMENT, + BOTTOM_ALIGNMENT = RIGHT_ALIGNMENT, }; Orientation orientation = HORIZONTAL_ORIENTATION; Alignment alignment = LEFT_ALIGNMENT; + bool wrap = true; /** Space between box bounds. */ math::Vec margin; - /** Space between adjacent elements. */ + /** Space between adjacent elements, and adjacent lines if wrapped. */ math::Vec spacing; void step() override; diff --git a/src/ui/SequentialLayout.cpp b/src/ui/SequentialLayout.cpp index aa784d3c..e5954c35 100644 --- a/src/ui/SequentialLayout.cpp +++ b/src/ui/SequentialLayout.cpp @@ -62,7 +62,7 @@ void SequentialLayout::step() { } // Should we wrap the widget now? - if (!row.empty() && rowWidth + X(child->box.size) > boundWidth) { + if (wrap && !row.empty() && rowWidth + X(child->box.size) > boundWidth) { flushRow(); rowWidth = 0.0; }