/**
* @file XTPDockingPaneCaptionButton.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(__XTPDOCKINGPANECAPTIONBUTTON_H__)
# define __XTPDOCKINGPANECAPTIONBUTTON_H__
/** @endcond */
# if _MSC_VER > 1000
# pragma once
# endif // _MSC_VER > 1000
# include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h"
/**
* @brief
* CXTPDockingPaneCaptionButton is a standalone internal class.
*/
class _XTP_EXT_CLASS CXTPDockingPaneCaptionButton
{
public:
/**
* @brief
* Constructs a CXTPDockingPaneCaptionButton object.
* @param nID ID of the caption button.
* @param pPane Pane that the caption button controls.
*/
CXTPDockingPaneCaptionButton(int nID, CXTPDockingPaneBase* pPane);
/**
* @brief
* Call this member to set the button's rectangle.
* @param rc Button's rectangle.
*/
void SetRect(CRect rc);
/**
* @brief
* Call this member to draw the pin button.
* @param pDC Pointer to the device context in which to draw.
* @param pt Center point.
* @param bPinned TRUE if the button is pinned.
* @param clr Button color. COLORREF_NULL by default. In this case,
* current text color is used.
* @return Draws pin button
*/
static void AFX_CDECL DrawPinButton(CDC* pDC, CPoint pt, BOOL bPinned,
COLORREF clr = COLORREF_NULL);
/**
* @brief
* Call this member to draw the pin button.
* @param pDC Pointer to the device context in which to draw.
* @param rc Button rectangle.
* @param bPinned TRUE if the button is pinned.
* @param clr Button color. COLORREF_NULL by default. In this case,
* current text color is used.
* @return Draws pin button
*/
static void AFX_CDECL DrawPinButton(CDC* pDC, CRect rc, BOOL bPinned,
COLORREF clr = COLORREF_NULL);
/** @cond */
_XTP_DEPRECATED_IN_FAVOR(DrawPinButton)
static void AFX_CDECL DrawPinnButton(CDC* pDC, CPoint pt, BOOL bPinned,
COLORREF clr = COLORREF_NULL)
{
DrawPinButton(pDC, pt, bPinned, clr);
}
_XTP_DEPRECATED_IN_FAVOR(DrawPinButton)
static void AFX_CDECL DrawPinnButton(CDC* pDC, CRect rc, BOOL bPinned,
COLORREF clr = COLORREF_NULL)
{
DrawPinButton(pDC, rc, bPinned, clr);
}
/** @endcond */
/**
* @brief
* Call this member to draw the Maximize/Restore button.
* @param pDC Pointer to the device context in which to draw.
* @param pt Center point.
* @param bMaximize TRUE to draw the Maximize button,
* FALSE to draw the Restore button.
* @param clr Button color. COLORREF_NULL by default. In this case,
* current text color is used.
* @return Draws the Maximize/Restore button
*/
static void AFX_CDECL DrawMaximizeRestoreButton(CDC* pDC, CPoint pt, BOOL bMaximize,
COLORREF clr = COLORREF_NULL);
/**
* @brief
* Call this member to draw the Maximize/Restore button.
* @param pDC Pointer to the device context in which to draw.
* @param rc Button rectangle.
* @param bMaximize TRUE to draw the Maximize button,
* FALSE to draw the Restore button.
* @param clr Button color. COLORREF_NULL by default. In this case,
* current text color is used.
* @return Draws the Maximize/Restore button
*/
static void AFX_CDECL DrawMaximizeRestoreButton(CDC* pDC, CRect rc, BOOL bMaximize,
COLORREF clr = COLORREF_NULL);
/**
* @brief
* Call this member to draw the Close button.
* @param pDC Pointer to the device context in which to draw.
* @param rc Button rectangle.
* @param clr Button color. COLORREF_NULL by default. In this case,
* current text color is used.
* @return Draws the Close button
*/
static void AFX_CDECL DrawCloseButton(CDC* pDC, CRect rc, COLORREF clr = COLORREF_NULL);
/**
* @brief
* Call this member to draw the Menu button.
* @param pDC Pointer to the device context in which to draw.
* @param rc Button rectangle.
* @param clr Button color. COLORREF_NULL by default. In this case,
* current text color is used.
* @return Draws the menu button
*/
static void AFX_CDECL DrawMenuButton(CDC* pDC, CRect rc, COLORREF clr = COLORREF_NULL);
/**
* @brief
* Call this method to click a button.
* @param pWnd Parent window of the button.
* @param pt Initial mouse position.
* @param bClient TRUE if pt belongs in the client area of the window.
* @return Draws the click button
*/
DWORD Click(CWnd* pWnd, CPoint pt, BOOL bClient = TRUE);
/**
* @brief
* Call this member to get the bounding rectangle.
* @return
* A CRect object.
*/
CRect GetRect() const;
/**
* @brief
* Call this member to determine the state of the pin caption button. This
* will tell you if the pin caption button is visible or if it is pushed.
* @return
* 1 if the the button is visible, 2 if it is pushed,
* or 3 if it is both visible and pushed.
* @see
* XTPDockingPanePinState
*/
DWORD GetState() const;
/**
* @brief
* Call this member to set the state for the pin caption button.
* @param dwState XTPDockingPanePinState for the pin caption button.
* @see
* XTPDockingPanePinState
*/
void SetState(DWORD dwState);
/**
* @brief
* Call this member to retrieve the button identifier.
* @return
* Button identifier. Standard values are:
* XTP_IDS_DOCKINGPANE_CLOSE: Close button.
* XTP_IDS_DOCKINGPANE_AUTOHIDE: Auto-hide button.
*/
int GetID() const;
/**
* @brief
* Call this member to retrieve the pane that the pin caption button controls.
* @return
* Pane that the pin caption button controls.
*/
CXTPDockingPaneBase* GetPane() const;
/**
* @brief
* Call this member to determine if a specified point belongs to the button.
* @param pt Point to test.
* @return
* TRUE if the point belongs to the button, otherwise FALSE.
*/
BOOL PtInRect(POINT pt) const;
/**
* @brief
* Call this member to refresh the styles of the button.
* @param pt Pointer to the mouse cursor.
* @return True if mouse over, false otherwise
*/
BOOL CheckForMouseOver(CPoint pt);
/**
* @brief
* Call this member to redraw the button.
*/
void InvalidateRect();
/**
* @brief
* Call this member to determine if the pin caption button is pressed.
* @return
* TRUE if the pin caption button is pressed, otherwise FALSE.
*/
BOOL IsPressed() const;
/**
* @brief
* Call this member to determine if the mouse is hovering over the
* pin caption button.
* @return
* TRUE if the mouse is hovering over the pin caption button,
* otherwise FALSE.
*/
BOOL IsSelected() const;
/**
* @brief
* Call this member to determine if the pin caption button is visible.
* @return
* TRUE if the pin caption button is visible, otherwise FALSE.
*/
BOOL IsVisible() const;
/**
* @brief
* Call this member to determine if the pin caption button is enabled.
* @return
* TRUE if the pin caption button is enabled, otherwise FALSE.
*/
BOOL IsEnabled() const;
protected:
CRect m_rcButton; /**< Bounding rectangle of the button. */
CXTPDockingPaneBase* m_pPane; /**< Parent pane. */
int m_nID; /**< Identifier of the button. */
BOOL m_bPressed; /**< TRUE if the button is pressed. */
BOOL m_bSelected; /**< TRUE if the mouse is hovering over the button. */
DWORD m_dwState; /**< XTPDockingPanePinState of the pin caption button. */
friend class CXTPDockingPaneTabbedContainer;
friend class CXTPDockingPaneMiniWnd;
private:
static COLORREF AFX_CDECL NormalizeButtonColor(CDC* pDC, COLORREF clr);
};
AFX_INLINE CRect CXTPDockingPaneCaptionButton::GetRect() const
{
return m_rcButton;
}
AFX_INLINE DWORD CXTPDockingPaneCaptionButton::GetState() const
{
return m_dwState;
}
AFX_INLINE void CXTPDockingPaneCaptionButton::SetState(DWORD dwState)
{
m_dwState = dwState;
}
AFX_INLINE int CXTPDockingPaneCaptionButton::GetID() const
{
return m_nID;
}
AFX_INLINE CXTPDockingPaneBase* CXTPDockingPaneCaptionButton::GetPane() const
{
return m_pPane;
}
AFX_INLINE BOOL CXTPDockingPaneCaptionButton::PtInRect(POINT pt) const
{
return m_rcButton.PtInRect(pt) != 0;
}
AFX_INLINE BOOL CXTPDockingPaneCaptionButton::IsPressed() const
{
return m_bPressed;
}
AFX_INLINE BOOL CXTPDockingPaneCaptionButton::IsSelected() const
{
return m_bSelected;
}
# include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h"
/** @cond */
#endif // !defined(__XTPDOCKINGPANECAPTIONBUTTON_H__)
/** @endcond */