aboutsummaryrefslogtreecommitdiff
path: root/src/ui/events/window_event.hpp
blob: 21c644af3906e02842d1beb72303ef8c51ff14ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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_;
};
}