aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/llfocusmgr.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:34 -0500
committerJacek Antonelli2008-08-15 23:45:34 -0500
commitcd17687f01420952712a500107e0f93e7ab8d5f8 (patch)
treece48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/llui/llfocusmgr.cpp
parentSecond Life viewer sources 1.19.0.5 (diff)
downloadmeta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz
Second Life viewer sources 1.19.1.0
Diffstat (limited to 'linden/indra/llui/llfocusmgr.cpp')
-rw-r--r--linden/indra/llui/llfocusmgr.cpp34
1 files changed, 13 insertions, 21 deletions
diff --git a/linden/indra/llui/llfocusmgr.cpp b/linden/indra/llui/llfocusmgr.cpp
index efca3d8..0634513 100644
--- a/linden/indra/llui/llfocusmgr.cpp
+++ b/linden/indra/llui/llfocusmgr.cpp
@@ -57,12 +57,8 @@ LLFocusMgr::LLFocusMgr()
57{ 57{
58} 58}
59 59
60LLFocusMgr::~LLFocusMgr()
61{
62 mFocusHistory.clear();
63}
64 60
65void LLFocusMgr::releaseFocusIfNeeded( LLView* view ) 61void LLFocusMgr::releaseFocusIfNeeded( const LLView* view )
66{ 62{
67 if( childHasMouseCapture( view ) ) 63 if( childHasMouseCapture( view ) )
68 { 64 {
@@ -146,7 +142,7 @@ void LLFocusMgr::setKeyboardFocus(LLUICtrl* new_focus, BOOL lock)
146 142
147 if (focus_subtree) 143 if (focus_subtree)
148 { 144 {
149 mFocusHistory[focus_subtree->mViewHandle] = mKeyboardFocus ? mKeyboardFocus->mViewHandle : LLViewHandle::sDeadHandle; 145 mFocusHistory[focus_subtree->getHandle()] = mKeyboardFocus ? mKeyboardFocus->getHandle() : LLHandle<LLView>();
150 } 146 }
151 } 147 }
152 148
@@ -156,10 +152,6 @@ void LLFocusMgr::setKeyboardFocus(LLUICtrl* new_focus, BOOL lock)
156 } 152 }
157} 153}
158 154
159void LLFocusMgr::setDefaultKeyboardFocus(LLUICtrl* default_focus)
160{
161 mDefaultKeyboardFocus = default_focus;
162}
163 155
164// Returns TRUE is parent or any descedent of parent has keyboard focus. 156// Returns TRUE is parent or any descedent of parent has keyboard focus.
165BOOL LLFocusMgr::childHasKeyboardFocus(const LLView* parent ) const 157BOOL LLFocusMgr::childHasKeyboardFocus(const LLView* parent ) const
@@ -177,7 +169,7 @@ BOOL LLFocusMgr::childHasKeyboardFocus(const LLView* parent ) const
177} 169}
178 170
179// Returns TRUE is parent or any descedent of parent is the mouse captor. 171// Returns TRUE is parent or any descedent of parent is the mouse captor.
180BOOL LLFocusMgr::childHasMouseCapture( LLView* parent ) 172BOOL LLFocusMgr::childHasMouseCapture( const LLView* parent ) const
181{ 173{
182 if( mMouseCaptor && mMouseCaptor->isView() ) 174 if( mMouseCaptor && mMouseCaptor->isView() )
183 { 175 {
@@ -194,7 +186,7 @@ BOOL LLFocusMgr::childHasMouseCapture( LLView* parent )
194 return FALSE; 186 return FALSE;
195} 187}
196 188
197void LLFocusMgr::removeKeyboardFocusWithoutCallback( LLView* focus ) 189void LLFocusMgr::removeKeyboardFocusWithoutCallback( const LLView* focus )
198{ 190{
199 // should be ok to unlock here, as you have to know the locked view 191 // should be ok to unlock here, as you have to know the locked view
200 // in order to unlock it 192 // in order to unlock it
@@ -253,7 +245,7 @@ void LLFocusMgr::setMouseCapture( LLMouseHandler* new_captor )
253 } 245 }
254} 246}
255 247
256void LLFocusMgr::removeMouseCaptureWithoutCallback( LLMouseHandler* captor ) 248void LLFocusMgr::removeMouseCaptureWithoutCallback( const LLMouseHandler* captor )
257{ 249{
258 //if (mFocusLocked) 250 //if (mFocusLocked)
259 //{ 251 //{
@@ -269,7 +261,7 @@ void LLFocusMgr::removeMouseCaptureWithoutCallback( LLMouseHandler* captor )
269} 261}
270 262
271 263
272BOOL LLFocusMgr::childIsTopCtrl( LLView* parent ) 264BOOL LLFocusMgr::childIsTopCtrl( const LLView* parent ) const
273{ 265{
274 LLView* top_view = (LLView*)mTopCtrl; 266 LLView* top_view = (LLView*)mTopCtrl;
275 while( top_view ) 267 while( top_view )
@@ -304,7 +296,7 @@ void LLFocusMgr::setTopCtrl( LLUICtrl* new_top )
304 } 296 }
305} 297}
306 298
307void LLFocusMgr::removeTopCtrlWithoutCallback( LLUICtrl* top_view ) 299void LLFocusMgr::removeTopCtrlWithoutCallback( const LLUICtrl* top_view )
308{ 300{
309 if( mTopCtrl == top_view ) 301 if( mTopCtrl == top_view )
310 { 302 {
@@ -325,12 +317,12 @@ void LLFocusMgr::unlockFocus()
325 mLockedView = NULL; 317 mLockedView = NULL;
326} 318}
327 319
328F32 LLFocusMgr::getFocusFlashAmt() 320F32 LLFocusMgr::getFocusFlashAmt() const
329{ 321{
330 return clamp_rescale(getFocusTime(), 0.f, FOCUS_FADE_TIME, mFocusWeight, 0.f); 322 return clamp_rescale(getFocusTime(), 0.f, FOCUS_FADE_TIME, mFocusWeight, 0.f);
331} 323}
332 324
333LLColor4 LLFocusMgr::getFocusColor() 325LLColor4 LLFocusMgr::getFocusColor() const
334{ 326{
335 LLColor4 focus_color = lerp(LLUI::sColorsGroup->getColor( "FocusColor" ), LLColor4::white, getFocusFlashAmt()); 327 LLColor4 focus_color = lerp(LLUI::sColorsGroup->getColor( "FocusColor" ), LLColor4::white, getFocusFlashAmt());
336 // de-emphasize keyboard focus when app has lost focus (to avoid typing into wrong window problem) 328 // de-emphasize keyboard focus when app has lost focus (to avoid typing into wrong window problem)
@@ -362,15 +354,15 @@ void LLFocusMgr::setAppHasFocus(BOOL focus)
362 mAppHasFocus = focus; 354 mAppHasFocus = focus;
363} 355}
364 356
365LLUICtrl* LLFocusMgr::getLastFocusForGroup(LLView* subtree_root) 357LLUICtrl* LLFocusMgr::getLastFocusForGroup(LLView* subtree_root) const
366{ 358{
367 if (subtree_root) 359 if (subtree_root)
368 { 360 {
369 focus_history_map_t::iterator found_it = mFocusHistory.find(subtree_root->mViewHandle); 361 focus_history_map_t::const_iterator found_it = mFocusHistory.find(subtree_root->getHandle());
370 if (found_it != mFocusHistory.end()) 362 if (found_it != mFocusHistory.end())
371 { 363 {
372 // found last focus for this subtree 364 // found last focus for this subtree
373 return static_cast<LLUICtrl*>(LLView::getViewByHandle(found_it->second)); 365 return static_cast<LLUICtrl*>(found_it->second.get());
374 } 366 }
375 } 367 }
376 return NULL; 368 return NULL;
@@ -380,6 +372,6 @@ void LLFocusMgr::clearLastFocusForGroup(LLView* subtree_root)
380{ 372{
381 if (subtree_root) 373 if (subtree_root)
382 { 374 {
383 mFocusHistory.erase(subtree_root->mViewHandle); 375 mFocusHistory.erase(subtree_root->getHandle());
384 } 376 }
385} 377}