/** * @file XTPTaskDialogControls.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(__XTPTASKLINKCTRL_H__) # define __XTPTASKLINKCTRL_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" /** * @brief * CXTPTaskDialogLinkCtrl is a CStatic derived class that is used to * display a text block that contains clickable links. */ class _XTP_EXT_CLASS CXTPTaskDialogLinkCtrl : public CStatic { public: /** * @brief * LINKITEM is used to set and retrieve information about a link item. * @see * CXTPTaskDialogLinkCtrl::HitTest */ struct LINKITEM { DWORD nStart; /**< Starting character position. */ int nIndex; /**< Character index of the character nearest the specified point. */ CString strLabel; /**< Specifies the execute string for the link. */ CString strUrl; /**< Specifies the display string for the link. */ CArray arrParts; }; typedef CArray CTaskLinkItemArray; /** @cond */ DECLARE_DYNCREATE(CXTPTaskDialogLinkCtrl) /** @endcond */ public: /** * @brief * Constructs a CXTPTaskDialogLinkCtrl object. */ CXTPTaskDialogLinkCtrl(); /** * @brief * Destroys a CXTPTaskDialogLinkCtrl object, handles cleanup and deallocation. */ virtual ~CXTPTaskDialogLinkCtrl(); /** * @brief * Call this member function to create a CXTPTaskDialogLinkCtrl text * control. The control is used by CXTPTaskDialog to display a static * text block that contains clickable link text. * @param rect Specifies the edit control's size and position. Can * be a CRect object or RECT structure. * @param strBuffer NULL-terminated string that contains link text to be * displayed. * @param pFont Specifies the font to be used with the text control. * @param pParentWnd Specifies the edit control's parent window (usually a * CXTPTaskDialog). It must not be NULL. * @details * When specified strBuffer can contain links in the form: *
	 * \\Hyperlink Text.\\
	 * 
* @return * Nonzero if initialization is successful, otherwise 0. */ virtual BOOL Create(const CRect& rect, CString& strBuffer, CFont* pFont, CWnd* pParentWnd); # if _MSC_VER > 1200 using CStatic::Create; using CWnd::Create; # endif /** * @brief * Call this member function to return the focused link. * @return * The pointer of the currently focused link, otherwise NULL. */ LINKITEM* GetFocusedLink() const; /** * @brief * Call this member function to set the focus to a specified link. * @param iFocusItem The index of the focused item or -1 to indicate no focus. */ void FocusItem(int iFocusItem); /** * @brief * Call this member function to return the link information from * the specified cursor position. * @param pt Client coordinates. * @return * A LINKITEM pointer if successful, otherwise NULL. */ LINKITEM* HitTest(CPoint pt) const; /** * @brief * This member function is called to retrieve the character index of * the first link located after the index specified by iPos. * @param strBuffer NULL-terminated string to search for link text. * @param iPos Starting position to begin search from. * @return * The LOWORD value contains the starting position of the first * link text block found, the HIWORD value contains the number * of characters in the link text. */ DWORD GetLinkPos(CString strBuffer, int iPos = 0); /** * @brief * This member function is called to extract link information from * the specified string buffer and store it internally. The string is * then reformatted to remove the link tag information. * @param strBuffer NULL-terminated string to search for link text. * @return * TRUE if link text was located, otherwise FALSE. */ BOOL ExtractLinks(CString& strBuffer); /** * @brief * Call this member function to set the background color for the link control. * @param crBack An RGB value representing the link control's background color. */ void SetBackColor(COLORREF crBack); /** * @brief * Call this member function to retrieve the link control's background color. * @return * An RGB value representing the link control's background color. */ COLORREF GetBackColor() const; /** * @brief * Call this member function to set the text color for the link control. * @param crText An RGB value representing the link control's text color. */ void SetTextColor(COLORREF crText); /** * @brief * Call this member function to retrieve the link control's text color. * @return * An RGB value representing the link control's text color. */ COLORREF GetTextColor() const; /** * @brief * Call this member function to set the text link color for the link control. * @param crTextLink An RGB value representing the link control's text link color. */ void SetTextLinkColor(COLORREF crTextLink); /** * @brief * Call this member function to retrieve the link control's text link color. * @return * An RGB value representing the link control's text link color. */ COLORREF GetTextLinkColor() const; private: void DrawText(CDC* pDC, CRect rClient); void DrawTextPart(CDC* pDC, int& x, int& y, int nWidth, CString strBuffer, LINKITEM* pItem); int DrawTextPartText(CDC* pDC, CString strBuffer, int x, int y, LINKITEM* pItem); void RemoveAllLinks(); protected: /** @cond */ DECLARE_MESSAGE_MAP() //{{AFX_VIRTUAL(CXTPTaskDialogLinkCtrl) BOOL PreCreateWindow(CREATESTRUCT& cs); void PreSubclassWindow(); //}}AFX_VIRTUAL //{{AFX_MSG(CXTPTaskDialogLinkCtrl) afx_msg void OnPaint(); afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); afx_msg LRESULT OnNcHitTest(CPoint /*point*/); afx_msg void OnSetFocus(CWnd* pOldWnd); afx_msg void OnKillFocus(CWnd* pNewWnd); afx_msg UINT OnGetDlgCode(); afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg LRESULT OnUpdateUIState(WPARAM wParam, LPARAM lParam); LRESULT OnSetText(WPARAM wParam, LPARAM lParam); //}}AFX_MSG /** @endcond */ protected: int m_nFocused; /**< Index of the currently focus link. */ CXTPFont m_xtpFontUL; /**< Font used to render link text. */ XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, m_fontUL, m_xtpFontUL, GetULFontHandle); CString m_strBuffer; /**< Text buffer to be displayed in the control. */ HCURSOR m_hcurHand; /**< Handle to text link cursor. */ COLORREF m_crBack; /**< RGB background color value. */ COLORREF m_crText; /**< RGB text color value. */ COLORREF m_crTextLink; /**< RGB link text color value. */ CTaskLinkItemArray m_arrLinks; /**< Array of links for the display text. */ BOOL m_bPreSubclassWindow; }; /** * @brief * CXTPTaskButtonTheme. */ class _XTP_EXT_CLASS CXTPTaskButtonTheme : public CXTPButtonTheme { public: CXTPTaskButtonTheme(BOOL bThemeReady); CXTPTaskButtonTheme(); virtual void RefreshMetrics(CXTPButton* pButton); void SetTitleFont(CFont* FontTitle); CFont* GetTitleFont(); protected: virtual BOOL DrawButtonThemeBackground(CDC* pDC, CXTPButton* pButton); virtual BOOL DrawWinThemeBackground(CDC* pDC, CXTPButton* pButton); virtual void DrawButtonText(CDC* pDC, CXTPButton* pButton); virtual COLORREF GetTextColor(CXTPButton* pButton); virtual void GetButtonText(CXTPButton* pButton); virtual void DrawButtonIcon(CDC* pDC, CXTPButton* pButton); virtual void DrawButton(CDC* pDC, CXTPButton* pButton); CPoint GetTextPosition(CDC* pDC, CSize sizeText, CXTPButton* pButton); CFont* m_pFontTitle; CPoint m_ptMargin; CString m_strButton; CString m_strCaptText; CString m_strNoteText; CBitmap m_bmpBackClassic; CBitmap m_bmpBackThemed; CXTPPaintManagerColor m_crTextHilite; CXTPPaintManagerColor m_crBackSelected; CXTPPaintManagerColor m_crBorderActive; BOOL m_bThemeReady; }; /** * @brief * CXTPTaskButtonThemeExpando. */ class _XTP_EXT_CLASS CXTPTaskButtonThemeExpando : public CXTPButtonTheme { public: CXTPTaskButtonThemeExpando(); void DrawButton(CDC* pDC, CXTPButton* pButton); }; /** * @brief * CXTPTaskDialogProgressCtrl. */ class _XTP_EXT_CLASS CXTPTaskDialogProgressCtrl : public CProgressCtrl { public: CXTPTaskDialogProgressCtrl(); protected: DECLARE_MESSAGE_MAP() //{{AFX_VIRTUAL(CXTPTaskDialogProgressCtrl) //}}AFX_VIRTUAL //{{AFX_MSG(CXTPTaskDialogProgressCtrl) afx_msg void OnPaint(); afx_msg void OnTimer(UINT_PTR nIDEvent); afx_msg LRESULT OnStartMarquee(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnSetState(WPARAM wParam, LPARAM lParam); //}}AFX_MSG protected: int m_nState; int m_nMarqueePos; UINT m_nMarqueeDelay; BOOL m_bMarquee; }; /** @cond */ AFX_INLINE void CXTPTaskDialogLinkCtrl::SetBackColor(COLORREF crBack) { m_crBack = crBack; } AFX_INLINE COLORREF CXTPTaskDialogLinkCtrl::GetBackColor() const { return m_crBack; } AFX_INLINE void CXTPTaskDialogLinkCtrl::SetTextColor(COLORREF crText) { m_crText = crText; } AFX_INLINE COLORREF CXTPTaskDialogLinkCtrl::GetTextColor() const { return m_crText; } AFX_INLINE void CXTPTaskDialogLinkCtrl::SetTextLinkColor(COLORREF crTextLink) { m_crTextLink = crTextLink; } AFX_INLINE COLORREF CXTPTaskDialogLinkCtrl::GetTextLinkColor() const { return m_crTextLink; } ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. /** @endcond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPTASKLINKCTRL_H__) /** @endcond */