/** * @file XTPMarkupToggleButton.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(__XTPMARKUPTOGGLEBUTTON_H__) # define __XTPMARKUPTOGGLEBUTTON_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPMarkupDependencyProperty; class CXTPMarkupRoutedEvent; class CXTPMarkupObject; class CXTPMarkupBuilder; class CXTPMarkupRoutedEventArgs; /** * @brief * CXTPMarkupToggleButton is a CXTPMarkupButtonBase derived class. * It implements a base class for Radio and CheckBox buttons. */ class _XTP_EXT_CLASS CXTPMarkupToggleButton : public CXTPMarkupButtonBase { /** @cond */ DECLARE_MARKUPCLASS(CXTPMarkupToggleButton); /** @endcond */ public: /** * @brief * Call this method to set the checked state for a button. * @param bChecked TRUE to set the button to checked, FALSE otherwise. */ void SetChecked(BOOL bChecked); /** * @brief * Determines the checked state of a button. * @return * TRUE if the button is checked, otherwise FALSE. */ BOOL GetChecked() const; /** * @brief * Specifies if the button supports two or three states. * @param bThreeState TRUE to set the button to support three states * (Checked, Normal, and Indeterminate). */ void SetThreeState(BOOL bThreeState); /** * @brief * Determines if the button supports two or three states. * @return * TRUE if the button supports three states * (Checked, Normal, and Indeterminate). */ BOOL IsThreeState() const; protected: /** * @brief * Virtual method called when the user clicks the button. */ virtual void OnClick(); /** * @brief * Virtual method called when the state is toggled by the user. */ virtual void OnToggle(); /** * @brief * Virtual method called when the user sets the state to checked. * @param e Mouse pointer information. */ virtual void OnChecked(CXTPMarkupRoutedEventArgs* e); /** * @brief * Virtual method called when the user sets the state to unchecked. * @param e Mouse pointer information. */ virtual void OnUnchecked(CXTPMarkupRoutedEventArgs* e); /** * @brief * Virtual method called when the user sets the state to indeterminate. * @param e Mouse pointer information. */ virtual void OnIndeterminate(CXTPMarkupRoutedEventArgs* e); /** @cond */ // Implementation protected: static void AFX_CDECL OnIsCheckedChanged(CXTPMarkupObject* d, CXTPMarkupPropertyChangedEventArgs* e); static CXTPMarkupObject* AFX_CDECL ConvertIsChecked(CXTPMarkupBuilder* pBuilder, CXTPMarkupObject* pObject, CXTPMarkupDependencyProperty* pAssociatedProperty = NULL); public: static CXTPMarkupDependencyProperty* m_pIsThreeStateProperty; static CXTPMarkupDependencyProperty* m_pIsCheckedProperty; static CXTPMarkupRoutedEvent* m_pCheckedEvent; static CXTPMarkupRoutedEvent* m_pUncheckedEvent; static CXTPMarkupRoutedEvent* m_pIndeterminateEvent; /** @endcond */ /** @cond */ public: DECLARE_DISPATCH_MAP() # ifdef _XTP_ACTIVEX DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPMarkupToggleButton); # endif afx_msg long OleGetIsChecked(); afx_msg void OleSetIsChecked(long bValue); afx_msg BOOL OleGetIsThreeState(); afx_msg void OleSetIsThreeState(BOOL bValue); afx_msg LPDISPATCH OleGetCheckedEvent(); afx_msg LPDISPATCH OleGetIndeterminateEvent(); afx_msg LPDISPATCH OleGetUncheckedEvent(); /** @endcond */ }; # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPMARKUPTOGGLEBUTTON_H__) /** @endcond */