aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/lluictrl.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llui/lluictrl.h')
-rw-r--r--linden/indra/llui/lluictrl.h59
1 files changed, 33 insertions, 26 deletions
diff --git a/linden/indra/llui/lluictrl.h b/linden/indra/llui/lluictrl.h
index bf61f8b..55e804c 100644
--- a/linden/indra/llui/lluictrl.h
+++ b/linden/indra/llui/lluictrl.h
@@ -13,12 +13,12 @@
13 * ("GPL"), unless you have obtained a separate licensing agreement 13 * ("GPL"), unless you have obtained a separate licensing agreement
14 * ("Other License"), formally executed by you and Linden Lab. Terms of 14 * ("Other License"), formally executed by you and Linden Lab. Terms of
15 * the GPL can be found in doc/GPL-license.txt in this distribution, or 15 * the GPL can be found in doc/GPL-license.txt in this distribution, or
16 * online at http://secondlife.com/developers/opensource/gplv2 16 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
17 * 17 *
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlife.com/developers/opensource/flossexception 21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 22 *
23 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -53,8 +53,31 @@ class LLCtrlScrollInterface;
53typedef void (*LLUICtrlCallback)(LLUICtrl* ctrl, void* userdata); 53typedef void (*LLUICtrlCallback)(LLUICtrl* ctrl, void* userdata);
54typedef BOOL (*LLUICtrlValidate)(LLUICtrl* ctrl, void* userdata); 54typedef BOOL (*LLUICtrlValidate)(LLUICtrl* ctrl, void* userdata);
55 55
56class LLFocusableElement
57{
58 friend class LLFocusMgr; // allow access to focus change handlers
59public:
60 LLFocusableElement();
61 virtual ~LLFocusableElement() {};
62
63 virtual void setFocus( BOOL b );
64 virtual BOOL hasFocus() const;
65
66 void setFocusLostCallback(void (*cb)(LLFocusableElement* caller, void*), void* user_data = NULL) { mFocusLostCallback = cb; mFocusCallbackUserData = user_data; }
67 void setFocusReceivedCallback( void (*cb)(LLFocusableElement*, void*), void* user_data = NULL) { mFocusReceivedCallback = cb; mFocusCallbackUserData = user_data; }
68 void setFocusChangedCallback( void (*cb)(LLFocusableElement*, void*), void* user_data = NULL ) { mFocusChangedCallback = cb; mFocusCallbackUserData = user_data; }
69
70protected:
71 virtual void onFocusReceived();
72 virtual void onFocusLost();
73 void (*mFocusLostCallback)( LLFocusableElement* caller, void* userdata );
74 void (*mFocusReceivedCallback)( LLFocusableElement* ctrl, void* userdata );
75 void (*mFocusChangedCallback)( LLFocusableElement* ctrl, void* userdata );
76 void* mFocusCallbackUserData;
77};
78
56class LLUICtrl 79class LLUICtrl
57: public LLView 80: public LLView, public LLFocusableElement
58{ 81{
59public: 82public:
60 LLUICtrl(); 83 LLUICtrl();
@@ -85,6 +108,11 @@ public:
85 virtual void setFocus( BOOL b ); 108 virtual void setFocus( BOOL b );
86 virtual BOOL hasFocus() const; 109 virtual BOOL hasFocus() const;
87 110
111 virtual void onFocusReceived();
112 virtual void onFocusLost();
113
114 virtual void onLostTop(); // called when registered as top ctrl and user clicks elsewhere
115
88 virtual void setTabStop( BOOL b ); 116 virtual void setTabStop( BOOL b );
89 virtual BOOL hasTabStop() const; 117 virtual BOOL hasTabStop() const;
90 118
@@ -115,6 +143,7 @@ public:
115 143
116 void setCommitCallback( void (*cb)(LLUICtrl*, void*) ) { mCommitCallback = cb; } 144 void setCommitCallback( void (*cb)(LLUICtrl*, void*) ) { mCommitCallback = cb; }
117 void setValidateBeforeCommit( BOOL(*cb)(LLUICtrl*, void*) ) { mValidateCallback = cb; } 145 void setValidateBeforeCommit( BOOL(*cb)(LLUICtrl*, void*) ) { mValidateCallback = cb; }
146 void setLostTopCallback( void (*cb)(LLUICtrl*, void*) ) { mLostTopCallback = cb; }
118 147
119 // Defaults to no-op! 148 // Defaults to no-op!
120 virtual void setDoubleClickCallback( void (*cb)(void*) ); 149 virtual void setDoubleClickCallback( void (*cb)(void*) );
@@ -126,23 +155,8 @@ public:
126 virtual void setMinValue(LLSD min_value); 155 virtual void setMinValue(LLSD min_value);
127 virtual void setMaxValue(LLSD max_value); 156 virtual void setMaxValue(LLSD max_value);
128 157
129 // In general, only LLPanel uses these.
130 void setFocusLostCallback(void (*cb)(LLUICtrl* caller, void* user_data)) { mFocusLostCallback = cb; }
131 void setFocusReceivedCallback( void (*cb)(LLUICtrl*, void*) ) { mFocusReceivedCallback = cb; }
132 void setFocusChangedCallback( void (*cb)(LLUICtrl*, void*) ) { mFocusChangedCallback = cb; }
133
134 static void onFocusLostCallback(LLUICtrl* old_focus);
135
136 /*virtual*/ BOOL focusFirstItem(BOOL prefer_text_fields = FALSE ); 158 /*virtual*/ BOOL focusFirstItem(BOOL prefer_text_fields = FALSE );
137 159
138 class LLTabStopPostFilter : public LLQueryFilter, public LLSingleton<LLTabStopPostFilter>
139 {
140 /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const
141 {
142 return filterResult_t(view->isCtrl() && static_cast<const LLUICtrl *>(view)->hasTabStop() && children.size() == 0, TRUE);
143 }
144 };
145
146 class LLTextInputFilter : public LLQueryFilter, public LLSingleton<LLTextInputFilter> 160 class LLTextInputFilter : public LLQueryFilter, public LLSingleton<LLTextInputFilter>
147 { 161 {
148 /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const 162 /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const
@@ -157,16 +171,9 @@ public:
157 virtual void resetDirty() {}; 171 virtual void resetDirty() {};
158 172
159protected: 173protected:
160 virtual void onFocusReceived();
161 virtual void onFocusLost();
162 void onChangeFocus( S32 direction );
163
164protected:
165 174
166 void (*mCommitCallback)( LLUICtrl* ctrl, void* userdata ); 175 void (*mCommitCallback)( LLUICtrl* ctrl, void* userdata );
167 void (*mFocusLostCallback)( LLUICtrl* caller, void* userdata ); 176 void (*mLostTopCallback)( LLUICtrl* ctrl, void* userdata );
168 void (*mFocusReceivedCallback)( LLUICtrl* ctrl, void* userdata );
169 void (*mFocusChangedCallback)( LLUICtrl* ctrl, void* userdata );
170 BOOL (*mValidateCallback)( LLUICtrl* ctrl, void* userdata ); 177 BOOL (*mValidateCallback)( LLUICtrl* ctrl, void* userdata );
171 178
172 void* mCallbackUserData; 179 void* mCallbackUserData;