2015-08-17 12:03:39 +00:00
|
|
|
/*
|
2023-06-23 11:04:32 +00:00
|
|
|
* PROJECT: PAINT for ReactOS
|
|
|
|
* LICENSE: LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
|
|
|
|
* PURPOSE: Window for fullscreen view
|
2023-06-27 18:22:21 +00:00
|
|
|
* COPYRIGHT: Copyright 2015 Benedikt Freisen <b.freisen@gmx.net>
|
2015-08-17 12:03:39 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "precomp.h"
|
|
|
|
|
2023-03-28 13:31:26 +00:00
|
|
|
CFullscreenWindow fullscreenWindow;
|
|
|
|
|
2015-08-17 12:03:39 +00:00
|
|
|
/* FUNCTIONS ********************************************************/
|
|
|
|
|
2023-03-28 13:31:26 +00:00
|
|
|
HWND CFullscreenWindow::DoCreate()
|
|
|
|
{
|
|
|
|
if (m_hWnd)
|
|
|
|
return m_hWnd;
|
|
|
|
|
|
|
|
RECT rc = {0, 0, 0, 0}; // Rely on SW_SHOWMAXIMIZED
|
|
|
|
return Create(HWND_DESKTOP, rc, NULL, WS_POPUPWINDOW, WS_EX_TOPMOST);
|
|
|
|
}
|
|
|
|
|
2015-08-17 12:03:39 +00:00
|
|
|
LRESULT CFullscreenWindow::OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
|
|
|
{
|
2023-11-04 10:25:45 +00:00
|
|
|
SendMessage(WM_SETICON, ICON_BIG, (LPARAM)::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDI_APPICON)));
|
|
|
|
SendMessage(WM_SETICON, ICON_SMALL, (LPARAM)::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDI_APPICON)));
|
2015-08-17 12:03:39 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
LRESULT CFullscreenWindow::OnCloseOrKeyDownOrLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
|
|
|
{
|
|
|
|
mainWindow.ShowWindow(SW_SHOW);
|
|
|
|
ShowWindow(SW_HIDE);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
LRESULT CFullscreenWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
|
|
|
{
|
|
|
|
PAINTSTRUCT ps;
|
|
|
|
HDC hDC = BeginPaint(&ps);
|
|
|
|
RECT rcWnd;
|
|
|
|
GetWindowRect(&rcWnd);
|
|
|
|
INT cxDest = imageModel.GetWidth();
|
|
|
|
INT cyDest = imageModel.GetHeight();
|
|
|
|
INT xDest = (rcWnd.right - rcWnd.left - cxDest) / 2;
|
|
|
|
INT yDest = (rcWnd.bottom - rcWnd.top - cyDest) / 2;
|
2023-11-18 05:25:19 +00:00
|
|
|
::BitBlt(hDC, xDest, yDest, cxDest, cyDest, imageModel.GetDC(), 0, 0, SRCCOPY);
|
2015-08-17 12:03:39 +00:00
|
|
|
EndPaint(&ps);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
LRESULT CFullscreenWindow::OnGetText(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
|
|
|
{
|
|
|
|
// return caption of the main window, instead
|
|
|
|
return mainWindow.SendMessage(nMsg, wParam, lParam);
|
|
|
|
}
|