aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui/controls
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/ui/controls')
-rw-r--r--include/cru/ui/controls/button.hpp17
-rw-r--r--include/cru/ui/controls/container.hpp4
-rw-r--r--include/cru/ui/controls/flex_layout.hpp4
-rw-r--r--include/cru/ui/controls/text_block.hpp12
4 files changed, 16 insertions, 21 deletions
diff --git a/include/cru/ui/controls/button.hpp b/include/cru/ui/controls/button.hpp
index d4a03e1d..60b1243f 100644
--- a/include/cru/ui/controls/button.hpp
+++ b/include/cru/ui/controls/button.hpp
@@ -3,24 +3,19 @@
#include "../click_detector.hpp"
#include "../render/border_render_object.hpp"
-#include "cru/platform/graph/brush.hpp"
#include "cru/platform/native/basic_types.hpp"
#include <memory>
-namespace cru::ui::render {
-class BorderRenderObject;
-}
-
namespace cru::ui::controls {
using render::CornerRadius;
struct ButtonStateStyle {
- std::shared_ptr<platform::graph::Brush> border_brush;
+ std::shared_ptr<platform::graph::IBrush> border_brush;
Thickness border_thickness;
CornerRadius border_radius;
- std::shared_ptr<platform::graph::Brush> foreground_brush;
- std::shared_ptr<platform::graph::Brush> background_brush;
+ std::shared_ptr<platform::graph::IBrush> foreground_brush;
+ std::shared_ptr<platform::graph::IBrush> background_brush;
};
struct ButtonStyle {
@@ -47,7 +42,7 @@ enum class ButtonState {
class Button : public ContentControl {
public:
- static constexpr auto control_type = L"Button";
+ static constexpr std::string_view control_type = "Button";
static Button* Create() { return new Button(); }
@@ -61,7 +56,7 @@ class Button : public ContentControl {
Button& operator=(Button&& other) = delete;
~Button() override = default;
- std::wstring_view GetControlType() const override final {
+ std::string_view GetControlType() const final {
return control_type;
}
@@ -96,7 +91,7 @@ class Button : public ContentControl {
}
private:
- std::shared_ptr<render::BorderRenderObject> render_object_{};
+ std::unique_ptr<render::BorderRenderObject> render_object_{};
ButtonState state_ = ButtonState::Normal;
diff --git a/include/cru/ui/controls/container.hpp b/include/cru/ui/controls/container.hpp
index 3c877067..efc099f7 100644
--- a/include/cru/ui/controls/container.hpp
+++ b/include/cru/ui/controls/container.hpp
@@ -7,7 +7,7 @@ class BorderRenderObject;
namespace cru::ui::controls {
class Container : public ContentControl {
- static constexpr auto control_type = L"Container";
+ static constexpr std::string_view control_type = "Container";
protected:
Container();
@@ -19,7 +19,7 @@ class Container : public ContentControl {
~Container() override;
public:
- std::wstring_view GetControlType() const override final {
+ std::string_view GetControlType() const final {
return control_type;
}
diff --git a/include/cru/ui/controls/flex_layout.hpp b/include/cru/ui/controls/flex_layout.hpp
index d8d92d08..ff8ec53b 100644
--- a/include/cru/ui/controls/flex_layout.hpp
+++ b/include/cru/ui/controls/flex_layout.hpp
@@ -15,7 +15,7 @@ using render::FlexMainAlignment;
class FlexLayout : public LayoutControl {
public:
- static constexpr auto control_type = L"FlexLayout";
+ static constexpr std::string_view control_type = "FlexLayout";
static FlexLayout* Create() { return new FlexLayout(); }
@@ -29,7 +29,7 @@ class FlexLayout : public LayoutControl {
FlexLayout& operator=(FlexLayout&& other) = delete;
~FlexLayout() override = default;
- std::wstring_view GetControlType() const override final {
+ std::string_view GetControlType() const final {
return control_type;
}
diff --git a/include/cru/ui/controls/text_block.hpp b/include/cru/ui/controls/text_block.hpp
index 45cd12b9..708b62f1 100644
--- a/include/cru/ui/controls/text_block.hpp
+++ b/include/cru/ui/controls/text_block.hpp
@@ -10,7 +10,7 @@ class TextRenderObject;
namespace cru::ui::controls {
class TextBlock : public NoChildControl {
public:
- static constexpr auto control_type = L"TextBlock";
+ static constexpr std::string_view control_type = "TextBlock";
static TextBlock* Create() { return new TextBlock(); }
@@ -22,18 +22,18 @@ class TextBlock : public NoChildControl {
TextBlock(TextBlock&& other) = delete;
TextBlock& operator=(const TextBlock& other) = delete;
TextBlock& operator=(TextBlock&& other) = delete;
- ~TextBlock() override = default;
+ ~TextBlock() override;
- std::wstring_view GetControlType() const override final {
+ std::string_view GetControlType() const final {
return control_type;
}
render::RenderObject* GetRenderObject() const override;
- std::wstring GetText() const;
- void SetText(std::wstring text);
+ std::string GetText() const;
+ void SetText(std::string text);
private:
- std::shared_ptr<render::TextRenderObject> render_object_;
+ std::unique_ptr<render::TextRenderObject> render_object_;
};
} // namespace cru::ui::controls