aboutsummaryrefslogtreecommitdiff
path: root/CruUI-Generate
diff options
context:
space:
mode:
Diffstat (limited to 'CruUI-Generate')
-rw-r--r--CruUI-Generate/cru_ui.cpp27
-rw-r--r--CruUI-Generate/cru_ui.hpp52
2 files changed, 78 insertions, 1 deletions
diff --git a/CruUI-Generate/cru_ui.cpp b/CruUI-Generate/cru_ui.cpp
index 3436f3f4..497af786 100644
--- a/CruUI-Generate/cru_ui.cpp
+++ b/CruUI-Generate/cru_ui.cpp
@@ -283,6 +283,7 @@ using cru::ui::controls::ToggleButton;
using cru::ui::controls::Button;
using cru::ui::controls::TextBox;
using cru::ui::controls::ListItem;
+using cru::ui::controls::FrameLayout;
int APIENTRY wWinMain(
HINSTANCE hInstance,
@@ -363,6 +364,8 @@ int APIENTRY wWinMain(
inner_layout->AddChild(TextBlock::Create(L"Toggle debug border"));
+ const auto l = FrameLayout::Create();
+ l->GetLayoutParams()->padding.SetLeftRight(20.0f);
const auto toggle_button = ToggleButton::Create();
#ifdef CRU_DEBUG_LAYOUT
toggle_button->toggle_event.AddHandler([&window](cru::ui::events::ToggleEventArgs& args)
@@ -370,7 +373,8 @@ int APIENTRY wWinMain(
window->SetDebugLayout(args.GetNewState());
});
#endif
- inner_layout->AddChild(toggle_button);
+ l->AddChild(toggle_button);
+ inner_layout->AddChild(l);
layout->AddChild(inner_layout);
}
@@ -3083,6 +3087,27 @@ namespace cru::ui::controls
//-------end of file: src\ui\controls\button.cpp
//--------------------------------------------------------
//--------------------------------------------------------
+//-------begin of file: src\ui\controls\frame_layout.cpp
+//--------------------------------------------------------
+
+namespace cru::ui::controls
+{
+ FrameLayout::FrameLayout() : Control(true)
+ {
+
+ }
+
+ FrameLayout::~FrameLayout() = default;
+
+ StringView FrameLayout::GetControlType() const
+ {
+ return control_type;
+ }
+}
+//--------------------------------------------------------
+//-------end of file: src\ui\controls\frame_layout.cpp
+//--------------------------------------------------------
+//--------------------------------------------------------
//-------begin of file: src\ui\controls\linear_layout.cpp
//--------------------------------------------------------
diff --git a/CruUI-Generate/cru_ui.hpp b/CruUI-Generate/cru_ui.hpp
index ddfd8d9e..93360e3a 100644
--- a/CruUI-Generate/cru_ui.hpp
+++ b/CruUI-Generate/cru_ui.hpp
@@ -701,6 +701,21 @@ namespace cru::ui
return top + bottom;
}
+ void SetLeftRight(const float value)
+ {
+ left = right = value;
+ }
+
+ void SetTopBottom(const float value)
+ {
+ top = bottom = value;
+ }
+
+ void SetAll(const float value)
+ {
+ left = top = right = bottom = value;
+ }
+
float Validate() const
{
return left >= 0.0 && top >= 0.0 && right >= 0.0 && bottom >= 0.0;
@@ -2775,6 +2790,43 @@ namespace cru::ui::controls
//-------end of file: src\ui\controls\popup_menu.hpp
//--------------------------------------------------------
//--------------------------------------------------------
+//-------begin of file: src\ui\controls\frame_layout.hpp
+//--------------------------------------------------------
+
+#include <initializer_list>
+
+
+namespace cru::ui::controls
+{
+ class FrameLayout : public Control
+ {
+ public:
+ static constexpr auto control_type = L"FrameLayout";
+
+ static FrameLayout* Create(const std::initializer_list<Control*>& children = std::initializer_list<Control*>{})
+ {
+ const auto layout = new FrameLayout();
+ for (auto child : children)
+ layout->AddChild(child);
+ return layout;
+ }
+
+ protected:
+ FrameLayout();
+ public:
+ FrameLayout(const FrameLayout& other) = delete;
+ FrameLayout(FrameLayout&& other) = delete;
+ FrameLayout& operator=(const FrameLayout& other) = delete;
+ FrameLayout& operator=(FrameLayout&& other) = delete;
+ ~FrameLayout() override;
+
+ StringView GetControlType() const override final;
+ };
+}
+//--------------------------------------------------------
+//-------end of file: src\ui\controls\frame_layout.hpp
+//--------------------------------------------------------
+//--------------------------------------------------------
//-------begin of file: src\graph\graph.hpp
//--------------------------------------------------------