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 #include "precomp.h" 10 11 CFullscreenWindow fullscreenWindow; 12 13 /* FUNCTIONS ********************************************************/ 14 15 HWND CFullscreenWindow::DoCreate() 16 { 17 if (m_hWnd) 18 return m_hWnd; 19 20 RECT rc = {0, 0, 0, 0}; // Rely on SW_SHOWMAXIMIZED 21 return Create(HWND_DESKTOP, rc, NULL, WS_POPUPWINDOW, WS_EX_TOPMOST); 22 } 23 24 LRESULT CFullscreenWindow::OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) 25 { 26 SendMessage(WM_SETICON, ICON_BIG, (LPARAM) LoadIcon(hProgInstance, MAKEINTRESOURCE(IDI_APPICON))); 27 SendMessage(WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(hProgInstance, MAKEINTRESOURCE(IDI_APPICON))); 28 return 0; 29 } 30 31 LRESULT CFullscreenWindow::OnCloseOrKeyDownOrLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) 32 { 33 mainWindow.ShowWindow(SW_SHOW); 34 ShowWindow(SW_HIDE); 35 return 0; 36 } 37 38 LRESULT CFullscreenWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) 39 { 40 PAINTSTRUCT ps; 41 HDC hDC = BeginPaint(&ps); 42 RECT rcWnd; 43 GetWindowRect(&rcWnd); 44 INT cxDest = imageModel.GetWidth(); 45 INT cyDest = imageModel.GetHeight(); 46 INT xDest = (rcWnd.right - rcWnd.left - cxDest) / 2; 47 INT yDest = (rcWnd.bottom - rcWnd.top - cyDest) / 2; 48 BitBlt(hDC, xDest, yDest, cxDest, cyDest, imageModel.GetDC(), 0, 0, SRCCOPY); 49 EndPaint(&ps); 50 return 0; 51 } 52 53 LRESULT CFullscreenWindow::OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) 54 { 55 Invalidate(TRUE); 56 return 0; 57 } 58 59 LRESULT CFullscreenWindow::OnGetText(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) 60 { 61 // return caption of the main window, instead 62 return mainWindow.SendMessage(nMsg, wParam, lParam); 63 } 64