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);
|
2052
|
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;}
|
2052
|
16 inline int GetX() const {RECT rc; GetWindowRect(api_handle, &rc); return rc.left;}
|
|
17 inline int GetY() const {RECT rc; GetWindowRect(api_handle, &rc); return rc.top;}
|
1804
|
18 inline unsigned int GetWidth() const {RECT rc; GetClientRect(api_handle, &rc); return rc.right - rc.left;}
|
|
19 inline unsigned int GetHeight() const {RECT rc; GetClientRect(api_handle, &rc); return rc.bottom - rc.top;}
|
|
20
|
|
21
|
|
22 bool OnOSMenu(int item_id);
|
|
23
|
|
24 // UIControl
|
|
25 virtual void Show() override;
|
|
26
|
|
27 // UIControl
|
|
28 virtual bool Focused() override {return GetFocus() == api_handle;}
|
|
29
|
|
30 // UIControl
|
1815
|
31 //virtual bool OnKey(int key) override;
|
1804
|
32 // UIControl
|
|
33 virtual bool OnMouseLeftClick(int x, int y) override;
|
|
34 // UIControl
|
|
35 virtual bool OnMouseRightClick(int x, int y) override;
|
|
36 // UIControl
|
1815
|
37 //virtual bool OnMouseEnter() override;
|
1804
|
38 // UIControl
|
1815
|
39 //virtual bool OnMouseLeave() override;
|
1804
|
40
|
|
41 protected:
|
|
42 bool Initialize(const wchar_t *title, int window_width, int window_height);
|
1994
|
43 void Deinitialize();
|
|
44 bool SetColorDepth(int bit);
|
1804
|
45 bool WinApiMessageProc(UINT msg, WPARAM wparam, LPARAM lparam, LRESULT *result);
|
|
46
|
2052
|
47 HWND api_handle;
|
1804
|
48
|
|
49 private:
|
2052
|
50 bool ChangedColorDepth;
|
1804
|
51 static LPARAM __stdcall WinApiMsgRouter(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
|
|
52
|
|
53 HMENU CreateDebugMenuPanel();
|
|
54 }; |