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);
|
1994
|
9 void Delete();
|
1804
|
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
|
1815
|
29 //virtual bool OnKey(int key) override;
|
1804
|
30 // UIControl
|
|
31 virtual bool OnMouseLeftClick(int x, int y) override;
|
|
32 // UIControl
|
|
33 virtual bool OnMouseRightClick(int x, int y) override;
|
|
34 // UIControl
|
1815
|
35 //virtual bool OnMouseEnter() override;
|
1804
|
36 // UIControl
|
1815
|
37 //virtual bool OnMouseLeave() override;
|
1804
|
38
|
|
39 protected:
|
|
40 bool Initialize(const wchar_t *title, int window_width, int window_height);
|
1994
|
41 void Deinitialize();
|
|
42 bool SetColorDepth(int bit);
|
1804
|
43 bool WinApiMessageProc(UINT msg, WPARAM wparam, LPARAM lparam, LRESULT *result);
|
|
44
|
|
45 HWND api_handle;
|
1994
|
46 DEVMODE dm;
|
1804
|
47
|
|
48 private:
|
1994
|
49 bool ChangedColorDepth;
|
1804
|
50 static LPARAM __stdcall WinApiMsgRouter(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
|
|
51
|
|
52 HMENU CreateDebugMenuPanel();
|
|
53 }; |