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.

189 lines
4.4 KiB

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