Fixed issue #506: TortoiseGit-1.5.2.0-32bit.msi does not recognize msysGit-fullinstal...
[TortoiseGit.git] / ext / ResizableLib / ResizableFrame.cpp
blob4089ec2673e9e5e310d8b7f189b13eb1c4c9dd24
1 // ResizableFrame.cpp : implementation file
2 //
3 /////////////////////////////////////////////////////////////////////////////
4 //
5 // This file is part of ResizableLib
6 // http://sourceforge.net/projects/resizablelib
7 //
8 // Copyright (C) 2000-2004 by Paolo Messina
9 // http://www.geocities.com/ppescher - mailto:ppescher@hotmail.com
11 // The contents of this file are subject to the Artistic License (the "License").
12 // You may not use this file except in compliance with the License.
13 // You may obtain a copy of the License at:
14 // http://www.opensource.org/licenses/artistic-license.html
16 // If you find this code useful, credits would be nice!
18 /////////////////////////////////////////////////////////////////////////////
20 #include "stdafx.h"
21 #include "ResizableFrame.h"
23 #ifdef _DEBUG
24 #define new DEBUG_NEW
25 #undef THIS_FILE
26 static char THIS_FILE[] = __FILE__;
27 #endif
29 /////////////////////////////////////////////////////////////////////////////
30 // CResizableFrame
32 IMPLEMENT_DYNCREATE(CResizableFrame, CFrameWnd)
34 CResizableFrame::CResizableFrame()
36 m_bEnableSaveRestore = FALSE;
39 CResizableFrame::~CResizableFrame()
44 BEGIN_MESSAGE_MAP(CResizableFrame, CFrameWnd)
45 //{{AFX_MSG_MAP(CResizableFrame)
46 ON_WM_GETMINMAXINFO()
47 ON_WM_DESTROY()
48 ON_WM_NCCREATE()
49 ON_WM_WINDOWPOSCHANGING()
50 //}}AFX_MSG_MAP
51 END_MESSAGE_MAP()
53 /////////////////////////////////////////////////////////////////////////////
54 // CResizableFrame message handlers
56 void CResizableFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
58 MinMaxInfo(lpMMI);
60 CView* pView = GetActiveView();
61 if (pView == NULL)
62 return;
64 ChainMinMaxInfo(lpMMI, this, pView);
67 // NOTE: this must be called after setting the layout
68 // to have the view and its controls displayed properly
69 BOOL CResizableFrame::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly)
71 m_sSection = pszSection;
73 m_bEnableSaveRestore = TRUE;
74 m_bRectOnly = bRectOnly;
76 // restore immediately
77 return LoadWindowRect(pszSection, bRectOnly);
80 void CResizableFrame::OnDestroy()
82 if (m_bEnableSaveRestore)
83 SaveWindowRect(m_sSection, m_bRectOnly);
85 CFrameWnd::OnDestroy();
88 BOOL CResizableFrame::OnNcCreate(LPCREATESTRUCT lpCreateStruct)
90 if (!CFrameWnd::OnNcCreate(lpCreateStruct))
91 return FALSE;
93 MakeResizable(lpCreateStruct);
95 return TRUE;
98 LRESULT CResizableFrame::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
100 if (message != WM_NCCALCSIZE || wParam == 0)
101 return CFrameWnd::WindowProc(message, wParam, lParam);
103 // specifying valid rects needs controls already anchored
104 LRESULT lResult = 0;
105 HandleNcCalcSize(FALSE, (LPNCCALCSIZE_PARAMS)lParam, lResult);
106 lResult = CFrameWnd::WindowProc(message, wParam, lParam);
107 HandleNcCalcSize(TRUE, (LPNCCALCSIZE_PARAMS)lParam, lResult);
108 return lResult;
111 // TODO: implement this in CResizableMinMax
112 // We definitely need pluggable message handlers ala WTL!
113 void CResizableFrame::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
115 if ((lpwndpos->flags & (SWP_NOSIZE|SWP_NOMOVE)) != (SWP_NOSIZE|SWP_NOMOVE))
116 CFrameWnd::OnWindowPosChanging(lpwndpos);