aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/llmultislider.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:34 -0500
committerJacek Antonelli2008-08-15 23:45:34 -0500
commitcd17687f01420952712a500107e0f93e7ab8d5f8 (patch)
treece48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/llui/llmultislider.h
parentSecond Life viewer sources 1.19.0.5 (diff)
downloadmeta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz
Second Life viewer sources 1.19.1.0
Diffstat (limited to '')
-rw-r--r--linden/indra/llui/llmultislider.h129
1 files changed, 129 insertions, 0 deletions
diff --git a/linden/indra/llui/llmultislider.h b/linden/indra/llui/llmultislider.h
new file mode 100644
index 0000000..7cd5061
--- /dev/null
+++ b/linden/indra/llui/llmultislider.h
@@ -0,0 +1,129 @@
1/**
2 * @file llmultislider.h
3 * @brief A simple multislider
4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 *
7 * Copyright (c) 2007-2008, 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 http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 *
22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above,
24 * and agree to abide by those obligations.
25 *
26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
30 */
31
32#ifndef LL_MULTI_SLIDER_H
33#define LL_MULTI_SLIDER_H
34
35#include "lluictrl.h"
36#include "v4color.h"
37
38class LLUICtrlFactory;
39
40class LLMultiSlider : public LLUICtrl
41{
42public:
43 LLMultiSlider(
44 const LLString& name,
45 const LLRect& rect,
46 void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata),
47 void* callback_userdata,
48 F32 initial_value,
49 F32 min_value,
50 F32 max_value,
51 F32 increment,
52 S32 max_sliders,
53 BOOL allow_overlap,
54 BOOL draw_track,
55 BOOL use_triangle,
56 const LLString& control_name = LLString::null );
57
58 virtual EWidgetType getWidgetType() const;
59 virtual LLString getWidgetTag() const;
60 virtual LLXMLNodePtr getXML(bool save_children = true) const;
61 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
62
63 void setSliderValue(const LLString& name, F32 value, BOOL from_event = FALSE);
64 F32 getSliderValue(const LLString& name) const;
65
66 const LLString& getCurSlider() const { return mCurSlider; }
67 F32 getCurSliderValue() const { return getSliderValue(mCurSlider); }
68 void setCurSlider(const LLString& name);
69 void setCurSliderValue(F32 val, BOOL from_event = false) { setSliderValue(mCurSlider, val, from_event); }
70
71 virtual void setValue(const LLSD& value);
72 virtual LLSD getValue() const { return mValue; }
73
74 virtual void setMinValue(LLSD min_value) { setMinValue((F32)min_value.asReal()); }
75 virtual void setMaxValue(LLSD max_value) { setMaxValue((F32)max_value.asReal()); }
76
77 F32 getInitialValue() const { return mInitialValue; }
78 F32 getMinValue() const { return mMinValue; }
79 F32 getMaxValue() const { return mMaxValue; }
80 F32 getIncrement() const { return mIncrement; }
81 void setMinValue(F32 min_value) { mMinValue = min_value; }
82 void setMaxValue(F32 max_value) { mMaxValue = max_value; }
83 void setIncrement(F32 increment) { mIncrement = increment; }
84 void setMouseDownCallback( void (*cb)(LLUICtrl* ctrl, void* userdata) ) { mMouseDownCallback = cb; }
85 void setMouseUpCallback( void (*cb)(LLUICtrl* ctrl, void* userdata) ) { mMouseUpCallback = cb; }
86
87 bool findUnusedValue(F32& initVal);
88 const LLString& addSlider();
89 const LLString& addSlider(F32 val);
90 void deleteSlider(const LLString& name);
91 void deleteCurSlider() { deleteSlider(mCurSlider); }
92 void clear();
93
94 virtual BOOL handleHover(S32 x, S32 y, MASK mask);
95 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
96 virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
97 virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
98 virtual void draw();
99
100protected:
101 LLSD mValue;
102 F32 mInitialValue;
103 F32 mMinValue;
104 F32 mMaxValue;
105 F32 mIncrement;
106 LLString mCurSlider;
107 static S32 mNameCounter;
108
109 S32 mMaxNumSliders;
110 BOOL mAllowOverlap;
111 BOOL mDrawTrack;
112 BOOL mUseTriangle; /// hacked in toggle to use a triangle
113
114 S32 mMouseOffset;
115 LLRect mDragStartThumbRect;
116
117 std::map<LLString, LLRect> mThumbRects;
118 LLColor4 mTrackColor;
119 LLColor4 mThumbOutlineColor;
120 LLColor4 mThumbCenterColor;
121 LLColor4 mThumbCenterSelectedColor;
122 LLColor4 mDisabledThumbColor;
123 LLColor4 mTriangleColor;
124
125 void (*mMouseDownCallback)(LLUICtrl* ctrl, void* userdata);
126 void (*mMouseUpCallback)(LLUICtrl* ctrl, void* userdata);
127};
128
129#endif // LL_LLSLIDER_H