Team Fortress 2 Source Code as on 22/4/2020
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 Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef BASESAVEGAMEDIALOG_H
  7. #define BASESAVEGAMEDIALOG_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "vgui_controls/Frame.h"
  12. #include "vgui/MouseCode.h"
  13. #include "KeyValues.h"
  14. #include "utlvector.h"
  15. #define SAVEGAME_MAPNAME_LEN 32
  16. #define SAVEGAME_COMMENT_LEN 80
  17. #define SAVEGAME_ELAPSED_LEN 32
  18. namespace vgui
  19. {
  20. class Button;
  21. };
  22. struct SaveGameDescription_t
  23. {
  24. char szShortName[64];
  25. char szFileName[128];
  26. char szMapName[SAVEGAME_MAPNAME_LEN];
  27. char szComment[SAVEGAME_COMMENT_LEN];
  28. char szType[64];
  29. char szElapsedTime[SAVEGAME_ELAPSED_LEN];
  30. char szFileTime[32];
  31. unsigned int iTimestamp;
  32. unsigned int iSize;
  33. };
  34. int SaveReadNameAndComment( FileHandle_t f, OUT_Z_CAP(nameSize) char *name, int nameSize, OUT_Z_CAP(commentSize) char *comment, int commentSize );
  35. //-----------------------------------------------------------------------------
  36. // Purpose: Base class for save & load game dialogs
  37. //-----------------------------------------------------------------------------
  38. class CBaseSaveGameDialog : public vgui::Frame
  39. {
  40. DECLARE_CLASS_SIMPLE( CBaseSaveGameDialog, vgui::Frame );
  41. public:
  42. CBaseSaveGameDialog( vgui::Panel *parent, const char *name );
  43. static int __cdecl SaveGameSortFunc( const void *lhs, const void *rhs );
  44. protected:
  45. CUtlVector<SaveGameDescription_t> m_SaveGames;
  46. vgui::PanelListPanel *m_pGameList;
  47. virtual void OnScanningSaveGames() {}
  48. void DeleteSaveGame( const char *fileName );
  49. void ScanSavedGames();
  50. void CreateSavedGamesList();
  51. int GetSelectedItemSaveIndex();
  52. void AddSaveGameItemToList( int saveIndex );
  53. bool ParseSaveData( char const *pszFileName, char const *pszShortName, SaveGameDescription_t &save );
  54. void OnKeyCodeTyped( vgui::KeyCode code );
  55. void OnKeyCodePressed( vgui::KeyCode code );
  56. private:
  57. MESSAGE_FUNC( OnPanelSelected, "PanelSelected" );
  58. vgui::Button *m_pLoadButton;
  59. };
  60. #endif // BASESAVEGAMEDIALOG_H