/** * @file XTPColorPopup.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(__XTPCOLORPOPUP_H__) # define __XTPCOLORPOPUP_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPShadowManager; /** * @brief * CXTPColorPopup is a CXTPColorSelectorCtrl derived class. It is used * to create a CXTPColorPopup window that will allow a user to select * colors and add custom colors to a color list. */ class _XTP_EXT_CLASS CXTPColorPopup : public CXTPColorSelectorCtrl { public: /** * @brief * Constructs a CXTPColorPopup object. * @param bAutoDelete TRUE if the color picker window is to be self deleting. * @param callerParam Caller parameter; it will be reported back as an LPARAM * of color pop-up notification messages. */ CXTPColorPopup(BOOL bAutoDelete = FALSE, LPARAM callerParam = 0); /** * @brief * Destroys a CXTPColorPopup object, handles cleanup and deallocation. */ virtual ~CXTPColorPopup(); public: /** @cond */ _XTP_DEPRECATED_IN_FAVOR(AddRecentColor) static void AFX_CDECL AddUserColor(COLORREF clrColor) { AddRecentColor(clrColor); } _XTP_DEPRECATED_IN_FAVOR(ResetRecentColors) static void AFX_CDECL ResetUserColors() { ResetRecentColors(); } /** @endcond */ /** * @brief * This member function handles the creation of the color pop-up window. * @param rect A reference to a CRect object that represents the * size of the color pop-up window. * @param pParentWnd Pointer to the parent window for the color pop-up. * @param dwPopup Style for the pop-up window. See the Remarks section for * a complete list of available styles. * @param clrColor An RGB value that represents the currently selected * color for the pop-up window. * @param clrDefault Specifies the default color for the color pop-up. * If the current style includes CPS_NOFILL, then this * parameter is ignored. * @details * Styles to be added or removed can be combined by using the bitwise * OR (|) operator. It can be one or more of the following: * CPS_XTP_NOFILL: The color picker will display a No Fill button * rather than the default Automatic Color button. * CPS_XTP_EXTENDED: The color picker will display 40 extended * colors rather than the default 16 colors. * CPS_XTP_MORECOLORS: The color picker will display a More Colors * button which will display a CXTPColorDialog. * CPS_XTP_SHOW3DSELECTION: Displays the color selection box with * a 3D raised border in CXTPColorDialog. * CPS_XTP_SHOWHEXVALUE: Displays the hex equivalent of * the selected color. * CPS_XTP_SHOWEYEDROPPER: Displays the eye dropper box to allow * for selecting any color on the screen. * @return * TRUE if successful, otherwise FALSE. * @see * CXTPColorPicker::ModifyCPStyle, CXTPColorSelectorCtrl::Create */ virtual BOOL Create(CRect& rect, CWnd* pParentWnd, DWORD dwPopup, COLORREF clrColor, COLORREF clrDefault = CLR_DEFAULT); /** * @brief * This member function adds a window that picker notifications are sent to. * @param hwndListener A handle to the listener window. * Messages will be sent to it. */ void AddListener(HWND hwndListener); /** * @brief * Enables/disables pop-up window shadow. * @param bDisplayShadow Flag that tells if the shadow is to be displayed. * TRUE to enable the shadow, FALSE to disable. * @details * This member function enables/disables the drawing of pop-up shadows. * Call this function after instantiating the color pop-up as a part * of an object's initialization. Do not call it after pop-up creation * because doing so may cause unpredictable results. */ void DisplayShadow(BOOL bDisplayShadow = TRUE); protected: /** * @brief * This member function will finish the selection process for the color * box or button in the color pop-up window. * @param nCurSel Current index of the selected color box or button * in the color pop-up window. */ virtual void EndSelection(int nCurSel); protected: /** @cond */ DECLARE_MESSAGE_MAP() //{{AFX_VIRTUAL(CXTPColorPopup) virtual void PostNcDestroy(); //}}AFX_VIRTUAL //{{AFX_MSG(CXTPColorPopup) afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized); afx_msg void OnDestroy(); afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnPaint(); afx_msg void OnKillFocus(CWnd* pNewWnd); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnNcPaint(); //}}AFX_MSG /** @endcond */ private: BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL); protected: BOOL m_bAutoDelete; /**< TRUE if the pop-up window is to be self deleting. */ BOOL m_bDisplayShadow; /**< TRUE if the pop-up window will render its shadow. */ CRect m_rcExclude; /**< Area to exclude from shadow display. */ BOOL m_bEndSelection; const LPARAM m_callerParam; /**< Caller parameter that will be reported back as an LPARAM of all */ /** * notification messages. */ CXTPShadowManager* m_pShadowManager; // Shadow manager to draw pop-up shadow }; ////////////////////////////////////////////////////////////////////// /** @cond */ AFX_INLINE BOOL CXTPColorPopup::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) { return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext); } AFX_INLINE void CXTPColorPopup::DisplayShadow(BOOL bDisplayShadow /* = TRUE*/) { m_bDisplayShadow = bDisplayShadow; } /** @endcond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif //#if !defined(__XTPCOLORPOPUP_H__) /** @endcond */