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.0 KiB

  1. //====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======
  2. //
  3. // Class that contains a list of recent files
  4. //
  5. //=============================================================================
  6. #ifndef RECENTFILELIST_H
  7. #define RECENTFILELIST_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tier1/utlvector.h"
  12. #include "tier1/utlstring.h"
  13. //-----------------------------------------------------------------------------
  14. // Forward declarations
  15. //-----------------------------------------------------------------------------
  16. namespace vgui
  17. {
  18. class Menu;
  19. class Panel;
  20. }
  21. //-----------------------------------------------------------------------------
  22. // Max # of recent files
  23. //-----------------------------------------------------------------------------
  24. #define MAX_RECENT_FILES 20
  25. //-----------------------------------------------------------------------------
  26. // Class that contains a list of recent files
  27. //-----------------------------------------------------------------------------
  28. class CToolsRecentFileList
  29. {
  30. public:
  31. // Adds a file to the list
  32. void Add( const char *pFileName, const char *pFileFormat );
  33. // Gets the file in a particular slot
  34. const char *GetFile( int slot ) const;
  35. const char *GetFileFormat( int slot ) const;
  36. // Removes all files from the list
  37. void Clear();
  38. // Load, store to registry
  39. void LoadFromRegistry( const char *pToolKeyName );
  40. void SaveToRegistry( const char *pToolKeyName ) const;
  41. // Adds all files in a list to a menu.
  42. // Will generate the commands '<pCommandName>01', '<pCommandName>02', etc.
  43. // depending on which one is selected
  44. void AddToMenu( vgui::Menu *menu, vgui::Panel *actionTarget, const char *pCommandName ) const;
  45. // Returns true if there's no files in the file list
  46. bool IsEmpty() const;
  47. private:
  48. struct RecentFileInfo_t
  49. {
  50. CUtlString m_pFileName;
  51. CUtlString m_pFileFormat;
  52. bool operator==( const RecentFileInfo_t& src ) const
  53. {
  54. return m_pFileName == src.m_pFileName;
  55. }
  56. };
  57. CUtlVector< RecentFileInfo_t > m_RecentFiles;
  58. };
  59. #endif // RECENTFILELIST_H