Mercurial > mm7
comparison OSWindow.h @ 1804:92ab1b3cc95a
oops
author | Nomad |
---|---|
date | Mon, 07 Oct 2013 11:59:51 +0200 |
parents | |
children | bd899dfd976c |
comparison
equal
deleted
inserted
replaced
1803:9f93b5700e2d | 1804:92ab1b3cc95a |
---|---|
1 #pragma once | |
2 #include "OSAPI.h" | |
3 #include "NewUI/UIControl.h" | |
4 | |
5 class OSWindow: public UIControl | |
6 { | |
7 public: | |
8 static OSWindow *Create(const wchar_t *title, int window_width, int window_height); | |
9 | |
10 | |
11 void SetFullscreenMode(); | |
12 void SetWindowedMode(int new_window_width, int new_window_height); | |
13 void SetCursor(const char *cursor_name); | |
14 | |
15 inline HWND GetApiHandle() const {return api_handle;} | |
16 inline unsigned int GetWidth() const {RECT rc; GetClientRect(api_handle, &rc); return rc.right - rc.left;} | |
17 inline unsigned int GetHeight() const {RECT rc; GetClientRect(api_handle, &rc); return rc.bottom - rc.top;} | |
18 | |
19 | |
20 bool OnOSMenu(int item_id); | |
21 | |
22 // UIControl | |
23 virtual void Show() override; | |
24 | |
25 // UIControl | |
26 virtual bool Focused() override {return GetFocus() == api_handle;} | |
27 | |
28 // UIControl | |
29 virtual bool OnKey(int key) override; | |
30 // UIControl | |
31 virtual bool OnMouseLeftClick(int x, int y) override; | |
32 // UIControl | |
33 virtual bool OnMouseRightClick(int x, int y) override; | |
34 // UIControl | |
35 virtual bool OnMouseEnter() override; | |
36 // UIControl | |
37 virtual bool OnMouseLeave() override; | |
38 | |
39 protected: | |
40 bool Initialize(const wchar_t *title, int window_width, int window_height); | |
41 bool WinApiMessageProc(UINT msg, WPARAM wparam, LPARAM lparam, LRESULT *result); | |
42 | |
43 HWND api_handle; | |
44 | |
45 private: | |
46 static LPARAM __stdcall WinApiMsgRouter(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); | |
47 | |
48 HMENU CreateDebugMenuPanel(); | |
49 }; |