aboutsummaryrefslogtreecommitdiff
path: root/include/cru/win/gui/GodWindow.hpp
blob: 0343b1595de7525c879acb14492f5438861aa6f6 (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
#pragma once
#include "Base.hpp"

#include "WindowNativeMessageEventArgs.hpp"
#include "cru/common/Event.hpp"

#include <memory>

namespace cru::platform::gui::win {
class GodWindow : public Object {
  CRU_DEFINE_CLASS_LOG_TAG(u"cru::platform::gui::win::GodWindow")

 public:
  explicit GodWindow(WinUiApplication* application);

  CRU_DELETE_COPY(GodWindow)
  CRU_DELETE_MOVE(GodWindow)

  ~GodWindow() override;

  HWND GetHandle() const { return hwnd_; }

  bool HandleGodWindowMessage(HWND hwnd, UINT msg, WPARAM w_param,
                              LPARAM l_param, LRESULT* result);

  IEvent<WindowNativeMessageEventArgs&>* MessageEvent() {
    return &message_event_;
  }

 private:
  WinUiApplication* application_;

  std::unique_ptr<WindowClass> god_window_class_;
  HWND hwnd_;

  Event<WindowNativeMessageEventArgs&> message_event_;
};
}  // namespace cru::platform::gui::win