PageRenderTime 23ms CodeModel.GetById 16ms app.highlight 4ms RepoModel.GetById 1ms 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
  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
 27#ifndef LL_LLSTATBAR_H
 28#define LL_LLSTATBAR_H
 29
 30#include "llview.h"
 31#include "llframetimer.h"
 32
 33class LLStat;
 34
 35class LLStatBar : public LLView
 36{
 37public:
 38	struct Params : public LLInitParam::Block<Params, LLView::Params>
 39	{
 40		Optional<std::string> label;
 41		Optional<std::string> unit_label;
 42		Optional<F32> bar_min;
 43		Optional<F32> bar_max;
 44		Optional<F32> tick_spacing;
 45		Optional<F32> label_spacing;
 46		Optional<U32> precision;
 47		Optional<F32> update_rate;
 48		Optional<bool> show_per_sec;
 49		Optional<bool> show_bar;
 50		Optional<bool> show_history;
 51		Optional<bool> show_mean;
 52		Optional<std::string> stat;
 53		Params()
 54			: label("label"),
 55			  unit_label("unit_label"),
 56			  bar_min("bar_min", 0.0f),
 57			  bar_max("bar_max", 50.0f),
 58			  tick_spacing("tick_spacing", 10.0f),
 59			  label_spacing("label_spacing", 10.0f),
 60			  precision("precision", 0),
 61			  update_rate("update_rate", 5.0f),
 62			  show_per_sec("show_per_sec", TRUE),
 63			  show_bar("show_bar", TRUE),
 64			  show_history("show_history", FALSE),
 65			  show_mean("show_mean", TRUE),
 66			  stat("stat")
 67		{
 68			changeDefault(follows.flags, FOLLOWS_TOP | FOLLOWS_LEFT);
 69		}
 70	};
 71	LLStatBar(const Params&);
 72
 73	virtual void draw();
 74	virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
 75
 76	void setStat(LLStat* stat) { mStatp = stat; }
 77	void setRange(F32 bar_min, F32 bar_max, F32 tick_spacing, F32 label_spacing);
 78	void getRange(F32& bar_min, F32& bar_max) { bar_min = mMinBar; bar_max = mMaxBar; }
 79	
 80	/*virtual*/ LLRect getRequiredRect();	// Return the height of this object, given the set options.
 81
 82private:
 83	F32 mMinBar;
 84	F32 mMaxBar;
 85	F32 mTickSpacing;
 86	F32 mLabelSpacing;
 87	U32 mPrecision;
 88	F32 mUpdatesPerSec;
 89	BOOL mPerSec;				// Use the per sec stats.
 90	BOOL mDisplayBar;			// Display the bar graph.
 91	BOOL mDisplayHistory;
 92	BOOL mDisplayMean;			// If true, display mean, if false, display current value
 93
 94	LLStat* mStatp;
 95
 96	LLFrameTimer mUpdateTimer;
 97	LLUIString mLabel;
 98	std::string mUnitLabel;
 99	F32 mValue;
100};
101
102#endif