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.

75 lines
2.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef CIRCULARPROGRESSBAR_H
  8. #define CIRCULARPROGRESSBAR_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui/VGUI.h>
  13. #include <vgui_controls/Panel.h>
  14. #include <vgui_controls/ProgressBar.h>
  15. enum progress_textures_t
  16. {
  17. PROGRESS_TEXTURE_FG,
  18. PROGRESS_TEXTURE_BG,
  19. NUM_PROGRESS_TEXTURES,
  20. };
  21. namespace vgui
  22. {
  23. //-----------------------------------------------------------------------------
  24. // Purpose: Progress Bar in the shape of a pie graph
  25. //-----------------------------------------------------------------------------
  26. class CircularProgressBar : public ProgressBar
  27. {
  28. DECLARE_CLASS_SIMPLE( CircularProgressBar, ProgressBar );
  29. public:
  30. CircularProgressBar(Panel *parent, const char *panelName);
  31. ~CircularProgressBar();
  32. virtual void ApplySettings(KeyValues *inResourceData);
  33. virtual void ApplySchemeSettings(IScheme *pScheme);
  34. void SetFgImage(const char *imageName) { SetImage( imageName, PROGRESS_TEXTURE_FG ); }
  35. void SetBgImage(const char *imageName) { SetImage( imageName, PROGRESS_TEXTURE_BG ); }
  36. enum CircularProgressDir_e
  37. {
  38. PROGRESS_CW,
  39. PROGRESS_CCW
  40. };
  41. int GetProgressDirection() const { return m_iProgressDirection; }
  42. void SetProgressDirection( int val ) { m_iProgressDirection = val; }
  43. void SetStartSegment( int val ) { m_iStartSegment = val; }
  44. void SetReverseProgress( bool bReverse ) { m_bReverseProgress = bReverse; }
  45. protected:
  46. virtual void Paint();
  47. virtual void PaintBackground();
  48. void DrawCircleSegment( Color c, float flEndDegrees, bool clockwise /* = true */ );
  49. void SetImage(const char *imageName, progress_textures_t iPos);
  50. private:
  51. int m_iProgressDirection;
  52. int m_iStartSegment;
  53. bool m_bReverseProgress;
  54. int m_nTextureId[NUM_PROGRESS_TEXTURES];
  55. char *m_pszImageName[NUM_PROGRESS_TEXTURES];
  56. int m_lenImageName[NUM_PROGRESS_TEXTURES];
  57. };
  58. } // namespace vgui
  59. #endif // CIRCULARPROGRESSBAR_H