/** * @file XTPTipOfTheDay.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(__XTPTIPOFTHEDAY_H__) # define __XTPTIPOFTHEDAY_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPMarkupContext; class CXTPMarkupUIElement; class CXTPImageManagerIcon; /** * @brief * CXTPTipOfTheDay is a CDialog derived class. * CXTPTipOfTheDay is used to create a Visual Studio(tm) style * Tip Of The Day dialog. To use, place a file called "tips.txt" in the * same directory as your application .exe. Place each tip on its own line. */ class _XTP_EXT_CLASS CXTPTipOfTheDay : public CDialog { /** @cond */ DECLARE_DYNAMIC(CXTPTipOfTheDay) /** @endcond */ public: /** * @brief * Constructs a CXTPTipOfTheDay object. * @param lpszTipFile A NULL-terminated string that represents the path and file name * of where the tips text file is located. By default, the file name * is set to "tips.txt". * @param pParent Pointer to the parent window for the Tip Of The Day Dialog. */ CXTPTipOfTheDay(LPCTSTR lpszTipFile = NULL, CWnd* pParent = NULL); /** * @brief * Destroys a CXTPTipOfTheDay object, handles cleanup and deallocation. */ virtual ~CXTPTipOfTheDay(); public: /** * @brief * This member function will set the fonts to be used by the "Did you * know..." and the Tip Of The Day text. * @param pFontTitle Pointer to a CFont object that represents the new * font to be used for the "Did you know..." text. * @param pFontTip Pointer to a CFont object that represents the new * font to be used for the Tip Of The Day text. */ virtual void SetDefaultFonts(CFont* pFontTitle, CFont* pFontTip); /** * @brief * This member function will retrieve the next string to be displayed * as the Tip Of The Day. * @param strNext A CString reference that represents the next * Tip Of The Day text that is to be displayed. */ virtual void GetNextTipString(CString& strNext); /** * @brief * This member function will set the text that is to be displayed * in place of the "Did you know..." string. * @param lpszTitle Represents a NULL-terminated string that is * the string to be displayed in place of the * "Did you know..." text. */ virtual void SetDefaultTitle(LPCTSTR lpszTitle); /** * @brief * This member function will set the path to where the tips file is * located. * @param lpszTipFile A NULL-terminated string that represents the full * path to where the tips text file is located. */ virtual void SetTipsFilePath(LPCTSTR lpszTipFile); /** * @brief * Call this method to add all tips manually. * @param lpszTip Next tooltip to add. */ void AddTip(LPCTSTR lpszTip); /** * @brief * Call this member function to set the tip text. * @param lpszText A NULL-terminated string that represents the new tip text * to display. */ void SetTipText(LPCTSTR lpszText); /** * @brief * Call this method to enable markup for tab captions. * @param bEnable TRUE to enable markup. */ void EnableMarkup(BOOL bEnable); /** * @brief * Call this method to get the Markup element that renders the item. * @return * A pointer to a CXTPMarkupContext object. */ CXTPMarkupContext* GetMarkupContext() const; protected: /** @cond */ DECLARE_MESSAGE_MAP() //{{AFX_VIRTUAL(CXTPTipOfTheDay) virtual void DoDataExchange(CDataExchange* pDX); /**< DDX/DDV support */ BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult); //}}AFX_VIRTUAL //{{AFX_MSG(CXTPTipOfTheDay) afx_msg void OnPaint(); virtual BOOL OnInitDialog(); virtual void OnOK(); afx_msg void OnDaytipNext(); //}}AFX_MSG /** @endcond */ public: /** @cond */ //{{AFX_DATA(CXTPTipOfTheDay) enum { IDD = XTP_IDD_TIPOFTHEDAY }; CButton m_ok; CButton m_showTips; CButton m_btnNextTip; CStatic m_staticBorder; BOOL m_bStartup; //}}AFX_DATA /** @endcond */ BOOL m_bClassicStyle; /**< Classic Style. */ protected: FILE* m_pStream; /**< A pointer to the open file stream. */ CRect m_rcBorder; /**< Size of the total display area. */ CRect m_rcTipText; /**< Size of the display area for tip text. */ CXTPFont m_xtpFontTitle; /**< Default font used for "Did you know..." text. */ CXTPFont m_xtpFontTip; /**< Default font used for tips. */ XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, m_fontTitle, m_xtpFontTitle, GetTitleFontHandle); XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, m_fontTip, m_xtpFontTip, GetTipFontHandle); CFont* m_pFontTitle; /**< User-defined font for "Did you know..." text. */ CFont* m_pFontTip; /**< User-defined font for tips. */ CString m_strTipTitle; /**< Represents the "Did you know" text. */ CString m_strTipText; /**< Represents the Tip Of The Day text. */ CString m_strTipFile; /**< Represents the file name and path for the tips file. */ CXTPImageManagerIcon* m_pLightBulbIcon; /**< Bulb bitmap. */ CXTPMarkupContext* m_pMarkupContext; /**< Markup Context. */ CXTPMarkupUIElement* m_pMarkupTipText; /**< Markup element. */ CStringArray m_arrTips; /**< Array of tips to display. */ UINT m_nNextTip; /**< Index of next tip to display. */ }; ////////////////////////////////////////////////////////////////////// /** @cond */ AFX_INLINE void CXTPTipOfTheDay::SetDefaultTitle(LPCTSTR lpszTitle) { m_strTipTitle = lpszTitle; } AFX_INLINE void CXTPTipOfTheDay::AddTip(LPCTSTR lpszTip) { m_arrTips.Add(lpszTip); } AFX_INLINE CXTPMarkupContext* CXTPTipOfTheDay::GetMarkupContext() const { return m_pMarkupContext; } /** @endcond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // #if !defined(__XTPTIPOFTHEDAY_H__) /** @endcond */