PageRenderTime 32ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llui/llstatbar.h

https://bitbucket.org/lindenlab/viewer-beta/
C Header | 102 lines | 66 code | 11 blank | 25 comment | 0 complexity | b80fdf834f017aade7e550f8d395d4cf MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llstatbar.h
  3. * @brief A little map of the world with network information
  4. *
  5. * $LicenseInfo:firstyear=2001&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLSTATBAR_H
  27. #define LL_LLSTATBAR_H
  28. #include "llview.h"
  29. #include "llframetimer.h"
  30. class LLStat;
  31. class LLStatBar : public LLView
  32. {
  33. public:
  34. struct Params : public LLInitParam::Block<Params, LLView::Params>
  35. {
  36. Optional<std::string> label;
  37. Optional<std::string> unit_label;
  38. Optional<F32> bar_min;
  39. Optional<F32> bar_max;
  40. Optional<F32> tick_spacing;
  41. Optional<F32> label_spacing;
  42. Optional<U32> precision;
  43. Optional<F32> update_rate;
  44. Optional<bool> show_per_sec;
  45. Optional<bool> show_bar;
  46. Optional<bool> show_history;
  47. Optional<bool> show_mean;
  48. Optional<std::string> stat;
  49. Params()
  50. : label("label"),
  51. unit_label("unit_label"),
  52. bar_min("bar_min", 0.0f),
  53. bar_max("bar_max", 50.0f),
  54. tick_spacing("tick_spacing", 10.0f),
  55. label_spacing("label_spacing", 10.0f),
  56. precision("precision", 0),
  57. update_rate("update_rate", 5.0f),
  58. show_per_sec("show_per_sec", TRUE),
  59. show_bar("show_bar", TRUE),
  60. show_history("show_history", FALSE),
  61. show_mean("show_mean", TRUE),
  62. stat("stat")
  63. {
  64. changeDefault(follows.flags, FOLLOWS_TOP | FOLLOWS_LEFT);
  65. }
  66. };
  67. LLStatBar(const Params&);
  68. virtual void draw();
  69. virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
  70. void setStat(LLStat* stat) { mStatp = stat; }
  71. void setRange(F32 bar_min, F32 bar_max, F32 tick_spacing, F32 label_spacing);
  72. void getRange(F32& bar_min, F32& bar_max) { bar_min = mMinBar; bar_max = mMaxBar; }
  73. /*virtual*/ LLRect getRequiredRect(); // Return the height of this object, given the set options.
  74. private:
  75. F32 mMinBar;
  76. F32 mMaxBar;
  77. F32 mTickSpacing;
  78. F32 mLabelSpacing;
  79. U32 mPrecision;
  80. F32 mUpdatesPerSec;
  81. BOOL mPerSec; // Use the per sec stats.
  82. BOOL mDisplayBar; // Display the bar graph.
  83. BOOL mDisplayHistory;
  84. BOOL mDisplayMean; // If true, display mean, if false, display current value
  85. LLStat* mStatp;
  86. LLFrameTimer mUpdateTimer;
  87. LLUIString mLabel;
  88. std::string mUnitLabel;
  89. F32 mValue;
  90. };
  91. #endif