annotate OSWindow.h @ 1996:f7e8c4d4a01b

sound id fix
author zipi
date Sun, 03 Nov 2013 14:29:45 +0000
parents 4088cc908c78
children 71a814f4482a
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
Nomad
parents:
diff changeset
5 class OSWindow: public UIControl
Nomad
parents:
diff changeset
6 {
Nomad
parents:
diff changeset
7 public:
Nomad
parents:
diff changeset
8 static OSWindow *Create(const wchar_t *title, int window_width, int window_height);
1994
4088cc908c78 auto change color depth to 16 bit
zipi
parents: 1815
diff changeset
9 void Delete();
1804
Nomad
parents:
diff changeset
10
Nomad
parents:
diff changeset
11 void SetFullscreenMode();
Nomad
parents:
diff changeset
12 void SetWindowedMode(int new_window_width, int new_window_height);
Nomad
parents:
diff changeset
13 void SetCursor(const char *cursor_name);
Nomad
parents:
diff changeset
14
Nomad
parents:
diff changeset
15 inline HWND GetApiHandle() const {return api_handle;}
Nomad
parents:
diff changeset
16 inline unsigned int GetWidth() const {RECT rc; GetClientRect(api_handle, &rc); return rc.right - rc.left;}
Nomad
parents:
diff changeset
17 inline unsigned int GetHeight() const {RECT rc; GetClientRect(api_handle, &rc); return rc.bottom - rc.top;}
Nomad
parents:
diff changeset
18
Nomad
parents:
diff changeset
19
Nomad
parents:
diff changeset
20 bool OnOSMenu(int item_id);
Nomad
parents:
diff changeset
21
Nomad
parents:
diff changeset
22 // UIControl
Nomad
parents:
diff changeset
23 virtual void Show() override;
Nomad
parents:
diff changeset
24
Nomad
parents:
diff changeset
25 // UIControl
Nomad
parents:
diff changeset
26 virtual bool Focused() override {return GetFocus() == api_handle;}
Nomad
parents:
diff changeset
27
Nomad
parents:
diff changeset
28 // UIControl
1815
bd899dfd976c MainMenuWindow
Nomad
parents: 1804
diff changeset
29 //virtual bool OnKey(int key) override;
1804
Nomad
parents:
diff changeset
30 // UIControl
Nomad
parents:
diff changeset
31 virtual bool OnMouseLeftClick(int x, int y) override;
Nomad
parents:
diff changeset
32 // UIControl
Nomad
parents:
diff changeset
33 virtual bool OnMouseRightClick(int x, int y) override;
Nomad
parents:
diff changeset
34 // UIControl
1815
bd899dfd976c MainMenuWindow
Nomad
parents: 1804
diff changeset
35 //virtual bool OnMouseEnter() override;
1804
Nomad
parents:
diff changeset
36 // UIControl
1815
bd899dfd976c MainMenuWindow
Nomad
parents: 1804
diff changeset
37 //virtual bool OnMouseLeave() override;
1804
Nomad
parents:
diff changeset
38
Nomad
parents:
diff changeset
39 protected:
Nomad
parents:
diff changeset
40 bool Initialize(const wchar_t *title, int window_width, int window_height);
1994
4088cc908c78 auto change color depth to 16 bit
zipi
parents: 1815
diff changeset
41 void Deinitialize();
4088cc908c78 auto change color depth to 16 bit
zipi
parents: 1815
diff changeset
42 bool SetColorDepth(int bit);
1804
Nomad
parents:
diff changeset
43 bool WinApiMessageProc(UINT msg, WPARAM wparam, LPARAM lparam, LRESULT *result);
Nomad
parents:
diff changeset
44
Nomad
parents:
diff changeset
45 HWND api_handle;
1994
4088cc908c78 auto change color depth to 16 bit
zipi
parents: 1815
diff changeset
46 DEVMODE dm;
1804
Nomad
parents:
diff changeset
47
Nomad
parents:
diff changeset
48 private:
1994
4088cc908c78 auto change color depth to 16 bit
zipi
parents: 1815
diff changeset
49 bool ChangedColorDepth;
1804
Nomad
parents:
diff changeset
50 static LPARAM __stdcall WinApiMsgRouter(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
Nomad
parents:
diff changeset
51
Nomad
parents:
diff changeset
52 HMENU CreateDebugMenuPanel();
Nomad
parents:
diff changeset
53 };