diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/llui/llsliderctrl.h | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/llui/llsliderctrl.h')
-rw-r--r-- | linden/indra/llui/llsliderctrl.h | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/linden/indra/llui/llsliderctrl.h b/linden/indra/llui/llsliderctrl.h new file mode 100644 index 0000000..baa0c42 --- /dev/null +++ b/linden/indra/llui/llsliderctrl.h | |||
@@ -0,0 +1,143 @@ | |||
1 | /** | ||
2 | * @file llsliderctrl.h | ||
3 | * @brief LLSliderCtrl base class | ||
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_LLSLIDERCTRL_H | ||
29 | #define LL_LLSLIDERCTRL_H | ||
30 | |||
31 | #include "lluictrl.h" | ||
32 | #include "v4color.h" | ||
33 | #include "llslider.h" | ||
34 | #include "lltextbox.h" | ||
35 | #include "llrect.h" | ||
36 | |||
37 | // | ||
38 | // Constants | ||
39 | // | ||
40 | const S32 SLIDERCTRL_SPACING = 4; // space between label, slider, and text | ||
41 | const S32 SLIDERCTRL_HEIGHT = 16; | ||
42 | |||
43 | // | ||
44 | // Classes | ||
45 | // | ||
46 | class LLFontGL; | ||
47 | class LLLineEditor; | ||
48 | class LLSlider; | ||
49 | |||
50 | |||
51 | class LLSliderCtrl : public LLUICtrl | ||
52 | { | ||
53 | public: | ||
54 | LLSliderCtrl(const LLString& name, | ||
55 | const LLRect& rect, | ||
56 | const LLString& label, | ||
57 | const LLFontGL* font, | ||
58 | S32 slider_left, | ||
59 | S32 text_left, | ||
60 | BOOL show_text, | ||
61 | BOOL can_edit_text, | ||
62 | void (*commit_callback)(LLUICtrl*, void*), | ||
63 | void* callback_userdata, | ||
64 | F32 initial_value, F32 min_value, F32 max_value, F32 increment, | ||
65 | const LLString& control_which = LLString::null ); | ||
66 | |||
67 | virtual ~LLSliderCtrl(); | ||
68 | virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_SLIDER; } | ||
69 | virtual LLString getWidgetTag() const { return LL_SLIDER_CTRL_TAG; } | ||
70 | virtual LLXMLNodePtr getXML(bool save_children = true) const; | ||
71 | static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); | ||
72 | |||
73 | F32 getValueF32() const; | ||
74 | void setValue(F32 v, BOOL from_event = FALSE); | ||
75 | |||
76 | virtual void setValue(const LLSD& value ) { setValue((F32)value.asReal(), TRUE); } | ||
77 | virtual LLSD getValue() const { return LLSD(getValueF32()); } | ||
78 | virtual BOOL setLabelArg( const LLString& key, const LLString& text ); | ||
79 | |||
80 | virtual void setMinValue(LLSD min_value) { setMinValue((F32)min_value.asReal()); } | ||
81 | virtual void setMaxValue(LLSD max_value) { setMaxValue((F32)max_value.asReal()); } | ||
82 | |||
83 | BOOL isMouseHeldDown(); | ||
84 | |||
85 | virtual void setEnabled( BOOL b ); | ||
86 | virtual void clear(); | ||
87 | virtual void setPrecision(S32 precision); | ||
88 | void setMinValue(F32 min_value) {mSlider->setMinValue(min_value);} | ||
89 | void setMaxValue(F32 max_value) {mSlider->setMaxValue(max_value);} | ||
90 | void setIncrement(F32 increment) {mSlider->setIncrement(increment);} | ||
91 | |||
92 | F32 getMinValue() { return mSlider->getMinValue(); } | ||
93 | F32 getMaxValue() { return mSlider->getMaxValue(); } | ||
94 | |||
95 | void setLabel(const LLString& label) { if (mLabelBox) mLabelBox->setText(label); } | ||
96 | void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; } | ||
97 | void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; } | ||
98 | |||
99 | void setSliderMouseDownCallback( void (*slider_mousedown_callback)(LLUICtrl* caller, void* userdata) ); | ||
100 | void setSliderMouseUpCallback( void (*slider_mouseup_callback)(LLUICtrl* caller, void* userdata) ); | ||
101 | |||
102 | virtual void onTabInto(); | ||
103 | |||
104 | virtual void setTentative(BOOL b); // marks value as tentative | ||
105 | virtual void onCommit(); // mark not tentative, then commit | ||
106 | |||
107 | virtual void setControlName(const LLString& control_name, LLView* context); | ||
108 | virtual LLString getControlName() const; | ||
109 | |||
110 | static void onSliderCommit(LLUICtrl* caller, void* userdata); | ||
111 | static void onSliderMouseDown(LLUICtrl* caller,void* userdata); | ||
112 | static void onSliderMouseUp(LLUICtrl* caller,void* userdata); | ||
113 | |||
114 | static void onEditorCommit(LLUICtrl* caller, void* userdata); | ||
115 | static void onEditorGainFocus(LLUICtrl* caller, void *userdata); | ||
116 | static void onEditorChangeFocus(LLUICtrl* caller, S32 direction, void *userdata); | ||
117 | |||
118 | private: | ||
119 | void updateText(); | ||
120 | void reportInvalidData(); | ||
121 | |||
122 | private: | ||
123 | const LLFontGL* mFont; | ||
124 | BOOL mShowText; | ||
125 | BOOL mCanEditText; | ||
126 | |||
127 | S32 mPrecision; | ||
128 | LLTextBox* mLabelBox; | ||
129 | S32 mLabelWidth; | ||
130 | |||
131 | F32 mValue; | ||
132 | LLSlider* mSlider; | ||
133 | LLLineEditor* mEditor; | ||
134 | LLTextBox* mTextBox; | ||
135 | |||
136 | LLColor4 mTextEnabledColor; | ||
137 | LLColor4 mTextDisabledColor; | ||
138 | |||
139 | void (*mSliderMouseUpCallback)( LLUICtrl* ctrl, void* userdata ); | ||
140 | void (*mSliderMouseDownCallback)( LLUICtrl* ctrl, void* userdata ); | ||
141 | }; | ||
142 | |||
143 | #endif // LL_LLSLIDERCTRL_H | ||