diff options
author | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
commit | cd17687f01420952712a500107e0f93e7ab8d5f8 (patch) | |
tree | ce48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/llui/llsliderctrl.h | |
parent | Second Life viewer sources 1.19.0.5 (diff) | |
download | meta-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/llsliderctrl.h')
-rw-r--r-- | linden/indra/llui/llsliderctrl.h | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/linden/indra/llui/llsliderctrl.h b/linden/indra/llui/llsliderctrl.h index 7af0abf..705fa5c 100644 --- a/linden/indra/llui/llsliderctrl.h +++ b/linden/indra/llui/llsliderctrl.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /** | 1 | /** |
2 | * @file llsliderctrl.h | 2 | * @file llsliderctrl.h |
3 | * @brief LLSliderCtrl base class | 3 | * @brief Decorated wrapper for a LLSlider. |
4 | * | 4 | * |
5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ | 5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ |
6 | * | 6 | * |
@@ -44,13 +44,6 @@ | |||
44 | const S32 SLIDERCTRL_SPACING = 4; // space between label, slider, and text | 44 | const S32 SLIDERCTRL_SPACING = 4; // space between label, slider, and text |
45 | const S32 SLIDERCTRL_HEIGHT = 16; | 45 | const S32 SLIDERCTRL_HEIGHT = 16; |
46 | 46 | ||
47 | // | ||
48 | // Classes | ||
49 | // | ||
50 | class LLFontGL; | ||
51 | class LLLineEditor; | ||
52 | class LLSlider; | ||
53 | |||
54 | 47 | ||
55 | class LLSliderCtrl : public LLUICtrl | 48 | class LLSliderCtrl : public LLUICtrl |
56 | { | 49 | { |
@@ -63,41 +56,41 @@ public: | |||
63 | S32 text_left, | 56 | S32 text_left, |
64 | BOOL show_text, | 57 | BOOL show_text, |
65 | BOOL can_edit_text, | 58 | BOOL can_edit_text, |
66 | BOOL volume, | 59 | BOOL volume, //TODO: create a "volume" slider sub-class or just use image art, no? -MG |
67 | void (*commit_callback)(LLUICtrl*, void*), | 60 | void (*commit_callback)(LLUICtrl*, void*), |
68 | void* callback_userdata, | 61 | void* callback_userdata, |
69 | F32 initial_value, F32 min_value, F32 max_value, F32 increment, | 62 | F32 initial_value, F32 min_value, F32 max_value, F32 increment, |
70 | const LLString& control_which = LLString::null ); | 63 | const LLString& control_which = LLString::null ); |
71 | 64 | ||
72 | virtual ~LLSliderCtrl(); | 65 | virtual ~LLSliderCtrl() {} // Children all cleaned up by default view destructor. |
73 | virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_SLIDER; } | 66 | virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_SLIDER; } |
74 | virtual LLString getWidgetTag() const { return LL_SLIDER_CTRL_TAG; } | 67 | virtual LLString getWidgetTag() const { return LL_SLIDER_CTRL_TAG; } |
75 | virtual LLXMLNodePtr getXML(bool save_children = true) const; | 68 | virtual LLXMLNodePtr getXML(bool save_children = true) const; |
76 | static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); | 69 | static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); |
77 | 70 | ||
78 | F32 getValueF32() const; | 71 | F32 getValueF32() const { return mSlider->getValueF32(); } |
79 | void setValue(F32 v, BOOL from_event = FALSE); | 72 | void setValue(F32 v, BOOL from_event = FALSE); |
80 | 73 | ||
81 | virtual void setValue(const LLSD& value ) { setValue((F32)value.asReal(), TRUE); } | 74 | virtual void setValue(const LLSD& value) { setValue((F32)value.asReal(), TRUE); } |
82 | virtual LLSD getValue() const { return LLSD(getValueF32()); } | 75 | virtual LLSD getValue() const { return LLSD(getValueF32()); } |
83 | virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text ); | 76 | virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text ); |
84 | 77 | ||
85 | virtual void setMinValue(LLSD min_value) { setMinValue((F32)min_value.asReal()); } | 78 | virtual void setMinValue(LLSD min_value) { setMinValue((F32)min_value.asReal()); } |
86 | virtual void setMaxValue(LLSD max_value) { setMaxValue((F32)max_value.asReal()); } | 79 | virtual void setMaxValue(LLSD max_value) { setMaxValue((F32)max_value.asReal()); } |
87 | 80 | ||
88 | BOOL isMouseHeldDown(); | 81 | BOOL isMouseHeldDown() const { return mSlider->hasMouseCapture(); } |
89 | 82 | ||
90 | virtual void setEnabled( BOOL b ); | 83 | virtual void setEnabled( BOOL b ); |
91 | virtual void clear(); | 84 | virtual void clear(); |
92 | virtual void setPrecision(S32 precision); | 85 | virtual void setPrecision(S32 precision); |
93 | void setMinValue(F32 min_value) {mSlider->setMinValue(min_value);} | 86 | void setMinValue(F32 min_value) { mSlider->setMinValue(min_value); updateText(); } |
94 | void setMaxValue(F32 max_value) {mSlider->setMaxValue(max_value);} | 87 | void setMaxValue(F32 max_value) { mSlider->setMaxValue(max_value); updateText(); } |
95 | void setIncrement(F32 increment) {mSlider->setIncrement(increment);} | 88 | void setIncrement(F32 increment) { mSlider->setIncrement(increment);} |
96 | 89 | ||
97 | F32 getMinValue() { return mSlider->getMinValue(); } | 90 | F32 getMinValue() { return mSlider->getMinValue(); } |
98 | F32 getMaxValue() { return mSlider->getMaxValue(); } | 91 | F32 getMaxValue() { return mSlider->getMaxValue(); } |
99 | 92 | ||
100 | void setLabel(const LLStringExplicit& label) { if (mLabelBox) mLabelBox->setText(label); } | 93 | void setLabel(const LLStringExplicit& label) { if (mLabelBox) mLabelBox->setText(label); } |
101 | void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; } | 94 | void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; } |
102 | void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; } | 95 | void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; } |
103 | 96 | ||
@@ -109,8 +102,13 @@ public: | |||
109 | virtual void setTentative(BOOL b); // marks value as tentative | 102 | virtual void setTentative(BOOL b); // marks value as tentative |
110 | virtual void onCommit(); // mark not tentative, then commit | 103 | virtual void onCommit(); // mark not tentative, then commit |
111 | 104 | ||
112 | virtual void setControlName(const LLString& control_name, LLView* context); | 105 | virtual void setControlName(const LLString& control_name, LLView* context) |
113 | virtual LLString getControlName() const; | 106 | { |
107 | LLView::setControlName(control_name, context); | ||
108 | mSlider->setControlName(control_name, context); | ||
109 | } | ||
110 | |||
111 | virtual LLString getControlName() const { return mSlider->getControlName(); } | ||
114 | 112 | ||
115 | static void onSliderCommit(LLUICtrl* caller, void* userdata); | 113 | static void onSliderCommit(LLUICtrl* caller, void* userdata); |
116 | static void onSliderMouseDown(LLUICtrl* caller,void* userdata); | 114 | static void onSliderMouseDown(LLUICtrl* caller,void* userdata); |
@@ -124,7 +122,6 @@ private: | |||
124 | void updateText(); | 122 | void updateText(); |
125 | void reportInvalidData(); | 123 | void reportInvalidData(); |
126 | 124 | ||
127 | private: | ||
128 | const LLFontGL* mFont; | 125 | const LLFontGL* mFont; |
129 | BOOL mShowText; | 126 | BOOL mShowText; |
130 | BOOL mCanEditText; | 127 | BOOL mCanEditText; |
@@ -136,7 +133,7 @@ private: | |||
136 | 133 | ||
137 | F32 mValue; | 134 | F32 mValue; |
138 | LLSlider* mSlider; | 135 | LLSlider* mSlider; |
139 | LLLineEditor* mEditor; | 136 | class LLLineEditor* mEditor; |
140 | LLTextBox* mTextBox; | 137 | LLTextBox* mTextBox; |
141 | 138 | ||
142 | LLColor4 mTextEnabledColor; | 139 | LLColor4 mTextEnabledColor; |