55 lines
1.3 KiB
C++
55 lines
1.3 KiB
C++
/// Josh's User Interface Library
|
|
/// A C++20 Library for creating, styling, and rendering of a UI/UX widgets.
|
|
/// Developed and Maintained by Josh O'Leary @ Redacted Software.
|
|
/// Special Thanks to William Tomasine II and Maxine Hayes.
|
|
/// (c) 2024 Redacted Software
|
|
/// This work is dedicated to the public domain.
|
|
|
|
/// @file GridLayout.hpp
|
|
/// @desc Lays out child elements in a grid-matrix.
|
|
/// @edit 2024-08-05
|
|
|
|
#pragma once
|
|
|
|
#include <JUI/Base/LayoutContainer.hpp>
|
|
|
|
namespace JUI
|
|
{
|
|
// TODO: TableLayout class?
|
|
|
|
/// A GridLayout lays out sibling UI elements in multiple rows within the parent UI element.
|
|
class GridLayout : public LayoutContainer
|
|
{
|
|
public:
|
|
GridLayout() : LayoutContainer() {
|
|
Name("GridLayout");
|
|
}
|
|
explicit GridLayout(Widget* parent) : GridLayout()
|
|
{
|
|
this->Parent(parent);
|
|
}
|
|
~GridLayout() override {}
|
|
|
|
void ApplyLayout() override
|
|
{
|
|
int consumed_w;
|
|
int consumed_h;
|
|
int cells;
|
|
|
|
// TODO: Implement widget.LayoutOrder and sort by that number.
|
|
for (auto& child_widget : children)
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
|
|
protected:
|
|
UDim2 cell_padding;
|
|
UDim2 cell_size;
|
|
int max_cells;
|
|
bool start_from_left;
|
|
private:
|
|
|
|
};
|
|
} |