aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CruUI.vcxproj15
-rw-r--r--CruUI.vcxproj.filters21
-rw-r--r--src/application.cpp5
-rw-r--r--src/application.hpp2
-rw-r--r--src/cru_debug.cpp2
-rw-r--r--src/exception.hpp2
-rw-r--r--src/graph/graph.hpp8
-rw-r--r--src/system_headers.hpp20
-rw-r--r--src/timer.hpp2
-rw-r--r--src/ui/control.cpp9
-rw-r--r--src/ui/control.hpp14
-rw-r--r--src/ui/controls/button.cpp0
-rw-r--r--src/ui/controls/button.hpp8
-rw-r--r--src/ui/controls/text_block.cpp2
-rw-r--r--src/ui/cursor.cpp24
-rw-r--r--src/ui/cursor.hpp37
-rw-r--r--src/ui/d2d_util.hpp2
-rw-r--r--src/ui/events/ui_event.cpp6
-rw-r--r--src/ui/events/ui_event.hpp45
-rw-r--r--src/ui/events/window_event.cpp3
-rw-r--r--src/ui/events/window_event.hpp42
-rw-r--r--src/ui/input_util.cpp2
-rw-r--r--src/ui/render/text_render_object.cpp2
-rw-r--r--src/ui/ui_manager.cpp2
-rw-r--r--src/ui/ui_manager.hpp3
-rw-r--r--src/ui/window.cpp23
-rw-r--r--src/ui/window.hpp6
-rw-r--r--src/ui/window_class.hpp2
-rw-r--r--src/util/string_util.cpp5
29 files changed, 114 insertions, 200 deletions
diff --git a/CruUI.vcxproj b/CruUI.vcxproj
index 374a882c..4143bb43 100644
--- a/CruUI.vcxproj
+++ b/CruUI.vcxproj
@@ -83,6 +83,7 @@
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
+ <AdditionalDependencies>D3D11.lib;D2d1.lib;DWrite.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -100,6 +101,7 @@
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
+ <AdditionalDependencies>D3D11.lib;D2d1.lib;DWrite.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -108,6 +110,9 @@
<LanguageStandard>stdcpplatest</LanguageStandard>
<PreprocessorDefinitions>CRU_X64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
+ <Link>
+ <AdditionalDependencies>D3D11.lib;D2d1.lib;DWrite.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
@@ -115,9 +120,14 @@
<AdditionalIncludeDirectories>$(ProjectDir)\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>CRU_X64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
+ <Link>
+ <AdditionalDependencies>D3D11.lib;D2d1.lib;DWrite.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\ui\content_control.cpp" />
+ <ClCompile Include="src\ui\controls\button.cpp" />
+ <ClCompile Include="src\ui\events\window_event.cpp" />
<ClCompile Include="src\ui\layout_control.cpp" />
<ClCompile Include="src\ui\no_child_control.cpp" />
<ClCompile Include="src\ui\render\border_render_object.cpp" />
@@ -135,6 +145,8 @@
<ClCompile Include="src\ui\controls\flex_layout.cpp" />
<ClCompile Include="src\util\string_util.cpp" />
<ClInclude Include="src\ui\content_control.hpp" />
+ <ClInclude Include="src\ui\controls\button.hpp" />
+ <ClInclude Include="src\ui\events\window_event.hpp" />
<ClInclude Include="src\ui\layout_control.hpp" />
<ClInclude Include="src\ui\no_child_control.hpp" />
<ClInclude Include="src\ui\render\border_render_object.hpp" />
@@ -144,7 +156,6 @@
<ClInclude Include="src\util\format.hpp" />
<ClInclude Include="src\util\math_util.hpp" />
<ClInclude Include="src\ui\controls\text_block.hpp" />
- <ClCompile Include="src\ui\cursor.cpp" />
<ClCompile Include="src\ui\events\ui_event.cpp" />
<ClCompile Include="src\ui\input_util.cpp" />
<ClCompile Include="src\ui\render\flex_layout_render_object.cpp" />
@@ -161,14 +172,12 @@
<ClInclude Include="src\exception.hpp" />
<ClInclude Include="src\pre.hpp" />
<ClInclude Include="src\graph\graph.hpp" />
- <ClInclude Include="src\system_headers.hpp" />
<ClInclude Include="src\timer.hpp" />
<ClInclude Include="src\ui\animations\animation.hpp" />
<ClInclude Include="src\ui\control.hpp" />
<ClInclude Include="src\ui\controls\flex_layout.hpp" />
<ClCompile Include="src\ui\controls\text_block.cpp" />
<ClInclude Include="src\ui\d2d_util.hpp" />
- <ClInclude Include="src\ui\cursor.hpp" />
<ClInclude Include="src\ui\events\ui_event.hpp" />
<ClInclude Include="src\ui\input_util.hpp" />
<ClInclude Include="src\ui\render\flex_layout_render_object.hpp" />
diff --git a/CruUI.vcxproj.filters b/CruUI.vcxproj.filters
index 5554927b..01575ce2 100644
--- a/CruUI.vcxproj.filters
+++ b/CruUI.vcxproj.filters
@@ -42,9 +42,6 @@
<ClCompile Include="src\ui\events\ui_event.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\ui\cursor.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\cru_debug.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -90,6 +87,12 @@
<ClCompile Include="src\ui\render\border_render_object.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\ui\controls\button.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\ui\events\window_event.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\graph\graph.hpp">
@@ -104,9 +107,6 @@
<ClInclude Include="src\ui\control.hpp">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="src\ui\cursor.hpp">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="src\ui\ui_base.hpp">
<Filter>Header Files</Filter>
</ClInclude>
@@ -128,9 +128,6 @@
<ClInclude Include="src\exception.hpp">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="src\system_headers.hpp">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="src\timer.hpp">
<Filter>Header Files</Filter>
</ClInclude>
@@ -188,6 +185,12 @@
<ClInclude Include="src\ui\render\border_render_object.hpp">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="src\ui\controls\button.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="src\ui\events\window_event.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\application.cpp">
diff --git a/src/application.cpp b/src/application.cpp
index e580b56b..aafca6fe 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -1,8 +1,9 @@
#include "application.hpp"
+#include <VersionHelpers.h>
+
#include "exception.hpp"
#include "timer.hpp"
-#include "ui/cursor.hpp"
#include "ui/window_class.hpp"
namespace cru {
@@ -79,8 +80,6 @@ Application::Application(HINSTANCE h_instance) : h_instance_(h_instance) {
throw std::runtime_error("Must run on Windows 8 or later.");
god_window_ = std::make_unique<GodWindow>(this);
-
- ui::cursors::LoadSystemCursors();
}
Application::~Application() {
diff --git a/src/application.hpp b/src/application.hpp
index acf264c3..f5f69ea4 100644
--- a/src/application.hpp
+++ b/src/application.hpp
@@ -1,12 +1,12 @@
#pragma once
#include "pre.hpp"
+#include <Windows.h>
#include <functional>
#include <memory>
#include <optional>
#include <type_traits>
#include <typeindex>
-#include "system_headers.hpp"
#include "base.hpp"
diff --git a/src/cru_debug.cpp b/src/cru_debug.cpp
index 331d2bce..81945227 100644
--- a/src/cru_debug.cpp
+++ b/src/cru_debug.cpp
@@ -1,6 +1,6 @@
#include "cru_debug.hpp"
-#include "system_headers.hpp"
+#include <Windows.h>
namespace cru::debug {
#ifdef CRU_DEBUG
diff --git a/src/exception.hpp b/src/exception.hpp
index db2572f1..ade51d54 100644
--- a/src/exception.hpp
+++ b/src/exception.hpp
@@ -1,8 +1,8 @@
#pragma once
#include "pre.hpp"
+#include <Windows.h>
#include <optional>
-#include "system_headers.hpp"
#include "base.hpp"
diff --git a/src/graph/graph.hpp b/src/graph/graph.hpp
index bad5b6d0..af14cc50 100644
--- a/src/graph/graph.hpp
+++ b/src/graph/graph.hpp
@@ -1,9 +1,13 @@
#pragma once
#include "pre.hpp"
+#include <d2d1_2.h>
+#include <dxgi1_2.h>
+#include <d3d11.h>
+#include <dwrite.h>
+#include <wrl/client.h>
#include <functional>
#include <memory>
-#include "system_headers.hpp"
#include "base.hpp"
@@ -101,7 +105,7 @@ class GraphManager final : public Object {
Microsoft::WRL::ComPtr<IDWriteFontCollection> GetSystemFontCollection()
const {
- return dwrite_system_font_collection_.Get();
+ return dwrite_system_font_collection_;
}
private:
diff --git a/src/system_headers.hpp b/src/system_headers.hpp
deleted file mode 100644
index 5517d71a..00000000
--- a/src/system_headers.hpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#pragma once
-#include "pre.hpp"
-
-//include system headers
-#include <Windows.h>
-#include <windowsx.h>
-
-#pragma comment(lib, "D3D11.lib")
-#include <d3d11.h>
-
-#pragma comment(lib, "D2d1.lib")
-#include <d2d1_1.h>
-
-#pragma comment(lib, "DWrite.lib")
-#include <dwrite.h>
-
-#include <dxgi1_2.h>
-#include <wrl/client.h>
-
-#include <VersionHelpers.h>
diff --git a/src/timer.hpp b/src/timer.hpp
index 685e83b9..7199adc2 100644
--- a/src/timer.hpp
+++ b/src/timer.hpp
@@ -1,11 +1,11 @@
#pragma once
#include "pre.hpp"
+#include <Windows.h>
#include <chrono>
#include <functional>
#include <map>
#include <optional>
-#include "system_headers.hpp"
#include "base.hpp"
diff --git a/src/ui/control.cpp b/src/ui/control.cpp
index 5c629fd6..318d591a 100644
--- a/src/ui/control.cpp
+++ b/src/ui/control.cpp
@@ -55,15 +55,6 @@ bool Control::HasFocus() {
return window->GetFocusControl() == this;
}
-void Control::SetCursor(const Cursor::Ptr& cursor) {
- if (cursor != cursor_) {
- cursor_ = cursor;
- const auto window = GetWindow();
- if (window && window->GetMouseHoverControl() == this)
- window->UpdateCursor();
- }
-}
-
void Control::OnParentChanged(Control* old_parent, Control* new_parent) {}
void Control::OnAttachToWindow(Window* window) {}
diff --git a/src/ui/control.hpp b/src/ui/control.hpp
index 8454e981..a44399bf 100644
--- a/src/ui/control.hpp
+++ b/src/ui/control.hpp
@@ -1,12 +1,8 @@
#pragma once
#include "pre.hpp"
-#include "system_headers.hpp"
-
#include "base.hpp"
-#include "cursor.hpp"
#include "events/ui_event.hpp"
-#include "input_util.hpp"
#include "ui_base.hpp"
namespace cru::ui {
@@ -60,14 +56,6 @@ class Control : public Object {
bool HasFocus();
- //*************** region: cursor ***************
- // If cursor is set to null, then it uses parent's cursor.
- // Window's cursor can't be null.
- public:
- Cursor::Ptr GetCursor() const { return cursor_; }
-
- void SetCursor(const Cursor::Ptr& cursor);
-
//*************** region: events ***************
public:
// Raised when mouse enter the control.
@@ -107,7 +95,5 @@ class Control : public Object {
private:
Window* window_ = nullptr;
Control* parent_ = nullptr;
-
- Cursor::Ptr cursor_{};
};
} // namespace cru::ui
diff --git a/src/ui/controls/button.cpp b/src/ui/controls/button.cpp
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/ui/controls/button.cpp
diff --git a/src/ui/controls/button.hpp b/src/ui/controls/button.hpp
new file mode 100644
index 00000000..010c3f5b
--- /dev/null
+++ b/src/ui/controls/button.hpp
@@ -0,0 +1,8 @@
+#pragma once
+#include "pre.hpp"
+
+#include "ui/control.hpp"
+
+namespace cru::ui::controls {
+
+}
diff --git a/src/ui/controls/text_block.cpp b/src/ui/controls/text_block.cpp
index c891b832..85116910 100644
--- a/src/ui/controls/text_block.cpp
+++ b/src/ui/controls/text_block.cpp
@@ -1,5 +1,7 @@
#include "text_block.hpp"
+#include <dwrite.h>
+
#include "ui/render/text_render_object.hpp"
#include "ui/ui_manager.hpp"
diff --git a/src/ui/cursor.cpp b/src/ui/cursor.cpp
deleted file mode 100644
index d8c362ed..00000000
--- a/src/ui/cursor.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#include "cursor.hpp"
-
-#include "exception.hpp"
-
-namespace cru::ui {
-Cursor::Cursor(HCURSOR handle, const bool auto_release)
- : handle_(handle), auto_release_(auto_release) {}
-
-Cursor::~Cursor() {
- if (auto_release_) ::DestroyCursor(handle_);
-}
-
-namespace cursors {
-Cursor::Ptr arrow{};
-Cursor::Ptr hand{};
-Cursor::Ptr i_beam{};
-
-void LoadSystemCursors() {
- arrow = std::make_shared<Cursor>(::LoadCursorW(nullptr, IDC_ARROW), false);
- hand = std::make_shared<Cursor>(::LoadCursorW(nullptr, IDC_HAND), false);
- i_beam = std::make_shared<Cursor>(::LoadCursorW(nullptr, IDC_IBEAM), false);
-}
-} // namespace cursors
-} // namespace cru::ui
diff --git a/src/ui/cursor.hpp b/src/ui/cursor.hpp
deleted file mode 100644
index aec3fc40..00000000
--- a/src/ui/cursor.hpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#pragma once
-
-// ReSharper disable once CppUnusedIncludeDirective
-#include "pre.hpp"
-
-#include <memory>
-#include "system_headers.hpp"
-
-#include "base.hpp"
-
-namespace cru::ui {
-class Cursor : public Object {
- public:
- using Ptr = std::shared_ptr<Cursor>;
-
- Cursor(HCURSOR handle, bool auto_release);
- Cursor(const Cursor& other) = delete;
- Cursor(Cursor&& other) = delete;
- Cursor& operator=(const Cursor& other) = delete;
- Cursor& operator=(Cursor&& other) = delete;
- ~Cursor() override;
-
- HCURSOR GetHandle() const { return handle_; }
-
- private:
- HCURSOR handle_;
- bool auto_release_;
-};
-
-namespace cursors {
-extern Cursor::Ptr arrow;
-extern Cursor::Ptr hand;
-extern Cursor::Ptr i_beam;
-
-void LoadSystemCursors();
-} // namespace cursors
-} // namespace cru::ui
diff --git a/src/ui/d2d_util.hpp b/src/ui/d2d_util.hpp
index 96a017dc..2ec8ba98 100644
--- a/src/ui/d2d_util.hpp
+++ b/src/ui/d2d_util.hpp
@@ -1,7 +1,7 @@
#pragma once
#include "pre.hpp"
-#include "system_headers.hpp"
+#include <d2d1.h>
#include "ui_base.hpp"
diff --git a/src/ui/events/ui_event.cpp b/src/ui/events/ui_event.cpp
index ee3a68dc..78d56a83 100644
--- a/src/ui/events/ui_event.cpp
+++ b/src/ui/events/ui_event.cpp
@@ -1,7 +1,3 @@
#include "ui_event.hpp"
-#include "ui/control.hpp"
-
-namespace cru::ui::events
-{
-}
+namespace cru::ui::events {}
diff --git a/src/ui/events/ui_event.hpp b/src/ui/events/ui_event.hpp
index 572cf8d6..7fe4e6eb 100644
--- a/src/ui/events/ui_event.hpp
+++ b/src/ui/events/ui_event.hpp
@@ -2,13 +2,14 @@
#include "pre.hpp"
#include <optional>
-#include "system_headers.hpp"
#include "base.hpp"
#include "cru_event.hpp"
#include "ui/ui_base.hpp"
#include "ui/input_util.hpp"
+struct ID2D1RenderTarget;
+
namespace cru::ui {
class Control;
}
@@ -112,18 +113,18 @@ class MouseWheelEventArgs : public MouseEventArgs {
class DrawEventArgs : public UiEventArgs {
public:
DrawEventArgs(Object* sender, Object* original_sender,
- ID2D1DeviceContext* device_context)
- : UiEventArgs(sender, original_sender), device_context_(device_context) {}
+ ID2D1RenderTarget* render_target)
+ : UiEventArgs(sender, original_sender), render_target_(render_target) {}
DrawEventArgs(const DrawEventArgs& other) = default;
DrawEventArgs(DrawEventArgs&& other) = default;
DrawEventArgs& operator=(const DrawEventArgs& other) = default;
DrawEventArgs& operator=(DrawEventArgs&& other) = default;
~DrawEventArgs() = default;
- ID2D1DeviceContext* GetDeviceContext() const { return device_context_; }
+ ID2D1RenderTarget* GetRenderTarget() const { return render_target_; }
private:
- ID2D1DeviceContext* device_context_;
+ ID2D1RenderTarget* render_target_;
};
class FocusChangeEventArgs : public UiEventArgs {
@@ -160,40 +161,6 @@ class ToggleEventArgs : public UiEventArgs {
bool new_state_;
};
-struct WindowNativeMessage {
- HWND hwnd;
- int msg;
- WPARAM w_param;
- LPARAM l_param;
-};
-
-class WindowNativeMessageEventArgs : public UiEventArgs {
- public:
- WindowNativeMessageEventArgs(Object* sender, Object* original_sender,
- const WindowNativeMessage& message)
- : UiEventArgs(sender, original_sender),
- message_(message),
- result_(std::nullopt) {}
- WindowNativeMessageEventArgs(const WindowNativeMessageEventArgs& other) =
- default;
- WindowNativeMessageEventArgs(WindowNativeMessageEventArgs&& other) = default;
- WindowNativeMessageEventArgs& operator=(
- const WindowNativeMessageEventArgs& other) = default;
- WindowNativeMessageEventArgs& operator=(
- WindowNativeMessageEventArgs&& other) = default;
- ~WindowNativeMessageEventArgs() override = default;
-
- WindowNativeMessage GetWindowMessage() const { return message_; }
-
- std::optional<LRESULT> GetResult() const { return result_; }
-
- void SetResult(const std::optional<LRESULT> result) { result_ = result; }
-
- private:
- WindowNativeMessage message_;
- std::optional<LRESULT> result_;
-};
-
class KeyEventArgs : public UiEventArgs {
public:
KeyEventArgs(Object* sender, Object* original_sender, int virtual_code)
diff --git a/src/ui/events/window_event.cpp b/src/ui/events/window_event.cpp
new file mode 100644
index 00000000..a217136c
--- /dev/null
+++ b/src/ui/events/window_event.cpp
@@ -0,0 +1,3 @@
+#include "window_event.hpp"
+
+namespace cru::ui::events {}
diff --git a/src/ui/events/window_event.hpp b/src/ui/events/window_event.hpp
new file mode 100644
index 00000000..21c644af
--- /dev/null
+++ b/src/ui/events/window_event.hpp
@@ -0,0 +1,42 @@
+#pragma once
+#include "pre.hpp"
+
+#include <Windows.h>
+
+#include "ui_event.hpp"
+
+namespace cru::ui::events {
+struct WindowNativeMessage {
+ HWND hwnd;
+ int msg;
+ WPARAM w_param;
+ LPARAM l_param;
+};
+
+class WindowNativeMessageEventArgs : public UiEventArgs {
+ public:
+ WindowNativeMessageEventArgs(Object* sender, Object* original_sender,
+ const WindowNativeMessage& message)
+ : UiEventArgs(sender, original_sender),
+ message_(message),
+ result_(std::nullopt) {}
+ WindowNativeMessageEventArgs(const WindowNativeMessageEventArgs& other) =
+ default;
+ WindowNativeMessageEventArgs(WindowNativeMessageEventArgs&& other) = default;
+ WindowNativeMessageEventArgs& operator=(
+ const WindowNativeMessageEventArgs& other) = default;
+ WindowNativeMessageEventArgs& operator=(
+ WindowNativeMessageEventArgs&& other) = default;
+ ~WindowNativeMessageEventArgs() override = default;
+
+ WindowNativeMessage GetWindowMessage() const { return message_; }
+
+ std::optional<LRESULT> GetResult() const { return result_; }
+
+ void SetResult(const std::optional<LRESULT> result) { result_ = result; }
+
+ private:
+ WindowNativeMessage message_;
+ std::optional<LRESULT> result_;
+};
+}
diff --git a/src/ui/input_util.cpp b/src/ui/input_util.cpp
index 3fe34f10..193cba4a 100644
--- a/src/ui/input_util.cpp
+++ b/src/ui/input_util.cpp
@@ -1,6 +1,6 @@
#include "input_util.hpp"
-#include "system_headers.hpp"
+#include <Windows.h>
namespace cru::ui {
bool IsKeyDown(const int virtual_code) {
diff --git a/src/ui/render/text_render_object.cpp b/src/ui/render/text_render_object.cpp
index d57335ad..e8967d48 100644
--- a/src/ui/render/text_render_object.cpp
+++ b/src/ui/render/text_render_object.cpp
@@ -1,5 +1,7 @@
#include "text_render_object.hpp"
+#include <d2d1.h>
+#include <dwrite.h>
#include <algorithm>
#include "exception.hpp"
diff --git a/src/ui/ui_manager.cpp b/src/ui/ui_manager.cpp
index bcda4133..26b1fe62 100644
--- a/src/ui/ui_manager.cpp
+++ b/src/ui/ui_manager.cpp
@@ -1,5 +1,7 @@
#include "ui_manager.hpp"
+#include <Windows.h>
+
#include "application.hpp"
#include "exception.hpp"
#include "graph/graph.hpp"
diff --git a/src/ui/ui_manager.hpp b/src/ui/ui_manager.hpp
index 3fd2adc9..c2331dd4 100644
--- a/src/ui/ui_manager.hpp
+++ b/src/ui/ui_manager.hpp
@@ -1,7 +1,8 @@
#pragma once
#include "pre.hpp"
-#include "system_headers.hpp"
+#include <d2d1.h>
+#include <wrl/client.h>
#include "base.hpp"
diff --git a/src/ui/window.cpp b/src/ui/window.cpp
index ca3356ff..7b00ca05 100644
--- a/src/ui/window.cpp
+++ b/src/ui/window.cpp
@@ -1,7 +1,8 @@
#include "window.hpp"
+#include <windowsx.h>
+
#include "application.hpp"
-#include "cursor.hpp"
#include "exception.hpp"
#include "graph/graph.hpp"
#include "render/window_render_object.hpp"
@@ -153,17 +154,6 @@ inline POINT DipToPi(const Point& dip_point) {
return result;
}
-namespace {
-Cursor::Ptr GetCursorInherit(Control* control) {
- while (control != nullptr) {
- const auto cursor = control->GetCursor();
- if (cursor != nullptr) return cursor;
- control = control->GetParent();
- }
- return cursors::arrow;
-}
-} // namespace
-
Window* Window::CreateOverlapped() {
return new Window(tag_overlapped_constructor{});
}
@@ -220,8 +210,6 @@ void Window::AfterCreateHwnd(WindowManager* window_manager) {
render_target_ =
graph::GraphManager::GetInstance()->CreateWindowRenderTarget(hwnd_);
- SetCursor(cursors::arrow);
-
render_object_ = new render::WindowRenderObject(this);
}
@@ -522,12 +510,6 @@ Control* Window::ReleaseCurrentMouseCapture() {
}
}
-void Window::UpdateCursor() {
- if (IsWindowValid() && mouse_hover_control_ != nullptr) {
- SetCursorInternal(GetCursorInherit(mouse_hover_control_)->GetHandle());
- }
-}
-
#ifdef CRU_DEBUG_LAYOUT
void Window::SetDebugLayout(const bool value) {
if (debug_layout_ != value) {
@@ -719,7 +701,6 @@ void Window::DispatchMouseHoverControlChangeEvent(Control* old_control,
DispatchEvent(new_control, &Control::mouse_enter_event,
lowest_common_ancestor,
point); // dispatch mouse enter event.
- UpdateCursor();
}
}
}
diff --git a/src/ui/window.hpp b/src/ui/window.hpp
index 3e0422b1..1c48bf43 100644
--- a/src/ui/window.hpp
+++ b/src/ui/window.hpp
@@ -1,12 +1,13 @@
#pragma once
#include "pre.hpp"
+#include <Windows.h>
#include <map>
#include <memory>
-#include "system_headers.hpp"
#include "content_control.hpp"
#include "events/ui_event.hpp"
+#include "events/window_event.hpp"
#include "window_class.hpp"
namespace cru::graph {
@@ -164,9 +165,6 @@ class Window final : public ContentControl {
Control* CaptureMouseFor(Control* control);
Control* ReleaseCurrentMouseCapture();
- //*************** region: cursor ***************
- void UpdateCursor();
-
public:
//*************** region: events ***************
Event<events::UiEventArgs> activated_event;
diff --git a/src/ui/window_class.hpp b/src/ui/window_class.hpp
index 66babd94..72a7c431 100644
--- a/src/ui/window_class.hpp
+++ b/src/ui/window_class.hpp
@@ -1,7 +1,7 @@
#pragma once
#include "pre.hpp"
-#include "system_headers.hpp"
+#include <Windows.h>
#include "base.hpp"
diff --git a/src/util/string_util.cpp b/src/util/string_util.cpp
index 3c765259..c9391fc6 100644
--- a/src/util/string_util.cpp
+++ b/src/util/string_util.cpp
@@ -1,6 +1,7 @@
#include "string_util.hpp"
-#include "system_headers.hpp"
+#include <Windows.h>
+
#include "exception.hpp"
namespace cru::util {
@@ -18,4 +19,4 @@ MultiByteString ToUtf8String(const StringView& string) {
"Failed to convert wide string to UTF-8.");
return result;
}
-}
+} // namespace cru::util