/** * @file XTPCustomizeSheet.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(__XTPCUSTOMIZESHEET_H__) && defined(_XTP_INCLUDE_CONTROLS) # define __XTPCUSTOMIZESHEET_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPCommandBars; class CXTPCustomizeToolbarsPage; class CXTPCustomizeCommandsPage; class CXTPImageManager; class CXTPPropertyPage; class CXTPPopupBar; class CXTPControl; /** * @brief * CXTPCustomizeSheet is a CPropertySheet derived class. It represents * the Customize dialog. */ class _XTP_EXT_CLASS CXTPCustomizeSheet : public CXTPPropertySheet { public: /** * @brief * Constructs a CXTPCustomizeSheet object * * @param pCommandBars Points to a CXTPCommandBars object * @param iSelectPage Page initially selected. */ CXTPCustomizeSheet(CXTPCommandBars* pCommandBars, UINT iSelectPage = 0); /** * @brief * Destroys a CXTPCustomizeSheet object, handles cleanup and deallocation. */ virtual ~CXTPCustomizeSheet(); public: /** * @brief * Call this member to get a pointer to the context menu that * is displayed in customization mode when a user right-clicks * on a control. * * @return * Retrieves the context menu. */ CXTPPopupBar* GetContextMenu() const; /** * @brief * Retrieves collection of custom icons that can be selected for * a control during customization mode. Custom icons are displayed * in the "Change Button Image" pop-up of the context menu that is * displayed when a user right-clicks on a control. * @return Returns collection of custom icons * * @details * Icons must be numbered from 1. When adding icons, the numbering * must start with 1 and increment by 1 for each icon added. So the * numbering would look like this: 1, 2, 3, 4, ...N. * * The toolkit provide 42 "built-in" icons that you can choose from * and they are automatically displayed in the "Change Button Icon" * pop-up menu if you do not remove them. If you do not remove the * "built-in" icons that are provided with the toolkit then you should * start your numbering at 43. If you start at 1 and you did not * remove the "bulilt-in" icons, then you will overwrite some of * the "built-in" icons. So you would number your icons * 43, 44, 45, ...N. So you could even keep some of the "built-in" * icons and overwrite the ones you don't need with your own * custom icons. */ CXTPImageManager* GetCustomIcons() const; /** * @brief Displays a message box. * * @param lpszText Text in message box. * @param nType Specifies the contents and behavior of the dialog box. * * @return If the function succeeds, the return value specified the * button that was selected. */ int MessageBox(LPCTSTR lpszText, UINT nType = MB_OK); /** * @brief * Call this member to retrieve the current customized control. * * @return * A pointer to a CXTPControl object. */ CXTPControl* GetDragControl() const; public: /** * @brief * Returns the Commands PropertyPage * * @return * A pointer to a CXTPCustomizeCommandsPage object */ CXTPCustomizeCommandsPage* GetCommandsPage() const; /** * @brief * Returns the Toolbars PropertyPage * * @return * A pointer to a CXTPCustomizeCommandsPage object */ CXTPCustomizeToolbarsPage* GetToolbarsPage() const; /** * @brief * Returns the parent Command Bars class * * @return * A pointer to a CXTPCommandBars object */ CXTPCommandBars* GetCommandBars() const; /** * @brief * Call this method to show customize dialog. * @return Returns customize dialog */ INT_PTR DoModal(); /** * @brief * This method shows the context menu for toolbars * * @param point Position of the menu to show */ void ContextMenu(CPoint point); /** * @brief * Adds the supplied page with the rightmost tab in the property sheet. * @param nIndex Point index. * @param pPage Points to the page to be added to the property sheet. Cannot be NULL. */ void AddPage(CXTPPropertyPage* pPage, int nIndex = -1); protected: /** @cond */ DECLARE_MESSAGE_MAP() //{{AFX_VIRTUAL(CXTPCustomizeSheet) BOOL OnInitDialog(); BOOL PreTranslateMessage(MSG* pMsg); BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo); //}}AFX_VIRTUAL //{{AFX_MSG(CXTPCustomizeSheet) afx_msg void OnCustomizeDefaultStyle(); afx_msg void OnCustomizeImageAndText(); afx_msg void OnCustomizeTextOnly(); afx_msg void OnCustomizeBeginGroup(); afx_msg void OnCustomizeDelete(); afx_msg void OnCustomizeCopyImage(); afx_msg void OnCustomizePasteImage(); afx_msg void OnCustomizeResetImage(); afx_msg void OnCustomizeEditImage(); afx_msg void OnCustomizeReset(); afx_msg LRESULT OnCustomizeName(WPARAM wParam, LPARAM lParam); afx_msg void OnUpdateCustomizeDefaultStyle(CCmdUI* pCmdUI); afx_msg void OnUpdateCustomizeImageAndText(CCmdUI* pCmdUI); afx_msg void OnUpdateCustomizeTextOnly(CCmdUI* pCmdUI); afx_msg void OnUpdateCustomizeBeginGroup(CCmdUI* pCmdUI); afx_msg void OnUpdateCustomizeName(CCmdUI* pCmdUI); afx_msg void OnUpdateCustomizeCopyImage(CCmdUI* pCmdUI); afx_msg void OnUpdateCustomizePasteImage(CCmdUI* pCmdUI); afx_msg void OnUpdateCustomizeResetImage(CCmdUI* pCmdUI); afx_msg void OnUpdateCustomizeReset(CCmdUI* pCmdUI); afx_msg void OnUpdateCustomizeEditImage(CCmdUI* pCmdUI); afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnInitCommandsPopup(CXTPPopupBar* pPopupBar); afx_msg void OnGrabFocus(); //}}AFX_MSG /** @endcond */ private: BOOL FilterMouse(WPARAM wParam, LPARAM lParam); BOOL FilterKey(WPARAM wParam, LPARAM lParam); BOOL FilterMessage(WPARAM wParam, LPARAM lParam); void CreateContextMenu(); BOOL IsAllowChangeStyle(CXTPControl* pControl) const; virtual BOOL CreateClient(); public: BOOL m_bHookMainFrame; protected: CXTPCustomizeToolbarsPage* m_pPageToolBars; /**< Toolbar page.*/ CXTPCustomizeCommandsPage* m_pPageCommands; /**< Commands page.*/ CWnd* m_pWndParent; /**< Parent window.*/ CXTPCommandBars* m_pCommandBars; /**< Customized comamndBars.*/ CXTPPopupBar* m_pContextMenu; /**< Context menu that is displayed in customization mode when a user right-clicks on a control.*/ CXTPImageManager* m_pCustomIcons; /**< Icons displayed in the "Change Button Image" pop-up of the context menu that is displayed when a user right-clicks on a control.*/ private: DECLARE_DYNAMIC(CXTPCustomizeSheet) class CCustomizeButton; class CCustomizeEdit; }; ///////////////////////////////////////////////////////////////////////////// AFX_INLINE CXTPCustomizeCommandsPage* CXTPCustomizeSheet::GetCommandsPage() const { return m_pPageCommands; } AFX_INLINE CXTPCustomizeToolbarsPage* CXTPCustomizeSheet::GetToolbarsPage() const { return m_pPageToolBars; } AFX_INLINE CXTPCommandBars* CXTPCustomizeSheet::GetCommandBars() const { return m_pCommandBars; } AFX_INLINE CXTPPopupBar* CXTPCustomizeSheet::GetContextMenu() const { return m_pContextMenu; } AFX_INLINE CXTPImageManager* CXTPCustomizeSheet::GetCustomIcons() const { return m_pCustomIcons; } /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // #if !defined(__XTPCUSTOMIZESHEET_H__) /** @endcond */