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.

89 lines
1.8 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef ITREEITEM_H
  7. #define ITREEITEM_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. class CWorkspace;
  12. class CProject;
  13. class CScene;
  14. class CVCDFile;
  15. class CSoundEntry;
  16. class CWaveFile;
  17. class mxTreeView;
  18. class ITreeItem
  19. {
  20. public:
  21. ITreeItem()
  22. {
  23. m_bExpanded = false;
  24. m_nOrdinal = -1;
  25. }
  26. virtual char const *GetName() const = 0;
  27. ITreeItem *GetParentItem();
  28. virtual CWorkspace *GetWorkspace() = 0;
  29. virtual CProject *GetProject() = 0;
  30. virtual CScene *GetScene() = 0;
  31. virtual CVCDFile *GetVCDFile() = 0;
  32. virtual CSoundEntry *GetSoundEntry() = 0;
  33. virtual CWaveFile *GetWaveFile() = 0;
  34. virtual int GetIconIndex() const = 0;
  35. bool IsExpanded() const
  36. {
  37. return m_bExpanded;
  38. }
  39. void SetExpanded( bool exp )
  40. {
  41. m_bExpanded = exp;
  42. }
  43. mxTreeViewItem *FindItem( mxTreeView *tree, mxTreeViewItem *parent, bool recurse = false );
  44. virtual void Checkout( bool updatestateicons = true ) = 0;
  45. virtual void Checkin( bool updatestateicons = true ) = 0;
  46. virtual void MoveChildUp( ITreeItem *child ) = 0;
  47. virtual void MoveChildDown( ITreeItem *child ) = 0;
  48. virtual bool IsFirstChild()
  49. {
  50. if ( !GetParentItem() )
  51. return false;
  52. return GetParentItem()->IsChildFirst( this );
  53. }
  54. virtual bool IsLastChild()
  55. {
  56. if ( !GetParentItem() )
  57. return false;
  58. return GetParentItem()->IsChildLast( this );
  59. }
  60. virtual bool IsChildFirst( ITreeItem *child ) = 0;
  61. virtual bool IsChildLast( ITreeItem *child ) = 0;
  62. void SetOrdinal( int ordinal ) { m_nOrdinal = ordinal; }
  63. int GetOrdinal( void ) const { return m_nOrdinal; }
  64. virtual void SetDirty( bool dirty ) = 0;
  65. private:
  66. bool m_bExpanded;
  67. int m_nOrdinal;
  68. };
  69. #endif // ITREEITEM_H