OSDN Git Service

igit.exe update (staged/modified checking order restored)
[tortoisegit/TortoiseGitJp.git] / ext / ResizableLib / ResizableMDIChild.cpp
1 // ResizableMDIChild.cpp : implementation file\r
2 //\r
3 /////////////////////////////////////////////////////////////////////////////\r
4 //\r
5 // This file is part of ResizableLib\r
6 // http://sourceforge.net/projects/resizablelib\r
7 //\r
8 // Copyright (C) 2000-2004 by Paolo Messina\r
9 // http://www.geocities.com/ppescher - mailto:ppescher@hotmail.com\r
10 //\r
11 // The contents of this file are subject to the Artistic License (the "License").\r
12 // You may not use this file except in compliance with the License. \r
13 // You may obtain a copy of the License at:\r
14 // http://www.opensource.org/licenses/artistic-license.html\r
15 //\r
16 // If you find this code useful, credits would be nice!\r
17 //\r
18 /////////////////////////////////////////////////////////////////////////////\r
19 \r
20 #include "stdafx.h"\r
21 #include "ResizableMDIChild.h"\r
22 \r
23 #ifdef _DEBUG\r
24 #define new DEBUG_NEW\r
25 #undef THIS_FILE\r
26 static char THIS_FILE[] = __FILE__;\r
27 #endif\r
28 \r
29 /////////////////////////////////////////////////////////////////////////////\r
30 // CResizableMDIChild\r
31 \r
32 IMPLEMENT_DYNCREATE(CResizableMDIChild, CMDIChildWnd)\r
33 \r
34 CResizableMDIChild::CResizableMDIChild()\r
35 {\r
36         m_bEnableSaveRestore = FALSE;\r
37 }\r
38 \r
39 CResizableMDIChild::~CResizableMDIChild()\r
40 {\r
41 }\r
42 \r
43 \r
44 BEGIN_MESSAGE_MAP(CResizableMDIChild, CMDIChildWnd)\r
45         //{{AFX_MSG_MAP(CResizableMDIChild)\r
46         ON_WM_GETMINMAXINFO()\r
47         ON_WM_SIZE()\r
48         ON_WM_DESTROY()\r
49         ON_WM_NCCREATE()\r
50         //}}AFX_MSG_MAP\r
51 END_MESSAGE_MAP()\r
52 \r
53 /////////////////////////////////////////////////////////////////////////////\r
54 // CResizableMDIChild message handlers\r
55 \r
56 void CResizableMDIChild::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) \r
57 {\r
58         // MDI should call default implementation\r
59         CMDIChildWnd::OnGetMinMaxInfo(lpMMI);\r
60 \r
61         MinMaxInfo(lpMMI);\r
62 \r
63         CWnd* pView = GetDlgItem(AFX_IDW_PANE_FIRST);//GetActiveView();\r
64         if (pView != NULL)\r
65                 ChainMinMaxInfo(lpMMI, this, pView);\r
66 }\r
67 \r
68 void CResizableMDIChild::OnSize(UINT nType, int cx, int cy) \r
69 {\r
70         CMDIChildWnd::OnSize(nType, cx, cy);\r
71 \r
72 /* Why was this necessary???\r
73 \r
74         // make sure the MDI parent frame doesn't clip\r
75         // this child window when it is maximized\r
76         if (nType == SIZE_MAXIMIZED)\r
77         {\r
78                 CMDIFrameWnd* pFrame = GetMDIFrame();\r
79 \r
80                 CRect rect;\r
81                 pFrame->GetWindowRect(rect);\r
82                 pFrame->MoveWindow(rect);\r
83         }\r
84 /*/\r
85 }\r
86 \r
87 // NOTE: this must be called after setting the layout\r
88 //       to have the view and its controls displayed properly\r
89 BOOL CResizableMDIChild::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly)\r
90 {\r
91         m_sSection = pszSection;\r
92 \r
93         m_bEnableSaveRestore = TRUE;\r
94         m_bRectOnly = bRectOnly;\r
95 \r
96         // restore immediately\r
97         return LoadWindowRect(pszSection, bRectOnly);\r
98 }\r
99 \r
100 void CResizableMDIChild::OnDestroy() \r
101 {\r
102         if (m_bEnableSaveRestore)\r
103                 SaveWindowRect(m_sSection, m_bRectOnly);\r
104 \r
105         CMDIChildWnd::OnDestroy();\r
106 }\r
107 \r
108 \r
109 LRESULT CResizableMDIChild::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) \r
110 {\r
111         if (message != WM_NCCALCSIZE || wParam == 0)\r
112                 return CMDIChildWnd::WindowProc(message, wParam, lParam);\r
113 \r
114         // specifying valid rects needs controls already anchored\r
115         LRESULT lResult = 0;\r
116         HandleNcCalcSize(FALSE, (LPNCCALCSIZE_PARAMS)lParam, lResult);\r
117         lResult = CMDIChildWnd::WindowProc(message, wParam, lParam);\r
118         HandleNcCalcSize(TRUE, (LPNCCALCSIZE_PARAMS)lParam, lResult);\r
119         return lResult;\r
120 }\r
121 \r
122 BOOL CResizableMDIChild::OnNcCreate(LPCREATESTRUCT lpCreateStruct) \r
123 {\r
124         if (!CMDIChildWnd::OnNcCreate(lpCreateStruct))\r
125                 return FALSE;\r
126         ModifyStyle(0, WS_CLIPCHILDREN);\r
127         return TRUE;\r
128 }\r