/** * @file XTPCalendarCaptionBarTheme.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(__XTPCALENDARCAPTIONBARTHEME_H__) # define __XTPCALENDARCAPTIONBARTHEME_H__ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPCalendarCaptionBarPaintManager; class CXTPSwitchViewButtonPart; class CXTPExpandButtonPart; class CXTPDateLabelPart; class CXTPScrollDateButtonPart; class CXTPRadioButtonPart; class CXTPCheckboxButtonPart; /** * @brief * This class CalendarCaptionBar control drawing, user interaction logic * and interaction logic with attached Calendar control. * paint theme. * * @see CXTPCalendarCaptionBarTheme */ class _XTP_EXT_CLASS CXTPCalendarCaptionBarTheme : public CXTPCalendarWMHandler { DECLARE_DYNCREATE(CXTPCalendarCaptionBarTheme) friend class CXTPCalendarCaptionBarControl; friend class CXTPCalendarCaptionBarThemePart; public: /** * @brief * Default object constructor. * * @see ~CXTPCalendarCaptionBarTheme */ CXTPCalendarCaptionBarTheme(); /** * @brief * Default object destructor. * * @see CXTPCalendarCaptionBarTheme() */ virtual ~CXTPCalendarCaptionBarTheme(); double m_dScale; /**< The scale.*/ public: /** * @brief * This member function retrieves the minimum size required to show a * CaptionBar control. * * @param pDC Pointer to a valid device context (may be NULL). * @param bExactSize BOOL flag to make Caption Bar minimum height if TRUE * and 11 pixels more if not (esthetic choice) * * @return A minimum rectangle required to show CaptionBar control. * * @see CXTPCalendarCaptionBarControl::CalcMinRect */ virtual CRect CalcMinRect(CDC* pDC = NULL, BOOL bExactSize = FALSE); /** * @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 * 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 functions is used to get is CaptionBar object visible. * * @return TRUE if corresponding object is visible, FALSE otherwise. * * @see SetSwitchViewButtons * @see SetScrollDateButtons * @see SetDateLabel */ BOOL IsSwitchViewButtons() const; /** * @brief * This member functions is used to get is Scroll Date Buttons object visible. * * @return TRUE if corresponding object is visible, FALSE otherwise. */ BOOL IsScrollDateButtons() const; /** * @brief * This member functions is used to get is Date Label object visible. * * @return TRUE if corresponding object is visible, FALSE otherwise. */ BOOL IsDateLabel() const; /** * @brief * This member functions is used to get is Expand Button object visible. * * @return TRUE if corresponding object is visible, FALSE otherwise. */ BOOL IsExpandButton() const; /** * @brief * This member function is used to set visible Switch View Buttons object's state. * * @param bVisible A BOOL value to define visible state. * * @see GetVisible */ void SetSwitchViewButtons(BOOL bVisible); /** * @brief * This member functions is used to set Scroll Date Buttons object visible or not. * * @param bVisible A BOOL value to define visible state. */ void SetScrollDateButtons(BOOL bVisible); /** * @brief * This member functions is used to set Date Label object visible or not. * * @param bVisible A BOOL value to define visible state. */ void SetDateLabel(BOOL bVisible); /** * @brief * This member functions is used to set Expand Button object visible or not. * * @param bVisible A BOOL value to define visible state. */ void SetExpandButton(BOOL bVisible); /** * @brief * This member functions is used to set Expand Button Checked state. * * @param bCheck A BOOL value to define checked state. */ void SetExpandButtonCheck(BOOL bCheck); /** * @brief * This member functions is used to get is Expand Button object checked. * * @return TRUE if corresponding object is checked, FALSE otherwise. */ BOOL GetExpandButtonCheck(); /** * @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 set current paint theme. * * @param nTheme A paint theme ID from enum XTPCalendarTheme. */ virtual void SetPaintTheme(XTPCalendarTheme nTheme); /** * @brief * This member function is used to set current paint theme. * * @param pPaintManager Pointer to a valid CXTPCalendarCaptionBarPaintManager derived class. */ virtual void SetPaintTheme(CXTPCalendarCaptionBarPaintManager* pPaintManager); /** * @brief * This member function is used to get Notify Connection object * * @return pointer to CXTPNotifyConnection object; */ CXTPNotifyConnection* GetConnection(); public: /** * @brief * This member function is used to draw the object content utilizing * the specified device context. * * @param pDC Pointer to a valid device context. */ virtual void Draw(CDC* pDC); /** * @brief * This member function is used to draw the object borders * * @param pDC Pointer to a valid device context. * @param rcRect object rectangle * @param rcBorders border rectangle */ virtual void DrawBorders(CDC* pDC, const CRect& rcRect, const CRect& rcBorders); /** * @brief * This member function is used to obtain an object rectangle. * * @return An object rectangle. */ virtual const CRect& GetRect(); /** * @brief * This member function is used to obtain an owner (parent, host) window. * * @return A pointer to CWnd object. */ CWnd* GetOwnerWnd() const; /** * @brief * This member function is used to set owner (parent, host) window. * * @details CXTPCalendarCaptionBarControl::SetTheme call this method. * * @param pCaptionBar A pointer to CXTPCalendarCaptionBarControl window. */ virtual void SetOwner(CXTPCalendarCaptionBarControl* pCaptionBar); /** * @brief * This member function is used to attach to CalendarControl to interact * as a single control. * * @param pCalendar A pointer to CXTPCalendarControl object or set as NULL to detach from * calendar. * * @see GetCalendarCtrl */ virtual void AttachCalendar(CXTPCalendarControl* pCalendar); /** * @brief * This member function is used to obtain attached calendar control. * * @return A pointer to CXTPCalendarControl object. */ virtual CXTPCalendarControl* GetCalendarCtrl() const; /** * @brief * This member function is called to update CaptionBar controls states * correspondingly to attached calendar control. */ virtual void UpdateControlsState(); /** * @brief * This member function is called when user click on the caption bar * element (part). * * @param nPartID An identifier of clicked part object. */ virtual void OnPartClick(int nPartID); /** * @brief * Gives access to theme paint manager. * * @return A pointer to a theme paint manager or NULL of no paint manager is set. */ CXTPCalendarCaptionBarPaintManager* GetPaintManager() const; BOOL m_bTimelineEnable; /**< Flag to show (and able to use) button to toggle TimeLine mode*/ BOOL m_bMulticolumnsEnable; /**< Flag to show (and able to use) button to toggle Multi-Column / 2-Column Week modes*/ CXTPCalendarCaptionBarControl* m_pCaptionBar; /**< Store pointer owner CaptionBar control.*/ protected: virtual int GetChildHandlersCount() const; virtual CXTPCalendarWMHandler* GetChildHandlerAt(int nIndex) const; virtual void OnBeforeDestroy(); virtual void OnMouseMove(UINT nFlags, CPoint point); virtual BOOL OnTimer(UINT_PTR uTimerID); virtual void OnKillFocus(CWnd* pNewWnd); virtual BOOL _UpdateControlsHotState(BOOL* pbMouseLeave = NULL); protected: CXTPCalendarCaptionBarPaintManager* m_pPaintManager; CXTPCalendarControl* m_pCalendar; /**< Store pointer attached calendar control.*/ CRect m_rcRect; /**< Store object rect.*/ UINT_PTR m_nCheckHotStateTimerID; /**< Store timer ID to refresh controls hot state.*/ protected: CXTPSwitchViewButtonPart* m_pButtonViewDay; /**< Store Switch to DayView button part object.*/ CXTPSwitchViewButtonPart* m_pButtonViewWeek; /**< Store Switch to WeekView button part object.*/ CXTPSwitchViewButtonPart* m_pButtonViewMonth; /**< Store Switch to MonthView button part object.*/ CXTPRadioButtonPart* m_pShowWorkWeek; /**< Store Show Work Week radio button part object.*/ CXTPRadioButtonPart* m_pShowFullWeek; /**< Store Show Full Week radio button part object.*/ CXTPCheckboxButtonPart* m_pShowMcWeek; /**< Store Show Multicolumns Week check box part object.*/ CXTPCheckboxButtonPart* m_pShowTimeline; /**< Store Show Timeline check box part object.*/ //--------------------------------- CXTPScrollDateButtonPart* m_pScrollPrevDate; /**< Store Scroll Date Prev button part object.*/ CXTPScrollDateButtonPart* m_pScrollNextDate; /**< Store Scroll Date Next button part object.*/ CXTPDateLabelPart* m_pDateLabel; /**< Store Date Label part object.*/ CXTPExpandButtonPart* m_pExpandButton; /**< Store Expand button part object.*/ //--------------------------------- BOOL m_bIsSwitchViewButtons; /**< Store option is SwitchViewBar visible.*/ BOOL m_bIsScrollDateButtons; /**< Store option is ScrollDate buttons visible.*/ BOOL m_bIsDateLabel; /**< Store option is date Label visible.*/ BOOL m_bIsExpandButton; /**< Store option is Expand button visible.*/ BOOL m_bIsOneLine; /**< flag to present 1-line (if TRUE) or 2-lines object layout*/ public: int m_nScrollDateButtonsMargin; /** * @brief * This member functions is used to get is CaptionBar layout use 1-line shape. * * @return TRUE if corresponding object use 1-line shape, FALSE if 2-lines shape. */ BOOL IsOneLine() { return m_bIsOneLine; } /** * @brief * This member functions is used to set CaptionBar layout to use 1-line shape. * * @param bSet BOOL (TRUE to use 1-line shape, FALSE to use 2-lines shape) */ void SetOneLine(BOOL bSet) { m_bIsOneLine = bSet; } public: typedef CXTPCalendarPtrCollectionT CThemePartsArray; CThemePartsArray m_arMembers; protected: CXTPNotifyConnection* m_pConnection; CXTPNotifySink* m_pSink; virtual void OnEvent_Calendar(XTP_NOTIFY_CODE Event, WPARAM wParam, LPARAM lParam); virtual void OnEvent_ResourceImagesChanged(XTP_NOTIFY_CODE Event, WPARAM wParam, LPARAM lParam); friend class CCalendarCaptionBarCtrl; friend class CXTPCalendarCaptionBarPaintManager; }; ////////////////////////////////////////////////////////////////////////// AFX_INLINE CXTPCalendarControl* CXTPCalendarCaptionBarTheme::GetCalendarCtrl() const { return m_pCalendar; } AFX_INLINE const CRect& CXTPCalendarCaptionBarTheme::GetRect() { return m_rcRect; } AFX_INLINE BOOL CXTPCalendarCaptionBarTheme::IsSwitchViewButtons() const { return m_bIsSwitchViewButtons; } AFX_INLINE BOOL CXTPCalendarCaptionBarTheme::IsScrollDateButtons() const { return m_bIsScrollDateButtons; } AFX_INLINE BOOL CXTPCalendarCaptionBarTheme::IsDateLabel() const { return m_bIsDateLabel; } AFX_INLINE BOOL CXTPCalendarCaptionBarTheme::IsExpandButton() const { return m_bIsExpandButton; } AFX_INLINE void CXTPCalendarCaptionBarTheme::SetSwitchViewButtons(BOOL bVisible) { m_bIsSwitchViewButtons = bVisible; AdjustLayout(NULL, GetRect()); Redraw(); } AFX_INLINE void CXTPCalendarCaptionBarTheme::SetScrollDateButtons(BOOL bVisible) { m_bIsScrollDateButtons = bVisible; AdjustLayout(NULL, GetRect()); Redraw(); } AFX_INLINE void CXTPCalendarCaptionBarTheme::SetExpandButton(BOOL bVisible) { m_bIsExpandButton = bVisible; AdjustLayout(NULL, GetRect()); Redraw(); } AFX_INLINE void CXTPCalendarCaptionBarTheme::SetDateLabel(BOOL bVisible) { m_bIsDateLabel = bVisible; AdjustLayout(NULL, GetRect()); Redraw(); } AFX_INLINE CXTPCalendarCaptionBarPaintManager* CXTPCalendarCaptionBarTheme::GetPaintManager() const { return m_pPaintManager; } # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // !defined(__XTPCALENDARCAPTIONBARTHEME_H__)