-
Notifications
You must be signed in to change notification settings - Fork 0
/
Window.h
75 lines (62 loc) · 2.07 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef WINDOW_H_INCLUDED
#define WINDOW_H_INCLUDED
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#include "KeyEventProcessor.h"
namespace ST
{
class Window;
extern Window* MainWindow;
/** A singleton system window.
*/
class Window
{
public:
/** Initialization of the window instance.
@param title The name of the window.
@param style The style of the window.
@param width The width, in device units, of the window.
@param height The height, in device units, of the window.
@param x The initial horizontal position of the window.
@param y The initial vertical position of the window.
@param exStyle The extended window style of the window.
@param parent A handle to the parent or owner of this window.
@param menu A handle to a menu.
*/
Window (LPCTSTR title,
DWORD style,
DWORD exStyle = 0,
int width = 800,
int height = 600,
int x = 50,
int y = 50,
HWND parent = 0,
HMENU menu = 0
);
/** Returns a handle to a created window.
*/
HWND GetHandle() const
{
return hwnd;
}
/** Key events will be sent to processor.
*/
void SetKeyEventProcessor(KeyEventProcessor* processor)
{
keyEventProcessor = processor;
}
private:
static LRESULT CALLBACK windowProc(HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam);
LRESULT handleMessage(UINT msg, WPARAM wParam, LPARAM lParam);
private:
static const LPCWSTR className;
static size_t countOfWindows;
HWND hwnd;
KeyEventProcessor* keyEventProcessor;
};
}
#endif // WINDOW_H_INCLUDED