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.

124 lines
2.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef OBJECTBAR_H
  8. #define OBJECTBAR_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "AutoSelCombo.h"
  13. #include "HammerBar.h"
  14. #include "FilteredComboBox.h"
  15. class CMapView;
  16. class BoundBox;
  17. class CMapClass;
  18. class Vector;
  19. class CPrefab;
  20. #define MAX_PREV_SEL 12
  21. class CObjectBar : public CHammerBar, public CFilteredComboBox::ICallbacks
  22. {
  23. public:
  24. CObjectBar();
  25. BOOL Create(CWnd *pParentWnd);
  26. static LPCTSTR GetDefaultEntityClass(void);
  27. virtual BOOL PreTranslateMessage(MSG* pMsg);
  28. void UpdateListForTool(int iTool);
  29. void SetupForBlockTool();
  30. void DoHideControls();
  31. CMapClass *CreateInBox(BoundBox *pBox, CMapView *pView = NULL);
  32. BOOL GetPrefabBounds(BoundBox *pBox);
  33. // If this is on, then it'll randomize the yaw when entities are placed.
  34. bool UseRandomYawOnEntityPlacement();
  35. void DoDataExchange(CDataExchange *pDX);
  36. bool IsEntityToolCreatingPrefab( void );
  37. bool IsEntityToolCreatingEntity( void );
  38. CMapClass *BuildPrefabObjectAtPoint( Vector const &HitPos );
  39. // CFilteredComboBox::ICallbacks implementation.
  40. virtual void OnTextChanged( const char *pText );
  41. private:
  42. enum
  43. {
  44. listPrimitives,
  45. listPrefabs,
  46. listEntities
  47. } ListType;
  48. //{{AFX_DATA(CMapViewBar)
  49. enum { IDD = IDD_OBJECTBAR };
  50. //}}AFX_DATA
  51. CFilteredComboBox m_CreateList; // this should really be m_ItemList
  52. CComboBox m_CategoryList;
  53. CEdit m_Faces;
  54. CSpinButtonCtrl m_FacesSpin;
  55. CPrefab* FindPrefabByName( const char *pName );
  56. void LoadBlockCategories( void );
  57. void LoadEntityCategories( void );
  58. void LoadPrefabCategories( void );
  59. void LoadBlockItems( void );
  60. void LoadEntityItems( void );
  61. void LoadPrefabItems( void );
  62. int UpdatePreviousSelection( int iTool );
  63. int GetPrevSelIndex(DWORD dwGameID, int *piNewIndex = NULL);
  64. BOOL EnableFaceControl(CWnd *pWnd, BOOL bModifyWnd);
  65. int iEntitySel;
  66. int iBlockSel;
  67. // previous selections:
  68. DWORD m_dwPrevGameID;
  69. struct tagprevsel
  70. {
  71. DWORD dwGameID;
  72. struct tagblock
  73. {
  74. CString strItem;
  75. CString strCategory;
  76. } block;
  77. struct tagentity
  78. {
  79. CString strItem;
  80. CString strCategory;
  81. } entity;
  82. } m_PrevSel[MAX_PREV_SEL];
  83. int m_iLastTool;
  84. protected:
  85. afx_msg void UpdateControl(CCmdUI*);
  86. afx_msg void UpdateFaceControl(CCmdUI*);
  87. afx_msg void OnCategorylistSelchange();
  88. afx_msg void OnChangeCategory();
  89. DECLARE_MESSAGE_MAP()
  90. };
  91. #endif // OBJECTBAR_H