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 /tools/toolutils/basepropertiescontainer.cpp | |
| download | archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.tar.xz archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.zip | |
Diffstat (limited to 'tools/toolutils/basepropertiescontainer.cpp')
| -rw-r--r-- | tools/toolutils/basepropertiescontainer.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tools/toolutils/basepropertiescontainer.cpp b/tools/toolutils/basepropertiescontainer.cpp new file mode 100644 index 0000000..50891a9 --- /dev/null +++ b/tools/toolutils/basepropertiescontainer.cpp @@ -0,0 +1,47 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//============================================================================= + +#include "toolutils/basepropertiescontainer.h" +#include "tier1/KeyValues.h" + +CBasePropertiesContainer::CBasePropertiesContainer( vgui::Panel *parent, IDmNotify *pNotify, CDmeEditorTypeDictionary *pDict /*=NULL*/ ) + : BaseClass( parent, pNotify, NULL, true, pDict ) +{ + SetDropEnabled( true ); +} + +bool CBasePropertiesContainer::IsDroppable( CUtlVector< KeyValues * >& msglist ) +{ + if ( msglist.Count() != 1 ) + return false; + + KeyValues *data = msglist[ 0 ]; + CDmElement *ptr = reinterpret_cast< CDmElement * >( g_pDataModel->GetElement( DmElementHandle_t( data->GetInt( "dmeelement", DMELEMENT_HANDLE_INVALID ) ) ) ); + if ( !ptr ) + return false; + + if ( ptr == GetObject() ) + return false; + + return true; +} + +void CBasePropertiesContainer::OnPanelDropped( CUtlVector< KeyValues * >& msglist ) +{ + if ( msglist.Count() != 1 ) + return; + + KeyValues *data = msglist[ 0 ]; + CDmElement *ptr = reinterpret_cast< CDmElement * >( g_pDataModel->GetElement( DmElementHandle_t( data->GetInt( "dmeelement", DMELEMENT_HANDLE_INVALID ) ) ) ); + if ( !ptr ) + return; + + // Already browsing + if ( ptr == GetObject() ) + return; + + SetObject( ptr ); +}
\ No newline at end of file |