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.

81 lines
2.3 KiB

  1. //====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef GAMEFILETREEVIEW_H
  7. #define GAMEFILETREEVIEW_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tier1/utlstring.h"
  12. #include "vgui_controls/TreeView.h"
  13. #include "vgui_controls/ImageList.h"
  14. //-----------------------------------------------------------------------------
  15. // Forward declarations
  16. //-----------------------------------------------------------------------------
  17. namespace vgui
  18. {
  19. class IScheme;
  20. }
  21. //-----------------------------------------------------------------------------
  22. // Purpose: Handles file view for game files
  23. //-----------------------------------------------------------------------------
  24. class CGameFileTreeView : public vgui::TreeView
  25. {
  26. DECLARE_CLASS_SIMPLE( CGameFileTreeView, vgui::TreeView );
  27. public:
  28. CGameFileTreeView( vgui::Panel *parent, const char *name, const char *pRootFolderName, const char *pRootDir, const char *pExtension = NULL );
  29. // Inherited from base classes
  30. virtual void GenerateChildrenOfNode( int itemIndex );
  31. virtual void GenerateContextMenu( int itemIndex, int x, int y );
  32. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  33. // Purpose: Refreshes the active file list
  34. void RefreshFileList();
  35. // Sets an item to be colored as if its a menu
  36. void SetItemColorForDirectories( int itemID );
  37. // Gets the number of root directories
  38. int GetRootDirectoryCount();
  39. // Gets the ith root directory
  40. const char *GetRootDirectory( int nIndex );
  41. // Selects the root folder
  42. void SelectRoot();
  43. private:
  44. // Populate the root node (necessary since tree view can't have multiple roots)
  45. void PopulateRootNode( int itemIndex );
  46. // Populate the root node with directories
  47. void AddDirectoriesOfNode( int itemIndex, const char *pFilePath );
  48. // Populate the root node with directories
  49. bool DoesDirectoryHaveSubdirectories( const char *pFilePath );
  50. // Populate the root node with files
  51. void AddFilesOfNode( int itemIndex, const char *pFilePath, const char *pExt );
  52. CUtlString m_RootDir;
  53. CUtlString m_Ext;
  54. CUtlString m_RootFolderName;
  55. vgui::ImageList m_Images;
  56. bool m_bUseExt; // To differentiate "" from NULL in m_Ext
  57. };
  58. #endif // GAMEFILETREEVIEW_H