aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/llfocusmgr.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llui/llfocusmgr.h')
-rw-r--r--linden/indra/llui/llfocusmgr.h49
1 files changed, 39 insertions, 10 deletions
diff --git a/linden/indra/llui/llfocusmgr.h b/linden/indra/llui/llfocusmgr.h
index aaeb25a..88ede1a 100644
--- a/linden/indra/llui/llfocusmgr.h
+++ b/linden/indra/llui/llfocusmgr.h
@@ -37,10 +37,39 @@
37 37
38#include "llstring.h" 38#include "llstring.h"
39#include "llframetimer.h" 39#include "llframetimer.h"
40#include "llview.h" 40#include "llui.h"
41 41
42class LLUICtrl; 42class LLUICtrl;
43class LLMouseHandler; 43class LLMouseHandler;
44class LLView;
45
46class LLFocusableElement
47{
48 friend class LLFocusMgr; // allow access to focus change handlers
49public:
50 LLFocusableElement();
51 virtual ~LLFocusableElement();
52
53 virtual void setFocus( BOOL b );
54 virtual BOOL hasFocus() const;
55
56 void setFocusLostCallback(void (*cb)(LLFocusableElement* caller, void*), void* user_data = NULL) { mFocusLostCallback = cb; mFocusCallbackUserData = user_data; }
57 void setFocusReceivedCallback( void (*cb)(LLFocusableElement*, void*), void* user_data = NULL) { mFocusReceivedCallback = cb; mFocusCallbackUserData = user_data; }
58 void setFocusChangedCallback( void (*cb)(LLFocusableElement*, void*), void* user_data = NULL ) { mFocusChangedCallback = cb; mFocusCallbackUserData = user_data; }
59
60 // These were brought up the hierarchy from LLView so that we don't have to use dynamic_cast when dealing with keyboard focus.
61 virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
62 virtual BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent);
63
64protected:
65 virtual void onFocusReceived();
66 virtual void onFocusLost();
67 void (*mFocusLostCallback)( LLFocusableElement* caller, void* userdata );
68 void (*mFocusReceivedCallback)( LLFocusableElement* ctrl, void* userdata );
69 void (*mFocusChangedCallback)( LLFocusableElement* ctrl, void* userdata );
70 void* mFocusCallbackUserData;
71};
72
44 73
45class LLFocusMgr 74class LLFocusMgr
46{ 75{
@@ -55,11 +84,11 @@ public:
55 BOOL childHasMouseCapture( const LLView* parent ) const; 84 BOOL childHasMouseCapture( const LLView* parent ) const;
56 85
57 // Keyboard Focus 86 // Keyboard Focus
58 void setKeyboardFocus(LLUICtrl* new_focus, BOOL lock = FALSE, BOOL keystrokes_only = FALSE); // new_focus = NULL to release the focus. 87 void setKeyboardFocus(LLFocusableElement* new_focus, BOOL lock = FALSE, BOOL keystrokes_only = FALSE); // new_focus = NULL to release the focus.
59 LLUICtrl* getKeyboardFocus() const { return mKeyboardFocus; } 88 LLFocusableElement* getKeyboardFocus() const { return mKeyboardFocus; }
60 LLUICtrl* getLastKeyboardFocus() const { return mLastKeyboardFocus; } 89 LLFocusableElement* getLastKeyboardFocus() const { return mLastKeyboardFocus; }
61 BOOL childHasKeyboardFocus( const LLView* parent ) const; 90 BOOL childHasKeyboardFocus( const LLView* parent ) const;
62 void removeKeyboardFocusWithoutCallback( const LLView* focus ); 91 void removeKeyboardFocusWithoutCallback( const LLFocusableElement* focus );
63 BOOL getKeystrokesOnly() { return mKeystrokesOnly; } 92 BOOL getKeystrokesOnly() { return mKeystrokesOnly; }
64 void setKeystrokesOnly(BOOL keystrokes_only) { mKeystrokesOnly = keystrokes_only; } 93 void setKeystrokesOnly(BOOL keystrokes_only) { mKeystrokesOnly = keystrokes_only; }
65 94
@@ -75,8 +104,8 @@ public:
75 104
76 // If setKeyboardFocus(NULL) is called, and there is a non-NULL default 105 // If setKeyboardFocus(NULL) is called, and there is a non-NULL default
77 // keyboard focus view, focus goes there. JC 106 // keyboard focus view, focus goes there. JC
78 void setDefaultKeyboardFocus(LLUICtrl* default_focus) { mDefaultKeyboardFocus = default_focus; } 107 void setDefaultKeyboardFocus(LLFocusableElement* default_focus) { mDefaultKeyboardFocus = default_focus; }
79 LLUICtrl* getDefaultKeyboardFocus() const { return mDefaultKeyboardFocus; } 108 LLFocusableElement* getDefaultKeyboardFocus() const { return mDefaultKeyboardFocus; }
80 109
81 110
82 // Top View 111 // Top View
@@ -98,9 +127,9 @@ private:
98 LLMouseHandler* mMouseCaptor; // Mouse events are premptively routed to this object 127 LLMouseHandler* mMouseCaptor; // Mouse events are premptively routed to this object
99 128
100 // Keyboard Focus 129 // Keyboard Focus
101 LLUICtrl* mKeyboardFocus; // Keyboard events are preemptively routed to this object 130 LLFocusableElement* mKeyboardFocus; // Keyboard events are preemptively routed to this object
102 LLUICtrl* mLastKeyboardFocus; // who last had focus 131 LLFocusableElement* mLastKeyboardFocus; // who last had focus
103 LLUICtrl* mDefaultKeyboardFocus; 132 LLFocusableElement* mDefaultKeyboardFocus;
104 BOOL mKeystrokesOnly; 133 BOOL mKeystrokesOnly;
105 134
106 // Top View 135 // Top View