forked from BellCrow/GettingInShapes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Window.h
32 lines (24 loc) · 879 Bytes
/
Window.h
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
#pragma once
#include "MyWinHeader.h"
#include "WindowMessage.h"
#include "IWindowMessageReceiver.h"
#include <memory>
#include <vector>
class Window
{
public:
Window(int width, int height, const char* name);
~Window()noexcept;
Window(const Window&) = delete;
Window& operator= (const Window&) = delete;
static LRESULT CALLBACK InitialMessageHandler(HWND handle, UINT msg, WPARAM w, LPARAM l) noexcept;
static LRESULT CALLBACK HandleMessageAdapter(HWND handle, UINT msg, WPARAM w, LPARAM l) noexcept;
LRESULT HandleMsg(HWND handle, UINT msg, WPARAM w, LPARAM l) noexcept;
void SetTitle(const char* title) const;
void Subscribe(std::shared_ptr<IWindowMessageReceiver>);
HWND GetWindowHandle() { return m_windowHandle; }
private:
HWND m_windowHandle;
std::vector<std::shared_ptr<IWindowMessageReceiver>> _subscribers;
void FireEvent(const WindowMessage&);
};