feat(ui): add child anchor and content sizing to column layout

This commit is contained in:
2026-07-15 17:38:12 +08:00
parent 715108125a
commit 8111a99fc0
5 changed files with 41 additions and 20 deletions

View File

@@ -1,6 +1,9 @@
#pragma once
#include "Cubed/ui/widget.hpp"
namespace Cubed {
enum class ColumnLayoutAnchor { LEFT, CENTER, RIGHT };
class ColumnLayout : public Widget {
public:
ColumnLayout(const ColumnLayout&) = delete;
@@ -18,10 +21,13 @@ public:
ColumnLayout& set_spacing(int spacing);
// No need for parent node pointer; do not modify children's anchors and
// scale.
ColumnLayout& set_child_anchor(ColumnLayoutAnchor anchor);
void layout();
private:
int m_spacing = 0;
float m_content_height = 0;
float m_content_width = 0;
ColumnLayoutAnchor m_layout_anchor = ColumnLayoutAnchor::CENTER;
};
} // namespace Cubed