Updated libgit to version 2.46.2 based on Git for Windows sources
[TortoiseGit.git] / ext / ResizableLib / ResizableMDIChild.cpp
blob03c19f08a6065d0ff3ac76523829c99b5f731b73
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()
38 CResizableMDIChild::~CResizableMDIChild()
43 BEGIN_MESSAGE_MAP(CResizableMDIChild, CMDIChildWnd)
44 //{{AFX_MSG_MAP(CResizableMDIChild)
45 ON_WM_GETMINMAXINFO()
46 ON_WM_SIZE()
47 ON_WM_DESTROY()
48 ON_WM_NCCREATE()
49 //}}AFX_MSG_MAP
50 END_MESSAGE_MAP()
52 /////////////////////////////////////////////////////////////////////////////
53 // CResizableMDIChild message handlers
55 void CResizableMDIChild::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
57 // MDI should call default implementation
58 CMDIChildWnd::OnGetMinMaxInfo(lpMMI);
60 MinMaxInfo(lpMMI);
62 CWnd* pView = GetDlgItem(AFX_IDW_PANE_FIRST);//GetActiveView();
63 if (pView != NULL)
64 ChainMinMaxInfo(lpMMI, this, pView);
67 void CResizableMDIChild::OnSize(UINT nType, int cx, int cy)
69 CMDIChildWnd::OnSize(nType, cx, cy);
71 /* Why was this necessary???
73 // make sure the MDI parent frame doesn't clip
74 // this child window when it is maximized
75 if (nType == SIZE_MAXIMIZED)
77 CMDIFrameWnd* pFrame = GetMDIFrame();
79 CRect rect;
80 pFrame->GetWindowRect(rect);
81 pFrame->MoveWindow(rect);
83 /*/
86 // NOTE: this must be called after setting the layout
87 // to have the view and its controls displayed properly
88 BOOL CResizableMDIChild::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly, BOOL bHorzResize, BOOL bVertResize)
90 m_sSection = pszSection;
92 m_bEnableSaveRestore = TRUE;
93 m_bRectOnly = bRectOnly;
95 // restore immediately
96 return LoadWindowRect(pszSection, bRectOnly, bHorzResize, bVertResize);
99 void CResizableMDIChild::OnDestroy()
101 if (m_bEnableSaveRestore)
102 SaveWindowRect(m_sSection, m_bRectOnly);
104 CMDIChildWnd::OnDestroy();
108 LRESULT CResizableMDIChild::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
110 if (message != WM_NCCALCSIZE || wParam == 0)
111 return CMDIChildWnd::WindowProc(message, wParam, lParam);
113 // specifying valid rects needs controls already anchored
114 LRESULT lResult = 0;
115 HandleNcCalcSize(FALSE, (LPNCCALCSIZE_PARAMS)lParam, lResult);
116 lResult = CMDIChildWnd::WindowProc(message, wParam, lParam);
117 HandleNcCalcSize(TRUE, (LPNCCALCSIZE_PARAMS)lParam, lResult);
118 return lResult;
121 BOOL CResizableMDIChild::OnNcCreate(LPCREATESTRUCT lpCreateStruct)
123 if (!CMDIChildWnd::OnNcCreate(lpCreateStruct))
124 return FALSE;
125 ModifyStyle(0, WS_CLIPCHILDREN);
126 return TRUE;