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.

91 lines
2.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef MXEXPRESSIONSLIDER_H
  8. #define MXEXPRESSIONSLIDER_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <mxtk/mxWindow.h>
  13. #include <mxtk/mxCheckBox.h>
  14. #define IDC_INFLUENCE 1000
  15. class mxExpressionSlider : public mxWindow
  16. {
  17. public:
  18. enum
  19. {
  20. MAGNITUDE_BAR = 0,
  21. BALANCE_BAR = 1,
  22. NUMBARS = 2
  23. };
  24. mxExpressionSlider (mxWindow *parent, int x, int y, int w, int h, int id );
  25. ~mxExpressionSlider( void );
  26. void SetTitleWidth( int width );
  27. void SetDrawTitle( bool drawTitle );
  28. void SetMode( bool paired );
  29. void setValue ( int barnum, float value);
  30. void setRange ( int barnum, float min, float max, int ticks = 100);
  31. void setInfluence ( float value );
  32. void setEdited( bool isEdited );
  33. // ACCESSORS
  34. float getRawValue( int barnum ) const;
  35. float getValue( int barnum ) const;
  36. float getMinValue( int barnum ) const;
  37. float getMaxValue( int barnum ) const;
  38. float getInfluence( ) const;
  39. void setEdited( int barnum, bool isEdited );
  40. bool isEdited( int barnum ) const;
  41. virtual void redraw();
  42. virtual bool PaintBackground( void );
  43. virtual int handleEvent (mxEvent *event);
  44. private:
  45. void BoundValue( void );
  46. void GetSliderRect( RECT& rc );
  47. void GetBarRect( RECT &rc );
  48. void GetThumbRect( int barnum, RECT &rc );
  49. void DrawBar( HDC& dc );
  50. void DrawThumb( int barnum, HDC& dc );
  51. void DrawTitle( HDC &dc );
  52. void MoveThumb( int barnum, int xpos, bool finish );
  53. int m_nTitleWidth;
  54. bool m_bDrawTitle;
  55. float m_flMin[ NUMBARS ], m_flMax[ NUMBARS ];
  56. int m_nTicks[ NUMBARS ];
  57. float m_flCurrent[ NUMBARS ]; // slider location (amount/balance)
  58. float m_flSetting[ NUMBARS ]; // paired flex input values (right/left)
  59. bool m_bIsEdited[ NUMBARS ]; // paired flex input values (right/left)
  60. bool m_bDraggingThumb;
  61. int m_nCurrentBar;
  62. bool m_bPaired;
  63. mxCheckBox *m_pInfluence;
  64. };
  65. #endif // MXEXPRESSIONSLIDER_H