aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/platform')
-rw-r--r--include/cru/platform/native/cursor.hpp6
-rw-r--r--include/cru/platform/native/event.hpp (renamed from include/cru/platform/native/native_event.hpp)3
-rw-r--r--include/cru/platform/native/ui_application.hpp21
-rw-r--r--include/cru/platform/native/window.hpp (renamed from include/cru/platform/native/native_window.hpp)11
4 files changed, 16 insertions, 25 deletions
diff --git a/include/cru/platform/native/cursor.hpp b/include/cru/platform/native/cursor.hpp
index 961dff34..cb8b7ed2 100644
--- a/include/cru/platform/native/cursor.hpp
+++ b/include/cru/platform/native/cursor.hpp
@@ -1,18 +1,18 @@
#pragma once
-#include "../native_resource.hpp"
+#include "../resource.hpp"
#include <memory>
namespace cru::platform::native {
-struct ICursor : public virtual INativeResource {};
+struct ICursor : virtual INativeResource {};
enum class SystemCursorType {
Arrow,
Hand,
};
-struct ICursorManager : public virtual INativeResource {
+struct ICursorManager : virtual INativeResource {
virtual std::shared_ptr<ICursor> GetSystemCursor(SystemCursorType type) = 0;
// TODO: Add method to create cursor.
diff --git a/include/cru/platform/native/native_event.hpp b/include/cru/platform/native/event.hpp
index dcd7a336..48e9cfca 100644
--- a/include/cru/platform/native/native_event.hpp
+++ b/include/cru/platform/native/event.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include "../graphic_base.hpp"
+#include "../graph_base.hpp"
#include "basic_types.hpp"
namespace cru::platform::native {
@@ -12,5 +12,4 @@ struct NativeMouseButtonEventArgs {
enum class FocusChangeType { Gain, Lost };
enum class MouseEnterLeaveType { Enter, Leave };
-
} // namespace cru::platform::native
diff --git a/include/cru/platform/native/ui_application.hpp b/include/cru/platform/native/ui_application.hpp
index 6d2ab659..c1f10d15 100644
--- a/include/cru/platform/native/ui_application.hpp
+++ b/include/cru/platform/native/ui_application.hpp
@@ -1,30 +1,21 @@
#pragma once
-#include "../native_resource.hpp"
+#include "../resource.hpp"
#include <chrono>
#include <functional>
#include <vector>
+namespace cru::platform::graph {
+struct IGraphFactory;
+}
+
namespace cru::platform::native {
struct INativeWindow;
struct ICursorManager;
// The entry point of a ui application.
-// It will call IGraphFactory::CreateInstance during its creation
-// and set graph factory to be auto deleted. If you want to keep
-// the graph factory then you should manually set it to false after
-// creating the ui application.
struct IUiApplication : public virtual INativeResource {
public:
- // Create a platform-specific instance and save it as the global instance.
- // Do not create the instance twice. Implements should assert for that.
- // After creating, get the instance by GetInstance.
- static IUiApplication* CreateInstance();
-
- // Get the global instance. If it is not created, then return nullptr.
- static IUiApplication* GetInstance();
-
- public:
// Block current thread and run the message loop. Return the exit code when
// message loop gets a quit message (possibly posted by method RequestQuit).
virtual int Run() = 0;
@@ -44,6 +35,8 @@ struct IUiApplication : public virtual INativeResource {
virtual std::vector<INativeWindow*> GetAllWindow() = 0;
virtual INativeWindow* CreateWindow(INativeWindow* parent) = 0;
+ virtual cru::platform::graph::IGraphFactory* GetGraphFactory() = 0;
+
virtual ICursorManager* GetCursorManager() = 0;
};
} // namespace cru::platform::native
diff --git a/include/cru/platform/native/native_window.hpp b/include/cru/platform/native/window.hpp
index cd2459e0..bfaf170b 100644
--- a/include/cru/platform/native/native_window.hpp
+++ b/include/cru/platform/native/window.hpp
@@ -1,12 +1,11 @@
#pragma once
-#include "../native_resource.hpp"
+#include "../resource.hpp"
-#include "cru/common/event.hpp"
-
-#include "../graphic_base.hpp"
+#include "../graph_base.hpp"
#include "basic_types.hpp"
+#include "cru/common/event.hpp"
#include "cursor.hpp"
-#include "native_event.hpp"
+#include "event.hpp"
namespace cru::platform::graph {
struct IPainter;
@@ -21,7 +20,7 @@ namespace cru::platform::native {
// Close or closed by the user, which leads to an invalid instance. You can
// check the validity by IsValid. When you call perform native operations on the
// invalid instance, there is no effect.
-struct INativeWindow : public virtual INativeResource {
+struct INativeWindow : virtual INativeResource {
// Return if the window is still valid, that is, hasn't been closed or
// destroyed.
virtual bool IsValid() = 0;