mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-09 02:07:04 +08:00
feat(ui): add child anchor and content sizing to column layout
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user