Flush current work
[desktopswitcher.git] / shadowwindow.cpp
blob01ee313992fc8c4ee2cc5f48dd50f8d80092987c
1 // $Id: shadowwindow.cpp,v 1.1 2002/05/29 22:06:50 nedko Exp $
2 //
3 // Desktop Switcher
4 // Copyright (C) 2000,2001,2002 Nedko Arnaudov <nedko@users.sourceforge.net>
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include "ph.h"
21 #include "ShadowWindow.h"
22 #include "SwitcherWindow.h"
24 CShadowWindow::CShadowWindow(CSwitcherWindow *pWndSource)
26 m_pWndSource = pWndSource;
27 RECT rect;
29 pWndSource->GetWindowRect(&rect);
30 m_nWidth = rect.right-rect.left;
31 m_nHeight = rect.bottom-rect.top;
33 DWORD dwStyle = pWndSource->GetWindowLong(GWL_STYLE);
34 DWORD dwExStyle = pWndSource->GetWindowLong(GWL_EXSTYLE);
36 CWindowImpl<CShadowWindow>::Create(NULL, // Desktop is our parent
37 rect, // Window rectangle
38 "Shadow", // Window name
39 dwStyle&(~WS_VISIBLE), // Style
40 dwExStyle, // Extended style
41 0);
43 HRGN hRgn = NULL;
44 pWndSource->GetWindowRgn(hRgn);
45 VERIFY(SetWindowRgn(hRgn,TRUE));
48 CShadowWindow::~CShadowWindow()
50 if (m_hWnd)
51 DestroyWindow();
54 void CShadowWindow::Move(unsigned int x, unsigned int y)
56 ShowWindow(SW_SHOW);
58 MoveWindow(x,y,m_nWidth,m_nHeight,TRUE);
61 LRESULT CShadowWindow::OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
63 m_pWndSource->DrawWindow(m_hWnd);
65 return 0;