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/lluictrl.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/lluictrl.h')
-rw-r--r-- | linden/indra/llui/lluictrl.h | 172 |
1 files changed, 172 insertions, 0 deletions
diff --git a/linden/indra/llui/lluictrl.h b/linden/indra/llui/lluictrl.h new file mode 100644 index 0000000..7f48378 --- /dev/null +++ b/linden/indra/llui/lluictrl.h | |||
@@ -0,0 +1,172 @@ | |||
1 | /** | ||
2 | * @file lluictrl.h | ||
3 | * @author James Cook, Richard Nelson, Tom Yedwab | ||
4 | * @brief Abstract base class for UI controls | ||
5 | * | ||
6 | * Copyright (c) 2001-2007, Linden Research, Inc. | ||
7 | * | ||
8 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
9 | * to you under the terms of the GNU General Public License, version 2.0 | ||
10 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
11 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
12 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
13 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
14 | * | ||
15 | * There are special exceptions to the terms and conditions of the GPL as | ||
16 | * it is applied to this Source Code. View the full text of the exception | ||
17 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
18 | * online at http://secondlife.com/developers/opensource/flossexception | ||
19 | * | ||
20 | * By copying, modifying or distributing this software, you acknowledge | ||
21 | * that you have read and understood your obligations described above, | ||
22 | * and agree to abide by those obligations. | ||
23 | * | ||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
26 | * COMPLETENESS OR PERFORMANCE. | ||
27 | */ | ||
28 | |||
29 | #ifndef LL_LLUICTRL_H | ||
30 | #define LL_LLUICTRL_H | ||
31 | |||
32 | #include "llview.h" | ||
33 | #include "llrect.h" | ||
34 | #include "llsd.h" | ||
35 | |||
36 | // | ||
37 | // Classes | ||
38 | // | ||
39 | class LLViewerImage; | ||
40 | class LLFontGL; | ||
41 | class LLButton; | ||
42 | class LLTextBox; | ||
43 | class LLLineEditor; | ||
44 | class LLUICtrl; | ||
45 | class LLPanel; | ||
46 | class LLCtrlSelectionInterface; | ||
47 | class LLCtrlListInterface; | ||
48 | class LLCtrlScrollInterface; | ||
49 | |||
50 | typedef void (*LLUICtrlCallback)(LLUICtrl* ctrl, void* userdata); | ||
51 | typedef BOOL (*LLUICtrlValidate)(LLUICtrl* ctrl, void* userdata); | ||
52 | |||
53 | class LLUICtrl | ||
54 | : public LLView | ||
55 | { | ||
56 | public: | ||
57 | LLUICtrl(); | ||
58 | LLUICtrl( const LLString& name, const LLRect& rect, BOOL mouse_opaque, | ||
59 | LLUICtrlCallback callback, | ||
60 | void* callback_userdata, | ||
61 | U32 reshape=FOLLOWS_NONE); | ||
62 | virtual ~LLUICtrl(); | ||
63 | |||
64 | // LLView interface | ||
65 | //virtual BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect); | ||
66 | virtual void initFromXML(LLXMLNodePtr node, LLView* parent); | ||
67 | virtual LLXMLNodePtr getXML(bool save_children = true) const; | ||
68 | |||
69 | virtual LLSD getValue() const { return LLSD(); } | ||
70 | |||
71 | // Defaults to no-op | ||
72 | virtual BOOL setTextArg( const LLString& key, const LLString& text ); | ||
73 | |||
74 | // Defaults to no-op | ||
75 | virtual BOOL setLabelArg( const LLString& key, const LLString& text ); | ||
76 | |||
77 | // Defaults to return NULL | ||
78 | virtual LLCtrlSelectionInterface* getSelectionInterface(); | ||
79 | virtual LLCtrlListInterface* getListInterface(); | ||
80 | virtual LLCtrlScrollInterface* getScrollInterface(); | ||
81 | |||
82 | virtual void setFocus( BOOL b ); | ||
83 | virtual BOOL hasFocus() const; | ||
84 | |||
85 | virtual void setTabStop( BOOL b ); | ||
86 | virtual BOOL hasTabStop() const; | ||
87 | |||
88 | // Defaults to false | ||
89 | virtual BOOL acceptsTextInput() const; | ||
90 | |||
91 | // Default to no-op | ||
92 | virtual void onTabInto(); | ||
93 | virtual void clear(); | ||
94 | |||
95 | virtual void setIsChrome(BOOL is_chrome); | ||
96 | virtual BOOL getIsChrome() const; | ||
97 | |||
98 | virtual void onCommit(); | ||
99 | |||
100 | virtual BOOL isCtrl() const { return TRUE; } | ||
101 | // "Tentative" controls have a proposed value, but haven't committed | ||
102 | // it yet. This is used when multiple objects are selected and we | ||
103 | // want to display a parameter that differs between the objects. | ||
104 | virtual void setTentative(BOOL b); | ||
105 | virtual BOOL getTentative() const; | ||
106 | |||
107 | // Returns containing panel/floater or NULL if none found. | ||
108 | LLPanel* getParentPanel() const; | ||
109 | |||
110 | void* getCallbackUserData() const { return mCallbackUserData; } | ||
111 | void setCallbackUserData( void* data ) { mCallbackUserData = data; } | ||
112 | |||
113 | void setCommitCallback( void (*cb)(LLUICtrl*, void*) ) { mCommitCallback = cb; } | ||
114 | void setValidateBeforeCommit( BOOL(*cb)(LLUICtrl*, void*) ) { mValidateCallback = cb; } | ||
115 | |||
116 | // Defaults to no-op! | ||
117 | virtual void setDoubleClickCallback( void (*cb)(void*) ); | ||
118 | |||
119 | // Defaults to no-op | ||
120 | virtual void setColor(const LLColor4& color); | ||
121 | |||
122 | // Defaults to no-op | ||
123 | virtual void setMinValue(LLSD min_value); | ||
124 | virtual void setMaxValue(LLSD max_value); | ||
125 | |||
126 | // In general, only LLPanel uses these. | ||
127 | void setFocusReceivedCallback( void (*cb)(LLUICtrl*, void*) ) { mFocusReceivedCallback = cb; } | ||
128 | void setFocusChangedCallback( void (*cb)(LLUICtrl*, void*) ) { mFocusChangedCallback = cb; } | ||
129 | |||
130 | static void onFocusLostCallback(LLUICtrl* old_focus); | ||
131 | |||
132 | /*virtual*/ BOOL focusFirstItem(BOOL prefer_text_fields = FALSE ); | ||
133 | |||
134 | class LLTabStopPostFilter : public LLQueryFilter, public LLSingleton<LLTabStopPostFilter> | ||
135 | { | ||
136 | /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const | ||
137 | { | ||
138 | return filterResult_t(view->isCtrl() && static_cast<const LLUICtrl * const>(view)->hasTabStop() && children.size() == 0, TRUE); | ||
139 | } | ||
140 | }; | ||
141 | |||
142 | class LLTextInputFilter : public LLQueryFilter, public LLSingleton<LLTextInputFilter> | ||
143 | { | ||
144 | /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const | ||
145 | { | ||
146 | return filterResult_t(view->isCtrl() && static_cast<const LLUICtrl * const>(view)->acceptsTextInput(), TRUE); | ||
147 | } | ||
148 | }; | ||
149 | |||
150 | protected: | ||
151 | virtual void onFocusReceived(); | ||
152 | virtual void onFocusLost(); | ||
153 | void onChangeFocus( S32 direction ); | ||
154 | |||
155 | protected: | ||
156 | |||
157 | void (*mCommitCallback)( LLUICtrl* ctrl, void* userdata ); | ||
158 | void (*mFocusReceivedCallback)( LLUICtrl* ctrl, void* userdata ); | ||
159 | void (*mFocusChangedCallback)( LLUICtrl* ctrl, void* userdata ); | ||
160 | BOOL (*mValidateCallback)( LLUICtrl* ctrl, void* userdata ); | ||
161 | |||
162 | void* mCallbackUserData; | ||
163 | BOOL mTentative; | ||
164 | BOOL mTabStop; | ||
165 | |||
166 | private: | ||
167 | BOOL mIsChrome; | ||
168 | |||
169 | |||
170 | }; | ||
171 | |||
172 | #endif // LL_LLUICTRL_H | ||