/** * @file XTPCalendarCaptionBarThemePart.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(__XTPCALENDARCAPTIONBARTHEMEPART_H__) # define __XTPCALENDARCAPTIONBARTHEMEPART_H__ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPCalendarCaptionBarPaintManager; /** * @brief * Defines the part object states flags. */ enum EStates { xtpBtnStateNormal = 0, /**< defines a normal state.*/ xtpBtnStateMouseOver = 0x001, /**< defines a mouse over state.*/ xtpBtnStatePressed = 0x002, /**< defines a pressed state.*/ xtpBtnStateChecked = 0x004, /**< defines a checked state.*/ xtpBtnStateFocused = 0x008, /**< defines a ficused state.*/ }; /** * @brief * This class used as a base class for graphical Parts of CalendarCaptionBar * paint theme. * * @see CXTPCalendarCaptionBarTheme */ class _XTP_EXT_CLASS CXTPCalendarCaptionBarThemePart : public CXTPCalendarWMHandler { friend class CXTPCalendarCaptionBarTheme; /** @cond */ DECLARE_DYNAMIC(CXTPCalendarCaptionBarThemePart) /** @endcond */ public: /** * @brief * Default object constructor. * * @param pTheme Pointer to parent CXTPCalendarCaptionBarTheme object. * @param nPartID An object identifier (value from enum XTPEnumCalendarCaptionBarThemeObject). * * @see ~CXTPCalendarCaptionBarThemePart */ CXTPCalendarCaptionBarThemePart(CXTPCalendarCaptionBarTheme* pTheme, int nPartID); /** * @brief * Default object destructor. * * @see CXTPCalendarCaptionBarThemePart */ virtual ~CXTPCalendarCaptionBarThemePart(); /** * @brief * This member function is used to adjust the object's layout depending * on the provided bounding rectangle. * * @param pDC Pointer to a valid device context (may be NULL). * @param rcRect A CRect object containing the dimensions of the bounding rectangle for this * part. */ virtual void AdjustLayout(CDC* pDC, const CRect& rcRect); /** * @brief * This member function is used to draw the part content utilizing * the specified device context. * * @param pDC Pointer to a valid device context. */ virtual void Draw(CDC* pDC); /** * @brief * Performs refreshing of graphical related parameters from * system settings. Base implementation do nothing. */ virtual void RefreshMetrics(){}; /** * @brief * This member function initiates the CalendarCaptionBar control's redrawing. * * @param bUpdateNow Set this parameter to TRUE if you'd like to force control's redrawing. * * @details Call this member function if you want to request or force the control's redrawing. * * @see CXTPCalendarCaptionBarTheme::Redraw * @see AdjustLayout */ virtual void Redraw(BOOL bUpdateNow = FALSE); /** * @brief * This member function is used to determine is the specified point * over visible object rectangle. * * @param pt A CPoint object reference that contains the point to test. * * @return TRUE if the point is inside the caption bar, FALSE else. */ virtual BOOL HitTest(const CPoint& pt) const; /** * @brief * This member function is used to obtain pointer to parent * CXTPCalendarCaptionBarTheme object. * * @return A pointer to CXTPCalendarCaptionBarTheme object. */ virtual CXTPCalendarCaptionBarTheme* GetTheme() const; /** * @brief * This member function is used to obtain current paint theme. * * @return A paint theme ID from enum XTPCalendarTheme. */ virtual XTPCalendarTheme GetPaintTheme() const; /** * @brief * This member function is used to obtain an object identifier. * * @return An object ID (value from enum XTPEnumCalendarCaptionBarThemeObject). */ virtual int GetPartID() const; /** * @brief * This member function is used to obtain an object rectangle. * * @return An object rectangle. */ virtual CRect GetRect() const; /** * @brief * This member function is used to obtain an object text. * * @return An object text as CString. * * @see SetText */ virtual CString GetText() const; /** * @brief * This member function is used to set object text. * * @param pcszText An object text to set. * * @see GetText */ virtual void SetText(LPCTSTR pcszText); /** * @brief * This member function is used to get is part object visible. * * @return TRUE if object is visible, FALSE otherwise. * * @see SetVisible */ virtual BOOL IsVisible() const; /** * @brief * This member function is used to set visible object's state. * * @param bVisible - A BOOL value to define visible state. * * @see GetVisible */ virtual void SetVisible(BOOL bVisible); /** * @brief * This member function is used to get checked state. * * @return Nonzero if object is checked, 0 (zero) otherwise. * * @see SetCheck */ virtual int GetCheck() const; /** * @brief * This member function is used to set checked state. * * @param nCheck Set as Nonzero if object is checked, 0 (zero) otherwise. * * @see GetCheck */ virtual void SetCheck(int nCheck); /** * @brief * This member function is used to get object state (flags from * CXTPCalendarCaptionBarThemePart::EStates enum). * * @return Current object state flags. * * @see SetState */ int GetState() const; /** * @brief * This member function is used to set object state as set of flags * from CXTPCalendarCaptionBarThemePart::EStates enum. * * @param nState Current object state flags. * * @see SetState */ virtual void SetState(int nState); /** * @brief * This member function is used to get object text color. * * @return m_clrTextColor value returned if it is defined, otherwise GetTheme()->m_clrTextColor * value returned. * * @see CXTPCalendarCaptionBarThemePart::m_clrTextColor, * @see CXTPCalendarCaptionBarTheme::m_clrTextColor */ virtual COLORREF GetTextColor(); /** * @brief * Gets the paint manager. * * @return A pointer to the paint manager. */ CXTPCalendarCaptionBarPaintManager* GetPaintManager() const; public: /** * @brief * This member function is used to processes mouse movement events. * * @param nFlags A UINT that is used to indicate whether various virtual * keys are down. * @param point A CPoint that specifies the x- and y- coordinates of the cursor. * These coordinates are always relative to the * upper-left corner of the window. * * @details This method is called by the parent object when the user moves the mouse cursor. */ virtual void OnMouseMove(UINT nFlags, CPoint point); /** * @brief * This member function is used to process left mouse button down events. * * @param nFlags An int that indicates whether various virtual keys are down. * @param point A CPoint object that specifies the x- and y- coordinates of the cursor. * These coordinates are always relative to the * upper-left corner of the window. * * @return TRUE if the message is handled successfully, FALSE else. * * @details This method is called by the parent object when the user presses the left mouse * button. */ virtual BOOL OnLButtonDown(UINT nFlags, CPoint point); /** * @brief * This member function is used to process left mouse button up events. * * @param nFlags An int that indicates whether various virtual keys are down. * @param point A CPoint object that specifies the x- and y- coordinates of the cursor. * These coordinates are always relative to the * upper-left corner of the window. * * @return TRUE if the message is handled successfully, FALSE else. * * @details This method is called by the parent object when the user * releases the left mouse button. */ virtual BOOL OnLButtonUp(UINT nFlags, CPoint point); public: CXTPPaintManagerColor m_clrTextColor; /**< Store the object's text color.*/ CRect m_rcRect; /**< Store a Part rectangle.*/ int m_nState; /**< Store a Part state.*/ CString m_strText; /**< Store a Part text.*/ protected: CXTPCalendarCaptionBarTheme* m_pTheme; /**< Store pointer to a parent theme object.*/ int m_nPartID; /**< Store a Part ID.*/ BOOL m_bVisible; /**< Store a Part visible state.*/ }; /** * @brief * This class implements SwitchView button part of the SwitchViewBar. * * @see CXTPCalendarCaptionBarThemePart */ class _XTP_EXT_CLASS CXTPSwitchViewButtonPart : public CXTPCalendarCaptionBarThemePart { public: CXTPSwitchViewButtonPart(CXTPCalendarCaptionBarTheme* pTheme, int nPartID) : CXTPCalendarCaptionBarThemePart(pTheme, nPartID){}; virtual void RefreshMetrics(); virtual void AdjustLayout(CDC* pDC, const CRect& rcRect); virtual void Draw(CDC* pDC); }; /** * @brief * This class implements Radio button part of the SwitchViewBar. * * @see CXTPCalendarCaptionBarThemePart */ class _XTP_EXT_CLASS CXTPRadioButtonPart : public CXTPCalendarCaptionBarThemePart { public: CXTPRadioButtonPart(CXTPCalendarCaptionBarTheme* pTheme, int nPartID) : CXTPCalendarCaptionBarThemePart(pTheme, nPartID){}; virtual void AdjustLayout(CDC* pDC, const CRect& rcRect); virtual void RefreshMetrics(); virtual void Draw(CDC* pDC); }; /** * @brief * This class implements Checkbox button part of the SwitchViewBar. * * @see CXTPCalendarCaptionBarThemePart */ class _XTP_EXT_CLASS CXTPCheckboxButtonPart : public CXTPCalendarCaptionBarThemePart { public: CXTPCheckboxButtonPart(CXTPCalendarCaptionBarTheme* pTheme, int nPartID) : CXTPCalendarCaptionBarThemePart(pTheme, nPartID){}; virtual void AdjustLayout(CDC* pDC, const CRect& rcRect); virtual void RefreshMetrics(); virtual void Draw(CDC* pDC); }; /** * @brief * This class implements Scroll Date button part of the ScrollDateBar. * * @see CXTPCalendarCaptionBarThemePart */ class _XTP_EXT_CLASS CXTPScrollDateButtonPart : public CXTPCalendarCaptionBarThemePart { public: CXTPScrollDateButtonPart(CXTPCalendarCaptionBarTheme* pTheme, int nPartID) : CXTPCalendarCaptionBarThemePart(pTheme, nPartID){}; virtual void Draw(CDC* pDC); virtual void AdjustLayout(CDC* pDC, const CRect& rcRect); virtual BOOL OnLButtonDown(UINT nFlags, CPoint point); virtual void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); virtual void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags); virtual LPCTSTR _GetImageName(); protected: virtual void DrawScrollTriangle(CDC* pDC, CRect rcRect, BOOL bLeftDirection, COLORREF clrColor); }; /** * @brief * This class implements Date Label part of the ScrollDateBar. * * @see CXTPCalendarCaptionBarThemePart */ class _XTP_EXT_CLASS CXTPDateLabelPart : public CXTPCalendarCaptionBarThemePart { public: CXTPDateLabelPart(CXTPCalendarCaptionBarTheme* pTheme, int nPartID) : CXTPCalendarCaptionBarThemePart(pTheme, nPartID){}; virtual void RefreshMetrics(); virtual void Draw(CDC* pDC); virtual CString _FormatDate(COleDateTime dtDay1, COleDateTime dtDay2, BOOL bShowMonthDay); void UserAction_FormatCaptionBarLabel(CString& strCaption, COleDateTime dtDay1); public: CXTPCalendarThemeFontValue m_fntTextFont; /**< Store the text font.*/ }; /** * @brief * This class implements Expand button part of the ScrollDateBar. * * @see CXTPCalendarCaptionBarThemePart */ class _XTP_EXT_CLASS CXTPExpandButtonPart : public CXTPCalendarCaptionBarThemePart { public: CXTPExpandButtonPart(CXTPCalendarCaptionBarTheme* pTheme, int nPartID) : CXTPCalendarCaptionBarThemePart(pTheme, nPartID){}; virtual void Draw(CDC* pDC); virtual void AdjustLayout(CDC* pDC, const CRect& rcRect); protected: // virtual LPCTSTR _GetImageName(); // virtual void _DrawTriangle(CDC* pDC, CPoint pt0, CPoint pt1, CPoint pt2, COLORREF clrColor); virtual void DrawExpandTriangle(CDC* pDC, CRect rcRect, BOOL bDownDirection, COLORREF clrColor); }; ////////////////////////////////////////////////////////////////////////// AFX_INLINE CXTPCalendarCaptionBarTheme* CXTPCalendarCaptionBarThemePart::GetTheme() const { return m_pTheme; } AFX_INLINE CRect CXTPCalendarCaptionBarThemePart::GetRect() const { return m_rcRect; } AFX_INLINE CString CXTPCalendarCaptionBarThemePart::GetText() const { return m_strText; } AFX_INLINE void CXTPCalendarCaptionBarThemePart::SetText(LPCTSTR pcszText) { m_strText = pcszText; } AFX_INLINE int CXTPCalendarCaptionBarThemePart::GetPartID() const { return m_nPartID; } AFX_INLINE BOOL CXTPCalendarCaptionBarThemePart::IsVisible() const { return m_bVisible; } AFX_INLINE void CXTPCalendarCaptionBarThemePart::SetVisible(BOOL bVisible) { m_bVisible = bVisible; } AFX_INLINE int CXTPCalendarCaptionBarThemePart::GetCheck() const { return !!(m_nState & xtpBtnStateChecked); } AFX_INLINE void CXTPCalendarCaptionBarThemePart::SetCheck(int nCheck) { if (nCheck) m_nState = m_nState | xtpBtnStateChecked; else m_nState = m_nState & (~xtpBtnStateChecked); } AFX_INLINE int CXTPCalendarCaptionBarThemePart::GetState() const { return m_nState; } AFX_INLINE void CXTPCalendarCaptionBarThemePart::SetState(int nState) { m_nState = nState; } # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // !defined(__XTPCALENDARCAPTIONBARTHEMEPART_H__)