summaryrefslogtreecommitdiff
path: root/tools/toolutils/basepropertiescontainer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/toolutils/basepropertiescontainer.cpp')
-rw-r--r--tools/toolutils/basepropertiescontainer.cpp47
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