aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/llmultisliderctrl.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/llmultisliderctrl.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 'linden/indra/llui/llmultisliderctrl.h')
-rw-r--r--linden/indra/llui/llmultisliderctrl.h160
1 files changed, 160 insertions, 0 deletions
diff --git a/linden/indra/llui/llmultisliderctrl.h b/linden/indra/llui/llmultisliderctrl.h
new file mode 100644
index 0000000..90f43df
--- /dev/null
+++ b/linden/indra/llui/llmultisliderctrl.h
@@ -0,0 +1,160 @@
1/**
2 * @file llmultisliderctrl.h
3 * @brief LLMultiSliderCtrl base class
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_SLIDERCTRL_H
33#define LL_MULTI_SLIDERCTRL_H
34
35#include "lluictrl.h"
36#include "v4color.h"
37#include "llmultislider.h"
38#include "lltextbox.h"
39#include "llrect.h"
40
41//
42// Constants
43//
44const S32 MULTI_SLIDERCTRL_SPACING = 4; // space between label, slider, and text
45const S32 MULTI_SLIDERCTRL_HEIGHT = 16;
46
47//
48// Classes
49//
50class LLFontGL;
51class LLLineEditor;
52class LLSlider;
53
54
55class LLMultiSliderCtrl : public LLUICtrl
56{
57public:
58 LLMultiSliderCtrl(const LLString& name,
59 const LLRect& rect,
60 const LLString& label,
61 const LLFontGL* font,
62 S32 slider_left,
63 S32 text_left,
64 BOOL show_text,
65 BOOL can_edit_text,
66 void (*commit_callback)(LLUICtrl*, void*),
67 void* callback_userdata,
68 F32 initial_value, F32 min_value, F32 max_value, F32 increment,
69 S32 max_sliders, BOOL allow_overlap, BOOL draw_track,
70 BOOL use_triangle,
71 const LLString& control_which = LLString::null );
72
73 virtual ~LLMultiSliderCtrl();
74 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MULTI_SLIDER; }
75 virtual LLString getWidgetTag() const { return LL_MULTI_SLIDER_CTRL_TAG; }
76 virtual LLXMLNodePtr getXML(bool save_children = true) const;
77 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
78
79 F32 getSliderValue(const LLString& name) const;
80 void setSliderValue(const LLString& name, F32 v, BOOL from_event = FALSE);
81
82 virtual void setValue(const LLSD& value );
83 virtual LLSD getValue() const { return mMultiSlider->getValue(); }
84 virtual BOOL setLabelArg( const LLString& key, const LLString& text );
85
86 const LLString& getCurSlider() const { return mMultiSlider->getCurSlider(); }
87 F32 getCurSliderValue() const { return mCurValue; }
88 void setCurSlider(const LLString& name);
89 void setCurSliderValue(F32 val, BOOL from_event = false) { setSliderValue(mMultiSlider->getCurSlider(), val, from_event); }
90
91 virtual void setMinValue(LLSD min_value) { setMinValue((F32)min_value.asReal()); }
92 virtual void setMaxValue(LLSD max_value) { setMaxValue((F32)max_value.asReal()); }
93
94 BOOL isMouseHeldDown();
95
96 virtual void setEnabled( BOOL b );
97 virtual void clear();
98 virtual void setPrecision(S32 precision);
99 void setMinValue(F32 min_value) {mMultiSlider->setMinValue(min_value);}
100 void setMaxValue(F32 max_value) {mMultiSlider->setMaxValue(max_value);}
101 void setIncrement(F32 increment) {mMultiSlider->setIncrement(increment);}
102
103 /// for adding and deleting sliders
104 const LLString& addSlider();
105 const LLString& addSlider(F32 val);
106 void deleteSlider(const LLString& name);
107 void deleteCurSlider() { deleteSlider(mMultiSlider->getCurSlider()); }
108
109 F32 getMinValue() { return mMultiSlider->getMinValue(); }
110 F32 getMaxValue() { return mMultiSlider->getMaxValue(); }
111
112 void setLabel(const LLString& label) { if (mLabelBox) mLabelBox->setText(label); }
113 void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; }
114 void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; }
115
116 void setSliderMouseDownCallback( void (*slider_mousedown_callback)(LLUICtrl* caller, void* userdata) );
117 void setSliderMouseUpCallback( void (*slider_mouseup_callback)(LLUICtrl* caller, void* userdata) );
118
119 virtual void onTabInto();
120
121 virtual void setTentative(BOOL b); // marks value as tentative
122 virtual void onCommit(); // mark not tentative, then commit
123
124 virtual void setControlName(const LLString& control_name, LLView* context);
125 virtual LLString getControlName() const;
126
127 static void onSliderCommit(LLUICtrl* caller, void* userdata);
128 static void onSliderMouseDown(LLUICtrl* caller,void* userdata);
129 static void onSliderMouseUp(LLUICtrl* caller,void* userdata);
130
131 static void onEditorCommit(LLUICtrl* caller, void* userdata);
132 static void onEditorGainFocus(LLFocusableElement* caller, void *userdata);
133 static void onEditorChangeFocus(LLUICtrl* caller, S32 direction, void *userdata);
134
135private:
136 void updateText();
137 void reportInvalidData();
138
139private:
140 const LLFontGL* mFont;
141 BOOL mShowText;
142 BOOL mCanEditText;
143
144 S32 mPrecision;
145 LLTextBox* mLabelBox;
146 S32 mLabelWidth;
147
148 F32 mCurValue;
149 LLMultiSlider* mMultiSlider;
150 LLLineEditor* mEditor;
151 LLTextBox* mTextBox;
152
153 LLColor4 mTextEnabledColor;
154 LLColor4 mTextDisabledColor;
155
156 void (*mSliderMouseUpCallback)( LLUICtrl* ctrl, void* userdata );
157 void (*mSliderMouseDownCallback)( LLUICtrl* ctrl, void* userdata );
158};
159
160#endif // LL_MULTI_SLIDERCTRL_H