1804
|
1 #pragma once
|
|
2 #include "OSAPI.h"
|
1815
|
3 #include "NewUI/Core/UIControl.h"
|
1804
|
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 void SetFullscreenMode();
|
|
11 void SetWindowedMode(int new_window_width, int new_window_height);
|
|
12 void SetCursor(const char *cursor_name);
|
|
13
|
|
14 inline HWND GetApiHandle() const {return api_handle;}
|
2052
|
15 inline int GetX() const {RECT rc; GetWindowRect(api_handle, &rc); return rc.left;}
|
|
16 inline int GetY() const {RECT rc; GetWindowRect(api_handle, &rc); return rc.top;}
|
1804
|
17 inline unsigned int GetWidth() const {RECT rc; GetClientRect(api_handle, &rc); return rc.right - rc.left;}
|
|
18 inline unsigned int GetHeight() const {RECT rc; GetClientRect(api_handle, &rc); return rc.bottom - rc.top;}
|
|
19
|
|
20
|
|
21 bool OnOSMenu(int item_id);
|
|
22
|
|
23 // UIControl
|
|
24 virtual void Show() override;
|
|
25
|
|
26 // UIControl
|
|
27 virtual bool Focused() override {return GetFocus() == api_handle;}
|
|
28
|
|
29 // UIControl
|
1815
|
30 //virtual bool OnKey(int key) override;
|
1804
|
31 // UIControl
|
|
32 virtual bool OnMouseLeftClick(int x, int y) override;
|
|
33 // UIControl
|
|
34 virtual bool OnMouseRightClick(int x, int y) override;
|
|
35 // UIControl
|
1815
|
36 //virtual bool OnMouseEnter() override;
|
1804
|
37 // UIControl
|
1815
|
38 //virtual bool OnMouseLeave() override;
|
1804
|
39
|
|
40 protected:
|
|
41 bool Initialize(const wchar_t *title, int window_width, int window_height);
|
|
42 bool WinApiMessageProc(UINT msg, WPARAM wparam, LPARAM lparam, LRESULT *result);
|
|
43
|
2052
|
44 HWND api_handle;
|
1804
|
45
|
|
46 private:
|
|
47 static LPARAM __stdcall WinApiMsgRouter(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
|
|
48
|
|
49 HMENU CreateDebugMenuPanel();
|
|
50 }; |