/** * @file XTPControlGalleryItem.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(__XTPCONTROLGALLERYITEM_H__) # define __XTPCONTROLGALLERYITEM_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" /** * @brief * CXTPControlGalleryItem is a CXTPCmdTarget derived class. It represents * a single item of a gallery object. */ class _XTP_EXT_CLASS CXTPControlGalleryItem : public CXTPCmdTarget { DECLARE_DYNAMIC(CXTPControlGalleryItem); public: /** * @brief * Constructs a CXTPControlGalleryItem object. */ CXTPControlGalleryItem(); /** * @brief * Destroys a CXTPControlGalleryItem object, handles cleanup and deallocation. */ ~CXTPControlGalleryItem(); public: /** * @brief * This method is called to get the size of the item. * @return * A CSize object containing the size of the item. * @see * SetSize, CXTPControlGalleryItems::SetItemSize */ virtual CSize GetSize(); static int AFX_CDECL GetDefaultHeight(); /** * @brief * Call this method to set the size of the individual item. You can call * CXTPControlGalleryItems::SetItemSize to set the default size for items. * @param szItem Size of the item to be set. */ void SetSize(CSize szItem); /** * @brief * This method is called to draw the item. * @param pDC Pointer to a valid device context. * @param pGallery Pointer to the parent gallery of the item. * @param rcItem Bounding rectangle of the item. * @param bEnabled TRUE to draw the item enabled, FALSE to draw the item disabled. * @param bSelected TRUE to draw the item selected. * @param bPressed TRUE to draw the item pressed. * @param bChecked TRUE to draw the item checked. */ virtual void Draw(CDC* pDC, CXTPControlGallery* pGallery, CRect rcItem, BOOL bEnabled, BOOL bSelected, BOOL bPressed, BOOL bChecked); /** * @brief * Retrieves the image of the item. * @return * A pointer to the image of the item. */ CXTPImageManagerIcon* GetImage(); /** * @brief * Call this method to determine if the item is a label. * @return * TRUE if the item is a label, otherwise FALSE. */ BOOL IsLabel() const; /** * @brief * Call this method to set the caption of the item. * @param lpszCaption Caption of the item to be set. * @see * GetCaption, SetToolTip, GetToolTip */ void SetCaption(LPCTSTR lpszCaption); /** * @brief * Call this method to set the tooltip of the item. * @param lpszToolTip Tooltip of the item to be set. * @see * GetToolTip, SetCaption, GetCaption */ void SetToolTip(LPCTSTR lpszToolTip); /** * @brief * Retrieves the tooltip of the item. * @return * The tooltip of the item. * @see * SetToolTip, SetCaption, GetCaption */ CString GetToolTip() const; /** * @brief * Retrieves the caption of the item. * @return * The caption of the item. * @see * SetCaption, SetToolTip, GetToolTip */ CString GetCaption() const; /** * @brief * Call this member to enable or disable the item. * @param bEnabled TRUE to enable the item, FALSE to disable the item. * @see * GetEnabled */ void SetEnabled(BOOL bEnabled); /** * @brief * Call this member to get the state of the item. * @return * TRUE if the item is enabled, otherwise FALSE. */ BOOL GetEnabled() const; /** * @brief * Retrieves the index of the item. * @return * The index of the item. */ int GetIndex() const; /** * @brief * Call this member to set the identifier of the item. * @param nId Identifier to be set. */ void SetID(int nId); /** * @brief * Call this member to get the item's identifier. * @return * The identifier of the item. */ int GetID() const; /** * @brief * Sets the 32-bit value associated with the item. * @param dwData New value to be set. */ void SetData(DWORD_PTR dwData); /** * @brief * Retrieves the application-supplied, 32-bit value associated * with the item. * @return * The 32-bit value associated with the item. */ DWORD_PTR GetData() const; /** * @brief * Call this member to set the description of the item. * @param lpszDescription Description to be set. * @see * SetCaption, SetTooltip */ void SetDescription(LPCTSTR lpszDescription); /** * @brief * Call this member to get the item's description. * @return * The description of the control. */ CString GetDescription() const; /** * @brief * Set the preferred image width. * @param nImageWidth preferred image width. */ void SetImageWidth(int nImageWidth); /** * @brief * Get the preferred image width. * @return * Preferred image width. */ int GetImageWidth() const; /** * @brief * This member functions are used to get stored CXTPMarkupUIElement object. * @return * A pointer to a CXTPMarkupUIElement object. */ CXTPMarkupUIElement* GetMarkupUIElement() const; /** * @brief * Gets the index of the used image. * @return * The index of the image. */ virtual int GetImageIndex(); /** * @brief * Sets the preferred image index. * @param nImageIndex New image index. */ virtual void SetImageIndex(int nImageIndex); virtual BOOL OnClick(); protected: int m_nId; /**< Identifier */ int m_nIndex; /**< Index of the item */ int m_nImage; /**< Image index */ CString m_strCaption; /**< Caption of the item */ CString m_strToolTip; /**< Tooltip of the item */ CString m_strDescriptionText; /**< Description of the item */ CXTPControlGalleryItems* m_pItems; /**< Parent items collection */ DWORD_PTR m_dwData; /**< 32-bit data */ CSize m_szItem; /**< Size of the item; CSize(0, 0) - to use default value */ BOOL m_bLabel; /**< TRUE if item is label */ BOOL m_bEnabled; /**< TRUE to enable, FALSE to disable. */ int m_nImageWidth; /**< preferred image width (0) - to use default value */ CXTPMarkupUIElement* m_pMarkupUIElement; # ifdef _XTP_COMMANDBARS_ACTIVEX /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPControlGalleryItem); COleVariant m_oleTag; BOOL OleGetLabel(); DECLARE_PROPERTY(ImageIndex, int); DECLARE_PROPERTY(ItemWidth, int); DECLARE_PROPERTY(ItemHeight, int); /** @endcond */ # endif friend class CXTPControlGalleryItems; friend class CXTPControlGallery; }; AFX_INLINE CString CXTPControlGalleryItem::GetToolTip() const { return m_strToolTip; } AFX_INLINE CString CXTPControlGalleryItem::GetCaption() const { return m_strCaption; } AFX_INLINE void CXTPControlGalleryItem::SetDescription(LPCTSTR lpszDescription) { m_strDescriptionText = lpszDescription; } AFX_INLINE CString CXTPControlGalleryItem::GetDescription() const { return m_strDescriptionText; } AFX_INLINE void CXTPControlGalleryItem::SetID(int nId) { m_nId = nId; } AFX_INLINE int CXTPControlGalleryItem::GetID() const { return m_nId; } AFX_INLINE BOOL CXTPControlGalleryItem::IsLabel() const { return m_bLabel; } AFX_INLINE void CXTPControlGalleryItem::SetToolTip(LPCTSTR lpszToolTip) { m_strToolTip = lpszToolTip; } AFX_INLINE void CXTPControlGalleryItem::SetData(DWORD_PTR dwData) { m_dwData = dwData; } AFX_INLINE DWORD_PTR CXTPControlGalleryItem::GetData() const { return m_dwData; } AFX_INLINE void CXTPControlGalleryItem::SetImageWidth(int nImageWidth) { m_nImageWidth = nImageWidth; } AFX_INLINE int CXTPControlGalleryItem::GetImageWidth() const { return m_nImageWidth; } AFX_INLINE BOOL CXTPControlGalleryItem::OnClick() { return FALSE; } AFX_INLINE CXTPMarkupUIElement* CXTPControlGalleryItem::GetMarkupUIElement() const { return m_pMarkupUIElement; } # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // __XTPCONTROLGALLERYITEM_H__ /** @endcond */