/** * @file XTPPropertySheet.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(__XTPPROPERTYSHEET_H__) # define __XTPPROPERTYSHEET_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPDialogEx; class CXTPPropertyPageNavigator; class CXTPPropertyPage; /** * @brief * XTPPropertyPageBorder is an enumeration used to set the client frame style * drawn around the client of tabs. * Example: *
wndSheet.SetPageBorderStyle(xtpPageBorderFrame);* @see * CXTPPropertySheet * @see * xtpPageBorderNone, xtpPageBorderBottomLine, xtpPageBorderFrame> */ enum XTPPropertyPageBorder { xtpPageBorderNone, /**< No page boarder */ xtpPageBorderBottomLine, /**< Draw a bottom border */ xtpPageBorderFrame /**< Draw a page boarder */ }; /** * @brief * CXTPPropertySheet is a CXTPDialogEx derived class. It represents a property * sheet, otherwise known as a tab dialog box. A property sheet consists of a * CXTPPropertySheet object and one or more CXTPPropertyPage objects. * @see * CXTPPropertySheet::DoModal, CXTPPropertyPage, CXTPPropertyPageNavigator */ class _XTP_EXT_CLASS CXTPPropertySheet : public CXTPDialogEx { /** @cond */ DECLARE_DYNAMIC(CXTPPropertySheet) /** @endcond */ public: /** * @brief * Constructs a CXTPPropertySheet object. * @details * To display the property sheet, call DoModal or Create. * The string contained in the first parameter will be placed in the caption bar * for the property sheet. */ CXTPPropertySheet(); /** * @brief * Constructs a CXTPPropertySheet object. * @param nIDCaption ID of the caption to be used for the property sheet. * @param pParentWnd Pointer to the parent window of the property sheet. If NULL, the * parent window will be the main window of the application. * @param iSelectPage The index of the page that will initially be on top. Default is * the first page added to the sheet. * @details * To display the property sheet, call DoModal or Create. * The string contained in the first parameter will be placed in the caption bar * for the property sheet. */ CXTPPropertySheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0); /** * @brief * Constructs a CXTPPropertySheet object. * @param pszCaption Pointer to a string containing the caption to be used for the * property sheet. Cannot be NULL. * @param pParentWnd Pointer to the parent window of the property sheet. If NULL, the * parent window will be the main window of the application. * @param iSelectPage The index of the page that will initially be on top. Default is * the first page added to the sheet. * @details * To display the property sheet, call DoModal or Create. * The string contained in the first parameter will be placed in the caption bar * for the property sheet. */ CXTPPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0); /** * @brief * Destroys a CXTPPropertySheet object, handles cleanup and deallocation. */ ~CXTPPropertySheet(); public: /** * @brief * Displays a modeless property sheet. * @param pParentWnd Pointer to the parent window. If NULL, the parent is the desktop. * @param dwStyle Window styles for property sheet. * @param dwExStyle Extended window styles for property sheet. * @details * The default style, expressed by passing -1 as dwStyle, is actually * WS_SYSMENU | WS_POPUP | WS_CAPTION | DS_MODALFRAME | DS_CONTEXT_HELP | WS_VISIBLE. * * To display a modal property sheet, call DoModal instead. * @return TRUE if successful, FALSE otherwise. * @see * CXTPPropertySheet::DoModal */ BOOL Create(CWnd* pParentWnd = NULL, DWORD dwStyle = (DWORD)-1, DWORD dwExStyle = 0); using CXTPDialogEx::Create; # if (1200 < _MSC_VER) using CWnd::Create; # endif /** * @brief * Call this member function to display a modal property sheet. * @return * IDOK or IDCANCEL if the function was successful, otherwise 0 or -1. * @details * The return value corresponds to the ID of the control that closed the * property sheet. After this function returns, the windows corresponding * to the property sheet and all the pages will have been destroyed. * * To display a modeless property sheet, call Create instead. * @see * CXTPPropertySheet::Create */ INT_PTR DoModal(); public: /** * @brief * Adds a page to the property sheet. * @param pPage Pointer to the page to be added to the property sheet. Cannot be NULL. * @details * This member function adds the supplied page with the rightmost tab in * the property sheet. Add pages to the property sheet in the left-to-right * order you want them to appear. * * AddPage adds the CPropertyPage object to the CPropertySheet object's list * of pages but does not actually create the window for the page. The framework * postpones creation of the window for the page until the user selects that page. * @see * CXTPPropertySheet::GetPageCount */ void AddPage(CXTPPropertyPage* pPage); /** * @brief * Adds a page to the property sheet. * @param nIndex Index to insert the page. * @param pPage Pointer to the page to be added to the property sheet. Cannot be NULL. * @details * This member function adds the supplied page with the rightmost tab in * the property sheet. Add pages to the property sheet in the left-to-right * order you want them to appear. * * AddPage adds the CPropertyPage object to the CPropertySheet object's list * of pages but does not actually create the window for the page. The framework * postpones creation of the window for the page until the user selects that page. * @see * CXTPPropertySheet::GetPageCount */ void InsertPage(int nIndex, CXTPPropertyPage* pPage); /** * @brief * This member function removes a page from the property sheet and destroys * the associated window. \ * @param nPage Index of the page to be removed. Must be between 0 and one less than * the number of pages in the property sheet, inclusive. * @see * CXTPPropertySheet::AddPage */ void RemovePage(int nPage); /** * @brief * This member function removes a page from the property sheet and destroys * the associated window. * @param pPage Pointer to the page to be removed from the property sheet. Cannot be NULL. * the number of pages in the property sheet, inclusive. * @see * CXTPPropertySheet::AddPage */ void RemovePage(CXTPPropertyPage* pPage); /** * @brief * Call this member function to determine the number of pages currently in * the property sheet. * @return * The number of pages in the property sheet. * @see * CXTPPropertySheet::AddPage, CXTPPropertySheet::GetPage */ int GetPageCount() const; /** * @brief * Call this member function to retrieve a pointer to a specified page in * the property sheet. * @param nPage Index of the desired page, starting at 0. Must be between 0 and * one less than the number of pages in the property sheet, inclusive. * @return * The pointer to the page corresponding to the nPage parameter. * @see * CXTPPropertySheet::AddPage, CXTPPropertySheet::GetPageCount */ CXTPPropertyPage* GetPage(int nPage) const; /** * @brief * Call this member function to retrieve the index number of a specified page in * the property sheet. * @param pPage Pointer to the page with the index to be found. Cannot be NULL. * @return * The index number of the page corresponding to the pPage parameter. * @details * This method can be used to get the page index number for the * SetActivePage or GetPage methods. * @see * CXTPPropertySheet::GetActivePage */ int GetPageIndex(CXTPPropertyPage* pPage) const; /** * @brief * Call this member function to retrieve a pointer to the property sheet * window's active page. * @return * The pointer to the property sheet window's active page. * @details * This method can be used to perform some action on the active page. * @see * CXTPPropertySheet::GetPage */ CXTPPropertyPage* GetActivePage() const; /** * @brief * Call this member function to retrieve the index number of the property sheet * window's active page. * @return * The index number of the property sheet window's active page. * @details * The return value for this method can be used as the parameter for GetPage. * @see * CXTPPropertySheet::GetActivePage */ int GetActiveIndex() const; /** * @brief * Call this member function to set the active page. * @param nPage Index of the page to set. It must be between 0 and one less than * the number of pages in the property sheet, inclusive. * @return * Nonzero if the property sheet is activated successfully, otherwise 0. * @details * This method should be used if a user's action on one page should cause * another page to become the active page. * @see * CXTPPropertySheet::GetActivePage */ virtual BOOL SetActivePage(int nPage); /** * @brief * Call this member function to set the active page. * @param pPage Pointer to the page to set in the property sheet. It cannot be NULL. * @return * Nonzero if the property sheet is activated successfully, otherwise 0. * @details * This method should be used if a user's action on one page should cause * another page to become the active page. * @see * CXTPPropertySheet::GetActivePage */ virtual BOOL SetActivePage(CXTPPropertyPage* pPage); /** * @brief * Call this member function to set the property sheet's caption * (the text displayed in the title bar of a frame window). * @param lpszText Pointer to the text to be used as the caption in the title bar * of the property sheet. * @see * CXTPPropertySheet::GetPage */ void SetTitle(LPCTSTR lpszText); /** * @brief * Retrieves the CRect bounding rectangle for all property pages. * @return * The CRect bounding rectangle for all property pages. */ CRect GetPageRect() const; public: /** * @brief * Retrieves the currently used navigator object. * @return * A CXTPPropertyPageNavigator class pointer. * @see * CXTPPropertySheet::SetNavigator */ CXTPPropertyPageNavigator* GetNavigator() const; /** * @brief * Sets the navigator object that will be used to switch property pages. * @param pNavigator A CXTPPropertyPageNavigator class pointer that will be set * as the new navigator object * @details * CXTPPropertyPageNavigator class used to specify how the user will navigate * and switch pages. Default navigator classes are: * CXTPPropertyPageTabNavigator: Represents TabControl navigator. * CXTPPropertyPageListNavigator: Represents List navigator. * CXTPPropertyPageTreeNavigator: Represents Tree navigator. * Example: *
* CXTPPropertyPageListNavigator* pList = new CXTPPropertyPageListNavigator(); * pList->SetListStyle(xtpListBoxOffice2007); * ps.SetNavigator(pList); ** @see * CXTPPropertySheet::GetNavigator */ void SetNavigator(CXTPPropertyPageNavigator* pNavigator); public: /** * @brief * Adds a new button to the property sheet window. * @param nIDCaption ID of the caption to be used for the property sheet button. * @param nID Identifier to be used for the property sheet button. * @return * Nonzero if the property sheet is activated successfully, otherwise 0. * @see * CXTPPropertySheet::RemoveButtons */ virtual BOOL AddButton(UINT nIDCaption, UINT nID); /** * @brief * Deletes all buttons from the property sheet. * @see * CXTPPropertySheet::AddButton */ void RemoveButtons(); /** * @brief * Sets a border style around a client page rectangle. * @param nBorder Border style to be set. * @see * XTPPropertyPageBorder, CXTPPropertySheet::GetPageBorderStyle */ void SetPageBorderStyle(XTPPropertyPageBorder nBorder); /** * @brief * Retrieves the border style around a client page rectangle. * @return * An XTPPropertyPageBorder border style. * @see * XTPPropertyPageBorder, CXTPPropertySheet::SetPageBorderStyle */ XTPPropertyPageBorder GetPageBorderStyle() const; /** * @brief * Call this member to allow the user to resize the property sheet. * @param bResizable TRUE to allow the user to resize the property sheet. * By default, this parameter is TRUE. */ void SetResizable(BOOL bResizable = TRUE); /** * @brief * Call this member to set a custom size for property pages. * @param szPage New property page size to be set. */ void SetPageSize(CSize szPage); /** * @brief * Call this member to set a minimun size for property pages. * @param szPage New property page minimun size to be set. */ void SetPageSizeMin(CSize szPage); /** * @brief * Call this member to set a maximum size for property pages. * @param szPage New property page maximum size to be set. */ void SetPageSizeMax(CSize szPage); public: /** * @brief * This member function saves the window placement to the registry. * @param pszSection Name of a section in the initialization file or a key in the * Windows registry where placement information is stored. * @return * TRUE if successful. */ BOOL SavePlacement(LPCTSTR pszSection); /** * @brief * This member function loads saved window placement information from the registry. * @param pszSection Name of a section in the initialization file or a key in the * Windows registry where placement information is stored. * @return * TRUE if position was changed. */ BOOL LoadPlacement(LPCTSTR pszSection); /** * @brief * This member function loads saved window placement information from * the registry. This version is the same as LoadPlacement but there * is no need for calling SavePlacement when the window is destroyed. * This will be called automatically. * @param pszSection Name of a section in the initialization file or a key in the * Windows registry where placement information is stored. * @return * TRUE if position was changed. */ BOOL AutoLoadPlacement(LPCTSTR pszSection); /** * @brief * Forces all pages to update themselves as the data that they rely on * is supposed to be changed from outside. */ void UpdatePages(); /** * @brief * Call this member to switch the visual theme of the control. * @param theme New visual theme. Can be any of the values listed * in the Remarks section. * @details * nTheme can be one of the theme IDs specified by XTPControlTheme. * @see * XTPControlTheme */ void SetTheme(XTPControlTheme theme); /** * @brief * This method is called to retrieve the current theme ID. * @return * A XTPControlTheme value representing the current theme. */ XTPControlTheme GetTheme(); protected: /** * @brief * This method is called to create all property sheet buttons. * @return * TRUE if successful, otherwise FALSE. */ virtual BOOL CreateButtons(); /** * @brief * This method is called to create a property page window. * @param pPage Page to be created. * @return * TRUE if successful, otherwise FALSE. */ virtual BOOL CreatePage(CXTPPropertyPage* pPage); /** @cond */ public: CFont* GetFont(); void EndDialog(int nEndID); virtual void RecalcLayout(LPSIZE pPageSize = NULL, BOOL bMoveWindow = FALSE); BOOL IsWizard() const; HWND GetNavigatorHwnd() const; protected: void CommonConstruct(CWnd* pParentWnd, UINT iSelectPage); protected: virtual BOOL CreateClient(); void ResizeParentToFit(CSize szClient, BOOL bMoveWindow); BOOL IsPositionRelativeToWindow(); virtual void MoveButtons(AFX_SIZEPARENTPARAMS* pLayout, CSize szClient); void CreateFont(CXTPPropertyPage* pActivePage); virtual CXTPButton* CreateButton(); private: void PageInfoChanged(CXTPPropertyPage* pPage, BOOL bModified); BOOL OnButtonClick(UINT nButton); LRESULT SendPageNotify(CXTPPropertyPage* pPage, int code, LPARAM lParam = 0); TCHAR ToUpper(TCHAR vkTCHAR); /** @endcond */ protected: /** @cond */ DECLARE_MESSAGE_MAP() //{{AFX_VIRTUAL(CXTPPropertySheet) public: virtual BOOL PreTranslateMessage(MSG* pMsg); protected: virtual void DoDataExchange(CDataExchange* pDX); /**< DDX/DDV support */ virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); //}}AFX_VIRTUAL //{{AFX_MSG(CXTPPropertySheet) afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnDestroy(); virtual BOOL OnInitDialog(); afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam); afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnClose(); afx_msg void OnPaint(); afx_msg LRESULT OnQuerySiblings(WPARAM wParam, LPARAM lParam); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg LRESULT HandleInitDialog(WPARAM, LPARAM); afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg void OnGetMinMaxInfo(MINMAXINFO* pMMI); //}}AFX_MSG /** @endcond */ protected: CString m_strCaption; /**< Caption of the dialog. */ LPDLGTEMPLATE m_lpDlgTemplate; /**< Dialog template. */ CArray