aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/gui/win/GodWindow.h
blob: 84fdfcea77ab056a47bff06308dfb65c94732760 (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
#pragma once
#include "Base.h"

#include "WindowNativeMessageEventArgs.h"
#include "cru/base/Event.h"
#include "cru/base/String.h"

#include <memory>

namespace cru::platform::gui::win {
class CRU_WIN_GUI_API GodWindow : public Object {
  CRU_DEFINE_CLASS_LOG_TAG(u"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