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/llspinctrl.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 '')
-rw-r--r-- | linden/indra/llui/llspinctrl.h | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/linden/indra/llui/llspinctrl.h b/linden/indra/llui/llspinctrl.h new file mode 100644 index 0000000..46776ed --- /dev/null +++ b/linden/indra/llui/llspinctrl.h | |||
@@ -0,0 +1,141 @@ | |||
1 | /** | ||
2 | * @file llspinctrl.h | ||
3 | * @brief LLSpinCtrl 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_LLSPINCTRL_H | ||
29 | #define LL_LLSPINCTRL_H | ||
30 | |||
31 | |||
32 | #include "stdtypes.h" | ||
33 | #include "lluictrl.h" | ||
34 | #include "v4color.h" | ||
35 | #include "llrect.h" | ||
36 | |||
37 | // | ||
38 | // Constants | ||
39 | // | ||
40 | const S32 SPINCTRL_BTN_HEIGHT = 8; | ||
41 | const S32 SPINCTRL_BTN_WIDTH = 16; | ||
42 | const S32 SPINCTRL_SPACING = 2; // space between label right and button left | ||
43 | const S32 SPINCTRL_HEIGHT = 2 * SPINCTRL_BTN_HEIGHT; | ||
44 | const S32 SPINCTRL_DEFAULT_LABEL_WIDTH = 10; | ||
45 | |||
46 | // | ||
47 | // Classes | ||
48 | // | ||
49 | class LLFontGL; | ||
50 | class LLButton; | ||
51 | class LLTextBox; | ||
52 | class LLLineEditor; | ||
53 | class LLUICtrlFactory; | ||
54 | |||
55 | |||
56 | class LLSpinCtrl | ||
57 | : public LLUICtrl | ||
58 | { | ||
59 | public: | ||
60 | LLSpinCtrl(const LLString& name, const LLRect& rect, | ||
61 | const LLString& label, | ||
62 | const LLFontGL* font, | ||
63 | void (*commit_callback)(LLUICtrl*, void*), | ||
64 | void* callback_userdata, | ||
65 | F32 initial_value, F32 min_value, F32 max_value, F32 increment, | ||
66 | const LLString& control_name = LLString(), | ||
67 | S32 label_width = SPINCTRL_DEFAULT_LABEL_WIDTH ); | ||
68 | |||
69 | virtual ~LLSpinCtrl(); | ||
70 | virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_SPINNER; } | ||
71 | virtual LLString getWidgetTag() const { return LL_SPIN_CTRL_TAG; } | ||
72 | virtual LLXMLNodePtr getXML(bool save_children = true) const; | ||
73 | static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); | ||
74 | |||
75 | virtual void setValue(const LLSD& value ); | ||
76 | virtual LLSD getValue() const; | ||
77 | F32 get() { return (F32)getValue().asReal(); } | ||
78 | void set(F32 value) { setValue(value); } | ||
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 setFocus( BOOL b ); | ||
87 | virtual void clear(); | ||
88 | virtual void setPrecision(S32 precision); | ||
89 | virtual void setMinValue(F32 min) { mMinValue = min; } | ||
90 | virtual void setMaxValue(F32 max) { mMaxValue = max; } | ||
91 | virtual void setIncrement(F32 inc) { mIncrement = inc; } | ||
92 | |||
93 | void setLabel(const LLString& label); | ||
94 | void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; } | ||
95 | void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; } | ||
96 | |||
97 | virtual void onTabInto(); | ||
98 | |||
99 | virtual void setTentative(BOOL b); // marks value as tentative | ||
100 | virtual void onCommit(); // mark not tentative, then commit | ||
101 | |||
102 | void forceEditorCommit(); // for commit on external button | ||
103 | |||
104 | virtual BOOL handleScrollWheel(S32 x,S32 y,S32 clicks); | ||
105 | virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); | ||
106 | |||
107 | virtual void draw(); | ||
108 | |||
109 | static void onEditorCommit(LLUICtrl* caller, void* userdata); | ||
110 | static void onEditorGainFocus(LLUICtrl* caller, void *userdata); | ||
111 | static void onEditorChangeFocus(LLUICtrl* caller, S32 direction, void *userdata); | ||
112 | |||
113 | static void onUpBtn(void *userdata); | ||
114 | static void onDownBtn(void *userdata); | ||
115 | |||
116 | protected: | ||
117 | void updateEditor(); | ||
118 | void reportInvalidData(); | ||
119 | |||
120 | protected: | ||
121 | |||
122 | F32 mValue; | ||
123 | F32 mInitialValue; | ||
124 | F32 mMaxValue; | ||
125 | F32 mMinValue; | ||
126 | F32 mIncrement; | ||
127 | |||
128 | S32 mPrecision; | ||
129 | LLTextBox* mLabelBox; | ||
130 | |||
131 | LLLineEditor* mEditor; | ||
132 | LLColor4 mTextEnabledColor; | ||
133 | LLColor4 mTextDisabledColor; | ||
134 | |||
135 | LLButton* mUpBtn; | ||
136 | LLButton* mDownBtn; | ||
137 | |||
138 | BOOL mbHasBeenSet; | ||
139 | }; | ||
140 | |||
141 | #endif // LL_LLSPINCTRL_H | ||