diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /public/panorama/controls/panelhandle.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'public/panorama/controls/panelhandle.h')
| -rw-r--r-- | public/panorama/controls/panelhandle.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/public/panorama/controls/panelhandle.h b/public/panorama/controls/panelhandle.h new file mode 100644 index 0000000..bbd868b --- /dev/null +++ b/public/panorama/controls/panelhandle.h @@ -0,0 +1,56 @@ +//=========== Copyright Valve Corporation, All rights reserved. ===============// +// +// Purpose: +//=============================================================================// + +#ifndef PANELHANDLE_H +#define PANELHANDLE_H + +#ifdef _WIN32 +#pragma once +#endif + +#include "tier0/platform.h" + +namespace panorama +{ + +const uint64 k_ulInvalidPanelHandle64 = 0x00000000FFFFFFFF; + +// +// Safe handle to a panel. To get pointer to actual panel, call IUIEngine::GetPanelPtr +// +struct PanelHandle_t +{ + int32 m_iPanelIndex; // index into panel map + uint32 m_unSerialNumber; // unique number used to ensure that panel at m_iPanelIndex is still the panel we originally pointed to + + bool operator<( const PanelHandle_t &rhs ) const + { + if ( m_iPanelIndex != rhs.m_iPanelIndex ) + return m_iPanelIndex < rhs.m_iPanelIndex; + + return m_unSerialNumber < rhs.m_unSerialNumber; + } + + bool operator==( const PanelHandle_t &rhs ) const + { + return (m_iPanelIndex == rhs.m_iPanelIndex) && (m_unSerialNumber == rhs.m_unSerialNumber); + } + + bool operator!=( const PanelHandle_t &rhs ) const + { + return !(*this == rhs); + } + + + static const PanelHandle_t &InvalidHandle() + { + static PanelHandle_t s_invalid = { k_ulInvalidPanelHandle64 >> 32, 0xffffffff & k_ulInvalidPanelHandle64 }; + return s_invalid; + } +}; + +} // namespace panorama + +#endif // PANELHANDLE_H |