/** * @file XTPGaugeStateType.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(__XTPGAUGESTATETYPE_H__) # define __XTPGAUGESTATETYPE_H__ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" /** * @brief * Implements a State gauge type. This kind of gauges is supposed to reflect a limited and * strictly defined set of states. A simple example of it can be an ON/OFF light or a power * switch. Gauges of this type must have an initial state value set to a valid value. State can * be updated from both a user code and by the gauge itself in reaction to a certain user * input or time events. * * @see CXTPGaugeBaseType * @see CXTPGaugeMeterType * @see CXTPGaugeCtrl */ class _XTP_EXT_CLASS CXTPGaugeStateType : public CXTPGaugeBaseType { DECLARE_DYNCREATE(CXTPGaugeStateType); private: CXTPGaugeStateType(); public: /** * @brief * Handles gauge type object destruction. */ ~CXTPGaugeStateType(); /** * @brief * Obtains implementation specified type name. * * @returns Type name string point. */ virtual LPCWSTR GetTypeName() const; /** * @brief * Gets the current state value. * * @details * The meaning and the limits of state value are defined by the actual State gauge * JavaScript implementation. It's the caller's responsibility to ensure that a new state * value passed can be accepted and handled by the currently loaded gauge. * * @returns The current state value. */ UINT GetState() const; /** * @brief * Sets the current state value. * * @details * The meaning and the limits of state value are defined by the actual State gauge * JavaScript implementation. It's the caller's responsibility to ensure that a new state * value passed can be accepted and handled by the currently loaded gauge. * * @param nState A new state value to be set. * @returns TRUE if the new state value is different from the previous one and the * actual state change is taking place. */ BOOL SetState(UINT nState); /** * @brief * Obtains the supported number of states that is the number of elements of the 'states' array * specified in traits. * @returns * The supported number of states. */ UINT GetStateCount() const; protected: /** @cond */ virtual void OnUpdate(); /** @endcond */ private: mutable UINT* m_pState; mutable UINT m_nStateCount; BOOL m_bInSetState; }; # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // !defined(__XTPGAUGESTATETYPE_H__)