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.

181 lines
4.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef OBJECTPROPERTIES_H
  8. #define OBJECTPROPERTIES_H
  9. #pragma once
  10. #include "MapClass.h"
  11. #include "EditGameClass.h"
  12. #include "ObjectPage.h"
  13. #include "OP_Groups.h"
  14. #include "AnchorMgr.h"
  15. class COP_Entity;
  16. class COP_Flags;
  17. class COP_Output;
  18. class COP_Input;
  19. class COP_Model;
  20. enum LayoutType_t;
  21. //
  22. // Wrap map classes in CObject so we can use runtime identification
  23. // to pass edit data to the object pages.
  24. //
  25. class editCMapClass : public CObject, public CMapClass
  26. {
  27. DECLARE_DYNAMIC(editCMapClass)
  28. public:
  29. // kludge:
  30. MAPCLASSTYPE GetType() { return NULL; }
  31. BOOL IsMapClass(MAPCLASSTYPE Type) { return FALSE; }
  32. };
  33. class editCEditGameClass : public CObject, public CEditGameClass
  34. {
  35. DECLARE_DYNAMIC(editCEditGameClass)
  36. };
  37. class CObjectProperties : public CPropertySheet
  38. {
  39. DECLARE_DYNAMIC(CObjectProperties)
  40. public:
  41. CObjectProperties(void);
  42. virtual ~CObjectProperties(void);
  43. CObjectProperties(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
  44. CObjectProperties(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
  45. inline void UpdateGrouplist(void);
  46. PVOID GetEditObject(CRuntimeClass *pType);
  47. PVOID GetEditObjectFromMapObject(CMapClass *pobj, CRuntimeClass *pType);
  48. void CopyDataToEditObjects(CMapClass *pobj);
  49. void SetPageToOutput(CEntityConnection *pConnection);
  50. void SetPageToInput(CEntityConnection *pConnection);
  51. BOOL SetupPages(void);
  52. void CreatePages(void);
  53. void SaveData(void);
  54. void LoadDataForPages(int iPage = -1);
  55. void SetObjectList(const CMapObjectList *pObjectList);
  56. void MarkDataDirty();
  57. void SetOutputButtonState(int nState);
  58. void SetInputButtonState(int nState);
  59. // Overrides
  60. // ClassWizard generated virtual function overrides
  61. //{{AFX_VIRTUAL(CObjectProperties)
  62. virtual BOOL OnInitDialog();
  63. //}}AFX_VIRTUAL
  64. protected:
  65. void AddObjectExpandGroups(CMapClass *pObject);
  66. void ReloadData();
  67. LayoutType_t GetLayout(void);
  68. void GetTabsForLayout(LayoutType_t eLayoutType, bool &bEntity, bool &bGroups, bool &bFlags, bool &bModel);
  69. void CreateButtons(void);
  70. void UpdateOutputButton(void);
  71. void UpdateInputButton(void);
  72. void SaveActivePage(void);
  73. void RestoreActivePage(void);
  74. void UpdateAnchors( CWnd *pPage );
  75. CAnchorMgr m_AnchorMgr;
  76. //
  77. // Pages.
  78. //
  79. COP_Entity *m_pEntity;
  80. COP_Groups *m_pGroups;
  81. COP_Flags *m_pFlags;
  82. COP_Output *m_pOutput;
  83. COP_Input *m_pInput;
  84. COP_Model *m_pModel;
  85. //
  86. // instance button
  87. //
  88. CButton *m_pInstanceButton;
  89. //
  90. // Input/output connection buttons
  91. //
  92. CButton *m_pInputButton;
  93. CButton *m_pOutputButton;
  94. HICON m_hIconOutputGood;
  95. HICON m_hIconOutputBad;
  96. HICON m_hIconInputGood;
  97. HICON m_hIconInputBad;
  98. CPropertyPage *m_pDummy; //
  99. bool m_bDummy; //
  100. CMapObjectList m_DstObjects; // list of objects we work on
  101. const CMapObjectList *m_pOrgObjects; // list of input object we will work on
  102. CObjectPage **m_ppPages; // Pointers to the pages that are currently in use
  103. int m_nPages; // Number of pages currently in use
  104. CObjectPage *m_pLastActivePage; // Used for restoring the last active page when changing selection.
  105. bool m_bDataDirty; // true if selected object somehow changed etc
  106. bool m_bCanEdit; // true if the object can be edited
  107. //{{AFX_MSG(CObjectProperties)
  108. afx_msg void OnOK(void);
  109. afx_msg void OnApply(void);
  110. afx_msg void OnCancel(void);
  111. afx_msg void OnInputs(void);
  112. afx_msg void OnOutputs(void);
  113. afx_msg void OnEditInstance(void);
  114. afx_msg void OnClose();
  115. afx_msg void OnPaint();
  116. afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
  117. afx_msg void OnSize( UINT nType, int cx, int cy );
  118. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  119. //}}AFX_MSG
  120. DECLARE_MESSAGE_MAP()
  121. friend CObjectPage;
  122. };
  123. //-----------------------------------------------------------------------------
  124. // Purpose:
  125. //-----------------------------------------------------------------------------
  126. inline void CObjectProperties::UpdateGrouplist(void)
  127. {
  128. if (m_pGroups != NULL)
  129. {
  130. m_pGroups->UpdateGroupList();
  131. }
  132. }
  133. #endif // OBJECTPROPERTIES_H