aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/ui')
-rw-r--r--include/cru/ui/Base.h11
-rw-r--r--include/cru/ui/ThemeManager.h13
-rw-r--r--include/cru/ui/ThemeResourceDictionary.h10
-rw-r--r--include/cru/ui/components/Input.h14
-rw-r--r--include/cru/ui/components/Menu.h8
-rw-r--r--include/cru/ui/components/PopupButton.h8
-rw-r--r--include/cru/ui/components/Select.h6
-rw-r--r--include/cru/ui/controls/IconButton.h6
-rw-r--r--include/cru/ui/controls/TextBlock.h8
-rw-r--r--include/cru/ui/controls/TextBox.h6
-rw-r--r--include/cru/ui/controls/TextHostControlService.h26
-rw-r--r--include/cru/ui/events/KeyEventArgs.h4
-rw-r--r--include/cru/ui/events/MouseButtonEventArgs.h13
-rw-r--r--include/cru/ui/events/MouseWheelEventArgs.h4
-rw-r--r--include/cru/ui/helper/ClickDetector.h2
-rw-r--r--include/cru/ui/helper/ShortcutHub.h18
-rw-r--r--include/cru/ui/mapper/Mapper.h4
-rw-r--r--include/cru/ui/mapper/StringMapper.h2
-rw-r--r--include/cru/ui/render/RenderObject.h2
-rw-r--r--include/cru/ui/render/ScrollBar.h2
-rw-r--r--include/cru/ui/render/TextRenderObject.h4
-rw-r--r--include/cru/ui/style/ApplyBorderStyleInfo.h2
22 files changed, 91 insertions, 82 deletions
diff --git a/include/cru/ui/Base.h b/include/cru/ui/Base.h
index b4b2f18e..3f270b39 100644
--- a/include/cru/ui/Base.h
+++ b/include/cru/ui/Base.h
@@ -1,7 +1,9 @@
#pragma once
-#include "cru/base/Base.h"
-#include "cru/platform/graphics/Base.h"
-#include "cru/platform/gui/Base.h"
+#include <cru/base/Base.h>
+#include <cru/platform/Color.h>
+#include <cru/platform/GraphicsBase.h>
+#include <cru/platform/Matrix.h>
+#include <cru/platform/gui/Input.h>
#ifdef CRU_IS_DLL
#ifdef CRU_UI_EXPORT_API
@@ -25,8 +27,7 @@ using cru::platform::Size;
using cru::platform::TextRange;
using cru::platform::Thickness;
using cru::platform::gui::MouseButton;
-
-namespace mouse_buttons = cru::platform::gui::mouse_buttons;
+using cru::platform::gui::MouseButtons;
namespace colors = cru::platform::colors;
diff --git a/include/cru/ui/ThemeManager.h b/include/cru/ui/ThemeManager.h
index 72ade899..10d90060 100644
--- a/include/cru/ui/ThemeManager.h
+++ b/include/cru/ui/ThemeManager.h
@@ -27,7 +27,7 @@ class CRU_UI_API ThemeManager : public Object {
std::unique_ptr<ThemeResourceDictionary> theme_resource_dictionary);
template <typename T>
- T GetResource(const String& key) {
+ T GetResource(std::string_view key) {
for (const auto& resource_dictionary : theme_resource_dictionary_list_) {
try {
return resource_dictionary->GetResource<T>(key);
@@ -35,18 +35,19 @@ class CRU_UI_API ThemeManager : public Object {
}
}
throw ThemeResourceKeyNotExistException(
- std::format("Theme resource key {} not exist.", key.ToUtf8()));
+ std::format("Theme resource key {} not exist.", key));
}
- String GetResourceString(const String& key);
+ std::string GetResourceString(std::string_view key);
std::shared_ptr<platform::graphics::IBrush> GetResourceBrush(
- const String& key);
+ std::string_view key);
- std::shared_ptr<platform::graphics::IFont> GetResourceFont(const String& key);
+ std::shared_ptr<platform::graphics::IFont> GetResourceFont(
+ std::string_view key);
std::shared_ptr<style::StyleRuleSet> GetResourceStyleRuleSet(
- const String& key);
+ std::string_view key);
IEvent<std::nullptr_t>* ThemeResourceChangeEvent() {
return &theme_resource_change_event_;
diff --git a/include/cru/ui/ThemeResourceDictionary.h b/include/cru/ui/ThemeResourceDictionary.h
index 0cbda01b..90cbe520 100644
--- a/include/cru/ui/ThemeResourceDictionary.h
+++ b/include/cru/ui/ThemeResourceDictionary.h
@@ -44,11 +44,11 @@ class CRU_UI_API ThemeResourceDictionary : public Object {
public:
template <typename T>
- T GetResource(const String& key) {
- auto find_result = resource_map_.find(key);
+ T GetResource(std::string_view key) {
+ auto find_result = resource_map_.find(std::string(key));
if (find_result == resource_map_.cend()) {
throw ThemeResourceKeyNotExistException(
- std::format("Theme resource key {} not exist.", key.ToUtf8()));
+ std::format("Theme resource key {} not exist.", key));
}
auto& cache = find_result->second.cache;
@@ -73,12 +73,12 @@ class CRU_UI_API ThemeResourceDictionary : public Object {
CRU_DEFAULT_COPY(ResourceEntry)
CRU_DEFAULT_MOVE(ResourceEntry)
- String name;
+ std::string name;
xml::XmlElementNode* xml_node;
std::unordered_map<std::type_index, std::any> cache;
};
std::unique_ptr<xml::XmlElementNode> xml_root_;
- std::unordered_map<String, ResourceEntry> resource_map_;
+ std::unordered_map<std::string, ResourceEntry> resource_map_;
};
} // namespace cru::ui
diff --git a/include/cru/ui/components/Input.h b/include/cru/ui/components/Input.h
index e808afd7..0f077983 100644
--- a/include/cru/ui/components/Input.h
+++ b/include/cru/ui/components/Input.h
@@ -5,17 +5,17 @@
namespace cru::ui::components {
struct CRU_UI_API InputValidateResult {
bool valid;
- String message;
+ std::string message;
};
struct CRU_UI_API IInputValidator : public virtual Interface {
- virtual InputValidateResult Validate(StringView text) const = 0;
+ virtual InputValidateResult Validate(std::string_view text) const = 0;
};
struct CRU_UI_API InputChangeEventArgs {
- String text;
+ std::string text;
bool valid;
- String message;
+ std::string message;
};
class CRU_UI_API Input : public Component {
@@ -26,8 +26,8 @@ class CRU_UI_API Input : public Component {
public:
controls::Control* GetRootControl() override;
- String GetText() const;
- void SetText(String text);
+ std::string GetText() const;
+ void SetText(std::string text);
IInputValidator* GetValidator() const;
void SetValidator(IInputValidator* validator);
@@ -48,7 +48,7 @@ class CRU_UI_API Input : public Component {
class CRU_UI_API FloatInputValidator : public Object,
public virtual IInputValidator {
public:
- InputValidateResult Validate(StringView text) const override;
+ InputValidateResult Validate(std::string_view text) const override;
std::optional<float> min;
std::optional<float> max;
diff --git a/include/cru/ui/components/Menu.h b/include/cru/ui/components/Menu.h
index 913f5c92..554a8898 100644
--- a/include/cru/ui/components/Menu.h
+++ b/include/cru/ui/components/Menu.h
@@ -14,7 +14,7 @@ namespace cru::ui::components {
class CRU_UI_API MenuItem : public Component {
public:
MenuItem();
- explicit MenuItem(String text);
+ explicit MenuItem(std::string text);
CRU_DELETE_COPY(MenuItem)
CRU_DELETE_MOVE(MenuItem)
@@ -24,7 +24,7 @@ class CRU_UI_API MenuItem : public Component {
public:
controls::Control* GetRootControl() override { return &container_; }
- void SetText(String text);
+ void SetText(std::string text);
void SetOnClick(std::function<void()> on_click) {
on_click_ = std::move(on_click);
@@ -55,10 +55,10 @@ class CRU_UI_API Menu : public Component {
Component* RemoveItemAt(Index index);
void ClearItems();
- void AddTextItem(String text, std::function<void()> on_click) {
+ void AddTextItem(std::string text, std::function<void()> on_click) {
AddTextItemAt(std::move(text), GetItemCount(), std::move(on_click));
}
- void AddTextItemAt(String text, Index index, std::function<void()> on_click);
+ void AddTextItemAt(std::string text, Index index, std::function<void()> on_click);
void SetOnItemClick(std::function<void(Index)> on_item_click) {
on_item_click_ = std::move(on_item_click);
diff --git a/include/cru/ui/components/PopupButton.h b/include/cru/ui/components/PopupButton.h
index c8ef9c50..5fa69044 100644
--- a/include/cru/ui/components/PopupButton.h
+++ b/include/cru/ui/components/PopupButton.h
@@ -18,14 +18,14 @@ class CRU_UI_API PopupMenuTextButton : public Component {
ui::controls::Button* GetButton() { return &button_; }
- String GetButtonText() { return button_text_.GetText(); }
- void SetButtonText(String text) { button_text_.SetText(std::move(text)); }
+ std::string GetButtonText() { return button_text_.GetText(); }
+ void SetButtonText(std::string text) { button_text_.SetText(std::move(text)); }
void SetButtonTextColor(const Color& color) {
button_text_.SetTextColor(color);
}
- void SetMenuItems(std::vector<String> items);
+ void SetMenuItems(std::vector<std::string> items);
IEvent<Index>* MenuItemSelectedEvent() { return &menu_item_selected_event_; }
@@ -47,7 +47,7 @@ class CRU_UI_API PopupMenuIconButton : public Component {
ui::controls::IconButton* GetButton() { return &button_; }
- void SetMenuItems(std::vector<String> items);
+ void SetMenuItems(std::vector<std::string> items);
IEvent<Index>* MenuItemSelectedEvent() { return &menu_item_selected_event_; }
diff --git a/include/cru/ui/components/Select.h b/include/cru/ui/components/Select.h
index d5ff0b43..9efe9a04 100644
--- a/include/cru/ui/components/Select.h
+++ b/include/cru/ui/components/Select.h
@@ -13,8 +13,8 @@ class CRU_UI_API Select : public Component {
public:
ui::controls::Control* GetRootControl() override { return &button_; }
- std::vector<String> GetItems() const { return items_; }
- void SetItems(std::vector<String> items);
+ std::vector<std::string> GetItems() const { return items_; }
+ void SetItems(std::vector<std::string> items);
Index GetSelectedIndex() const { return selected_index_; }
void SetSelectedIndex(Index index);
@@ -23,7 +23,7 @@ class CRU_UI_API Select : public Component {
private:
Index selected_index_;
- std::vector<String> items_;
+ std::vector<std::string> items_;
ui::controls::Button button_;
ui::controls::TextBlock button_text_;
diff --git a/include/cru/ui/controls/IconButton.h b/include/cru/ui/controls/IconButton.h
index 632450e2..9dbb3a3d 100644
--- a/include/cru/ui/controls/IconButton.h
+++ b/include/cru/ui/controls/IconButton.h
@@ -21,7 +21,7 @@ class CRU_UI_API IconButton : public NoChildControl,
public:
IconButton();
- IconButton(StringView icon_svg_path_data_string, const Rect& view_port);
+ IconButton(std::string_view icon_svg_path_data_string, const Rect& view_port);
~IconButton() override;
String GetControlType() const final { return kControlType.ToString(); }
@@ -84,10 +84,10 @@ class CRU_UI_API IconButton : public NoChildControl,
}
void SetIconFillColor(const Color& color);
- void SetIconWithSvgPathDataString(StringView icon_svg_path_data_string,
+ void SetIconWithSvgPathDataString(std::string_view icon_svg_path_data_string,
const Rect& view_port);
void SetIconWithSvgPathDataStringResourceKey(
- StringView icon_svg_path_data_string_resource_key, const Rect& view_port);
+ std::string_view icon_svg_path_data_string_resource_key, const Rect& view_port);
std::shared_ptr<platform::graphics::IBrush> GetContentBrush() const override {
return GetIconFillBrush();
diff --git a/include/cru/ui/controls/TextBlock.h b/include/cru/ui/controls/TextBlock.h
index 52e227eb..66330b23 100644
--- a/include/cru/ui/controls/TextBlock.h
+++ b/include/cru/ui/controls/TextBlock.h
@@ -16,8 +16,8 @@ class CRU_UI_API TextBlock : public NoChildControl,
public:
static constexpr StringView kControlType = u"TextBlock";
- static std::unique_ptr<TextBlock> Create(String text,
- bool selectable = false) {
+ static std::unique_ptr<TextBlock> Create(std::string text,
+ bool selectable = false) {
auto c = std::make_unique<TextBlock>();
c->SetText(std::move(text));
c->SetSelectable(selectable);
@@ -36,8 +36,8 @@ class CRU_UI_API TextBlock : public NoChildControl,
render::RenderObject* GetRenderObject() const override;
- String GetText() const;
- void SetText(String text);
+ std::string GetText() const;
+ void SetText(std::string text);
bool IsSelectable() const;
void SetSelectable(bool value);
diff --git a/include/cru/ui/controls/TextBox.h b/include/cru/ui/controls/TextBox.h
index 9388d3fd..13f5d356 100644
--- a/include/cru/ui/controls/TextBox.h
+++ b/include/cru/ui/controls/TextBox.h
@@ -37,9 +37,9 @@ class CRU_UI_API TextBox : public NoChildControl,
void ApplyBorderStyle(const style::ApplyBorderStyleInfo& style) override;
- String GetText() const { return service_->GetText(); }
- StringView GetTextView() const { return service_->GetTextView(); }
- void SetText(String text) { service_->SetText(std::move(text)); }
+ std::string GetText() const { return service_->GetText(); }
+ std::string_view GetTextView() const { return service_->GetTextView(); }
+ void SetText(std::string text) { service_->SetText(std::move(text)); }
IEvent<std::nullptr_t>* TextChangeEvent() {
return service_->TextChangeEvent();
diff --git a/include/cru/ui/controls/TextHostControlService.h b/include/cru/ui/controls/TextHostControlService.h
index 95f7a067..a945e427 100644
--- a/include/cru/ui/controls/TextHostControlService.h
+++ b/include/cru/ui/controls/TextHostControlService.h
@@ -48,10 +48,10 @@ class TextControlMovePattern : public Object {
static std::vector<TextControlMovePattern> kDefaultPatterns;
using MoveFunction =
- std::function<Index(TextHostControlService* service, StringView text,
- Index current_position)>;
+ std::function<Index(TextHostControlService* service,
+ std::string_view text, Index current_position)>;
- TextControlMovePattern(String name, helper::ShortcutKeyBind key_bind,
+ TextControlMovePattern(std::string name, helper::ShortcutKeyBind key_bind,
MoveFunction move_function)
: name_(std::move(name)),
key_bind_(key_bind),
@@ -63,15 +63,15 @@ class TextControlMovePattern : public Object {
~TextControlMovePattern() override = default;
public:
- String GetName() const { return name_; }
+ std::string GetName() const { return name_; }
helper::ShortcutKeyBind GetKeyBind() const { return key_bind_; }
- Index Move(TextHostControlService* service, StringView text,
+ Index Move(TextHostControlService* service, std::string_view text,
Index current_position) const {
return move_function_(service, text, current_position);
}
private:
- String name_;
+ std::string name_;
helper::ShortcutKeyBind key_bind_;
MoveFunction move_function_;
};
@@ -101,11 +101,11 @@ class CRU_UI_API TextHostControlService : public Object {
// If text contains line feed characters, it will be converted to space.
void SetMultiLine(bool multi_line);
- String GetText() { return this->text_; }
- StringView GetTextView() { return this->text_; }
- void SetText(String text, bool stop_composition = false);
+ std::string GetText() { return this->text_; }
+ std::string_view GetTextView() { return this->text_; }
+ void SetText(std::string text, bool stop_composition = false);
- void InsertText(Index position, StringView text,
+ void InsertText(Index position, std::string_view text,
bool stop_composition = false);
void DeleteChar(Index position, bool stop_composition = false);
@@ -126,7 +126,7 @@ class CRU_UI_API TextHostControlService : public Object {
Index GetCaretPosition() { return selection_.GetEnd(); }
TextRange GetSelection() { return selection_; }
- StringView GetSelectedText();
+ std::string_view GetSelectedText();
void SetSelection(Index caret_position);
void SetSelection(TextRange selection, bool scroll_to_caret = true);
@@ -139,7 +139,7 @@ class CRU_UI_API TextHostControlService : public Object {
void DeleteSelectedText();
// If some text is selected, then they are deleted first. Then insert text
// into caret position.
- void ReplaceSelectedText(StringView text);
+ void ReplaceSelectedText(std::string_view text);
void ScrollToCaret();
@@ -199,7 +199,7 @@ class CRU_UI_API TextHostControlService : public Object {
EventRevokerListGuard event_guard_;
EventRevokerListGuard input_method_context_event_guard_;
- String text_;
+ std::string text_;
TextRange selection_;
bool enable_ = false;
diff --git a/include/cru/ui/events/KeyEventArgs.h b/include/cru/ui/events/KeyEventArgs.h
index 0ece9126..bf6c8c0f 100644
--- a/include/cru/ui/events/KeyEventArgs.h
+++ b/include/cru/ui/events/KeyEventArgs.h
@@ -1,7 +1,7 @@
#pragma once
#include "UiEventArgs.h"
-#include "cru/platform/gui/Keyboard.h"
+#include "cru/platform/gui/Input.h"
namespace cru::ui::events {
class CRU_UI_API KeyEventArgs : public UiEventArgs {
@@ -26,4 +26,4 @@ class CRU_UI_API KeyEventArgs : public UiEventArgs {
platform::gui::KeyModifier key_modifier_;
};
-} // namespace cru::ui::event
+} // namespace cru::ui::events
diff --git a/include/cru/ui/events/MouseButtonEventArgs.h b/include/cru/ui/events/MouseButtonEventArgs.h
index 13b3b0a4..57a84cfb 100644
--- a/include/cru/ui/events/MouseButtonEventArgs.h
+++ b/include/cru/ui/events/MouseButtonEventArgs.h
@@ -1,20 +1,21 @@
#pragma once
#include "MouseEventArgs.h"
-#include "cru/platform/gui/Keyboard.h"
+#include "cru/platform/gui/Input.h"
namespace cru::ui::events {
class CRU_UI_API MouseButtonEventArgs : public MouseEventArgs {
public:
MouseButtonEventArgs(Object* sender, Object* original_sender,
- const Point& point, const MouseButton button,
+ const Point& point,
+ const platform::gui::MouseButton button,
platform::gui::KeyModifier key_modifier)
: MouseEventArgs(sender, original_sender, point),
button_(button),
key_modifier_(key_modifier) {}
MouseButtonEventArgs(Object* sender, Object* original_sender,
- const MouseButton button,
+ const platform::gui::MouseButton button,
platform::gui::KeyModifier key_modifier)
: MouseEventArgs(sender, original_sender),
button_(button),
@@ -25,11 +26,11 @@ class CRU_UI_API MouseButtonEventArgs : public MouseEventArgs {
MouseButtonEventArgs& operator=(MouseButtonEventArgs&& other) = default;
~MouseButtonEventArgs() override = default;
- MouseButton GetButton() const { return button_; }
+ platform::gui::MouseButton GetButton() const { return button_; }
platform::gui::KeyModifier GetKeyModifier() const { return key_modifier_; }
private:
- MouseButton button_;
+ platform::gui::MouseButton button_;
platform::gui::KeyModifier key_modifier_;
};
-} // namespace cru::ui::event
+} // namespace cru::ui::events
diff --git a/include/cru/ui/events/MouseWheelEventArgs.h b/include/cru/ui/events/MouseWheelEventArgs.h
index 85791491..9ed63924 100644
--- a/include/cru/ui/events/MouseWheelEventArgs.h
+++ b/include/cru/ui/events/MouseWheelEventArgs.h
@@ -1,7 +1,7 @@
#pragma once
#include "MouseEventArgs.h"
-#include "cru/platform/gui/Keyboard.h"
+#include <cru/platform/gui/Input.h>
namespace cru::ui::events {
class CRU_UI_API MouseWheelEventArgs : public MouseEventArgs {
@@ -26,4 +26,4 @@ class CRU_UI_API MouseWheelEventArgs : public MouseEventArgs {
float delta_;
platform::gui::KeyModifier key_modifier_;
};
-} // namespace cru::ui::event
+} // namespace cru::ui::events
diff --git a/include/cru/ui/helper/ClickDetector.h b/include/cru/ui/helper/ClickDetector.h
index ec63b92a..b83f0e20 100644
--- a/include/cru/ui/helper/ClickDetector.h
+++ b/include/cru/ui/helper/ClickDetector.h
@@ -79,7 +79,7 @@ class ClickDetector : public Object {
ClickState state_ = ClickState::None;
bool enable_ = true;
- MouseButton trigger_button_ = mouse_buttons::left | mouse_buttons::right;
+ MouseButton trigger_button_ = MouseButtons::Left | MouseButtons::Right;
Event<ClickEventArgs> event_;
Event<ClickState> state_change_event_;
diff --git a/include/cru/ui/helper/ShortcutHub.h b/include/cru/ui/helper/ShortcutHub.h
index 19d8c8c9..a5973ab5 100644
--- a/include/cru/ui/helper/ShortcutHub.h
+++ b/include/cru/ui/helper/ShortcutHub.h
@@ -4,7 +4,7 @@
#include "../events/KeyEventArgs.h"
#include "cru/base/Base.h"
#include "cru/base/Event.h"
-#include "cru/platform/gui/Keyboard.h"
+#include <cru/platform/gui/Input.h>
#include <cstddef>
#include <functional>
@@ -18,7 +18,7 @@ class ShortcutKeyBind {
public:
ShortcutKeyBind(
platform::gui::KeyCode key,
- platform::gui::KeyModifier modifier = platform::gui::KeyModifiers::none)
+ platform::gui::KeyModifier modifier = platform::gui::KeyModifiers::None)
: key_(key), modifier_(modifier) {}
CRU_DEFAULT_COPY(ShortcutKeyBind)
@@ -46,10 +46,10 @@ class ShortcutKeyBind {
return !this->operator==(other);
}
- String ToString() const {
- String result = u"(";
+ std::string ToString() const {
+ std::string result = "(";
result += platform::gui::ToString(modifier_);
- result += u")";
+ result += ")";
result += platform::gui::ToString(key_);
return result;
}
@@ -59,7 +59,7 @@ class ShortcutKeyBind {
platform::gui::KeyModifier modifier_;
};
-inline String ToString(const ShortcutKeyBind& key_bind) {
+inline std::string ToString(const ShortcutKeyBind& key_bind) {
return key_bind.ToString();
}
} // namespace cru::ui::helper
@@ -79,7 +79,7 @@ struct hash<cru::ui::helper::ShortcutKeyBind> {
namespace cru::ui::helper {
struct Shortcut {
// Just for debug.
- String name;
+ std::string name;
ShortcutKeyBind key_bind;
// Return true if it consumes the shortcut. Or return false if it does not
// handle the shortcut.
@@ -88,7 +88,7 @@ struct Shortcut {
struct ShortcutInfo {
int id;
- String name;
+ std::string name;
ShortcutKeyBind key_bind;
std::function<bool()> handler;
};
@@ -103,7 +103,7 @@ class CRU_UI_API ShortcutHub : public Object {
~ShortcutHub() override = default;
- int RegisterShortcut(String name, ShortcutKeyBind bind,
+ int RegisterShortcut(std::string name, ShortcutKeyBind bind,
std::function<bool()> handler) {
return RegisterShortcut({std::move(name), bind, std::move(handler)});
}
diff --git a/include/cru/ui/mapper/Mapper.h b/include/cru/ui/mapper/Mapper.h
index f7467120..709288f5 100644
--- a/include/cru/ui/mapper/Mapper.h
+++ b/include/cru/ui/mapper/Mapper.h
@@ -41,14 +41,14 @@ class CRU_UI_API MapperBase : public Object {
virtual bool XmlElementIsOfThisType(xml::XmlElementNode* node);
protected:
- void SetAllowedTags(std::vector<String> allowed_tags) {
+ void SetAllowedTags(std::vector<std::string> allowed_tags) {
allowed_tags_ = std::move(allowed_tags);
}
private:
std::type_index type_index_;
- std::vector<String> allowed_tags_;
+ std::vector<std::string> allowed_tags_;
};
template <typename T>
diff --git a/include/cru/ui/mapper/StringMapper.h b/include/cru/ui/mapper/StringMapper.h
index bfb7314b..01f58c77 100644
--- a/include/cru/ui/mapper/StringMapper.h
+++ b/include/cru/ui/mapper/StringMapper.h
@@ -1,6 +1,8 @@
#pragma once
#include "Mapper.h"
+#include <cru/base/String.h>
+
namespace cru::ui::mapper {
class CRU_UI_API StringMapper : public BasicMapper<String> {
public:
diff --git a/include/cru/ui/render/RenderObject.h b/include/cru/ui/render/RenderObject.h
index 80fa2e10..eba3b6c4 100644
--- a/include/cru/ui/render/RenderObject.h
+++ b/include/cru/ui/render/RenderObject.h
@@ -4,6 +4,8 @@
#include "MeasureRequirement.h"
#include "cru/base/String.h"
+#include <cru/platform/graphics/Painter.h>
+
namespace cru::ui::render {
struct BoxConstraint {
static const BoxConstraint kNotLimit;
diff --git a/include/cru/ui/render/ScrollBar.h b/include/cru/ui/render/ScrollBar.h
index 45f80389..fbe14244 100644
--- a/include/cru/ui/render/ScrollBar.h
+++ b/include/cru/ui/render/ScrollBar.h
@@ -39,7 +39,7 @@ enum class ScrollBarAreaKind {
enum class ScrollBarBrushUsageKind { Arrow, ArrowBackground, Slot, Thumb };
enum class ScrollBarBrushStateKind { Normal, Hover, Press, Disable };
-String CRU_UI_API GenerateScrollBarThemeColorKey(ScrollBarBrushUsageKind usage,
+std::string CRU_UI_API GenerateScrollBarThemeColorKey(ScrollBarBrushUsageKind usage,
ScrollBarBrushStateKind state);
class CRU_UI_API ScrollBar : public Object {
diff --git a/include/cru/ui/render/TextRenderObject.h b/include/cru/ui/render/TextRenderObject.h
index 72958f6f..b8d1882d 100644
--- a/include/cru/ui/render/TextRenderObject.h
+++ b/include/cru/ui/render/TextRenderObject.h
@@ -35,8 +35,8 @@ class CRU_UI_API TextRenderObject : public RenderObject {
TextRenderObject& operator=(TextRenderObject&& other) = delete;
~TextRenderObject() override;
- String GetText() const;
- void SetText(String new_text);
+ std::string GetText() const;
+ void SetText(std::string new_text);
std::shared_ptr<platform::graphics::IBrush> GetBrush() { return brush_; }
void SetBrush(std::shared_ptr<platform::graphics::IBrush> new_brush);
diff --git a/include/cru/ui/style/ApplyBorderStyleInfo.h b/include/cru/ui/style/ApplyBorderStyleInfo.h
index 2a3a7db1..857f73f8 100644
--- a/include/cru/ui/style/ApplyBorderStyleInfo.h
+++ b/include/cru/ui/style/ApplyBorderStyleInfo.h
@@ -1,6 +1,8 @@
#pragma once
#include "../Base.h"
+#include <cru/platform/graphics/Brush.h>
+
#include <optional>
namespace cru::ui::style {