Do not show "Open" or "Open with" context menu entries for folders
[TortoiseGit.git] / ext / ResizableLib / ResizableMDIFrame.cpp
blobc064fa87ac8c5764c6e95b0c5daf80a9d862aeb9
1 // ResizableMDIFrame.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 "ResizableMDIFrame.h"
23 #ifdef _DEBUG
24 #define new DEBUG_NEW
25 #undef THIS_FILE
26 static char THIS_FILE[] = __FILE__;
27 #endif
29 /////////////////////////////////////////////////////////////////////////////
30 // CResizableMDIFrame
32 IMPLEMENT_DYNCREATE(CResizableMDIFrame, CMDIFrameWnd)
34 CResizableMDIFrame::CResizableMDIFrame()
36 m_bEnableSaveRestore = FALSE;
37 m_bRectOnly = FALSE;
40 CResizableMDIFrame::~CResizableMDIFrame()
45 BEGIN_MESSAGE_MAP(CResizableMDIFrame, CMDIFrameWnd)
46 //{{AFX_MSG_MAP(CResizableMDIFrame)
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 // CResizableMDIFrame message handlers
57 void CResizableMDIFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
59 // MDI should call default implementation
60 CMDIFrameWnd::OnGetMinMaxInfo(lpMMI);
62 MinMaxInfo(lpMMI);
64 BOOL bMaximized = FALSE;
65 CMDIChildWnd* pChild = MDIGetActive(&bMaximized);
66 if (pChild != NULL && bMaximized)
67 ChainMinMaxInfo(lpMMI, this, pChild);
70 // NOTE: this must be called after setting the layout
71 // to have the view and its controls displayed properly
72 BOOL CResizableMDIFrame::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly)
74 m_sSection = pszSection;
76 m_bEnableSaveRestore = TRUE;
77 m_bRectOnly = bRectOnly;
79 // restore immediately
80 return LoadWindowRect(pszSection, bRectOnly);
83 void CResizableMDIFrame::OnDestroy()
85 if (m_bEnableSaveRestore)
86 SaveWindowRect(m_sSection, m_bRectOnly);
88 CMDIFrameWnd::OnDestroy();
91 BOOL CResizableMDIFrame::OnNcCreate(LPCREATESTRUCT lpCreateStruct)
93 if (!CMDIFrameWnd::OnNcCreate(lpCreateStruct))
94 return FALSE;
96 MakeResizable(lpCreateStruct);
98 return TRUE;
101 LRESULT CResizableMDIFrame::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
103 if (message != WM_NCCALCSIZE || wParam == 0)
104 return CMDIFrameWnd::WindowProc(message, wParam, lParam);
106 // specifying valid rects needs controls already anchored
107 LRESULT lResult = 0;
108 HandleNcCalcSize(FALSE, (LPNCCALCSIZE_PARAMS)lParam, lResult);
109 lResult = CMDIFrameWnd::WindowProc(message, wParam, lParam);
110 HandleNcCalcSize(TRUE, (LPNCCALCSIZE_PARAMS)lParam, lResult);
111 return lResult;
114 void CResizableMDIFrame::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
116 CMDIFrameWnd::OnWindowPosChanging(lpwndpos);
118 // since this window class doesn't have the style CS_HREDRAW|CS_VREDRAW
119 // the client area is not invalidated during a resize operation and
120 // this prevents the system from using WM_NCCALCSIZE to validate rects
121 Invalidate();