aboutsummaryrefslogtreecommitdiff
path: root/include/cru/win/gui/WindowNativeMessageEventArgs.h
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-02-08 16:53:51 +0800
committercrupest <crupest@outlook.com>2022-02-08 16:53:51 +0800
commit74bb9cd27242b9320f99ff4d2b50c3051576cc14 (patch)
tree744bac5799c593d1d6f81e7b09581bea626f2cde /include/cru/win/gui/WindowNativeMessageEventArgs.h
parentb90c398de829d1ba5329651d75bae82f5e4085fe (diff)
downloadcru-74bb9cd27242b9320f99ff4d2b50c3051576cc14.tar.gz
cru-74bb9cd27242b9320f99ff4d2b50c3051576cc14.tar.bz2
cru-74bb9cd27242b9320f99ff4d2b50c3051576cc14.zip
...
Diffstat (limited to 'include/cru/win/gui/WindowNativeMessageEventArgs.h')
-rw-r--r--include/cru/win/gui/WindowNativeMessageEventArgs.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/include/cru/win/gui/WindowNativeMessageEventArgs.h b/include/cru/win/gui/WindowNativeMessageEventArgs.h
new file mode 100644
index 00000000..bc85a597
--- /dev/null
+++ b/include/cru/win/gui/WindowNativeMessageEventArgs.h
@@ -0,0 +1,40 @@
+#pragma once
+#include "Base.h"
+
+#include "cru/common/Base.h"
+
+namespace cru::platform::gui::win {
+struct CRU_WIN_GUI_API WindowNativeMessage {
+ HWND hwnd;
+ UINT msg;
+ WPARAM w_param;
+ LPARAM l_param;
+};
+
+class CRU_WIN_GUI_API WindowNativeMessageEventArgs : public Object {
+ public:
+ WindowNativeMessageEventArgs(const WindowNativeMessage& message)
+ : message_(message) {}
+ CRU_DEFAULT_COPY(WindowNativeMessageEventArgs)
+ CRU_DEFAULT_MOVE(WindowNativeMessageEventArgs)
+ ~WindowNativeMessageEventArgs() override = default;
+
+ const WindowNativeMessage& GetWindowMessage() const { return message_; }
+
+ LRESULT GetResult() const { return result_; }
+ void SetResult(LRESULT result) { result_ = result; }
+
+ bool IsHandled() const { return handled_; }
+ void SetHandled(bool handled) { handled_ = handled; }
+
+ void HandleWithResult(LRESULT result) {
+ handled_ = true;
+ result_ = result;
+ }
+
+ private:
+ WindowNativeMessage message_;
+ LRESULT result_;
+ bool handled_ = false;
+};
+} // namespace cru::platform::gui::win