llstatbar.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /**
  2. * @file llstatbar.h
  3. * @brief A little map of the world with network information
  4. *
  5. * $LicenseInfo:firstyear=2001&license=viewergpl$
  6. *
  7. * Copyright (c) 2001-2009, Linden Research, Inc.
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  17. * There are special exceptions to the terms and conditions of the GPL as
  18. * it is applied to this Source Code. View the full text of the exception
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. #ifndef LL_LLSTATBAR_H
  33. #define LL_LLSTATBAR_H
  34. #include "llframetimer.h"
  35. #include "llview.h"
  36. class LLStat;
  37. class LLStatBar : public LLView
  38. {
  39. protected:
  40. LOG_CLASS(LLStatBar);
  41. private:
  42. enum STAT_MODE_FLAG
  43. {
  44. STAT_BAR_FLAG = 1,
  45. STAT_HISTORY_FLAG = 2
  46. };
  47. public:
  48. LLStatBar(const std::string& name, const LLRect& rect,
  49. const std::string& setting = std::string(),
  50. bool default_bar = false, bool default_history = false);
  51. void draw() override;
  52. bool handleMouseDown(S32 x, S32 y, MASK mask) override;
  53. const std::string& getLabel() const;
  54. void setLabel(const std::string& label);
  55. void setUnitLabel(const std::string& unit_label);
  56. // Returns the height of this object, given the set options:
  57. LLRect getRequiredRect() override;
  58. private:
  59. std::string mLabel;
  60. std::string mUnitLabel;
  61. std::string mSetting;
  62. LLFrameTimer mUpdateTimer;
  63. F32 mValue;
  64. public:
  65. LLStat* mStatp;
  66. F32 mUpdatesPerSec;
  67. F32 mMinBar;
  68. F32 mMaxBar;
  69. F32 mTickSpacing;
  70. F32 mLabelSpacing;
  71. U32 mPrecision;
  72. bool mPerSec; // Use the per sec stats.
  73. bool mDisplayBar; // Display the bar graph.
  74. bool mDisplayHistory;
  75. // Display mean if true, else display current value
  76. bool mDisplayMean;
  77. bool mNoResize; // When true, ignore handleMouseDown()
  78. };
  79. #endif