1 /*
2  * PROJECT:     PAINT for ReactOS
3  * LICENSE:     LGPL
4  * FILE:        base/applications/mspaint/fullscreen.cpp
5  * PURPOSE:     Window for fullscreen view
6  * PROGRAMMERS: Benedikt Freisen
7  */
8 
9 /* INCLUDES *********************************************************/
10 
11 #include "precomp.h"
12 
13 /* FUNCTIONS ********************************************************/
14 
15 LRESULT CFullscreenWindow::OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
16 {
17     SendMessage(WM_SETICON, ICON_BIG, (LPARAM) LoadIcon(hProgInstance, MAKEINTRESOURCE(IDI_APPICON)));
18     SendMessage(WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(hProgInstance, MAKEINTRESOURCE(IDI_APPICON)));
19     return 0;
20 }
21 
22 LRESULT CFullscreenWindow::OnCloseOrKeyDownOrLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
23 {
24     mainWindow.ShowWindow(SW_SHOW);
25     ShowWindow(SW_HIDE);
26     return 0;
27 }
28 
29 LRESULT CFullscreenWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
30 {
31     PAINTSTRUCT ps;
32     HDC hDC = BeginPaint(&ps);
33     RECT rcWnd;
34     GetWindowRect(&rcWnd);
35     INT cxDest = imageModel.GetWidth();
36     INT cyDest = imageModel.GetHeight();
37     INT xDest = (rcWnd.right - rcWnd.left - cxDest) / 2;
38     INT yDest = (rcWnd.bottom - rcWnd.top - cyDest) / 2;
39     BitBlt(hDC, xDest, yDest, cxDest, cyDest, imageModel.GetDC(), 0, 0, SRCCOPY);
40     EndPaint(&ps);
41     return 0;
42 }
43 
44 LRESULT CFullscreenWindow::OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
45 {
46     Invalidate(TRUE);
47     return 0;
48 }
49 
50 LRESULT CFullscreenWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
51 {
52     SetCursor(LoadCursor(NULL, IDC_ARROW));
53     bHandled = FALSE;
54     return 0;
55 }
56 
57 LRESULT CFullscreenWindow::OnGetText(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
58 {
59     // return caption of the main window, instead
60     return mainWindow.SendMessage(nMsg, wParam, lParam);
61 }
62