PageRenderTime 41ms CodeModel.GetById 33ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llui/llf32uictrl.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 77 lines | 39 code | 11 blank | 27 comment | 0 complexity | 3257da06d8a8efcdaf6ead3b09946a64 MD5 | raw file
 1/**
 2 * @file   llf32uictrl.h
 3 * @author Nat Goodspeed
 4 * @date   2008-09-08
 5 * @brief  Base class for float-valued LLUICtrl widgets
 6 * 
 7 * $LicenseInfo:firstyear=2008&license=viewerlgpl$
 8 * Second Life Viewer Source Code
 9 * Copyright (C) 2010, Linden Research, Inc.
10 * 
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation;
14 * version 2.1 of the License only.
15 * 
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 * Lesser General Public License for more details.
20 * 
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
24 * 
25 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
26 * $/LicenseInfo$
27 */
28
29#if ! defined(LL_LLF32UICTRL_H)
30#define LL_LLF32UICTRL_H
31
32#include "lluictrl.h"
33
34class LLF32UICtrl: public LLUICtrl
35{
36public:
37    struct Params: public LLInitParam::Block<Params, LLUICtrl::Params>
38    {
39		Optional<F32>	min_value,
40						max_value,
41						increment;
42
43		Params()
44		:	min_value("min_val", 0.f),
45			max_value("max_val", 1.f),
46			increment("increment", 0.1f)
47        {}			
48    };
49
50protected:
51    LLF32UICtrl(const Params& p);
52
53public:
54	virtual F32		getValueF32() const;
55
56	virtual void	setValue(const LLSD& value ) { mViewModel->setValue(value); }
57	virtual LLSD	getValue() const		{ return LLSD(getValueF32()); }
58
59	virtual void	setMinValue(const LLSD& min_value)	{ setMinValue((F32)min_value.asReal()); }
60	virtual void	setMaxValue(const LLSD& max_value)	{ setMaxValue((F32)max_value.asReal()); }
61
62	virtual F32		getInitialValue() const { return mInitialValue; }
63	virtual F32		getMinValue() const		{ return mMinValue; }
64	virtual F32		getMaxValue() const		{ return mMaxValue; }
65	virtual F32		getIncrement() const	{ return mIncrement; }
66	virtual void	setMinValue(F32 min_value) { mMinValue = min_value; }
67	virtual void	setMaxValue(F32 max_value) { mMaxValue = max_value; }
68	virtual void	setIncrement(F32 increment) { mIncrement = increment;}
69
70protected:
71	F32				mInitialValue;
72	F32				mMinValue;
73	F32				mMaxValue;
74	F32				mIncrement;
75};
76
77#endif /* ! defined(LL_LLF32UICTRL_H) */