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.

68 lines
1.9 KiB

  1. //====== Copyright � 1996-2003, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef CURVEEDITORPANEL_H
  7. #define CURVEEDITORPANEL_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "vgui_controls/Panel.h"
  12. //-----------------------------------------------------------------------------
  13. // Forward declarations
  14. //-----------------------------------------------------------------------------
  15. struct BGRA8888_t;
  16. //-----------------------------------------------------------------------------
  17. //
  18. // Curve editor image panel
  19. //
  20. //-----------------------------------------------------------------------------
  21. class CCurveEditorPanel : public vgui::Panel
  22. {
  23. DECLARE_CLASS_SIMPLE( CCurveEditorPanel, vgui::Panel );
  24. public:
  25. // constructor
  26. CCurveEditorPanel( vgui::Panel *pParent, const char *pName );
  27. ~CCurveEditorPanel();
  28. virtual void Paint( void );
  29. virtual void PaintBackground( void );
  30. virtual void OnCursorMoved( int x,int y );
  31. virtual void OnMousePressed( vgui::MouseCode code );
  32. virtual void OnMouseReleased( vgui::MouseCode code );
  33. virtual void OnKeyCodePressed( vgui::KeyCode code );
  34. protected:
  35. // Control points + values...
  36. virtual int FindOrAddControlPoint( float flIn, float flTolerance, float flOut ) = 0;
  37. virtual int FindControlPoint( float flIn, float flTolerance ) = 0;
  38. virtual int ModifyControlPoint( int nPoint, float flIn, float flOut ) = 0;
  39. virtual void RemoveControlPoint( int nPoint ) = 0;
  40. virtual float GetValue( float flIn ) = 0;
  41. virtual int ControlPointCount() = 0;
  42. virtual void GetControlPoint( int nPoint, float *pIn, float *pOut ) = 0;
  43. // Converts screen location to normalized values and back
  44. void ScreenToValue( int x, int y, float *pIn, float *pOut );
  45. void ValueToScreen( float flIn, float flOut, int *x, int *y );
  46. private:
  47. int m_nSelectedPoint;
  48. int m_nHighlightedPoint; // Used when not selecting
  49. };
  50. #endif // CURVEEDITORPANEL_H