Merge branch 'scintilla-357'
[TortoiseGit.git] / ext / ResizableLib / ResizablePage.cpp
blob472a40d10198d04aff9aefbe91e8501eda8b5de7
1 // ResizablePage.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 "ResizablePage.h"
23 #ifdef _DEBUG
24 #define new DEBUG_NEW
25 #undef THIS_FILE
26 static char THIS_FILE[] = __FILE__;
27 #endif
29 /////////////////////////////////////////////////////////////////////////////
30 // CResizablePage
32 IMPLEMENT_DYNCREATE(CResizablePage, CPropertyPage)
34 CResizablePage::CResizablePage()
38 CResizablePage::CResizablePage(UINT nIDTemplate, UINT nIDCaption)
39 : CPropertyPage(nIDTemplate, nIDCaption)
43 CResizablePage::CResizablePage(LPCTSTR lpszTemplateName, UINT nIDCaption)
44 : CPropertyPage(lpszTemplateName, nIDCaption)
48 CResizablePage::~CResizablePage()
53 BEGIN_MESSAGE_MAP(CResizablePage, CPropertyPage)
54 //{{AFX_MSG_MAP(CResizablePage)
55 ON_WM_SIZE()
56 ON_WM_ERASEBKGND()
57 ON_WM_GETMINMAXINFO()
58 ON_WM_DESTROY()
59 //}}AFX_MSG_MAP
60 END_MESSAGE_MAP()
63 /////////////////////////////////////////////////////////////////////////////
64 // CResizablePage message handlers
66 void CResizablePage::OnSize(UINT nType, int cx, int cy)
68 CWnd::OnSize(nType, cx, cy);
70 ArrangeLayout();
73 BOOL CResizablePage::OnEraseBkgnd(CDC* pDC)
75 ClipChildren(pDC, FALSE);
77 BOOL bRet = CPropertyPage::OnEraseBkgnd(pDC);
79 ClipChildren(pDC, TRUE);
81 return bRet;
84 void CResizablePage::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
86 MinMaxInfo(lpMMI);
89 BOOL CResizablePage::OnInitDialog()
91 CPropertyPage::OnInitDialog();
93 // set the initial size as the min track size
94 CRect rc;
95 GetWindowRect(&rc);
96 SetMinTrackSize(rc.Size());
98 return TRUE; // return TRUE unless you set the focus to a control
99 // EXCEPTION: OCX Property Pages should return FALSE
102 void CResizablePage::OnDestroy()
104 // remove child windows
105 RemoveAllAnchors();
107 CPropertyPage::OnDestroy();
110 LRESULT CResizablePage::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
112 if (message != WM_NCCALCSIZE || wParam == 0)
113 return CPropertyPage::WindowProc(message, wParam, lParam);
115 LRESULT lResult = 0;
116 HandleNcCalcSize(FALSE, (LPNCCALCSIZE_PARAMS)lParam, lResult);
117 lResult = CPropertyPage::WindowProc(message, wParam, lParam);
118 HandleNcCalcSize(TRUE, (LPNCCALCSIZE_PARAMS)lParam, lResult);
119 return lResult;