Parser Reflog output
[TortoiseGit.git] / ext / ResizableLib / ResizableMDIChild.cpp
blobe6819a26b7c1e5fa7ba0cb216477e5be23dfea79
1 // ResizableMDIChild.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 "ResizableMDIChild.h"
23 #ifdef _DEBUG
24 #define new DEBUG_NEW
25 #undef THIS_FILE
26 static char THIS_FILE[] = __FILE__;
27 #endif
29 /////////////////////////////////////////////////////////////////////////////
30 // CResizableMDIChild
32 IMPLEMENT_DYNCREATE(CResizableMDIChild, CMDIChildWnd)
34 CResizableMDIChild::CResizableMDIChild()
36 m_bEnableSaveRestore = FALSE;
39 CResizableMDIChild::~CResizableMDIChild()
44 BEGIN_MESSAGE_MAP(CResizableMDIChild, CMDIChildWnd)
45 //{{AFX_MSG_MAP(CResizableMDIChild)
46 ON_WM_GETMINMAXINFO()
47 ON_WM_SIZE()
48 ON_WM_DESTROY()
49 ON_WM_NCCREATE()
50 //}}AFX_MSG_MAP
51 END_MESSAGE_MAP()
53 /////////////////////////////////////////////////////////////////////////////
54 // CResizableMDIChild message handlers
56 void CResizableMDIChild::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
58 // MDI should call default implementation
59 CMDIChildWnd::OnGetMinMaxInfo(lpMMI);
61 MinMaxInfo(lpMMI);
63 CWnd* pView = GetDlgItem(AFX_IDW_PANE_FIRST);//GetActiveView();
64 if (pView != NULL)
65 ChainMinMaxInfo(lpMMI, this, pView);
68 void CResizableMDIChild::OnSize(UINT nType, int cx, int cy)
70 CMDIChildWnd::OnSize(nType, cx, cy);
72 /* Why was this necessary???
74 // make sure the MDI parent frame doesn't clip
75 // this child window when it is maximized
76 if (nType == SIZE_MAXIMIZED)
78 CMDIFrameWnd* pFrame = GetMDIFrame();
80 CRect rect;
81 pFrame->GetWindowRect(rect);
82 pFrame->MoveWindow(rect);
84 /*/
87 // NOTE: this must be called after setting the layout
88 // to have the view and its controls displayed properly
89 BOOL CResizableMDIChild::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly)
91 m_sSection = pszSection;
93 m_bEnableSaveRestore = TRUE;
94 m_bRectOnly = bRectOnly;
96 // restore immediately
97 return LoadWindowRect(pszSection, bRectOnly);
100 void CResizableMDIChild::OnDestroy()
102 if (m_bEnableSaveRestore)
103 SaveWindowRect(m_sSection, m_bRectOnly);
105 CMDIChildWnd::OnDestroy();
109 LRESULT CResizableMDIChild::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
111 if (message != WM_NCCALCSIZE || wParam == 0)
112 return CMDIChildWnd::WindowProc(message, wParam, lParam);
114 // specifying valid rects needs controls already anchored
115 LRESULT lResult = 0;
116 HandleNcCalcSize(FALSE, (LPNCCALCSIZE_PARAMS)lParam, lResult);
117 lResult = CMDIChildWnd::WindowProc(message, wParam, lParam);
118 HandleNcCalcSize(TRUE, (LPNCCALCSIZE_PARAMS)lParam, lResult);
119 return lResult;
122 BOOL CResizableMDIChild::OnNcCreate(LPCREATESTRUCT lpCreateStruct)
124 if (!CMDIChildWnd::OnNcCreate(lpCreateStruct))
125 return FALSE;
126 ModifyStyle(0, WS_CLIPCHILDREN);
127 return TRUE;