-
Notifications
You must be signed in to change notification settings - Fork 0
/
window.h
44 lines (31 loc) · 1020 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once
#if !defined(WINDOW_H)
#define WINDOW_H
#include <functional>
namespace trainlist8 {
class MessagePump;
extern "C" using WindowProc = LRESULT WINAPI(HWND, unsigned int, WPARAM, LPARAM);
// The base class of a C++-based window.
class Window {
public:
static HWND create(DWORD exStyle, const wchar_t *className, const wchar_t *windowName, DWORD style, int x, int y, int width, int height, HWND parent, HMENU menu, HINSTANCE instance, std::function<Window *(HWND)> factory);
static WindowProc windowProcThunk;
explicit Window(const Window &) = delete;
void operator=(const Window &) = delete;
protected:
MessagePump &pump;
explicit Window(HWND handle, MessagePump &pump);
virtual ~Window();
operator HWND() const;
unsigned int dpi() const;
HINSTANCE instance() const;
void updateIcon();
virtual LRESULT windowProc(unsigned int message, WPARAM wParam, LPARAM lParam) = 0;
private:
friend class MessagePump;
HWND handle_;
unsigned int dpi_;
HICON largeIcon, smallIcon;
};
}
#endif