Update Windows/WndMainWindow.cpp

This commit is contained in:
jacky400 committed 2012-12-05 14:31:41 +08:00
1 parent a072fff4d4
commit b49e053edd
1 file changed
+57 -3
+57 -3
View File
@@ -35,6 +35,9 @@
#include "XPTheme.h"
#endif
BOOL g_bFullScreen = FALSE;
RECT rc = {0};
namespace MainWindow
{
HWND hwndMain;
@@ -81,7 +84,7 @@ namespace MainWindow
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_PPSSPP);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH);
wcex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wcex.lpszMenuName = (LPCSTR)IDR_MENU1;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = (HICON)LoadImage(hInstance, (LPCTSTR)IDI_PPSSPP, IMAGE_ICON, 16,16,LR_SHARED);
@@ -465,8 +468,12 @@ namespace MainWindow
g_Config.bIgnoreBadMemAccess = !g_Config.bIgnoreBadMemAccess;
UpdateMenus();
break;
//case ID_OPTIONS_FULLSCREEN:
// break;
case ID_OPTIONS_FULLSCREEN:
if(g_bFullScreen)
_ViewNormal(hWnd);
else
_ViewFullScreen(hWnd);
break;
case ID_OPTIONS_DISPLAYRAWFRAMEBUFFER:
g_Config.bDisplayFramebuffer = !g_Config.bDisplayFramebuffer;
@@ -670,6 +677,53 @@ namespace MainWindow
{
InvalidateRect(hwndDisplay,0,0);
}
void _ViewNormal(HWND hWnd)
{
// put caption and border styles back
DWORD dwOldStyle = ::GetWindowLong(hWnd, GWL_STYLE);
DWORD dwNewStyle = dwOldStyle | WS_CAPTION | WS_THICKFRAME;
::SetWindowLong(hWnd, GWL_STYLE, dwNewStyle);
// put back the menu bar
::SetMenu(hWnd, menu);
// resize to normal view
// NOTE: use SWP_FRAMECHANGED to force redraw non-client
const int x = rc.left;
const int y = rc.top;
const int cx = rc.right - rc.left;
const int cy = rc.bottom - rc.top;
::SetWindowPos(hWnd, HWND_NOTOPMOST, x, y, cx, cy, SWP_FRAMECHANGED);
// reset full screen indicator
g_bFullScreen = FALSE;
}
void _ViewFullScreen(HWND hWnd)
{
// keep in mind normal window rectangle
::GetWindowRect(hWnd, &rc);
// remove caption and border styles
DWORD dwOldStyle = ::GetWindowLong(hWnd, GWL_STYLE);
DWORD dwNewStyle = dwOldStyle & ~(WS_CAPTION | WS_THICKFRAME);
::SetWindowLong(hWnd, GWL_STYLE, dwNewStyle);
// remove the menu bar
::SetMenu(hWnd, NULL);
// resize to full screen view
// NOTE: use SWP_FRAMECHANGED to force redraw non-client
const int x = 0;
const int y = 0;
const int cx = ::GetSystemMetrics(SM_CXSCREEN);
const int cy = ::GetSystemMetrics(SM_CYSCREEN);
::SetWindowPos(hWnd, HWND_TOPMOST, x, y, cx, cy, SWP_FRAMECHANGED);
// set full screen indicator
g_bFullScreen = TRUE;
}
void SetPlaying(const char *text)
{