aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui/controls
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-03-18 22:37:41 +0800
committercrupest <crupest@outlook.com>2020-03-18 22:37:41 +0800
commit477155d6fccc8eafadb6d7f4c468c9141d7d4e92 (patch)
tree0fe935c8f699a1c42c8750a39b6ca70d31f941a0 /include/cru/ui/controls
parent068714c0f2fe7ab003462e5483f9944b0bf2f8e0 (diff)
downloadcru-477155d6fccc8eafadb6d7f4c468c9141d7d4e92.tar.gz
cru-477155d6fccc8eafadb6d7f4c468c9141d7d4e92.tar.bz2
cru-477155d6fccc8eafadb6d7f4c468c9141d7d4e92.zip
...
Diffstat (limited to 'include/cru/ui/controls')
-rw-r--r--include/cru/ui/controls/button.hpp8
-rw-r--r--include/cru/ui/controls/container.hpp8
-rw-r--r--include/cru/ui/controls/flex_layout.hpp32
-rw-r--r--include/cru/ui/controls/stack_layout.hpp6
-rw-r--r--include/cru/ui/controls/text_block.hpp8
-rw-r--r--include/cru/ui/controls/text_box.hpp9
-rw-r--r--include/cru/ui/controls/text_common.hpp3
7 files changed, 7 insertions, 67 deletions
diff --git a/include/cru/ui/controls/button.hpp b/include/cru/ui/controls/button.hpp
index b24a9934..a95b75ce 100644
--- a/include/cru/ui/controls/button.hpp
+++ b/include/cru/ui/controls/button.hpp
@@ -2,14 +2,8 @@
#include "../content_control.hpp"
#include "../click_detector.hpp"
-#include "../render/border_render_object.hpp"
-#include "cru/platform/native/basic_types.hpp"
-
-#include <memory>
namespace cru::ui::controls {
-using render::CornerRadius;
-
struct ButtonStateStyle {
std::shared_ptr<platform::graph::IBrush> border_brush;
Thickness border_thickness;
@@ -43,7 +37,7 @@ class Button : public ContentControl {
Button(Button&& other) = delete;
Button& operator=(const Button& other) = delete;
Button& operator=(Button&& other) = delete;
- ~Button() override = default;
+ ~Button() override;
std::string_view GetControlType() const final { return control_type; }
diff --git a/include/cru/ui/controls/container.hpp b/include/cru/ui/controls/container.hpp
index efc099f7..d6aa5635 100644
--- a/include/cru/ui/controls/container.hpp
+++ b/include/cru/ui/controls/container.hpp
@@ -1,10 +1,6 @@
#pragma once
#include "../content_control.hpp"
-namespace cru::ui::render {
-class BorderRenderObject;
-}
-
namespace cru::ui::controls {
class Container : public ContentControl {
static constexpr std::string_view control_type = "Container";
@@ -19,9 +15,7 @@ class Container : public ContentControl {
~Container() override;
public:
- std::string_view GetControlType() const final {
- return control_type;
- }
+ std::string_view GetControlType() const final { return control_type; }
render::RenderObject* GetRenderObject() const override;
diff --git a/include/cru/ui/controls/flex_layout.hpp b/include/cru/ui/controls/flex_layout.hpp
index 7861534a..52eaec75 100644
--- a/include/cru/ui/controls/flex_layout.hpp
+++ b/include/cru/ui/controls/flex_layout.hpp
@@ -1,17 +1,7 @@
#pragma once
#include "../layout_control.hpp"
-#include "../render/flex_layout_render_object.hpp"
-
-#include <memory>
-
namespace cru::ui::controls {
-// import these basic entities
-using render::FlexChildLayoutData;
-using render::FlexCrossAlignment;
-using render::FlexDirection;
-using render::FlexMainAlignment;
-
class FlexLayout : public LayoutControl {
public:
static constexpr std::string_view control_type = "FlexLayout";
@@ -26,29 +16,17 @@ class FlexLayout : public LayoutControl {
FlexLayout(FlexLayout&& other) = delete;
FlexLayout& operator=(const FlexLayout& other) = delete;
FlexLayout& operator=(FlexLayout&& other) = delete;
- ~FlexLayout() override = default;
+ ~FlexLayout() override;
std::string_view GetControlType() const final { return control_type; }
render::RenderObject* GetRenderObject() const override;
- FlexMainAlignment GetContentMainAlign() const {
- return render_object_->GetContentMainAlign();
- }
-
- void SetContentMainAlign(FlexMainAlignment value) {
- if (value == GetContentMainAlign()) return;
- render_object_->SetContentMainAlign(value);
- }
-
- FlexDirection GetFlexDirection() const {
- return render_object_->GetFlexDirection();
- }
+ FlexMainAlignment GetContentMainAlign() const;
+ void SetContentMainAlign(FlexMainAlignment value);
- void SetFlexDirection(FlexDirection direction) {
- if (direction == GetFlexDirection()) return;
- render_object_->SetFlexDirection(direction);
- }
+ FlexDirection GetFlexDirection() const;
+ void SetFlexDirection(FlexDirection direction);
FlexChildLayoutData GetChildLayoutData(Control* control);
void SetChildLayoutData(Control* control, const FlexChildLayoutData& data);
diff --git a/include/cru/ui/controls/stack_layout.hpp b/include/cru/ui/controls/stack_layout.hpp
index 298de089..93861c19 100644
--- a/include/cru/ui/controls/stack_layout.hpp
+++ b/include/cru/ui/controls/stack_layout.hpp
@@ -1,12 +1,6 @@
#pragma once
#include "../layout_control.hpp"
-#include <memory>
-
-namespace cru::ui::render {
-class StackLayoutRenderObject;
-}
-
namespace cru::ui::controls {
class StackLayout : public LayoutControl {
public:
diff --git a/include/cru/ui/controls/text_block.hpp b/include/cru/ui/controls/text_block.hpp
index 02e0eb2b..db0fb4e5 100644
--- a/include/cru/ui/controls/text_block.hpp
+++ b/include/cru/ui/controls/text_block.hpp
@@ -3,14 +3,6 @@
#include "text_common.hpp"
-#include <memory>
-
-namespace cru::ui::render {
-class StackLayoutRenderObject;
-class TextRenderObject;
-class CanvasRenderObject;
-} // namespace cru::ui::render
-
namespace cru::ui::controls {
class TextBlock : public NoChildControl, public virtual ITextControl {
public:
diff --git a/include/cru/ui/controls/text_box.hpp b/include/cru/ui/controls/text_box.hpp
index 888a9527..a7e4dfa0 100644
--- a/include/cru/ui/controls/text_box.hpp
+++ b/include/cru/ui/controls/text_box.hpp
@@ -1,15 +1,6 @@
#pragma once
#include "../no_child_control.hpp"
-#include <memory>
-
-namespace cru::ui::render {
-class BorderRenderObject;
-class StackLayoutRenderObject;
-class TextRenderObject;
-class CanvasRenderObject;
-} // namespace cru::ui::render
-
namespace cru::ui::controls {
class TextBox : public NoChildControl {
public:
diff --git a/include/cru/ui/controls/text_common.hpp b/include/cru/ui/controls/text_common.hpp
index fbef6b06..64a9666c 100644
--- a/include/cru/ui/controls/text_common.hpp
+++ b/include/cru/ui/controls/text_common.hpp
@@ -3,9 +3,6 @@
#include "cru/ui/ui_event.hpp"
-#include <functional>
-#include <optional>
-
namespace cru::platform::graph {
struct IBrush;
}