annotate OSWindow.h @ 2146:6ed6ad15995d

restore broken filters
author Ritor1
date Mon, 06 Jan 2014 20:01:21 +0600
parents d24ee391fd1f
children 6d5877899730
rev   line source
1804
Nomad
parents:
diff changeset
1 #pragma once
Nomad
parents:
diff changeset
2 #include "OSAPI.h"
1815
bd899dfd976c MainMenuWindow
Nomad
parents: 1804
diff changeset
3 #include "NewUI/Core/UIControl.h"
1804
Nomad
parents:
diff changeset
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
Nomad
parents:
diff changeset
7 class OSWindow: public UIControl
Nomad
parents:
diff changeset
8 {
Nomad
parents:
diff changeset
9 public:
Nomad
parents:
diff changeset
10 static OSWindow *Create(const wchar_t *title, int window_width, int window_height);
Nomad
parents:
diff changeset
11
Nomad
parents:
diff changeset
12 void SetFullscreenMode();
Nomad
parents:
diff changeset
13 void SetWindowedMode(int new_window_width, int new_window_height);
Nomad
parents:
diff changeset
14 void SetCursor(const char *cursor_name);
Nomad
parents:
diff changeset
15
Nomad
parents:
diff changeset
16 inline HWND GetApiHandle() const {return api_handle;}
2052
71a814f4482a Moved implementation to cpp
Nomad
parents: 1994
diff changeset
17 inline int GetX() const {RECT rc; GetWindowRect(api_handle, &rc); return rc.left;}
71a814f4482a Moved implementation to cpp
Nomad
parents: 1994
diff changeset
18 inline int GetY() const {RECT rc; GetWindowRect(api_handle, &rc); return rc.top;}
1804
Nomad
parents:
diff changeset
19 inline unsigned int GetWidth() const {RECT rc; GetClientRect(api_handle, &rc); return rc.right - rc.left;}
Nomad
parents:
diff changeset
20 inline unsigned int GetHeight() const {RECT rc; GetClientRect(api_handle, &rc); return rc.bottom - rc.top;}
Nomad
parents:
diff changeset
21
Nomad
parents:
diff changeset
22
Nomad
parents:
diff changeset
23 bool OnOSMenu(int item_id);
Nomad
parents:
diff changeset
24
Nomad
parents:
diff changeset
25 // UIControl
Nomad
parents:
diff changeset
26 virtual void Show() override;
Nomad
parents:
diff changeset
27
Nomad
parents:
diff changeset
28 // UIControl
Nomad
parents:
diff changeset
29 virtual bool Focused() override {return GetFocus() == api_handle;}
Nomad
parents:
diff changeset
30
Nomad
parents:
diff changeset
31 // UIControl
1815
bd899dfd976c MainMenuWindow
Nomad
parents: 1804
diff changeset
32 //virtual bool OnKey(int key) override;
1804
Nomad
parents:
diff changeset
33 // UIControl
Nomad
parents:
diff changeset
34 virtual bool OnMouseLeftClick(int x, int y) override;
Nomad
parents:
diff changeset
35 // UIControl
Nomad
parents:
diff changeset
36 virtual bool OnMouseRightClick(int x, int y) override;
Nomad
parents:
diff changeset
37 // UIControl
1815
bd899dfd976c MainMenuWindow
Nomad
parents: 1804
diff changeset
38 //virtual bool OnMouseEnter() override;
1804
Nomad
parents:
diff changeset
39 // UIControl
1815
bd899dfd976c MainMenuWindow
Nomad
parents: 1804
diff changeset
40 //virtual bool OnMouseLeave() override;
1804
Nomad
parents:
diff changeset
41
Nomad
parents:
diff changeset
42 protected:
Nomad
parents:
diff changeset
43 bool Initialize(const wchar_t *title, int window_width, int window_height);
Nomad
parents:
diff changeset
44 bool WinApiMessageProc(UINT msg, WPARAM wparam, LPARAM lparam, LRESULT *result);
Nomad
parents:
diff changeset
45
2052
71a814f4482a Moved implementation to cpp
Nomad
parents: 1994
diff changeset
46 HWND api_handle;
1804
Nomad
parents:
diff changeset
47
Nomad
parents:
diff changeset
48 private:
Nomad
parents:
diff changeset
49 static LPARAM __stdcall WinApiMsgRouter(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
Nomad
parents:
diff changeset
50
Nomad
parents:
diff changeset
51 HMENU CreateDebugMenuPanel();
Nomad
parents:
diff changeset
52 };