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.

96 lines
2.9 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //===========================================================================//
  8. #ifndef COMMEDITDOC_H
  9. #define COMMEDITDOC_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include "dme_controls/inotifyui.h"
  14. #include "datamodel/dmehandle.h"
  15. #include "datamodel/dmelement.h"
  16. //-----------------------------------------------------------------------------
  17. // Forward declarations
  18. //-----------------------------------------------------------------------------
  19. class ICommEditDocCallback;
  20. class CCommEditDoc;
  21. class CDmeCommentaryNodeEntity;
  22. typedef CDmrElementArray<CDmeCommentaryNodeEntity> CDmrCommentaryNodeEntityList;
  23. //-----------------------------------------------------------------------------
  24. // Contains all editable state
  25. //-----------------------------------------------------------------------------
  26. class CCommEditDoc : public IDmNotify
  27. {
  28. public:
  29. CCommEditDoc( ICommEditDocCallback *pCallback );
  30. ~CCommEditDoc();
  31. // Inherited from INotifyUI
  32. virtual void NotifyDataChanged( const char *pReason, int nNotifySource, int nNotifyFlags );
  33. // Sets/Gets the file name
  34. const char *GetTXTFileName();
  35. void SetTXTFileName( const char *pFileName );
  36. // Dirty bits (has it changed since the last time it was saved?)
  37. void SetDirty( bool bDirty );
  38. bool IsDirty() const;
  39. // Saves/loads from file
  40. bool LoadFromFile( const char *pFileName );
  41. void SaveToFile( );
  42. // Returns the root object
  43. CDmElement *GetRootObject();
  44. // Called when data changes (see INotifyUI for flags)
  45. void OnDataChanged( const char *pReason, int nNotifySource, int nNotifyFlags );
  46. // Returns the entity list
  47. CDmAttribute *GetEntityList();
  48. // Adds a new info_target
  49. void AddNewInfoTarget( void );
  50. void AddNewInfoTarget( const Vector &vecOrigin, const QAngle &angAngles );
  51. // Adds a new commentary node
  52. void AddNewCommentaryNode( void );
  53. void AddNewCommentaryNode( const Vector &vecOrigin, const QAngle &angAngles );
  54. // Adds an info remarkable
  55. void AddNewInfoRemarkable( void );
  56. void AddNewInfoRemarkable( const Vector &vecOrigin, const QAngle &angAngles );
  57. // Deletes a commentary node
  58. void DeleteCommentaryNode( CDmElement *pNode );
  59. // Returns the commentary node at the specified location
  60. CDmeCommentaryNodeEntity *GetCommentaryNodeForLocation( Vector &vecOrigin, QAngle &angAbsAngles );
  61. // For element choice lists. Return false if it's an unknown choice list type
  62. virtual bool GetStringChoiceList( const char *pChoiceListType, CDmElement *pElement,
  63. const char *pAttributeName, bool bArrayElement, StringChoiceList_t &list );
  64. virtual bool GetElementChoiceList( const char *pChoiceListType, CDmElement *pElement,
  65. const char *pAttributeName, bool bArrayElement, ElementChoiceList_t &list );
  66. private:
  67. ICommEditDocCallback *m_pCallback;
  68. CDmeHandle< CDmElement > m_hRoot;
  69. char m_pTXTFileName[512];
  70. bool m_bDirty;
  71. };
  72. #endif // COMMEDITDOC_H