CommitDlg: Update index using libgit2 incrementally
[TortoiseGit.git] / ext / ResizableLib / ResizableFrame.cpp
blob56a33782f78ca3b33d662ecd731f509f43db53fb
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;
37 m_bRectOnly = FALSE;
40 CResizableFrame::~CResizableFrame()
45 BEGIN_MESSAGE_MAP(CResizableFrame, CFrameWnd)
46 //{{AFX_MSG_MAP(CResizableFrame)
47 ON_WM_GETMINMAXINFO()
48 ON_WM_DESTROY()
49 ON_WM_NCCREATE()
50 ON_WM_WINDOWPOSCHANGING()
51 //}}AFX_MSG_MAP
52 END_MESSAGE_MAP()
54 /////////////////////////////////////////////////////////////////////////////
55 // CResizableFrame message handlers
57 void CResizableFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
59 MinMaxInfo(lpMMI);
61 CView* pView = GetActiveView();
62 if (pView == NULL)
63 return;
65 ChainMinMaxInfo(lpMMI, this, pView);
68 // NOTE: this must be called after setting the layout
69 // to have the view and its controls displayed properly
70 BOOL CResizableFrame::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly)
72 m_sSection = pszSection;
74 m_bEnableSaveRestore = TRUE;
75 m_bRectOnly = bRectOnly;
77 // restore immediately
78 return LoadWindowRect(pszSection, bRectOnly);
81 void CResizableFrame::OnDestroy()
83 if (m_bEnableSaveRestore)
84 SaveWindowRect(m_sSection, m_bRectOnly);
86 CFrameWnd::OnDestroy();
89 BOOL CResizableFrame::OnNcCreate(LPCREATESTRUCT lpCreateStruct)
91 if (!CFrameWnd::OnNcCreate(lpCreateStruct))
92 return FALSE;
94 MakeResizable(lpCreateStruct);
96 return TRUE;
99 LRESULT CResizableFrame::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
101 if (message != WM_NCCALCSIZE || wParam == 0)
102 return CFrameWnd::WindowProc(message, wParam, lParam);
104 // specifying valid rects needs controls already anchored
105 LRESULT lResult = 0;
106 HandleNcCalcSize(FALSE, (LPNCCALCSIZE_PARAMS)lParam, lResult);
107 lResult = CFrameWnd::WindowProc(message, wParam, lParam);
108 HandleNcCalcSize(TRUE, (LPNCCALCSIZE_PARAMS)lParam, lResult);
109 return lResult;
112 // TODO: implement this in CResizableMinMax
113 // We definitely need pluggable message handlers ala WTL!
114 void CResizableFrame::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
116 if ((lpwndpos->flags & (SWP_NOSIZE|SWP_NOMOVE)) != (SWP_NOSIZE|SWP_NOMOVE))
117 CFrameWnd::OnWindowPosChanging(lpwndpos);