Mercurial > mm7
annotate OSWindow.h @ 2340:dc822157c98d
Moving functions from unsorted_subs.h pt4
author | Grumpy7 |
---|---|
date | Sun, 06 Apr 2014 12:50:35 +0200 |
parents | d24ee391fd1f |
children | 6d5877899730 |
rev | line source |
---|---|
1804 | 1 #pragma once |
2 #include "OSAPI.h" | |
1815 | 3 #include "NewUI/Core/UIControl.h" |
1804 | 4 |
2137
d24ee391fd1f
libavcodec playing movies and houses, loops not working yet
zipi
parents:
2061
diff
changeset
|
5 extern class OSWindow *window; |
d24ee391fd1f
libavcodec playing movies and houses, loops not working yet
zipi
parents:
2061
diff
changeset
|
6 |
1804 | 7 class OSWindow: public UIControl |
8 { | |
9 public: | |
10 static OSWindow *Create(const wchar_t *title, int window_width, int window_height); | |
11 | |
12 void SetFullscreenMode(); | |
13 void SetWindowedMode(int new_window_width, int new_window_height); | |
14 void SetCursor(const char *cursor_name); | |
15 | |
16 inline HWND GetApiHandle() const {return api_handle;} | |
2052 | 17 inline int GetX() const {RECT rc; GetWindowRect(api_handle, &rc); return rc.left;} |
18 inline int GetY() const {RECT rc; GetWindowRect(api_handle, &rc); return rc.top;} | |
1804 | 19 inline unsigned int GetWidth() const {RECT rc; GetClientRect(api_handle, &rc); return rc.right - rc.left;} |
20 inline unsigned int GetHeight() const {RECT rc; GetClientRect(api_handle, &rc); return rc.bottom - rc.top;} | |
21 | |
22 | |
23 bool OnOSMenu(int item_id); | |
24 | |
25 // UIControl | |
26 virtual void Show() override; | |
27 | |
28 // UIControl | |
29 virtual bool Focused() override {return GetFocus() == api_handle;} | |
30 | |
31 // UIControl | |
1815 | 32 //virtual bool OnKey(int key) override; |
1804 | 33 // UIControl |
34 virtual bool OnMouseLeftClick(int x, int y) override; | |
35 // UIControl | |
36 virtual bool OnMouseRightClick(int x, int y) override; | |
37 // UIControl | |
1815 | 38 //virtual bool OnMouseEnter() override; |
1804 | 39 // UIControl |
1815 | 40 //virtual bool OnMouseLeave() override; |
1804 | 41 |
42 protected: | |
43 bool Initialize(const wchar_t *title, int window_width, int window_height); | |
44 bool WinApiMessageProc(UINT msg, WPARAM wparam, LPARAM lparam, LRESULT *result); | |
45 | |
2052 | 46 HWND api_handle; |
1804 | 47 |
48 private: | |
49 static LPARAM __stdcall WinApiMsgRouter(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); | |
50 | |
51 HMENU CreateDebugMenuPanel(); | |
52 }; |