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.

74 lines
2.2 KiB

  1. //====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #include "filesystem.h"
  7. #include "matsys_controls/vtfpicker.h"
  8. #include "matsys_controls/vtfpreviewpanel.h"
  9. #include "vgui_controls/Splitter.h"
  10. // NOTE: This has to be the last file included!
  11. #include "tier0/memdbgon.h"
  12. using namespace vgui;
  13. //-----------------------------------------------------------------------------
  14. //
  15. // Asset Picker with no preview
  16. //
  17. //-----------------------------------------------------------------------------
  18. //-----------------------------------------------------------------------------
  19. // Purpose: Constructor
  20. //-----------------------------------------------------------------------------
  21. CVTFPicker::CVTFPicker( vgui::Panel *pParent ) :
  22. BaseClass( pParent, "VTF Files", "vtf", "materials", "vtfName" )
  23. {
  24. // Horizontal splitter for preview
  25. m_pPreviewSplitter = new Splitter( this, "PreviewSplitter", SPLITTER_MODE_VERTICAL, 1 );
  26. vgui::Panel *pSplitterLeftSide = m_pPreviewSplitter->GetChild( 0 );
  27. vgui::Panel *pSplitterRightSide = m_pPreviewSplitter->GetChild( 1 );
  28. // VTF preview
  29. m_pVTFPreview = new CVTFPreviewPanel( pSplitterRightSide, "VTFPreview" );
  30. // Standard browser controls
  31. CreateStandardControls( pSplitterLeftSide );
  32. LoadControlSettingsAndUserConfig( "resource/vtfpicker.res" );
  33. }
  34. CVTFPicker::~CVTFPicker()
  35. {
  36. }
  37. //-----------------------------------------------------------------------------
  38. // Derived classes have this called when the previewed asset changes
  39. //-----------------------------------------------------------------------------
  40. void CVTFPicker::OnSelectedAssetPicked( const char *pAssetName )
  41. {
  42. m_pVTFPreview->SetVTF( pAssetName );
  43. }
  44. //-----------------------------------------------------------------------------
  45. //
  46. // Purpose: Modal picker frame
  47. //
  48. //-----------------------------------------------------------------------------
  49. CVTFPickerFrame::CVTFPickerFrame( vgui::Panel *pParent, const char *pTitle ) :
  50. BaseClass( pParent )
  51. {
  52. SetAssetPicker( new CVTFPicker( this ) );
  53. LoadControlSettingsAndUserConfig( "resource/vtfpickerframe.res" );
  54. SetTitle( pTitle, false );
  55. }