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.

130 lines
2.8 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef ANGLEBOX_H
  7. #define ANGLEBOX_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "mathlib/vector.h"
  12. class CAngleCombo;
  13. class CAngleBox : public CWnd
  14. {
  15. public:
  16. CAngleBox();
  17. virtual ~CAngleBox();
  18. bool GetAngles(QAngle &vecAngles);
  19. char *GetAngles(char *szAngles);
  20. void SetAngles(const QAngle &vecAngles, bool bRedraw = true);
  21. void SetAngles(const char *szAngles, bool bRedraw = true);
  22. void SetDifferent(bool bDifferent, bool bRedraw = true);
  23. inline void SetEditControl(CAngleCombo *pEdit);
  24. char *GetAngleEditText(char *szBuf);
  25. void Enable(bool bEnable);
  26. void Show(bool bShow);
  27. // ClassWizard generated virtual function overrides
  28. //{{AFX_VIRTUAL(CAngleBox)
  29. public:
  30. //}}AFX_VIRTUAL
  31. protected:
  32. void UpdateAngleEditText(void);
  33. void UpdateLine(void);
  34. void DrawAngleLine(CDC *pDC);
  35. bool m_bDifferent; // Set to true when we have multiselected objects with different angles.
  36. CDC m_DragDC; // When dragging w/mouse.
  37. CPoint m_ptClientCenter;
  38. bool m_bDragging;
  39. QAngle m_vecAngles;
  40. CAngleCombo *m_pEdit; // The linked angle edit box, NULL if none.
  41. // Generated message map functions
  42. //{{AFX_MSG(CAngleBox)
  43. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  44. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  45. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  46. afx_msg void OnPaint();
  47. //}}AFX_MSG
  48. DECLARE_MESSAGE_MAP()
  49. private:
  50. friend class CAngleCombo;
  51. // Functions called by the angle combo to set our state without notification
  52. // back to the angle combo.
  53. void SetAnglesInternal(const QAngle &vecAngles, bool bRedraw = true);
  54. void SetDifferentInternal(bool bDifferent, bool bRedraw = true);
  55. };
  56. //-----------------------------------------------------------------------------
  57. // Purpose:
  58. //-----------------------------------------------------------------------------
  59. void CAngleBox::SetEditControl(CAngleCombo *pEdit)
  60. {
  61. m_pEdit = pEdit;
  62. }
  63. //-----------------------------------------------------------------------------
  64. // Purpose:
  65. //-----------------------------------------------------------------------------
  66. class CAngleCombo : public CComboBox
  67. {
  68. public:
  69. CAngleCombo();
  70. inline void SetAngleBox(CAngleBox *pBox);
  71. protected:
  72. void UpdateAngleBox(char *szText);
  73. // Generated message map functions
  74. //{{AFX_MSG(CAngleBox)
  75. afx_msg void OnChangeAngleEdit();
  76. afx_msg void OnSelChangeAngleEdit();
  77. //}}AFX_MSG
  78. DECLARE_MESSAGE_MAP()
  79. private:
  80. friend class CAngleBox;
  81. void SetAnglesInternal(const char *szAngles);
  82. CAngleBox *m_pBox; // The linked angle box control.
  83. bool m_bEnableUpdate; // Whether we forward update notifications to the linked angle box control.
  84. };
  85. void CAngleCombo::SetAngleBox(CAngleBox *pBox)
  86. {
  87. m_pBox = pBox;
  88. }
  89. #endif // ANGLEBOX_H