Do not show "Open" or "Open with" context menu entries for folders
[TortoiseGit.git] / ext / ResizableLib / ResizableMDIChild.cpp
blobbe57e04cc9f62aa586ce634cab9e8f9abf2f56d9
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;
37 m_bRectOnly = FALSE;
40 CResizableMDIChild::~CResizableMDIChild()
45 BEGIN_MESSAGE_MAP(CResizableMDIChild, CMDIChildWnd)
46 //{{AFX_MSG_MAP(CResizableMDIChild)
47 ON_WM_GETMINMAXINFO()
48 ON_WM_SIZE()
49 ON_WM_DESTROY()
50 ON_WM_NCCREATE()
51 //}}AFX_MSG_MAP
52 END_MESSAGE_MAP()
54 /////////////////////////////////////////////////////////////////////////////
55 // CResizableMDIChild message handlers
57 void CResizableMDIChild::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
59 // MDI should call default implementation
60 CMDIChildWnd::OnGetMinMaxInfo(lpMMI);
62 MinMaxInfo(lpMMI);
64 CWnd* pView = GetDlgItem(AFX_IDW_PANE_FIRST);//GetActiveView();
65 if (pView != NULL)
66 ChainMinMaxInfo(lpMMI, this, pView);
69 void CResizableMDIChild::OnSize(UINT nType, int cx, int cy)
71 CMDIChildWnd::OnSize(nType, cx, cy);
73 /* Why was this necessary???
75 // make sure the MDI parent frame doesn't clip
76 // this child window when it is maximized
77 if (nType == SIZE_MAXIMIZED)
79 CMDIFrameWnd* pFrame = GetMDIFrame();
81 CRect rect;
82 pFrame->GetWindowRect(rect);
83 pFrame->MoveWindow(rect);
85 /*/
88 // NOTE: this must be called after setting the layout
89 // to have the view and its controls displayed properly
90 BOOL CResizableMDIChild::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly)
92 m_sSection = pszSection;
94 m_bEnableSaveRestore = TRUE;
95 m_bRectOnly = bRectOnly;
97 // restore immediately
98 return LoadWindowRect(pszSection, bRectOnly);
101 void CResizableMDIChild::OnDestroy()
103 if (m_bEnableSaveRestore)
104 SaveWindowRect(m_sSection, m_bRectOnly);
106 CMDIChildWnd::OnDestroy();
110 LRESULT CResizableMDIChild::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
112 if (message != WM_NCCALCSIZE || wParam == 0)
113 return CMDIChildWnd::WindowProc(message, wParam, lParam);
115 // specifying valid rects needs controls already anchored
116 LRESULT lResult = 0;
117 HandleNcCalcSize(FALSE, (LPNCCALCSIZE_PARAMS)lParam, lResult);
118 lResult = CMDIChildWnd::WindowProc(message, wParam, lParam);
119 HandleNcCalcSize(TRUE, (LPNCCALCSIZE_PARAMS)lParam, lResult);
120 return lResult;
123 BOOL CResizableMDIChild::OnNcCreate(LPCREATESTRUCT lpCreateStruct)
125 if (!CMDIChildWnd::OnNcCreate(lpCreateStruct))
126 return FALSE;
127 ModifyStyle(0, WS_CLIPCHILDREN);
128 return TRUE;