aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/llfocusmgr.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/llui/llfocusmgr.h
parentREADME.txt (diff)
downloadmeta-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/llfocusmgr.h')
-rw-r--r--linden/indra/llui/llfocusmgr.h121
1 files changed, 121 insertions, 0 deletions
diff --git a/linden/indra/llui/llfocusmgr.h b/linden/indra/llui/llfocusmgr.h
new file mode 100644
index 0000000..5687b99
--- /dev/null
+++ b/linden/indra/llui/llfocusmgr.h
@@ -0,0 +1,121 @@
1/**
2 * @file llfocusmgr.h
3 * @brief LLFocusMgr 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// Singleton that manages keyboard and mouse focus
29
30#ifndef LL_LLFOCUSMGR_H
31#define LL_LLFOCUSMGR_H
32
33#include "llstring.h"
34#include "llframetimer.h"
35#include "llview.h"
36
37class LLUICtrl;
38class LLMouseHandler;
39
40class LLFocusMgr
41{
42public:
43 typedef void (*FocusLostCallback)(LLUICtrl*);
44
45 LLFocusMgr();
46 ~LLFocusMgr();
47
48 // Mouse Captor
49 void setMouseCapture(LLMouseHandler* new_captor,void (*on_capture_lost)(LLMouseHandler* old_captor)); // new_captor = NULL to release the mouse.
50 LLMouseHandler* getMouseCapture() { return mMouseCaptor; }
51 void removeMouseCaptureWithoutCallback( LLMouseHandler* captor );
52 BOOL childHasMouseCapture( LLView* parent );
53
54 // Keyboard Focus
55 void setKeyboardFocus(LLUICtrl* new_focus, FocusLostCallback on_focus_lost, BOOL lock = FALSE); // new_focus = NULL to release the focus.
56 LLUICtrl* getKeyboardFocus() const { return mKeyboardFocus; }
57 BOOL childHasKeyboardFocus( const LLView* parent ) const;
58 void removeKeyboardFocusWithoutCallback( LLView* focus );
59 FocusLostCallback getFocusCallback() { return mKeyboardFocusLostCallback; }
60 F32 getFocusTime() const { return mFocusTimer.getElapsedTimeF32(); }
61 F32 getFocusFlashAmt();
62 LLColor4 getFocusColor();
63 void triggerFocusFlash();
64 BOOL getAppHasFocus() { return mAppHasFocus; }
65 void setAppHasFocus(BOOL focus);
66 LLUICtrl* getLastFocusForGroup(LLView* subtree_root);
67 void clearLastFocusForGroup(LLView* subtree_root);
68
69 // If setKeyboardFocus(NULL) is called, and there is a non-NULL default
70 // keyboard focus view, focus goes there. JC
71 void setDefaultKeyboardFocus(LLUICtrl* default_focus);
72 LLUICtrl* getDefaultKeyboardFocus() const { return mDefaultKeyboardFocus; }
73
74
75 // Top View
76 void setTopView(LLView* new_top, void (*on_top_lost)(LLView* old_top));
77 LLView* getTopView() const { return mTopView; }
78 void removeTopViewWithoutCallback( LLView* top_view );
79 BOOL childIsTopView( LLView* parent );
80
81 // All Three
82 void releaseFocusIfNeeded( LLView* top_view );
83 void unlockFocus();
84 BOOL focusLocked() { return mLockedView != NULL; }
85
86protected:
87 LLUICtrl* mLockedView;
88 FocusLostCallback mKeyboardLockedFocusLostCallback;
89
90 // Mouse Captor
91 LLMouseHandler* mMouseCaptor; // Mouse events are premptively routed to this object
92 void (*mMouseCaptureLostCallback)(LLMouseHandler*); // The object to which mouse events are routed is called before another object takes its place
93
94 // Keyboard Focus
95 LLUICtrl* mKeyboardFocus; // Keyboard events are preemptively routed to this object
96 LLUICtrl* mDefaultKeyboardFocus;
97 FocusLostCallback mKeyboardFocusLostCallback; // The object to which keyboard events are routed is called before another object takes its place
98
99 // Top View
100 LLView* mTopView;
101 void (*mTopViewLostCallback)(LLView*);
102
103 LLFrameTimer mFocusTimer;
104 F32 mFocusWeight;
105
106 BOOL mAppHasFocus;
107
108 typedef std::map<LLViewHandle, LLViewHandle> focus_history_map_t;
109 focus_history_map_t mFocusHistory;
110
111 #ifdef _DEBUG
112 LLString mMouseCaptorName;
113 LLString mKeyboardFocusName;
114 LLString mTopViewName;
115 #endif
116};
117
118extern LLFocusMgr gFocusMgr;
119
120#endif // LL_LLFOCUSMGR_H
121