-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathResizablePage.cpp
120 lines (94 loc) · 2.8 KB
/
ResizablePage.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// ResizablePage.cpp : implementation file
//
/////////////////////////////////////////////////////////////////////////////
//
// This file is part of ResizableLib
// http://sourceforge.net/projects/resizablelib
//
// Copyright (C) 2000-2004 by Paolo Messina
// http://www.geocities.com/ppescher - mailto:[email protected]
//
// The contents of this file are subject to the Artistic License (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// http://www.opensource.org/licenses/artistic-license.html
//
// If you find this code useful, credits would be nice!
//
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ResizablePage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CResizablePage
IMPLEMENT_DYNCREATE(CResizablePage, CPropertyPage)
CResizablePage::CResizablePage()
{
}
CResizablePage::CResizablePage(UINT nIDTemplate, UINT nIDCaption)
: CPropertyPage(nIDTemplate, nIDCaption)
{
}
CResizablePage::CResizablePage(LPCTSTR lpszTemplateName, UINT nIDCaption)
: CPropertyPage(lpszTemplateName, nIDCaption)
{
}
CResizablePage::~CResizablePage()
{
}
BEGIN_MESSAGE_MAP(CResizablePage, CPropertyPage)
//{{AFX_MSG_MAP(CResizablePage)
ON_WM_SIZE()
ON_WM_ERASEBKGND()
ON_WM_GETMINMAXINFO()
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CResizablePage message handlers
void CResizablePage::OnSize(UINT nType, int cx, int cy)
{
CWnd::OnSize(nType, cx, cy);
ArrangeLayout();
}
BOOL CResizablePage::OnEraseBkgnd(CDC* pDC)
{
ClipChildren(pDC, FALSE);
BOOL bRet = CPropertyPage::OnEraseBkgnd(pDC);
ClipChildren(pDC, TRUE);
return bRet;
}
void CResizablePage::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
{
MinMaxInfo(lpMMI);
}
BOOL CResizablePage::OnInitDialog()
{
CPropertyPage::OnInitDialog();
// set the initial size as the min track size
CRect rc;
GetWindowRect(&rc);
SetMinTrackSize(rc.Size());
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CResizablePage::OnDestroy()
{
// remove child windows
RemoveAllAnchors();
CPropertyPage::OnDestroy();
}
LRESULT CResizablePage::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
if (message != WM_NCCALCSIZE || wParam == 0)
return CPropertyPage::WindowProc(message, wParam, lParam);
LRESULT lResult = 0;
HandleNcCalcSize(FALSE, (LPNCCALCSIZE_PARAMS)lParam, lResult);
lResult = CPropertyPage::WindowProc(message, wParam, lParam);
HandleNcCalcSize(TRUE, (LPNCCALCSIZE_PARAMS)lParam, lResult);
return lResult;
}