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.

72 lines
1.8 KiB

  1. //========= Copyright � 1996-2005, 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. protected:
  44. virtual void Paint();
  45. virtual void PaintBackground();
  46. void DrawCircleSegment( Color c, float flEndDegrees, bool clockwise /* = true */ );
  47. void SetImage(const char *imageName, progress_textures_t iPos);
  48. private:
  49. int m_iProgressDirection;
  50. int m_nTextureId[NUM_PROGRESS_TEXTURES];
  51. char *m_pszImageName[NUM_PROGRESS_TEXTURES];
  52. int m_lenImageName[NUM_PROGRESS_TEXTURES];
  53. };
  54. } // namespace vgui
  55. #endif // CIRCULARPROGRESSBAR_H