Browse Source

Add ability to disable SequentialLayout wrapping.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
94007a1c54
2 changed files with 7 additions and 2 deletions
  1. +6
    -1
      include/ui/SequentialLayout.hpp
  2. +1
    -1
      src/ui/SequentialLayout.cpp

+ 6
- 1
include/ui/SequentialLayout.hpp View File

@@ -17,13 +17,18 @@ struct SequentialLayout : widget::Widget {
LEFT_ALIGNMENT, LEFT_ALIGNMENT,
CENTER_ALIGNMENT, CENTER_ALIGNMENT,
RIGHT_ALIGNMENT, RIGHT_ALIGNMENT,

TOP_ALIGNMENT = LEFT_ALIGNMENT,
MIDDLE_ALIGNMENT = CENTER_ALIGNMENT,
BOTTOM_ALIGNMENT = RIGHT_ALIGNMENT,
}; };


Orientation orientation = HORIZONTAL_ORIENTATION; Orientation orientation = HORIZONTAL_ORIENTATION;
Alignment alignment = LEFT_ALIGNMENT; Alignment alignment = LEFT_ALIGNMENT;
bool wrap = true;
/** Space between box bounds. */ /** Space between box bounds. */
math::Vec margin; math::Vec margin;
/** Space between adjacent elements. */
/** Space between adjacent elements, and adjacent lines if wrapped. */
math::Vec spacing; math::Vec spacing;


void step() override; void step() override;


+ 1
- 1
src/ui/SequentialLayout.cpp View File

@@ -62,7 +62,7 @@ void SequentialLayout::step() {
} }


// Should we wrap the widget now? // 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(); flushRow();
rowWidth = 0.0; rowWidth = 0.0;
} }


Loading…
Cancel
Save