/** * @file XTPTaskPanelGroupItem.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(__XTPTASKPANELGROUPITEM_H__) # define __XTPTASKPANELGROUPITEM_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" /** * @brief * CXTPTaskPanelGroupItem is used in a TaskPanel control * to represent a single item of a group. */ class _XTP_EXT_CLASS CXTPTaskPanelGroupItem : public CXTPTaskPanelItem { /** @cond */ DECLARE_SERIAL(CXTPTaskPanelGroupItem) /** @endcond */ public: /** * @brief * Constructs a CXTPTaskPanelGroupItem object */ CXTPTaskPanelGroupItem(); /** * @brief * Destroys a CXTPTaskPanelGroupItem object, handles cleanup and deallocation. */ virtual ~CXTPTaskPanelGroupItem(); public: /** * @brief * This method is called when the group item must be repositioned. * @param rc Rectangle of the group item. * @return The updated item rectangle. */ virtual CRect OnReposition(CRect rc); /** * @brief * This method is called to draw the group item. * @param pDC Pointer to a valid device context. * @param rc Rectangle of the group item to draw. */ virtual void OnDrawItem(CDC* pDC, CRect rc); /** * @brief * Gets the margins of the group item. * @return * A reference to the margins of the group item. */ CRect& GetMargins(); /** * @brief * Gets the bounding rectangle of the group item. * @return * The bounding rectangle of the group item. */ CRect GetItemRect() const; /** * @brief * Sets the bounding rectangle for the group item. * @param lpRect Bounding rectangle to be set. */ void SetItemRect(LPCRECT lpRect); /** * @brief * Gets the parent group of the item. * @return * A pointer to the parent group of the item. */ CXTPTaskPanelGroup* GetItemGroup() const; /** * @brief * Enables/disables bold font for the group item. * @param bBold TRUE to enable bold font, FALSE to disable bold font. */ void SetBold(BOOL bBold = TRUE); /** * @brief * Determines if bold font is enabled/disabled for the group item. * @return * TRUE if bold font is enabled, FALSE if bold font is disabled. */ BOOL IsBold() const; /** * @brief * Sets the window handle for the group item. * @param hWnd Window handle to be set. */ void SetControlHandle(HWND hWnd); /** * @brief * Gets the window handle of the group item. * @return * The window handle of the group item. */ HWND GetControlHandle() const; /** * @brief * This method is called when an animation step is executed. * @param nStep Animation step that was executed. */ void OnAnimate(int nStep); /** * @brief * Sets the size of the group item. * @param szItem Group item size to be set. * @param bAutoHeight TRUE to enable auto-height for the group item, * FALSE to disable auto-height for the group item. * @details * If auto-height is enabled, then the height of the group item will be * stretched to fill the entire height of the group. * If auto-height is disabled, then the group item will use a defined height. * @see * GetSize */ void SetSize(CSize szItem, BOOL bAutoHeight = FALSE); /** * @brief * Gets the backcolor of the group item. * @return * The backcolor of the group item. */ COLORREF GetBackColor() const; /** * @brief * Gets the text color of the group item. * @return * The text color of the group item. */ COLORREF GetTextColor() const; /** * @brief * Sets the text color for the group item. * @param clrText Text color to be set. */ void SetTextColor(COLORREF clrText); /** * @brief * Gets the rectangle of the "tooltip zone". * @return * The rectangle of the "tooltip zone". * @details * The "tooltip zone" is the area where the tooltip will be displayed * when the mouse is positioned over the group item. * @see * CXTPTaskPanelGroup::GetHitTestRect */ CRect GetHitTestRect() const; /** * @brief * Gets the selected state of the group item. * @details * Multiple group items can be selected at a given time. * However, only one group item can have focus at a given time. * @return * TRUE if the group item is selected, otherwise FALSE. */ BOOL IsItemSelected() const; /** * @brief * Sets the selected state of the group item. * @param bSelected TRUE to set the group item to selected, FALSE otherwise. * @details * Multiple items can have focus. * See CXTPTaskPanel::SetSelectItemOnFocus for details. * @see * CXTPTaskPanel::SetSelectItemOnFocus */ void SetItemSelected(BOOL bSelected); /** * @brief * Reads/writes this object from/to an archive. * @param pPX Pointer to a CXTPPropExchange object to serialize to/from. */ virtual void DoPropExchange(CXTPPropExchange* pPX); /** * @brief * Sets the drag text for the group item. * @param lpszDragText Drag text to be set. */ void SetDragText(LPCTSTR lpszDragText); /** * @brief * Gets the drag text of the group item. * @return * The drag text of the group item. */ virtual CString GetDragText() const; /** * @brief * Caches the COleDataSource object containing the group item being dragged. * @param srcItem Reference to the COleDataSource object to cache. * @param bCacheTextData TRUE to cache the text data of the object, FALSE otherwise. * @return * TRUE if successful, FALSE if CacheGlobalData returns NULL. * @details * This method places the item being dragged onto the clipboard. * @see * CreateFromOleData, CacheGlobalData, CopyToClipboard, * PasteFromClipboard, PrepareDrag */ BOOL PrepareDrag(COleDataSource& srcItem, BOOL bCacheTextData = TRUE); /** * @brief * Gets the size of the group item. * @return * The size of the group item. * @see * SetSize */ CSize GetSize() const; /** * @brief * Determines if auto-height is enabled/disabled for the group item. * @return * TRUE if auto-height is enabled, FALSE if auto-height is disabled. * @details * If auto-height is enabled, then the height of the group item will be * stretched to fill the entire height of the group. * If auto-height is disabled, then the group item will use a defined height. */ BOOL IsAutoHeight() const; protected: /** @cond */ // System accessibility Support virtual HRESULT GetAccessibleDefaultAction(VARIANT varChild, BSTR* pszDefaultAction); virtual HRESULT AccessibleDoDefaultAction(VARIANT varChild); virtual HRESULT GetAccessibleState(VARIANT varChild, VARIANT* pvarState); virtual HRESULT AccessibleSelect(long flagsSelect, VARIANT varChild); /** @endcond */ private: void GetPreviewBitmap(CWnd* pWnd, CBitmap& bmp); protected: CRect m_rcMargins; /**< Item's margins. */ CRect m_rcItem; /**< Rectangle of the item. */ BOOL m_bBold; /**< TRUE to use bold font. */ BOOL m_bSelected; /**< TRUE if the item is currently selected. */ HWND m_hWnd; /**< Only used for items of type xtpTaskItemTypeControl; this is the control's child window. */ CSize m_szItem; /**< Size of the item. If the size is set to 0, then the size will be calculated by the Task Panel. */ CBitmap m_bmpPreview; /**< Internally used. This holds a screen shot of the attached Windows control when the item type is xtpTaskItemTypeControl. This screen shot is used during group animation. During animation, the Windows control is hidden and the screen shot of the control is used in place of the actual control during the animation process. */ CSize m_szPreview; /**< Last preview bitmap size. */ CString m_strDragText; /**< Drag text of the item. */ BOOL m_bAutoHeight; /**< TRUE if the item stretched inside its group. */ COLORREF m_clrText; /**< Text color. */ # ifdef _XTP_ACTIVEX /** @cond */ afx_msg void OleSetMargins(long nLeft, long nTop, long nRight, long nBottom); afx_msg void OleSetControl(LPDISPATCH lpDispatch); afx_msg LPDISPATCH OleGetControl() { return NULL; } afx_msg HWND OleGetHandle(); afx_msg void OleSetHandle(HWND); afx_msg BSTR OlegGetDragText(); afx_msg void OleSetSize(long cx, long cy, BOOL bAutHeight); afx_msg void OleRedrawPanel(); afx_msg void OleGetRect(long* nLeft, long* nTop, long* nRight, long* nBottom); DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPTaskPanelGroupItem) enum { dispidBold = 10L, dispidSetMargins = 11L, dispidControl = 12L, }; /** @endcond */ # endif friend class CXTPTaskPanelGroup; }; AFX_INLINE CRect& CXTPTaskPanelGroupItem::GetMargins() { return m_rcMargins; } AFX_INLINE CRect CXTPTaskPanelGroupItem::GetItemRect() const { return m_rcItem; } AFX_INLINE void CXTPTaskPanelGroupItem::SetItemRect(LPCRECT lpRect) { ::CopyRect(&m_rcItem, lpRect); } AFX_INLINE CSize CXTPTaskPanelGroupItem::GetSize() const { return m_szItem; } AFX_INLINE BOOL CXTPTaskPanelGroupItem::IsAutoHeight() const { return m_bAutoHeight; } AFX_INLINE COLORREF CXTPTaskPanelGroupItem::GetTextColor() const { return m_clrText; } AFX_INLINE void CXTPTaskPanelGroupItem::SetTextColor(COLORREF clr) { m_clrText = clr; RedrawPanel(); } # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPTASKPANELGROUPITEM_H__) /** @endcond */