aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/llslider.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llui/llslider.h100
1 files changed, 100 insertions, 0 deletions
diff --git a/linden/indra/llui/llslider.h b/linden/indra/llui/llslider.h
new file mode 100644
index 0000000..1cf1a90
--- /dev/null
+++ b/linden/indra/llui/llslider.h
@@ -0,0 +1,100 @@
1/**
2 * @file llslider.h
3 * @brief A simple slider with no label.
4 *
5 * Copyright (c) 2002-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28#ifndef LL_LLSLIDER_H
29#define LL_LLSLIDER_H
30
31#include "lluictrl.h"
32#include "v4color.h"
33
34class LLUICtrlFactory;
35
36class LLSlider : public LLUICtrl
37{
38public:
39 LLSlider(
40 const LLString& name,
41 const LLRect& rect,
42 void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata),
43 void* callback_userdata,
44 F32 initial_value,
45 F32 min_value,
46 F32 max_value,
47 F32 increment,
48 const LLString& control_name = LLString::null );
49
50 virtual EWidgetType getWidgetType() const;
51 virtual LLString getWidgetTag() const;
52 virtual LLXMLNodePtr getXML(bool save_children = true) const;
53 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
54
55 void setValue( F32 value, BOOL from_event = FALSE );
56 F32 getValueF32() const;
57
58 virtual void setValue(const LLSD& value ) { setValue((F32)value.asReal(), TRUE); }
59 virtual LLSD getValue() const { return LLSD(getValueF32()); }
60
61 virtual void setMinValue(LLSD min_value) { setMinValue((F32)min_value.asReal()); }
62 virtual void setMaxValue(LLSD max_value) { setMaxValue((F32)max_value.asReal()); }
63
64 F32 getInitialValue() const { return mInitialValue; }
65 F32 getMinValue() const { return mMinValue; }
66 F32 getMaxValue() const { return mMaxValue; }
67 F32 getIncrement() const { return mIncrement; }
68 void setMinValue(F32 min_value) {mMinValue = min_value;}
69 void setMaxValue(F32 max_value) {mMaxValue = max_value;}
70 void setIncrement(F32 increment) {mIncrement = increment;}
71 void setMouseDownCallback( void (*cb)(LLUICtrl* ctrl, void* userdata) ) { mMouseDownCallback = cb; }
72 void setMouseUpCallback( void (*cb)(LLUICtrl* ctrl, void* userdata) ) { mMouseUpCallback = cb; }
73
74 virtual BOOL handleHover(S32 x, S32 y, MASK mask);
75 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
76 virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
77 virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
78 virtual void draw();
79
80protected:
81 F32 mValue;
82 F32 mInitialValue;
83 F32 mMinValue;
84 F32 mMaxValue;
85 F32 mIncrement;
86
87 S32 mMouseOffset;
88 LLRect mDragStartThumbRect;
89
90 LLRect mThumbRect;
91 LLColor4 mTrackColor;
92 LLColor4 mThumbOutlineColor;
93 LLColor4 mThumbCenterColor;
94 LLColor4 mDisabledThumbColor;
95
96 void (*mMouseDownCallback)(LLUICtrl* ctrl, void* userdata);
97 void (*mMouseUpCallback)(LLUICtrl* ctrl, void* userdata);
98};
99
100#endif // LL_LLSLIDER_H