aboutsummaryrefslogtreecommitdiff
path: root/include/cru
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-01-17 22:55:09 +0800
committercrupest <crupest@outlook.com>2022-01-17 22:55:09 +0800
commit67dd012c0f49898f1734c46d3bb264f59d056a8e (patch)
tree780dc9c50868a8e7b89e68b463a60745fce72ae9 /include/cru
parent81f7d5faaaf79149070a901a4f299aee70c46379 (diff)
downloadcru-67dd012c0f49898f1734c46d3bb264f59d056a8e.tar.gz
cru-67dd012c0f49898f1734c46d3bb264f59d056a8e.tar.bz2
cru-67dd012c0f49898f1734c46d3bb264f59d056a8e.zip
...
Diffstat (limited to 'include/cru')
-rw-r--r--include/cru/ui/Base.hpp10
-rw-r--r--include/cru/ui/ThemeManager.hpp6
-rw-r--r--include/cru/ui/UiManager.hpp2
-rw-r--r--include/cru/ui/components/Component.hpp2
-rw-r--r--include/cru/ui/components/Menu.hpp6
-rw-r--r--include/cru/ui/controls/Button.hpp2
-rw-r--r--include/cru/ui/controls/Container.hpp2
-rw-r--r--include/cru/ui/controls/ContentControl.hpp2
-rw-r--r--include/cru/ui/controls/Control.hpp2
-rw-r--r--include/cru/ui/controls/FlexLayout.hpp2
-rw-r--r--include/cru/ui/controls/IBorderControl.hpp2
-rw-r--r--include/cru/ui/controls/IClickableControl.hpp2
-rw-r--r--include/cru/ui/controls/LayoutControl.hpp2
-rw-r--r--include/cru/ui/controls/NoChildControl.hpp2
-rw-r--r--include/cru/ui/controls/Popup.hpp2
-rw-r--r--include/cru/ui/controls/RootControl.hpp2
-rw-r--r--include/cru/ui/controls/ScrollView.hpp2
-rw-r--r--include/cru/ui/controls/StackLayout.hpp2
-rw-r--r--include/cru/ui/controls/TextBlock.hpp2
-rw-r--r--include/cru/ui/controls/TextBox.hpp5
-rw-r--r--include/cru/ui/controls/TextHostControlService.hpp4
-rw-r--r--include/cru/ui/controls/Window.hpp2
-rw-r--r--include/cru/ui/events/MouseEventArgs.hpp2
-rw-r--r--include/cru/ui/helper/ClickDetector.hpp2
-rw-r--r--include/cru/ui/helper/ShortcutHub.hpp2
-rw-r--r--include/cru/ui/host/LayoutPaintCycler.hpp2
-rw-r--r--include/cru/ui/host/WindowHost.hpp2
-rw-r--r--include/cru/ui/mapper/Mapper.hpp82
-rw-r--r--include/cru/ui/mapper/MapperRegistry.hpp26
-rw-r--r--include/cru/ui/render/BorderRenderObject.hpp2
-rw-r--r--include/cru/ui/render/CanvasRenderObject.hpp2
-rw-r--r--include/cru/ui/render/FlexLayoutRenderObject.hpp2
-rw-r--r--include/cru/ui/render/LayoutRenderObject.hpp2
-rw-r--r--include/cru/ui/render/RenderObject.hpp2
-rw-r--r--include/cru/ui/render/ScrollBar.hpp12
-rw-r--r--include/cru/ui/render/ScrollRenderObject.hpp2
-rw-r--r--include/cru/ui/render/StackLayoutRenderObject.hpp2
-rw-r--r--include/cru/ui/render/TextRenderObject.hpp2
-rw-r--r--include/cru/ui/xml/XmlMapper.hpp0
-rw-r--r--include/cru/ui/xml/XmlMapperRegistry.hpp0
40 files changed, 163 insertions, 48 deletions
diff --git a/include/cru/ui/Base.hpp b/include/cru/ui/Base.hpp
index fbdfec77..a8176b0d 100644
--- a/include/cru/ui/Base.hpp
+++ b/include/cru/ui/Base.hpp
@@ -8,6 +8,16 @@
#include <optional>
#include <vector>
+#ifdef CRU_PLATFORM_WINDOWS
+#ifdef CRU_UI_EXPORT_API
+#define CRU_UI_API __declspec(dllexport)
+#else
+#define CRU_UI_API __declspec(dllimport)
+#endif
+#else
+#define CRU_UI_API
+#endif
+
namespace cru::ui {
//-------------------- region: import --------------------
using cru::platform::Color;
diff --git a/include/cru/ui/ThemeManager.hpp b/include/cru/ui/ThemeManager.hpp
index 45cd810c..07b5f57b 100644
--- a/include/cru/ui/ThemeManager.hpp
+++ b/include/cru/ui/ThemeManager.hpp
@@ -8,17 +8,17 @@
#include <unordered_map>
namespace cru::ui {
-class ThemeResourceKeyNotExistException : public Exception {
+class CRU_UI_API ThemeResourceKeyNotExistException : public Exception {
public:
using Exception::Exception;
};
-class BadThemeResourceException : public Exception {
+class CRU_UI_API BadThemeResourceException : public Exception {
public:
using Exception::Exception;
};
-class ThemeManager : public Object {
+class CRU_UI_API ThemeManager : public Object {
public:
static ThemeManager* GetInstance();
diff --git a/include/cru/ui/UiManager.hpp b/include/cru/ui/UiManager.hpp
index e617dea8..4a2a7a77 100644
--- a/include/cru/ui/UiManager.hpp
+++ b/include/cru/ui/UiManager.hpp
@@ -26,7 +26,7 @@ struct ThemeResources {
style::StyleRuleSet menu_item_style;
};
-class UiManager : public Object {
+class CRU_UI_API UiManager : public Object {
public:
static UiManager* GetInstance();
diff --git a/include/cru/ui/components/Component.hpp b/include/cru/ui/components/Component.hpp
index 0dfc587b..4cbc3791 100644
--- a/include/cru/ui/components/Component.hpp
+++ b/include/cru/ui/components/Component.hpp
@@ -5,7 +5,7 @@ namespace cru::ui::components {
// In destructor, component should check all owned controls whether it is
// attached to window, if not, destroy them, otherwise it is host's duty to
// destroy them.
-class Component : public Object {
+class CRU_UI_API Component : public Object {
public:
Component() = default;
diff --git a/include/cru/ui/components/Menu.hpp b/include/cru/ui/components/Menu.hpp
index b409c4c0..9b60eb02 100644
--- a/include/cru/ui/components/Menu.hpp
+++ b/include/cru/ui/components/Menu.hpp
@@ -11,7 +11,7 @@
#include <vector>
namespace cru::ui::components {
-class MenuItem : public Component {
+class CRU_UI_API MenuItem : public Component {
public:
MenuItem();
explicit MenuItem(String text);
@@ -36,7 +36,7 @@ class MenuItem : public Component {
std::function<void()> on_click_;
};
-class Menu : public Component {
+class CRU_UI_API Menu : public Component {
public:
Menu();
@@ -73,7 +73,7 @@ class Menu : public Component {
std::function<void(Index)> on_item_click_;
};
-class PopupMenu : public Component {
+class CRU_UI_API PopupMenu : public Component {
public:
explicit PopupMenu(controls::Control* attached_control = nullptr);
diff --git a/include/cru/ui/controls/Button.hpp b/include/cru/ui/controls/Button.hpp
index e0335a39..77e0989c 100644
--- a/include/cru/ui/controls/Button.hpp
+++ b/include/cru/ui/controls/Button.hpp
@@ -8,7 +8,7 @@
#include "cru/ui/style/ApplyBorderStyleInfo.hpp"
namespace cru::ui::controls {
-class Button : public ContentControl,
+class CRU_UI_API Button : public ContentControl,
public virtual IClickableControl,
public virtual IBorderControl {
public:
diff --git a/include/cru/ui/controls/Container.hpp b/include/cru/ui/controls/Container.hpp
index f992c152..4385c23f 100644
--- a/include/cru/ui/controls/Container.hpp
+++ b/include/cru/ui/controls/Container.hpp
@@ -2,7 +2,7 @@
#include "ContentControl.hpp"
namespace cru::ui::controls {
-class Container : public ContentControl {
+class CRU_UI_API Container : public ContentControl {
static constexpr StringView control_type = u"Container";
protected:
diff --git a/include/cru/ui/controls/ContentControl.hpp b/include/cru/ui/controls/ContentControl.hpp
index 1bdaf7e4..7b40de64 100644
--- a/include/cru/ui/controls/ContentControl.hpp
+++ b/include/cru/ui/controls/ContentControl.hpp
@@ -4,7 +4,7 @@
#include "cru/ui/render/RenderObject.hpp"
namespace cru::ui::controls {
-class ContentControl : public Control {
+class CRU_UI_API ContentControl : public Control {
protected:
ContentControl() = default;
diff --git a/include/cru/ui/controls/Control.hpp b/include/cru/ui/controls/Control.hpp
index 29d48f21..ed6233a9 100644
--- a/include/cru/ui/controls/Control.hpp
+++ b/include/cru/ui/controls/Control.hpp
@@ -8,7 +8,7 @@
#include <string_view>
namespace cru::ui::controls {
-class Control : public Object {
+class CRU_UI_API Control : public Object {
friend host::WindowHost;
protected:
diff --git a/include/cru/ui/controls/FlexLayout.hpp b/include/cru/ui/controls/FlexLayout.hpp
index f4e186db..7724c4c6 100644
--- a/include/cru/ui/controls/FlexLayout.hpp
+++ b/include/cru/ui/controls/FlexLayout.hpp
@@ -2,7 +2,7 @@
#include "LayoutControl.hpp"
namespace cru::ui::controls {
-class FlexLayout : public LayoutControl {
+class CRU_UI_API FlexLayout : public LayoutControl {
public:
static constexpr StringView control_type = u"FlexLayout";
diff --git a/include/cru/ui/controls/IBorderControl.hpp b/include/cru/ui/controls/IBorderControl.hpp
index 817305ef..a8bc0b51 100644
--- a/include/cru/ui/controls/IBorderControl.hpp
+++ b/include/cru/ui/controls/IBorderControl.hpp
@@ -4,7 +4,7 @@
#include "cru/common/Base.hpp"
namespace cru::ui::controls {
-struct IBorderControl : virtual Interface {
+struct CRU_UI_API IBorderControl : virtual Interface {
virtual void ApplyBorderStyle(const style::ApplyBorderStyleInfo& style) = 0;
};
} // namespace cru::ui::controls
diff --git a/include/cru/ui/controls/IClickableControl.hpp b/include/cru/ui/controls/IClickableControl.hpp
index aa7f13ab..af9ae100 100644
--- a/include/cru/ui/controls/IClickableControl.hpp
+++ b/include/cru/ui/controls/IClickableControl.hpp
@@ -5,7 +5,7 @@
#include "cru/ui/helper/ClickDetector.hpp"
namespace cru::ui::controls {
-struct IClickableControl : virtual Interface {
+struct CRU_UI_API IClickableControl : virtual Interface {
virtual helper::ClickState GetClickState() = 0;
virtual IEvent<helper::ClickState>* ClickStateChangeEvent() = 0;
};
diff --git a/include/cru/ui/controls/LayoutControl.hpp b/include/cru/ui/controls/LayoutControl.hpp
index 381df1df..3999e9bc 100644
--- a/include/cru/ui/controls/LayoutControl.hpp
+++ b/include/cru/ui/controls/LayoutControl.hpp
@@ -2,7 +2,7 @@
#include "Control.hpp"
namespace cru::ui::controls {
-class LayoutControl : public Control {
+class CRU_UI_API LayoutControl : public Control {
protected:
LayoutControl() = default;
explicit LayoutControl(render::RenderObject* container_render_object)
diff --git a/include/cru/ui/controls/NoChildControl.hpp b/include/cru/ui/controls/NoChildControl.hpp
index 562137f1..0c432532 100644
--- a/include/cru/ui/controls/NoChildControl.hpp
+++ b/include/cru/ui/controls/NoChildControl.hpp
@@ -2,7 +2,7 @@
#include "Control.hpp"
namespace cru::ui::controls {
-class NoChildControl : public Control {
+class CRU_UI_API NoChildControl : public Control {
protected:
NoChildControl() = default;
diff --git a/include/cru/ui/controls/Popup.hpp b/include/cru/ui/controls/Popup.hpp
index 2e40bb5b..4076e45b 100644
--- a/include/cru/ui/controls/Popup.hpp
+++ b/include/cru/ui/controls/Popup.hpp
@@ -6,7 +6,7 @@
#include <memory>
namespace cru::ui::controls {
-class Popup : public RootControl {
+class CRU_UI_API Popup : public RootControl {
public:
static constexpr StringView kControlType = u"Popup";
diff --git a/include/cru/ui/controls/RootControl.hpp b/include/cru/ui/controls/RootControl.hpp
index c3f3da9f..f70f2eeb 100644
--- a/include/cru/ui/controls/RootControl.hpp
+++ b/include/cru/ui/controls/RootControl.hpp
@@ -9,7 +9,7 @@
#include "cru/ui/host/WindowHost.hpp"
namespace cru::ui::controls {
-class RootControl : public LayoutControl {
+class CRU_UI_API RootControl : public LayoutControl {
protected:
explicit RootControl(Control* attached_control);
diff --git a/include/cru/ui/controls/ScrollView.hpp b/include/cru/ui/controls/ScrollView.hpp
index 4edf1706..18a9bf97 100644
--- a/include/cru/ui/controls/ScrollView.hpp
+++ b/include/cru/ui/controls/ScrollView.hpp
@@ -8,7 +8,7 @@
#include <string_view>
namespace cru::ui::controls {
-class ScrollView : public ContentControl {
+class CRU_UI_API ScrollView : public ContentControl {
public:
static ScrollView* Create() { return new ScrollView(); }
diff --git a/include/cru/ui/controls/StackLayout.hpp b/include/cru/ui/controls/StackLayout.hpp
index 6128f4ef..657cadc6 100644
--- a/include/cru/ui/controls/StackLayout.hpp
+++ b/include/cru/ui/controls/StackLayout.hpp
@@ -2,7 +2,7 @@
#include "LayoutControl.hpp"
namespace cru::ui::controls {
-class StackLayout : public LayoutControl {
+class CRU_UI_API StackLayout : public LayoutControl {
public:
static constexpr StringView control_type = u"StackLayout";
diff --git a/include/cru/ui/controls/TextBlock.hpp b/include/cru/ui/controls/TextBlock.hpp
index 710a39d8..68e9ced1 100644
--- a/include/cru/ui/controls/TextBlock.hpp
+++ b/include/cru/ui/controls/TextBlock.hpp
@@ -4,7 +4,7 @@
#include "TextHostControlService.hpp"
namespace cru::ui::controls {
-class TextBlock : public NoChildControl, public virtual ITextHostControl {
+class CRU_UI_API TextBlock : public NoChildControl, public virtual ITextHostControl {
public:
static constexpr StringView control_type = u"TextBlock";
diff --git a/include/cru/ui/controls/TextBox.hpp b/include/cru/ui/controls/TextBox.hpp
index baca6e3e..241a8a16 100644
--- a/include/cru/ui/controls/TextBox.hpp
+++ b/include/cru/ui/controls/TextBox.hpp
@@ -7,10 +7,7 @@
#include <memory>
namespace cru::ui::controls {
-template <typename TControl>
-class TextControlService;
-
-class TextBox : public NoChildControl,
+class CRU_UI_API TextBox : public NoChildControl,
public virtual IBorderControl,
public virtual ITextHostControl {
public:
diff --git a/include/cru/ui/controls/TextHostControlService.hpp b/include/cru/ui/controls/TextHostControlService.hpp
index 7c0fbcda..be6a7c39 100644
--- a/include/cru/ui/controls/TextHostControlService.hpp
+++ b/include/cru/ui/controls/TextHostControlService.hpp
@@ -22,7 +22,7 @@ class PopupMenu;
namespace cru::ui::controls {
constexpr int k_default_caret_blink_duration = 500;
-struct ITextHostControl : virtual Interface {
+struct CRU_UI_API ITextHostControl : virtual Interface {
virtual gsl::not_null<render::TextRenderObject*> GetTextRenderObject() = 0;
// May return nullptr.
virtual render::ScrollRenderObject* GetScrollRenderObject() = 0;
@@ -76,7 +76,7 @@ class TextControlMovePattern : public Object {
MoveFunction move_function_;
};
-class TextHostControlService : public Object {
+class CRU_UI_API TextHostControlService : public Object {
CRU_DEFINE_CLASS_LOG_TAG(u"cru::ui::controls::TextControlService")
public:
diff --git a/include/cru/ui/controls/Window.hpp b/include/cru/ui/controls/Window.hpp
index b0828f70..c304a839 100644
--- a/include/cru/ui/controls/Window.hpp
+++ b/include/cru/ui/controls/Window.hpp
@@ -5,7 +5,7 @@
#include "cru/common/Base.hpp"
namespace cru::ui::controls {
-class Window final : public RootControl {
+class CRU_UI_API Window final : public RootControl {
public:
static constexpr StringView control_type = u"Window";
diff --git a/include/cru/ui/events/MouseEventArgs.hpp b/include/cru/ui/events/MouseEventArgs.hpp
index 1e6ddc95..0adc65b6 100644
--- a/include/cru/ui/events/MouseEventArgs.hpp
+++ b/include/cru/ui/events/MouseEventArgs.hpp
@@ -4,7 +4,7 @@
#include <optional>
namespace cru::ui::events {
-class MouseEventArgs : public UiEventArgs {
+class CRU_UI_API MouseEventArgs : public UiEventArgs {
public:
MouseEventArgs(Object* sender, Object* original_sender,
const std::optional<Point>& point = std::nullopt)
diff --git a/include/cru/ui/helper/ClickDetector.hpp b/include/cru/ui/helper/ClickDetector.hpp
index b58297b1..fd80a953 100644
--- a/include/cru/ui/helper/ClickDetector.hpp
+++ b/include/cru/ui/helper/ClickDetector.hpp
@@ -2,7 +2,7 @@
#include "../controls/Control.hpp"
namespace cru::ui::helper {
-class ClickEventArgs : Object {
+class CRU_UI_API ClickEventArgs : Object {
public:
ClickEventArgs(controls::Control* sender, const Point& down_point,
const Point& up_point, MouseButton button)
diff --git a/include/cru/ui/helper/ShortcutHub.hpp b/include/cru/ui/helper/ShortcutHub.hpp
index be5347ef..c7054786 100644
--- a/include/cru/ui/helper/ShortcutHub.hpp
+++ b/include/cru/ui/helper/ShortcutHub.hpp
@@ -96,7 +96,7 @@ struct ShortcutInfo {
std::function<bool()> handler;
};
-class ShortcutHub : public Object {
+class CRU_UI_API ShortcutHub : public Object {
public:
ShortcutHub() = default;
diff --git a/include/cru/ui/host/LayoutPaintCycler.hpp b/include/cru/ui/host/LayoutPaintCycler.hpp
index 861fff41..1d44ad06 100644
--- a/include/cru/ui/host/LayoutPaintCycler.hpp
+++ b/include/cru/ui/host/LayoutPaintCycler.hpp
@@ -7,7 +7,7 @@
#include <chrono>
namespace cru::ui::host {
-class LayoutPaintCycler {
+class CRU_UI_API LayoutPaintCycler {
public:
explicit LayoutPaintCycler(WindowHost* host);
diff --git a/include/cru/ui/host/WindowHost.hpp b/include/cru/ui/host/WindowHost.hpp
index 2fc174c6..7832174c 100644
--- a/include/cru/ui/host/WindowHost.hpp
+++ b/include/cru/ui/host/WindowHost.hpp
@@ -17,7 +17,7 @@ class LayoutPaintCycler;
struct AfterLayoutEventArgs {};
// The bridge between control tree and native window.
-class WindowHost : public Object {
+class CRU_UI_API WindowHost : public Object {
CRU_DEFINE_CLASS_LOG_TAG(u"cru::ui::host::WindowHost")
public:
diff --git a/include/cru/ui/mapper/Mapper.hpp b/include/cru/ui/mapper/Mapper.hpp
new file mode 100644
index 00000000..f2d347f1
--- /dev/null
+++ b/include/cru/ui/mapper/Mapper.hpp
@@ -0,0 +1,82 @@
+#pragma once
+
+#include "../Base.hpp"
+
+#include "cru/common/Exception.hpp"
+#include "cru/xml/XmlNode.hpp"
+
+#include <typeindex>
+#include <typeinfo>
+
+namespace cru::ui::mapper {
+template <typename T>
+class Mapper;
+
+class CRU_UI_API MapperBase : public Object {
+ public:
+ explicit MapperBase(std::type_index type_index);
+
+ CRU_DELETE_COPY(MapperBase)
+ CRU_DELETE_MOVE(MapperBase)
+
+ ~MapperBase() override = default;
+
+ public:
+ std::type_index GetTypeIndex() const { return type_index_; }
+
+ template <typename T>
+ Mapper<T>* StaticCast() {
+ return static_cast<Mapper<T>*>(this);
+ }
+
+ template <typename T>
+ Mapper<T>* DynamicCast() {
+ return dynamic_cast<Mapper<T>*>(this);
+ }
+
+ private:
+ std::type_index type_index_;
+};
+
+template <typename T>
+class CRU_UI_API BasicMapper : public MapperBase {
+ public:
+ BasicMapper() : MapperBase(typeid(T)) {}
+
+ CRU_DELETE_COPY(BasicMapper)
+ CRU_DELETE_MOVE(BasicMapper)
+
+ ~BasicMapper() override;
+
+ virtual bool SupportMapFromString() { return false; }
+ virtual std::unique_ptr<T> MapFromString(String str) {
+ if (!SupportMapFromString()) {
+ throw Exception(u"This mapper does not support map from string.");
+ }
+
+ return DoMapFromString(str);
+ }
+
+ virtual bool SupportMapFromXml() { return false; }
+ virtual bool XmlElementIsOfThisType(xml::XmlElementNode* node) {
+ return false;
+ }
+ std::unique_ptr<T> MapFromXml(xml::XmlElementNode* node) {
+ if (!SupportMapFromXml()) {
+ throw new Exception(u"This mapper does not support map from xml.");
+ }
+
+ if (!XmlElementIsOfThisType(node)) {
+ throw new Exception(u"This xml element is not of mapping type.");
+ }
+
+ return DoMapFromXml(node);
+ }
+
+ protected:
+ virtual std::unique_ptr<T> DoMapFromString(String str) { return nullptr; }
+ virtual std::unique_ptr<T> DoMapFromXml(xml::XmlElementNode* node) {
+ return nullptr;
+ }
+};
+} // namespace cru::ui::mapper
diff --git a/include/cru/ui/mapper/MapperRegistry.hpp b/include/cru/ui/mapper/MapperRegistry.hpp
new file mode 100644
index 00000000..a170440d
--- /dev/null
+++ b/include/cru/ui/mapper/MapperRegistry.hpp
@@ -0,0 +1,26 @@
+#pragma once
+
+#include "Mapper.hpp"
+
+#include <memory>
+#include <vector>
+
+namespace cru::ui::mapper {
+class CRU_UI_API MapperRegistry {
+ public:
+ MapperRegistry();
+
+ CRU_DELETE_COPY(MapperRegistry)
+ CRU_DELETE_MOVE(MapperRegistry)
+
+ ~MapperRegistry();
+
+ const std::vector<MapperBase*>& GetAllMappers() const { return mapper_list_; }
+
+ void RegisterMapper(MapperBase* mapper);
+ void UnregisterMapper(MapperBase* mapper);
+
+ private:
+ std::vector<MapperBase*> mapper_list_;
+};
+} // namespace cru::ui::mapper
diff --git a/include/cru/ui/render/BorderRenderObject.hpp b/include/cru/ui/render/BorderRenderObject.hpp
index 5bed3cb0..bf4b27a1 100644
--- a/include/cru/ui/render/BorderRenderObject.hpp
+++ b/include/cru/ui/render/BorderRenderObject.hpp
@@ -6,7 +6,7 @@
#include "cru/ui/Base.hpp"
namespace cru::ui::render {
-class BorderRenderObject : public RenderObject {
+class CRU_UI_API BorderRenderObject : public RenderObject {
CRU_DEFINE_CLASS_LOG_TAG(u"cru::ui::render::BorderRenderObject")
public:
diff --git a/include/cru/ui/render/CanvasRenderObject.hpp b/include/cru/ui/render/CanvasRenderObject.hpp
index 58fee59c..68400271 100644
--- a/include/cru/ui/render/CanvasRenderObject.hpp
+++ b/include/cru/ui/render/CanvasRenderObject.hpp
@@ -5,7 +5,7 @@ namespace cru::ui::render {
// Layout logic:
// If no preferred size is set. Then (100, 100) is used and then coerced to
// required range.
-class CanvasRenderObject : public RenderObject {
+class CRU_UI_API CanvasRenderObject : public RenderObject {
public:
CanvasRenderObject();
diff --git a/include/cru/ui/render/FlexLayoutRenderObject.hpp b/include/cru/ui/render/FlexLayoutRenderObject.hpp
index a8154487..c6fb7211 100644
--- a/include/cru/ui/render/FlexLayoutRenderObject.hpp
+++ b/include/cru/ui/render/FlexLayoutRenderObject.hpp
@@ -75,7 +75,7 @@ namespace cru::ui::render {
// (if specified), then coerce the length to the min value but not report error
// and just fill the rest space with blank.
//
-class FlexLayoutRenderObject : public LayoutRenderObject<FlexChildLayoutData> {
+class CRU_UI_API FlexLayoutRenderObject : public LayoutRenderObject<FlexChildLayoutData> {
CRU_DEFINE_CLASS_LOG_TAG(u"cru::ui::render::FlexLayoutRenderObject")
public:
diff --git a/include/cru/ui/render/LayoutRenderObject.hpp b/include/cru/ui/render/LayoutRenderObject.hpp
index 732031a1..424a5831 100644
--- a/include/cru/ui/render/LayoutRenderObject.hpp
+++ b/include/cru/ui/render/LayoutRenderObject.hpp
@@ -5,7 +5,7 @@
namespace cru::ui::render {
template <typename TChildLayoutData>
-class LayoutRenderObject : public RenderObject {
+class CRU_UI_API LayoutRenderObject : public RenderObject {
public:
using ChildLayoutData = TChildLayoutData;
diff --git a/include/cru/ui/render/RenderObject.hpp b/include/cru/ui/render/RenderObject.hpp
index 0dd95c71..bac97640 100644
--- a/include/cru/ui/render/RenderObject.hpp
+++ b/include/cru/ui/render/RenderObject.hpp
@@ -39,7 +39,7 @@ namespace cru::ui::render {
// protected:
// Size OnMeasureContent(const MeasureRequirement& requirement) override;
// void OnLayoutContent(const Rect& content_rect) override;
-class RenderObject : public Object {
+class CRU_UI_API RenderObject : public Object {
friend host::WindowHost;
CRU_DEFINE_CLASS_LOG_TAG(u"cru::ui::render::RenderObject")
diff --git a/include/cru/ui/render/ScrollBar.hpp b/include/cru/ui/render/ScrollBar.hpp
index d6042719..f1007d4d 100644
--- a/include/cru/ui/render/ScrollBar.hpp
+++ b/include/cru/ui/render/ScrollBar.hpp
@@ -41,10 +41,10 @@ enum class ScrollBarAreaKind {
enum class ScrollBarBrushUsageKind { Arrow, ArrowBackground, Slot, Thumb };
enum class ScrollBarBrushStateKind { Normal, Hover, Press, Disable };
-String GenerateScrollBarThemeColorKey(ScrollBarBrushUsageKind usage,
- ScrollBarBrushStateKind state);
+String CRU_UI_API GenerateScrollBarThemeColorKey(ScrollBarBrushUsageKind usage,
+ ScrollBarBrushStateKind state);
-class ScrollBar : public Object {
+class CRU_UI_API ScrollBar : public Object {
public:
ScrollBar(gsl::not_null<ScrollRenderObject*> render_object,
Direction direction);
@@ -153,7 +153,7 @@ class ScrollBar : public Object {
platform::gui::TimerAutoCanceler auto_collapse_timer_canceler_;
};
-class HorizontalScrollBar : public ScrollBar {
+class CRU_UI_API HorizontalScrollBar : public ScrollBar {
public:
explicit HorizontalScrollBar(
gsl::not_null<ScrollRenderObject*> render_object);
@@ -186,7 +186,7 @@ class HorizontalScrollBar : public ScrollBar {
bool CanScrollDown() override;
};
-class VerticalScrollBar : public ScrollBar {
+class CRU_UI_API VerticalScrollBar : public ScrollBar {
public:
explicit VerticalScrollBar(gsl::not_null<ScrollRenderObject*> render_object);
@@ -219,7 +219,7 @@ class VerticalScrollBar : public ScrollBar {
};
// A delegate to draw scrollbar and register related events.
-class ScrollBarDelegate : public Object {
+class CRU_UI_API ScrollBarDelegate : public Object {
public:
explicit ScrollBarDelegate(gsl::not_null<ScrollRenderObject*> render_object);
diff --git a/include/cru/ui/render/ScrollRenderObject.hpp b/include/cru/ui/render/ScrollRenderObject.hpp
index 099c8cb5..19814c51 100644
--- a/include/cru/ui/render/ScrollRenderObject.hpp
+++ b/include/cru/ui/render/ScrollRenderObject.hpp
@@ -18,7 +18,7 @@ namespace cru::ui::render {
// Layout logic:
// If child is smaller than content area, layout at lefttop.
// Or layout by scroll state.
-class ScrollRenderObject : public RenderObject {
+class CRU_UI_API ScrollRenderObject : public RenderObject {
public:
ScrollRenderObject();
diff --git a/include/cru/ui/render/StackLayoutRenderObject.hpp b/include/cru/ui/render/StackLayoutRenderObject.hpp
index 4f15ad11..b7b1502c 100644
--- a/include/cru/ui/render/StackLayoutRenderObject.hpp
+++ b/include/cru/ui/render/StackLayoutRenderObject.hpp
@@ -21,7 +21,7 @@ namespace cru::ui::render {
//
// 4. If result size is smaller than min size (if specified), coerce result size
// to min size.
-class StackLayoutRenderObject
+class CRU_UI_API StackLayoutRenderObject
: public LayoutRenderObject<StackChildLayoutData> {
CRU_DEFINE_CLASS_LOG_TAG(u"cru::ui::render:StackLayoutRenderObject")
diff --git a/include/cru/ui/render/TextRenderObject.hpp b/include/cru/ui/render/TextRenderObject.hpp
index 4e72e839..601bd0a8 100644
--- a/include/cru/ui/render/TextRenderObject.hpp
+++ b/include/cru/ui/render/TextRenderObject.hpp
@@ -17,7 +17,7 @@ namespace cru::ui::render {
//
// If the result layout box is bigger than actual text box, then text is center
// aligned.
-class TextRenderObject : public RenderObject {
+class CRU_UI_API TextRenderObject : public RenderObject {
CRU_DEFINE_CLASS_LOG_TAG(u"cru::ui::render::TextRenderObject")
public:
diff --git a/include/cru/ui/xml/XmlMapper.hpp b/include/cru/ui/xml/XmlMapper.hpp
deleted file mode 100644
index e69de29b..00000000
--- a/include/cru/ui/xml/XmlMapper.hpp
+++ /dev/null
diff --git a/include/cru/ui/xml/XmlMapperRegistry.hpp b/include/cru/ui/xml/XmlMapperRegistry.hpp
deleted file mode 100644
index e69de29b..00000000
--- a/include/cru/ui/xml/XmlMapperRegistry.hpp
+++ /dev/null