/** * @file XTPDialogBase.h * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ /** @cond */ #if !defined(__XTPDIALOGBASEEX_H__) # define __XTPDIALOGBASEEX_H__ /** @endcond */ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" /** @cond */ class CXTPCommandBars; class CXTPToolBar; class CXTPMenuBar; template class CXTPDialogBaseParentWrapper : public TBase { public: CXTPDialogBaseParentWrapper() { } CXTPDialogBaseParentWrapper(UINT nIDTemplate, CWnd* pParentWnd) : TBase(nIDTemplate, pParentWnd) { } CXTPDialogBaseParentWrapper(LPCTSTR lpszTemplateName, CWnd* pParentWnd) : TBase(lpszTemplateName, pParentWnd) { } # if (_MSC_VER > 1200) CXTPDialogBaseParentWrapper(UINT nIDTemplate, UINT nHtmlResID, CWnd* pParentWnd) : TBase(nIDTemplate, pParentWnd) { _ASSERTE(!"This constructor is added for interface compatibility only and must never be " "called for a non-DHTML dialog"); UNREFERENCED_PARAMETER(nHtmlResID); } CXTPDialogBaseParentWrapper(LPCTSTR lpszTemplateName, LPCTSTR szHtmlResID, CWnd* pParentWnd) : TBase(lpszTemplateName, pParentWnd) { _ASSERTE(!"This constructor is added for interface compatibility only and must never be " "called for a non-DHTML dialog"); UNREFERENCED_PARAMETER(szHtmlResID); } # endif // (_MSC_VER > 1200) }; # if (_MSC_VER > 1200) template<> class CXTPDialogBaseParentWrapper : public CDHtmlDialog { public: CXTPDialogBaseParentWrapper() { } CXTPDialogBaseParentWrapper(UINT nIDTemplate, CWnd* pParentWnd) : CDHtmlDialog(nIDTemplate, 0, pParentWnd) { _ASSERTE(!"This constructor is added for interface compatibility only and must never be " "called for a DHTML dialog"); } CXTPDialogBaseParentWrapper(LPCTSTR lpszTemplateName, CWnd* pParentWnd) : CDHtmlDialog(lpszTemplateName, 0, pParentWnd) { _ASSERTE(!"This constructor is added for interface compatibility only and must never be " "called for a DHTML dialog"); } CXTPDialogBaseParentWrapper(UINT nIDTemplate, UINT nHtmlResID, CWnd* pParentWnd) : CDHtmlDialog(nIDTemplate, nHtmlResID, pParentWnd) { } CXTPDialogBaseParentWrapper(LPCTSTR lpszTemplateName, LPCTSTR szHtmlResID, CWnd* pParentWnd) : CDHtmlDialog(lpszTemplateName, szHtmlResID, pParentWnd) { } }; template<> class CXTPDialogBaseParentWrapper : public CXTPResizeDHtmlDialog { public: CXTPDialogBaseParentWrapper() { } CXTPDialogBaseParentWrapper(UINT nIDTemplate, CWnd* pParentWnd) : CXTPResizeDHtmlDialog(nIDTemplate, 0, pParentWnd) { _ASSERTE(!"This constructor is added for interface compatibility only and must never be " "called for a DHTML dialog"); } CXTPDialogBaseParentWrapper(LPCTSTR lpszTemplateName, CWnd* pParentWnd) : CXTPResizeDHtmlDialog(lpszTemplateName, 0, pParentWnd) { _ASSERTE(!"This constructor is added for interface compatibility only and must never be " "called for a DHTML dialog"); } CXTPDialogBaseParentWrapper(UINT nIDTemplate, UINT nHtmlResID, CWnd* pParentWnd) : CXTPResizeDHtmlDialog(nIDTemplate, nHtmlResID, pParentWnd) { } CXTPDialogBaseParentWrapper(LPCTSTR lpszTemplateName, LPCTSTR szHtmlResID, CWnd* pParentWnd) : CXTPResizeDHtmlDialog(lpszTemplateName, szHtmlResID, pParentWnd) { } }; # endif // (_MSC_VER > 1200) class _XTP_EXT_CLASS CXTPDialogBaseImpl { protected: CXTPDialogBaseImpl() { # ifdef _XTP_INCLUDE_COMMANDBARS m_pCommandBars = 0; # endif } virtual ~CXTPDialogBaseImpl(); # ifdef _XTP_INCLUDE_COMMANDBARS virtual BOOL InitCommandBars(CRuntimeClass* pCommandBarsClass = NULL); void DockRightOf(CXTPToolBar* pBarToDock, CXTPToolBar* pBarOnLeft); virtual void SaveCommandBars(LPCTSTR lpszProfileName); virtual void LoadCommandBars(LPCTSTR lpszProfileName, BOOL bSilent = FALSE); virtual BOOL PreTranslateMessage(MSG* pMsg); virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult); virtual CWnd* GetCommandBarsSite() = 0; CXTPCommandBars* GetCommandBars() const { return m_pCommandBars; } private: CXTPCommandBars* m_pCommandBars; # endif }; /** @endcond */ /** * @brief * CXTPDialogBase is a TBase derived class. It represents the parent * class for a CXTPDialog class. */ template class CXTPDialogBase : public CXTPDialogBaseParentWrapper , private CXTPDialogBaseImpl { typedef CXTPDialogBaseParentWrapper Parent; public: /** * @brief * Constructs a CXTPDialog object. */ CXTPDialogBase() { } /** * @brief * Constructs a CXTPDialog object. * @param nIDTemplate Contains the ID number of a dialog-template resource. * @param pParentWnd Pointer to the parent of the DialogBase control. */ CXTPDialogBase(UINT nIDTemplate, CWnd* pParentWnd = NULL) : CXTPDialogBaseParentWrapper(nIDTemplate, pParentWnd) { } /** * @brief * Constructs a CXTPDialog object. * @param lpszTemplateName Contains a NULL-terminated string that is * the name of a dialog-template resource. * @param pParentWnd Pointer to the parent of the DialogBase control. */ CXTPDialogBase(LPCTSTR lpszTemplateName, CWnd* pParentWnd = NULL) : CXTPDialogBaseParentWrapper(lpszTemplateName, pParentWnd) { } # if (_MSC_VER > 1200) /** * @brief * Constructs a CXTPDialog object. * @param nIDTemplate Contains the ID number of a dialog-template resource. * @param nHtmlResID HTML page resource ID for DHTML dialogs. * @param pParentWnd Pointer to the parent of the DialogBase control. */ CXTPDialogBase(UINT nIDTemplate, UINT nHtmlResID, CWnd* pParentWnd = NULL) : CXTPDialogBaseParentWrapper(nIDTemplate, nHtmlResID, pParentWnd) { } /** * @brief * Constructs a CXTPDialog object. * @param lpszTemplateName Contains a NULL-terminated string that is * the name of a dialog-template resource. * @param szHtmlResID HTML page resource ID for DHTML dialogs. * @param pParentWnd Pointer to the parent of the DialogBase control. */ CXTPDialogBase(LPCTSTR lpszTemplateName, LPCTSTR szHtmlResID, CWnd* pParentWnd = NULL) : CXTPDialogBaseParentWrapper(lpszTemplateName, szHtmlResID, pParentWnd) { } # endif # ifdef _XTP_INCLUDE_COMMANDBARS /** * @brief * Creates command bars. * @param pCommandBarsClass Custom runtime class of CommandBars. It can be * used if you want to override some methods * of the CXTPCommandBars class. * @return * Nonzero if successful, otherwise 0. */ virtual BOOL InitCommandBars(CRuntimeClass* pCommandBarsClass = NULL) { return CXTPDialogBaseImpl::InitCommandBars(pCommandBarsClass); } using CXTPDialogBaseParentWrapper::RepositionBars; /** * @brief * This member function will re-dock a toolbar specified by 'pBarToDock' * to the right of a newly docked toolbar specified by 'pBarOnLeft'. * @param pBarToDock A CXTPToolBar pointer to the toolbar to be docked. * @param pBarOnLeft A CXTPToolBar pointer to the already docked toolbar. */ void DockRightOf(CXTPToolBar* pBarToDock, CXTPToolBar* pBarOnLeft) { CXTPDialogBaseImpl::DockRightOf(pBarToDock, pBarOnLeft); } /** * @brief * Call this function to save the state information to the registry * or .INI file. * @param lpszProfileName Pointer to a NULL-terminated string that specifies * the name of a section in the initialization file * or a key in the Windows registry where state * information is stored. */ virtual void SaveCommandBars(LPCTSTR lpszProfileName) { CXTPDialogBaseImpl::SaveCommandBars(lpszProfileName); } /** * @brief * Call this function to retrieve state information from the registry * or .INI file. * @param lpszProfileName Pointer to a NULL-terminated string that specifies * the name of a section in the initialization file * or a key in the Windows registry where state * information is stored. * @param bSilent TRUE to disable user notifications when command bars * are restored to their original state. */ virtual void LoadCommandBars(LPCTSTR lpszProfileName, BOOL bSilent = FALSE) { CXTPDialogBaseImpl::LoadCommandBars(lpszProfileName, bSilent); } /** * @brief * Call this member to retrieve a pointer to the CommandBars object. * @return * A pointer to the CommandBars object. */ CXTPCommandBars* GetCommandBars() const { return CXTPDialogBaseImpl::GetCommandBars(); } /** @cond */ protected: virtual CWnd* GetCommandBarsSite() { return this; } virtual BOOL PreTranslateMessage(MSG* pMsg) { if (CXTPDialogBaseImpl::PreTranslateMessage(pMsg)) return TRUE; if (TBase::PreTranslateMessage(pMsg)) return TRUE; return FALSE; } virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult) { if (CXTPDialogBaseImpl::OnWndMsg(message, wParam, lParam, pResult)) return TRUE; return TBase::OnWndMsg(message, wParam, lParam, pResult); } /** @endcond */ # endif }; /** * @brief * CXTPDialogEx is a CXTPDialogBase derived class. Use this class in * your dialog base application. */ class _XTP_EXT_CLASS CXTPDialogEx : public CXTPDialogBase { public: /** * @brief * Constructs a CXTPDialogEx object. */ CXTPDialogEx() { } /** * @brief * Constructs a CXTPDialogEx object. * @param nIDTemplate Contains the ID number of a dialog-template resource. * @param pParentWnd Pointer to the parent of the Dialog control. */ CXTPDialogEx(UINT nIDTemplate, CWnd* pParentWnd = NULL) : CXTPDialogBase(nIDTemplate, pParentWnd) { } /** * @brief * Constructs a CXTPDialogEx object. * @param lpszTemplateName Contains a NULL-terminated string that is * the name of a dialog-template resource. * @param pParentWnd Pointer to the parent of the Dialog control. */ CXTPDialogEx(LPCTSTR lpszTemplateName, CWnd* pParentWnd = NULL) : CXTPDialogBase(lpszTemplateName, pParentWnd) { } /** @cond */ # ifdef _XTP_INCLUDE_COMMANDBARS _XTP_DEPRECATE("Use CXTPCommandBars::SetMenu instead") void SetMenuBar(CXTPMenuBar* pMenuBar); # endif /** @endcond */ }; # if (_MSC_VER > 1200) /** * @brief * CXTPDHtmlDialogEx is a CXTPDialogBase derived class. Use this class in * your html dialog base application. */ class _XTP_EXT_CLASS CXTPDHtmlDialogEx : public CXTPDialogBase { public: /** * @brief * Constructs a CXTPDHtmlDialogEx object. */ CXTPDHtmlDialogEx() { } /** * @brief * Constructs a CXTPDHtmlDialogEx object. * @param nIDTemplate Contains the ID number of a dialog-template resource. * @param nHtmlResID Contains the ID number of a dialog-template resource. * @param pParentWnd Pointer to the parent of the Dialog control. */ CXTPDHtmlDialogEx(UINT nIDTemplate, UINT nHtmlResID = 0, CWnd* pParentWnd = NULL) : CXTPDialogBase(nIDTemplate, nHtmlResID, pParentWnd) { } /** * @brief * Constructs a CXTPDHtmlDialogEx object. * @param lpszTemplateName Contains a NULL-terminated string that is * the name of a dialog-template resource. * @param szHtmlResID Contains a NULL-terminated string that is * the name of a dialog-template resource. * @param pParentWnd Pointer to the parent of the Dialog control. */ CXTPDHtmlDialogEx(LPCTSTR lpszTemplateName, LPCTSTR szHtmlResID, CWnd* pParentWnd = NULL) : CXTPDialogBase(lpszTemplateName, szHtmlResID, pParentWnd) { } /** @cond */ # ifdef _XTP_INCLUDE_COMMANDBARS _XTP_DEPRECATE("Use CXTPCommandBars::SetMenu instead") void SetMenuBar(CXTPMenuBar* pMenuBar); # endif /** @endcond */ }; # endif # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // #if !defined(__XTPDIALOGBASEEX_H__) /** @endcond */