/** * @file XTPTabCtrlButtons.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(__XTPTABCTRLBUTTONS_H_) # define __XTPTABCTRLBUTTONS_H_ /** @endcond */ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPTabCtrlButtons; class CXTPTabBase; # define XTP_IDC_TAB_CLOSE 106 /** * @brief * CXTPTabCtrlButton is a standalone structure class. It is used internally * in the CXTPTabCtrlButtons class. */ class _XTP_EXT_CLASS CXTPTabCtrlButton { public: CXTPTabCtrlButton(DWORD wStyle); void Draw(CDC* pDC, COLORREF clrButton); DWORD Click(CXTPTabCtrlButtons* pWnd, CPoint pt, BOOL bRepeat = FALSE); void SetRect(CRect rc); CRect GetRect(); BOOL PtInRect(POINT pt) const; void CheckForMouseOver(CWnd* pWnd, CPoint pt); void SetEnable(BOOL bEnable); CRect m_Rect; DWORD m_wStyle; CTabCtrl* m_pTabCtrl; CXTPTabCtrlButtons* m_pButtons; }; ////////////////////////////////////////////////////////////////////// /** @cond */ AFX_INLINE CXTPTabCtrlButton::CXTPTabCtrlButton(DWORD wStyle) { m_wStyle = wStyle; m_pButtons = 0; m_pTabCtrl = 0; m_Rect.SetRectEmpty(); } AFX_INLINE void CXTPTabCtrlButton::SetRect(CRect rc) { m_Rect = rc; } AFX_INLINE CRect CXTPTabCtrlButton::GetRect() { return m_Rect; } AFX_INLINE BOOL CXTPTabCtrlButton::PtInRect(POINT pt) const { return m_Rect.PtInRect(pt) != 0; } /** @endcond */ /** * @brief * CXTPTabCtrlButtons is a CWnd derived class. It is used internally * in the CXTPTabBase class. */ class _XTP_EXT_CLASS CXTPTabCtrlButtons : public CWnd { public: CXTPTabCtrlButtons(); ~CXTPTabCtrlButtons(); BOOL Create(CXTPTabBase* pCtrlBase); int GetWidth(); void ShowButtons(BOOL bShow); BOOL ShowButtons(); void Refresh(); void SubclassTabButtons(CWnd* pWnd); void SetButtonStyle(DWORD dwFlags); void UnSubclassTabButtons(); CTabCtrl* GetTabCtrl() const; private: CRect AdjustRect(); private: CXTPTabCtrlButton m_btnClose; CXTPTabCtrlButton m_btnLeft; CXTPTabCtrlButton m_btnRight; DWORD m_dwFlags; CTabCtrl* m_pTabCtrl; CXTPTabBase* m_pTabCtrlBase; BOOL m_bShow; HWND m_hwndSubclassed; HWND m_hwndPrimary; private: afx_msg void OnPaint(); afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnMouseLeave(); afx_msg void OnWindowPosChanged(WINDOWPOS* lpwndpos); BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL); DECLARE_MESSAGE_MAP() friend class CXTPTabBase; friend class CXTPTabCtrlButton; }; /** @cond */ AFX_INLINE CTabCtrl* CXTPTabCtrlButtons::GetTabCtrl() const { return m_pTabCtrl; } AFX_INLINE BOOL CXTPTabCtrlButtons::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); } /** @endcond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // #if !defined(__XTPTABCTRLBUTTONS_H_) /** @endcond */