aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/native/window.hpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-01-03 00:31:34 +0800
committercrupest <crupest@outlook.com>2020-01-03 00:31:34 +0800
commitd5ff69096a3f56052b30d8ef827845473d4aa5ea (patch)
tree8faf7466ea173b66e81da83bdc4e0be1a159e263 /include/cru/platform/native/window.hpp
parent26c3b5c7a509d0123719f2a6537399c332a48011 (diff)
downloadcru-d5ff69096a3f56052b30d8ef827845473d4aa5ea.tar.gz
cru-d5ff69096a3f56052b30d8ef827845473d4aa5ea.tar.bz2
cru-d5ff69096a3f56052b30d8ef827845473d4aa5ea.zip
...
Diffstat (limited to 'include/cru/platform/native/window.hpp')
-rw-r--r--include/cru/platform/native/window.hpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/include/cru/platform/native/window.hpp b/include/cru/platform/native/window.hpp
index bfaf170b..84193a13 100644
--- a/include/cru/platform/native/window.hpp
+++ b/include/cru/platform/native/window.hpp
@@ -12,22 +12,17 @@ struct IPainter;
}
namespace cru::platform::native {
+struct INativeWindowResolver;
+
// Represents a native window, which exposes some low-level events and
// operations.
//
-// Although you can always retain an instance of this class, the real window
-// associated with it might be have already been destroyed by explicitly calling
-// 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.
+// Usually you save an INativeWindowResolver after creating a window. Because
+// window may be destroyed when user do certain actions like click the close
+// button. Then the INativeWindow instance is destroyed and
+// INativeWindowResolver::Resolve return nullptr to indicate the fact.
struct INativeWindow : virtual INativeResource {
- // Return if the window is still valid, that is, hasn't been closed or
- // destroyed.
- virtual bool IsValid() = 0;
-
- // Set if the instance is deleted automatically when the window is destroyed
- // by other ways. Default is true.
- virtual void SetDeleteThisOnDestroy(bool value) = 0;
+ virtual std::shared_ptr<INativeWindowResolver> GetResolver() = 0;
virtual void Close() = 0;
@@ -71,4 +66,9 @@ struct INativeWindow : virtual INativeResource {
virtual IEvent<int>* KeyDownEvent() = 0;
virtual IEvent<int>* KeyUpEvent() = 0;
};
+
+// See INativeWindow for more info.
+struct INativeWindowResolver : virtual INativeResource {
+ virtual INativeWindow* Resolve() = 0;
+};
} // namespace cru::platform::native