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.

96 lines
2.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef TOOLMANAGER_H
  7. #define TOOLMANAGER_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "ToolInterface.h"
  12. #include "utlvector.h"
  13. class CToolAxisHandle;
  14. class CToolDecal;
  15. class CToolDisplace;
  16. class CToolMagnify;
  17. class CToolMaterial;
  18. class CToolPickAngles;
  19. class CToolPickEntity;
  20. class CToolPickFace;
  21. class CToolPointHandle;
  22. class CToolSphere;
  23. class CBaseTool;
  24. class CToolSweptPlayerHull;
  25. class CChunkHandlerMap;
  26. class CToolManager
  27. {
  28. public:
  29. CToolManager();
  30. ~CToolManager();
  31. bool Init(CMapDoc *pDocument);
  32. void Shutdown();
  33. CBaseTool *GetActiveTool();
  34. ToolID_t GetActiveToolID();
  35. CBaseTool *GetToolForID(ToolID_t eToolID);
  36. void SetTool(ToolID_t nToolID); // changes current tool without touching the tool stack
  37. void PushTool(ToolID_t nToolID); // activates a new tool and put current tool on stack
  38. void PopTool(); // restores last tool on stack
  39. inline int GetToolCount();
  40. inline CBaseTool *GetTool(int nIndex);
  41. void RemoveAllTools();
  42. void AddTool(CBaseTool *pTool);
  43. static ChunkFileResult_t LoadCallback(CChunkFile *pFile, CBaseTool *pTool);
  44. void AddToolHandlers( CChunkHandlerMap *pHandlersMap );
  45. ChunkFileResult_t SaveVMF(CChunkFile *pFile, CSaveInfo *pSaveInfo);
  46. ChunkFileResult_t LoadVMF(CChunkFile *pFile);
  47. private:
  48. void ActivateTool( CBaseTool *pTool );
  49. void DeactivateTool( CBaseTool *pTool );
  50. CUtlVector<CBaseTool *> m_Tools; // List of ALL the tools.
  51. CMapDoc *m_pDocument; // document the manager is responisble for
  52. CBaseTool *m_pActiveTool; // Pointer to the active new tool, NULL if none.
  53. CUtlVector<ToolID_t> m_ToolIDStack; // Stack of active tool IDs, for PushTool/PopTool.
  54. };
  55. //-----------------------------------------------------------------------------
  56. // Purpose: Accessor for iterating tools.
  57. //-----------------------------------------------------------------------------
  58. int CToolManager::GetToolCount()
  59. {
  60. return m_Tools.Count();
  61. }
  62. //-----------------------------------------------------------------------------
  63. // Purpose: Accessor for iterating tools.
  64. //-----------------------------------------------------------------------------
  65. CBaseTool *CToolManager::GetTool(int nIndex)
  66. {
  67. return m_Tools.Element(nIndex);
  68. }
  69. // get the tool manager for the current active document:
  70. CToolManager *ToolManager();
  71. #endif // TOOLMANAGER_H