/** * @file XTPCalendarTip.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 * */ #if !defined(__XTPCalendarTip_H__) # define __XTPCalendarTip_H__ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" /** * @brief * The CXTPCalendarTip class emulates the functionality of a "tool tip" * control. * * @details * The CXTPCalendarTip class encapsulates the functionality of * a "tip control", a small pop-up window that displays a * single line of text describing the hidden text when hovering over * an item on the report area. * * CXTPCalendarTip provides the functionality to control the * the tip text, the size of the tip window itself, and the text * font of the tip. * * This class is used by the Grid control internally. * * @see CXTPCalendarControl */ class _XTP_EXT_CLASS CXTPCalendarTip : public CWnd { // Construction public: /** * @brief * Constructs a CXTPCalendarTip object. * * @details * Construct a CXTPCalendarTip object in two steps. * Call the constructor object and then call * Create, which initializes the window and * attaches it to the parent window. * * Example: *
* Declare a local CXTPCalendarTip object. * CXTPCalendarTip wndTip; * * // Declare a dynamic CXTPCalendarTip object. * CXTPCalendarTip* pTipWnd = new CXTPCalendarTip; ** * @see CWnd * @see Create * @see Activate */ CXTPCalendarTip(); /** * @brief * Destroys a CXTPCalendarTip object and handles cleanup and deallocation. */ virtual ~CXTPCalendarTip(); /** * @brief * This member function is used to create a report tip window. * * @param pParentWnd A pointer to a CWnd that is the parent report * control window. * * @details * Construct an object in two steps. * Call the constructor object and then call * Create(), which initializes the window and * attaches it to the parent window. * * Example: *
* void MyDialog::ShowToolTip(CRect rcTip, CXTPCalendarTip* pTipWnd)
* {
* if (!pTipWnd->GetSafeHwnd())
* {
* pTipWnd->Create(this);
* }
* pTipWnd->SetHoverRect(rcTip);
* pTipWnd->Activate(TRUE);
* }
*
*
* @return TRUE if tip window is created successfully, FALSE otherwise.
*
* @see CXTPCalendarTip::CXTPCalendarTip
* @see Activate
*/
virtual BOOL Create(CWnd* pParentWnd);
// Attributes
public:
/**
* @brief
* This member function is used to obtain the tooltip text string.
*
* @return A CString that contains the current tooltip text.
*
* @see SetTooltipText
*/
CString GetTooltipText() const;
/**
* @brief
* This member function is used to set the new tooltip text.
*
* @param str An LPCSTR string that contains the new tooltip caption.
*
* @details
* Call this member function before activating the tooltip window.
*
* @see GetTooltipText
*/
void SetTooltipText(LPCTSTR str);
/**
* @brief
* This member function is used to set the tooltip text font.
*
* @param pFont A pointer to a CFont object that contains the new font.
*/
void SetFont(CFont* pFont);
/**
* @brief
* This member function is used to set the coordinates of the
* tooltip hover rectangle.
*
* @param rc A CRect object that contains the new tooltip hover rectangle
* in the parent window coordinates.
*
* @details
* Called this member function before activating the tooltip window.
*
* @see GetHoverRect
*/
void SetHoverRect(CRect rc);
/**
* @brief
* This function is used to obtain the coordinates of a tooltip hover rectangle.
*
* @return The coordinates of the tooltip hover rectangle in parent window coordinates.
*
* @see SetHoverRect
*/
CRect GetHoverRect() const;
/**
* @brief
* This function is used to check whether advanced mode is enabled.
* Advanced mode means left mouse click handling.
*
* @return TRUE when advanced mode enabled (left mouse click handling).
*/
BOOL IsAdvancedMode() const;
/**
* @brief
* This function is used to set the advanced mode flag.
*
* @param bMode a BOOL flag to set the mode as advanced or standard
*/
void SetAdvancedMode(BOOL bMode = TRUE);
/**
* @brief
* This member function sets (or disables) the new control drawing
* theme.
*
* @param pTheme A CXTPCalendarTheme pointer to the theme object.
* If pTheme is NULL - themes are disabled and regular
* painting is used.
*/
void SetTheme(CXTPCalendarTheme* pTheme);
// Operations
public:
/**
* @brief
* Call this function to activate or deactivate a tool tip control.
*
* @param bActive A BOOL. Specifies whether the tool tip control is to be activated or
* deactivated.
* @param bAdvanced TRUE for advanced processing (Office2007 theme "add new appt")
*
* @details
* If bActivate is TRUE, the control is activated.
* If FALSE, it is deactivated.
*
* When a tool tip control is active, the tool tip information
* appears when the cursor is on a tool that is registered with
* the control. When it is inactive, the tool tip information
* does not appear, even when the cursor is on a tool.
*
* Example:
* See Create method example.
*
* @see Create
* @see CXTPCalendarTip::CXTPCalendarTip
* @see SetTooltipText
*/
void Activate(BOOL bActive, BOOL bAdvanced = FALSE);
/**
* @brief
* This function is used to calculate the tooltip rectangle.
*
* @param bFull A BOOL flag of the way of calculation.
*
* @details
* Standard window DC, stored font and tooltip text are used.
*
* @return Size of the tooltip rectangle.
*
* @see SetTooltipText
* @see SetFont
*/
CSize CalcToolTipRect(BOOL bFull = FALSE);
protected:
DECLARE_MESSAGE_MAP()
//{{AFX_MSG(CXTPCalendarTip)
afx_msg LRESULT OnNcHitTest(CPoint point);
afx_msg BOOL OnEraseBkgnd(CDC*);
afx_msg void OnPaint();
//}}AFX_MSG
private:
BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect,
CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
protected:
CRect m_rcHover; /**< Hover window coordinates. */
CFont* m_pFont; /**< Font for displaying tooltip text. */
CWnd* m_pParentWnd; /**< Pointer to the parent report window.*/
CString m_strTooltipText; /**< Tooltip text to display. */
BOOL m_bAdvancedMode; /**< TRUE when advanced mode is on */
CXTPCalendarTheme* m_pTheme; /**< Pointer to associated Theme object */
};
AFX_INLINE BOOL CXTPCalendarTip::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 CString CXTPCalendarTip::GetTooltipText() const
{
return m_strTooltipText;
}
AFX_INLINE void CXTPCalendarTip::SetTooltipText(LPCTSTR str)
{
m_strTooltipText = str;
}
AFX_INLINE void CXTPCalendarTip::SetFont(CFont* pFont)
{
m_pFont = pFont;
}
AFX_INLINE void CXTPCalendarTip::SetHoverRect(CRect rc)
{
m_rcHover = rc;
MoveWindow(rc);
}
AFX_INLINE CRect CXTPCalendarTip::GetHoverRect() const
{
return m_rcHover;
}
AFX_INLINE void CXTPCalendarTip::SetAdvancedMode(BOOL bMode)
{
m_bAdvancedMode = bMode;
}
AFX_INLINE BOOL CXTPCalendarTip::IsAdvancedMode() const
{
return m_bAdvancedMode;
}
# include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h"
#endif // !defined(__XTPCalendarTip_H__)