Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.3 KiB

  1. //====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #include "toolutils/basepropertiescontainer.h"
  7. #include "tier1/KeyValues.h"
  8. CBasePropertiesContainer::CBasePropertiesContainer( vgui::Panel *parent, IDmNotify *pNotify, CDmeEditorTypeDictionary *pDict /*=NULL*/ )
  9. : BaseClass( parent, pNotify, NULL, true, pDict )
  10. {
  11. SetDropEnabled( true );
  12. }
  13. bool CBasePropertiesContainer::IsDroppable( CUtlVector< KeyValues * >& msglist )
  14. {
  15. if ( msglist.Count() != 1 )
  16. return false;
  17. KeyValues *data = msglist[ 0 ];
  18. CDmElement *ptr = reinterpret_cast< CDmElement * >( g_pDataModel->GetElement( DmElementHandle_t( data->GetInt( "dmeelement", DMELEMENT_HANDLE_INVALID ) ) ) );
  19. if ( !ptr )
  20. return false;
  21. if ( ptr == GetObject() )
  22. return false;
  23. return true;
  24. }
  25. void CBasePropertiesContainer::OnPanelDropped( CUtlVector< KeyValues * >& msglist )
  26. {
  27. if ( msglist.Count() != 1 )
  28. return;
  29. KeyValues *data = msglist[ 0 ];
  30. CDmElement *ptr = reinterpret_cast< CDmElement * >( g_pDataModel->GetElement( DmElementHandle_t( data->GetInt( "dmeelement", DMELEMENT_HANDLE_INVALID ) ) ) );
  31. if ( !ptr )
  32. return;
  33. // Already browsing
  34. if ( ptr == GetObject() )
  35. return;
  36. SetObject( ptr );
  37. }