/** * @file XTPCalendarCaptionBarControl.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(__XTPCalendarCaptionBarControl_H__) # define __XTPCalendarCaptionBarControl_H__ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPNotifySink; class CXTPWinThemeWrapper; class CXTPCalendarCaptionBarTheme; ////////////////////////////////////////////////////////////////////////// // Office2007 // // Switch View Bar: // SwitchViewButtonPart // RadioButtonPart // * LabelPart // // Scroll Date Bar: // ScrollDateButtonPart // DateLabelPart // // ========================================== // ButtonViewDay : SwitchViewButtonPart // ButtonViewWeek : SwitchViewButtonPart // ButtonViewMonth : SwitchViewButtonPart // // ShowWorkWeek : RadioButtonPart // ShowFullWeek : RadioButtonPart // --------------------------------- // ScrollPrevDate : ScrollDateButtonPart // ScrollNextDate : ScrollDateButtonPart // DateLabel : DateLabelPart // // --------------------------------- // SwitchViewBarBkColor // ScrollDateBarBkColor /** * @brief * Enumerates Calendar Caption Bar graphical objects . */ enum XTPEnumCalendarCaptionBarThemeObject { xtpCalendarCaptionBar_Unknown = 0, /**< Defines Unknown (NULL) value. */ xtpCalendarCaptionBar_ButtonViewDay = 0x00000001, /**< Defines SwitchViewBar DayViewButton. */ xtpCalendarCaptionBar_ButtonViewWeek = 0x00000002, /**< Defines SwitchViewBar WeekViewButton. */ xtpCalendarCaptionBar_ButtonViewMonth = 0x00000004, /**< Defines SwitchViewBar MonthViewButton. */ xtpCalendarCaptionBar_ShowWorkWeek = 0x00000010, /**< Defines SwitchViewBar ShowWorkWeek radio*/ /**< button. */ xtpCalendarCaptionBar_ShowFullWeek = 0x00000020, /**< Defines SwitchViewBar ShowFullWeek radio*/ /**< button. */ xtpCalendarCaptionBar_ShowTimeline = 0x00000040, /**< Defines SwitchViewBar ShowTimeline radio*/ /**< button. */ xtpCalendarCaptionBar_MultiColumnsWeek = 0x00000080, /**< Defines SwitchViewBar MultiColumnsWeek */ /**< radio button. */ xtpCalendarCaptionBar_ScrollPrevDate = 0x00000100, /**< Defines ScrollDateBar PrevDateButton. */ xtpCalendarCaptionBar_ScrollNextDate = 0x00000200, /**< Defines ScrollDateBar NextDateButton. */ xtpCalendarCaptionBar_DateLabel = 0x00000400, /**< Defines ScrollDateBar DateLabel. */ xtpCalendarCaptionBar_ButtonExpand = 0x00000800 /**< Defines ScrollDateBar Expand Buton. */ }; /** * @brief * CXTPCalendarCaptionBarControl represents CalendarCaptionBar control and * used as a part of CXTPCalendarControl object. They looks and works as * a single control but separated on 2 objects for customization * possibilities. * * @details This class is used as owner (host, events source) window for * CXTPCalendarCaptionBarTheme object which implements the most control logic. * * @see CXTPCalendarCaptionBarTheme * @see CXTPCalendarControl */ class _XTP_EXT_CLASS CXTPCalendarCaptionBarControl : public CWnd { using CWnd::Create; /** @cond */ DECLARE_DYNAMIC(CXTPCalendarCaptionBarControl) /** @endcond */ public: /** * @brief * Default object constructor. * * @see ~CXTPCalendarCaptionBarControl */ CXTPCalendarCaptionBarControl(); /** * @brief * Default object destructor. * * @see CXTPCalendarCaptionBarControl */ virtual ~CXTPCalendarCaptionBarControl(); /** * @brief * This member function retrieves the minimum size required to show a * CaptionBar control. * * @param bExactSize BOOL flag for calc mode * * @return This member function call CXTPCalendarCaptionBarTheme::CalcMinRect function. * @return A minimum rectangle required to show CaptionBar control. * * @see CXTPCalendarCaptionBarTheme::CalcMinRect */ virtual CRect CalcMinRect(BOOL bExactSize = FALSE); /** * @brief This member function is used to create the CaptionBar control window. * * @param dwStyle Specifies the window style attributes. * @param rect A RECT object that contains the coordinates of the window, in the client * coordinates of pParentWnd. * @param pParentWnd A CWnd pointer to the parent window. * @param nID A UINT that contains the ID of the child window. * * @return Nonzero if successful. Otherwise 0. */ virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID); /** * @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 prcWnd A CRect object containing the dimensions of the bounding rectangle for this * part. */ virtual void AdjustLayout(CDC* pDC = NULL, const CRect* prcWnd = NULL); /** * @brief * This member function is used to obtain pointer to * CXTPCalendarCaptionBarTheme object. * * @return A pointer to CXTPCalendarCaptionBarTheme object. */ CXTPCalendarCaptionBarTheme* GetTheme() const; /** * @brief * This member function is used to set theme object. * * @param pTheme A pointer to CXTPCalendarCaptionBarTheme object. */ void SetTheme(CXTPCalendarCaptionBarTheme* pTheme); /** * @brief * Register the window class if it has not already been registered. * * @param hInstance Instance of resource where control is located * * @return TRUE if the window class was successfully registered. FALSE otherwise. */ BOOL RegisterWindowClass(HINSTANCE hInstance = NULL); /** * @brief * This member function is used to adjust the object's layout depending * on the provided bounding rectangle. * * @return A CRect object containing the dimensions of the bounding rectangle */ CRect GetBorders() const; /** * @brief * This member function is used to adjust the object's layout depending * on the provided bounding rectangle. * * @param nLeft rectange data * @param nTop rectange data * @param nRight rectange data * @param nBottom rectange data */ virtual void SetBorders(int nLeft, int nTop, int nRight, int nBottom); /** * @brief * This member function is used to adjust the object's layout depending * on the provided bounding rectangle. */ virtual void UpdateBorders(); /** * @brief * This member function is used to show or hide Timeline button. * * @param bEnable BOOL flag to pass * * @see m_bTimelineEnable */ void EnableTimeline(BOOL bEnable); /** * @brief * This member function is used to get state of m_bTimelineEnable * * @return TRUE if the time line is enabled, FALSE else. */ BOOL IsTimelineEnable(); /** * @brief * This member function is used to show or hide Multi-Columns mode button. * * @param bEnable BOOL flag to pass * * @see m_bMulticolumnsEnable */ void EnableMulticolumns(BOOL bEnable); /** * @brief * This member function is used to get state of m_bMulticolumnsEnable * * @return TRUE if the this button enable. */ BOOL IsMulticolumnsEnable(); /** * @brief * This member function is used to get state of GetTheme()->m_bIsOneLine - * * @param bSet BOOL flag to toggle CaptionMode 2-lines or 1-line modes */ void UseOneLine(BOOL bSet); /** * @brief * This member function is used to get state of GetTheme()->m_bIsOneLine - * flag to toggle CaptionMode 2-lines or 1-line modes * * @return TRUE if the this One Line mode used */ BOOL IsUseOneLine(); // get state of m_bIsOneLine /** * @brief * This member function is used to Set Button Text if text not empty * and hide button and adjust Caption Bar if text is empty * * @param iButtonNumber ordinal number of button starting from 0 * @param sButtonText CString of text passed * * @details Smart function which allow to set custom text on Caption Bar buttons and * hide if text EMPTY at least MonthView, WeekView and DayView buttons to prevent user * switch mode (for restricted app) * * Example of using with button numbers linked to specific View type: *
	 * GetCalendarCaptionBarCtrl().SetButtonText(0, _T("D"));   // DayView
	 * GetCalendarCaptionBarCtrl().SetButtonText(1, _T("W"));   // WeekView
	 * GetCalendarCaptionBarCtrl().SetButtonText(2, _T("M"));   // MonthView
	 * GetCalendarCaptionBarCtrl().SetButtonText(3, _T("TL"));  // TimeLine
	 * GetCalendarCaptionBarCtrl().SetButtonText(4, _T("WW"));  // WorkWeek
	 * GetCalendarCaptionBarCtrl().SetButtonText(5, _T("FW"));  // FullWeek
	 * GetCalendarCaptionBarCtrl().SetButtonText(6, _T("III")); // Multi-Columns mode
	 * 
*/ void SetButtonText(int iButtonNumber, CString sButtonText); protected: CXTPCalendarCaptionBarTheme* m_pTheme; /**< Store pointer to CXTPCalendarCaptionBarTheme object.*/ CRect m_Borders; /**< Store options to draw border lines; */ afx_msg void OnPaint(); afx_msg void OnNcPaint(); afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp); afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnTimer(UINT_PTR uTimerID); afx_msg void OnDestroy(); // afx_msg void OnEnable(BOOL bEnable); // afx_msg UINT OnGetDlgCode(); // afx_msg void OnSetFocus(CWnd* pOldWnd); afx_msg void OnKillFocus(CWnd* pNewWnd); DECLARE_MESSAGE_MAP() }; ///////////////////////////////////////////////////////////////////////////// AFX_INLINE CRect CXTPCalendarCaptionBarControl::GetBorders() const { return m_Borders; } # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // !defined(__XTPCalendarCaptionBarControl_H__)