From 0f9862e47dcaeedcc4fa27be53fcfbf7eb8e1de0 Mon Sep 17 00:00:00 2001 From: Blonder Date: Tue, 3 Sep 2019 13:15:25 +0200 Subject: [PATCH] Add #define BASE_DIALOG_CLASS CDialog to be able to switch to the newer CDialogEx, that can have background color and a background image, more easily. --- ResizableLib/ResizableDialog.cpp | 18 +++++++++--------- ResizableLib/ResizableDialog.h | 3 ++- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ResizableLib/ResizableDialog.cpp b/ResizableLib/ResizableDialog.cpp index 1cdab58..65dea67 100644 --- a/ResizableLib/ResizableDialog.cpp +++ b/ResizableLib/ResizableDialog.cpp @@ -40,13 +40,13 @@ CResizableDialog::CResizableDialog() } CResizableDialog::CResizableDialog(UINT nIDTemplate, CWnd* pParentWnd) - : CDialog(nIDTemplate, pParentWnd) + : BASE_DIALOG_CLASS(nIDTemplate, pParentWnd) { PrivateConstruct(); } CResizableDialog::CResizableDialog(LPCTSTR lpszTemplateName, CWnd* pParentWnd) - : CDialog(lpszTemplateName, pParentWnd) + : BASE_DIALOG_CLASS(lpszTemplateName, pParentWnd) { PrivateConstruct(); } @@ -56,7 +56,7 @@ CResizableDialog::~CResizableDialog() } -BEGIN_MESSAGE_MAP(CResizableDialog, CDialog) +BEGIN_MESSAGE_MAP(CResizableDialog, BASE_DIALOG_CLASS) //{{AFX_MSG_MAP(CResizableDialog) ON_WM_GETMINMAXINFO() ON_WM_SIZE() @@ -71,7 +71,7 @@ END_MESSAGE_MAP() BOOL CResizableDialog::OnNcCreate(LPCREATESTRUCT lpCreateStruct) { - if (!CDialog::OnNcCreate(lpCreateStruct)) + if (!BASE_DIALOG_CLASS::OnNcCreate(lpCreateStruct)) return FALSE; // child dialogs don't want resizable border or size grip, @@ -103,12 +103,12 @@ void CResizableDialog::OnDestroy() ResetAllRects(); PrivateConstruct(); - CDialog::OnDestroy(); + BASE_DIALOG_CLASS::OnDestroy(); } void CResizableDialog::OnSize(UINT nType, int cx, int cy) { - CDialog::OnSize(nType, cx, cy); + BASE_DIALOG_CLASS::OnSize(nType, cx, cy); if (nType == SIZE_MAXHIDE || nType == SIZE_MAXSHOW) return; // arrangement not needed @@ -145,7 +145,7 @@ BOOL CResizableDialog::OnEraseBkgnd(CDC* pDC) { ClipChildren(pDC, FALSE); - BOOL bRet = CDialog::OnEraseBkgnd(pDC); + BOOL bRet = BASE_DIALOG_CLASS::OnEraseBkgnd(pDC); ClipChildren(pDC, TRUE); @@ -155,11 +155,11 @@ BOOL CResizableDialog::OnEraseBkgnd(CDC* pDC) LRESULT CResizableDialog::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { if (message != WM_NCCALCSIZE || wParam == 0) - return CDialog::WindowProc(message, wParam, lParam); + return BASE_DIALOG_CLASS::WindowProc(message, wParam, lParam); LRESULT lResult = 0; HandleNcCalcSize(FALSE, (LPNCCALCSIZE_PARAMS)lParam, lResult); - lResult = CDialog::WindowProc(message, wParam, lParam); + lResult = BASE_DIALOG_CLASS::WindowProc(message, wParam, lParam); HandleNcCalcSize(TRUE, (LPNCCALCSIZE_PARAMS)lParam, lResult); return lResult; } diff --git a/ResizableLib/ResizableDialog.h b/ResizableLib/ResizableDialog.h index 4ff73a4..2fd6b35 100644 --- a/ResizableLib/ResizableDialog.h +++ b/ResizableLib/ResizableDialog.h @@ -27,10 +27,11 @@ #include "ResizableMinMax.h" #include "ResizableWndState.h" +#define BASE_DIALOG_CLASS CDialog ///////////////////////////////////////////////////////////////////////////// // CResizableDialog window -class CResizableDialog : public CDialog, public CResizableLayout, +class CResizableDialog : public BASE_DIALOG_CLASS, public CResizableLayout, public CResizableGrip, public CResizableMinMax, public CResizableWndState {