Updated LLFocusMgr to use boost::signals2 instead of vanilla function pointers. Also removed top-focus handling from lluictrl because it doesn't belong there.
This commit is contained in:
@@ -110,13 +110,11 @@ LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std::
|
||||
mButton->setImageOverlay("combobox_arrow.tga", LLFontGL::RIGHT);
|
||||
|
||||
updateLayout();
|
||||
|
||||
mTopLostSignalConnection = setTopLostCallback(boost::bind(&LLComboBox::hideList, this));
|
||||
}
|
||||
|
||||
|
||||
LLComboBox::~LLComboBox()
|
||||
{
|
||||
// children automatically deleted, including mMenu, mButton
|
||||
}
|
||||
|
||||
// virtual
|
||||
LLXMLNodePtr LLComboBox::getXML(bool save_children) const
|
||||
@@ -228,6 +226,16 @@ void LLComboBox::setEnabled(BOOL enabled)
|
||||
mButton->setEnabled(enabled);
|
||||
}
|
||||
|
||||
|
||||
LLComboBox::~LLComboBox()
|
||||
{
|
||||
// children automatically deleted, including mMenu, mButton
|
||||
|
||||
// explicitly disconect this signal, since base class destructor might fire top lost
|
||||
mTopLostSignalConnection.disconnect();
|
||||
}
|
||||
|
||||
|
||||
void LLComboBox::clear()
|
||||
{
|
||||
if (mTextEntry)
|
||||
@@ -481,12 +489,6 @@ void LLComboBox::onFocusLost()
|
||||
LLUICtrl::onFocusLost();
|
||||
}
|
||||
|
||||
void LLComboBox::onLostTop()
|
||||
{
|
||||
hideList();
|
||||
}
|
||||
|
||||
|
||||
void LLComboBox::setButtonVisible(BOOL visible)
|
||||
{
|
||||
mButton->setVisible(visible);
|
||||
|
||||
@@ -80,7 +80,6 @@ public:
|
||||
|
||||
virtual void draw();
|
||||
virtual void onFocusLost();
|
||||
virtual void onLostTop();
|
||||
|
||||
virtual void setEnabled(BOOL enabled);
|
||||
|
||||
@@ -212,6 +211,7 @@ private:
|
||||
bool mSuppressTentative;
|
||||
void (*mPrearrangeCallback)(LLUICtrl*,void*);
|
||||
void (*mTextEntryCallback)(LLLineEditor*, void*);
|
||||
boost::signals2::connection mTopLostSignalConnection;
|
||||
};
|
||||
|
||||
class LLFlyoutButton : public LLComboBox
|
||||
|
||||
@@ -2,31 +2,25 @@
|
||||
* @file llfocusmgr.cpp
|
||||
* @brief LLFocusMgr base class
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
@@ -38,13 +32,11 @@
|
||||
|
||||
const F32 FOCUS_FADE_TIME = 0.3f;
|
||||
|
||||
// NOTE: the LLFocusableElement implementation has been here from lluictrl.cpp.
|
||||
|
||||
LLFocusableElement::LLFocusableElement()
|
||||
: mFocusLostCallback(NULL),
|
||||
mFocusReceivedCallback(NULL),
|
||||
mFocusChangedCallback(NULL),
|
||||
mFocusCallbackUserData(NULL)
|
||||
mTopLostCallback(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -63,31 +55,27 @@ BOOL LLFocusableElement::handleUnicodeChar(llwchar uni_char, BOOL called_from_pa
|
||||
// virtual
|
||||
LLFocusableElement::~LLFocusableElement()
|
||||
{
|
||||
delete mFocusLostCallback;
|
||||
delete mFocusReceivedCallback;
|
||||
delete mFocusChangedCallback;
|
||||
delete mTopLostCallback;
|
||||
}
|
||||
|
||||
void LLFocusableElement::onFocusReceived()
|
||||
{
|
||||
if( mFocusReceivedCallback )
|
||||
{
|
||||
mFocusReceivedCallback( this, mFocusCallbackUserData );
|
||||
}
|
||||
if( mFocusChangedCallback )
|
||||
{
|
||||
mFocusChangedCallback( this, mFocusCallbackUserData );
|
||||
}
|
||||
if (mFocusReceivedCallback) (*mFocusReceivedCallback)(this);
|
||||
if (mFocusChangedCallback) (*mFocusChangedCallback)(this);
|
||||
}
|
||||
|
||||
void LLFocusableElement::onFocusLost()
|
||||
{
|
||||
if( mFocusLostCallback )
|
||||
{
|
||||
mFocusLostCallback( this, mFocusCallbackUserData );
|
||||
}
|
||||
if (mFocusLostCallback) (*mFocusLostCallback)(this);
|
||||
if (mFocusChangedCallback) (*mFocusChangedCallback)(this);
|
||||
}
|
||||
|
||||
if( mFocusChangedCallback )
|
||||
{
|
||||
mFocusChangedCallback( this, mFocusCallbackUserData );
|
||||
}
|
||||
void LLFocusableElement::onTopLost()
|
||||
{
|
||||
if (mTopLostCallback) (*mTopLostCallback)(this);
|
||||
}
|
||||
|
||||
BOOL LLFocusableElement::hasFocus() const
|
||||
@@ -99,28 +87,63 @@ void LLFocusableElement::setFocus(BOOL b)
|
||||
{
|
||||
}
|
||||
|
||||
boost::signals2::connection LLFocusableElement::setFocusLostCallback( const focus_signal_t::slot_type& cb)
|
||||
{
|
||||
if (!mFocusLostCallback) mFocusLostCallback = new focus_signal_t();
|
||||
return mFocusLostCallback->connect(cb);
|
||||
}
|
||||
|
||||
boost::signals2::connection LLFocusableElement::setFocusReceivedCallback(const focus_signal_t::slot_type& cb)
|
||||
{
|
||||
if (!mFocusReceivedCallback) mFocusReceivedCallback = new focus_signal_t();
|
||||
return mFocusReceivedCallback->connect(cb);
|
||||
}
|
||||
|
||||
boost::signals2::connection LLFocusableElement::setFocusChangedCallback(const focus_signal_t::slot_type& cb)
|
||||
{
|
||||
if (!mFocusChangedCallback) mFocusChangedCallback = new focus_signal_t();
|
||||
return mFocusChangedCallback->connect(cb);
|
||||
}
|
||||
|
||||
boost::signals2::connection LLFocusableElement::setTopLostCallback(const focus_signal_t::slot_type& cb)
|
||||
{
|
||||
if (!mTopLostCallback) mTopLostCallback = new focus_signal_t();
|
||||
return mTopLostCallback->connect(cb);
|
||||
}
|
||||
|
||||
|
||||
|
||||
typedef std::list<LLHandle<LLView> > view_handle_list_t;
|
||||
typedef std::map<LLHandle<LLView>, LLHandle<LLView> > focus_history_map_t;
|
||||
struct LLFocusMgr::Impl
|
||||
{
|
||||
// caching list of keyboard focus ancestors for calling onFocusReceived and onFocusLost
|
||||
view_handle_list_t mCachedKeyboardFocusList;
|
||||
|
||||
focus_history_map_t mFocusHistory;
|
||||
};
|
||||
|
||||
LLFocusMgr gFocusMgr;
|
||||
|
||||
LLFocusMgr::LLFocusMgr()
|
||||
:
|
||||
mLockedView( NULL ),
|
||||
: mLockedView( NULL ),
|
||||
mMouseCaptor( NULL ),
|
||||
mKeyboardFocus( NULL ),
|
||||
mLastKeyboardFocus( NULL ),
|
||||
mDefaultKeyboardFocus( NULL ),
|
||||
mKeystrokesOnly(FALSE),
|
||||
mTopCtrl( NULL ),
|
||||
mFocusWeight(0.f),
|
||||
mAppHasFocus(TRUE) // Macs don't seem to notify us that we've gotten focus, so default to true
|
||||
#ifdef _DEBUG
|
||||
, mMouseCaptorName("none")
|
||||
, mKeyboardFocusName("none")
|
||||
, mTopCtrlName("none")
|
||||
#endif
|
||||
mAppHasFocus(TRUE), // Macs don't seem to notify us that we've gotten focus, so default to true
|
||||
mImpl(new LLFocusMgr::Impl)
|
||||
{
|
||||
}
|
||||
|
||||
LLFocusMgr::~LLFocusMgr()
|
||||
{
|
||||
mImpl->mFocusHistory.clear();
|
||||
delete mImpl;
|
||||
mImpl = NULL;
|
||||
}
|
||||
|
||||
void LLFocusMgr::releaseFocusIfNeeded( const LLView* view )
|
||||
{
|
||||
@@ -151,6 +174,12 @@ void LLFocusMgr::releaseFocusIfNeeded( const LLView* view )
|
||||
|
||||
void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, BOOL lock, BOOL keystrokes_only)
|
||||
{
|
||||
// notes if keyboard focus is changed again (by onFocusLost/onFocusReceived)
|
||||
// making the rest of our processing unnecessary since it will already be
|
||||
// handled by the recursive call
|
||||
static bool focus_dirty;
|
||||
focus_dirty = false;
|
||||
|
||||
if (mLockedView &&
|
||||
(new_focus == NULL ||
|
||||
(new_focus != mLockedView
|
||||
@@ -162,8 +191,6 @@ void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, BOOL lock, BOOL
|
||||
return;
|
||||
}
|
||||
|
||||
//llinfos << "Keyboard focus handled by " << (new_focus ? new_focus->getName() : "nothing") << llendl;
|
||||
|
||||
mKeystrokesOnly = keystrokes_only;
|
||||
|
||||
if( new_focus != mKeyboardFocus )
|
||||
@@ -171,23 +198,58 @@ void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, BOOL lock, BOOL
|
||||
mLastKeyboardFocus = mKeyboardFocus;
|
||||
mKeyboardFocus = new_focus;
|
||||
|
||||
if( mLastKeyboardFocus )
|
||||
// list of the focus and it's ancestors
|
||||
view_handle_list_t old_focus_list = mImpl->mCachedKeyboardFocusList;
|
||||
view_handle_list_t new_focus_list;
|
||||
|
||||
// walk up the tree to root and add all views to the new_focus_list
|
||||
for (LLView* ctrl = dynamic_cast<LLView*>(mKeyboardFocus); ctrl; ctrl = ctrl->getParent())
|
||||
{
|
||||
mLastKeyboardFocus->onFocusLost();
|
||||
new_focus_list.push_back(ctrl->getHandle());
|
||||
}
|
||||
|
||||
// clear out any existing flash
|
||||
if (new_focus)
|
||||
// remove all common ancestors since their focus is unchanged
|
||||
while (!new_focus_list.empty() &&
|
||||
!old_focus_list.empty() &&
|
||||
new_focus_list.back() == old_focus_list.back())
|
||||
{
|
||||
mFocusWeight = 0.f;
|
||||
new_focus->onFocusReceived();
|
||||
new_focus_list.pop_back();
|
||||
old_focus_list.pop_back();
|
||||
}
|
||||
mFocusTimer.reset();
|
||||
|
||||
#ifdef _DEBUG
|
||||
LLUICtrl* focus_ctrl = dynamic_cast<LLUICtrl*>(new_focus);
|
||||
mKeyboardFocusName = focus_ctrl ? focus_ctrl->getName() : std::string("none");
|
||||
#endif
|
||||
// walk up the old focus branch calling onFocusLost
|
||||
// we bubble up the tree to release focus, and back down to add
|
||||
for (view_handle_list_t::iterator old_focus_iter = old_focus_list.begin();
|
||||
old_focus_iter != old_focus_list.end() && !focus_dirty;
|
||||
old_focus_iter++)
|
||||
{
|
||||
LLView* old_focus_view = old_focus_iter->get();
|
||||
if (old_focus_view)
|
||||
{
|
||||
mImpl->mCachedKeyboardFocusList.pop_front();
|
||||
old_focus_view->onFocusLost();
|
||||
}
|
||||
}
|
||||
|
||||
// walk down the new focus branch calling onFocusReceived
|
||||
for (view_handle_list_t::reverse_iterator new_focus_riter = new_focus_list.rbegin();
|
||||
new_focus_riter != new_focus_list.rend() && !focus_dirty;
|
||||
new_focus_riter++)
|
||||
{
|
||||
LLView* new_focus_view = new_focus_riter->get();
|
||||
if (new_focus_view)
|
||||
{
|
||||
mImpl->mCachedKeyboardFocusList.push_front(new_focus_view->getHandle());
|
||||
new_focus_view->onFocusReceived();
|
||||
}
|
||||
}
|
||||
|
||||
// if focus was changed as part of an onFocusLost or onFocusReceived call
|
||||
// stop iterating on current list since it is now invalid
|
||||
if (focus_dirty)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// If we've got a default keyboard focus, and the caller is
|
||||
// releasing keyboard focus, move to the default.
|
||||
@@ -212,7 +274,7 @@ void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, BOOL lock, BOOL
|
||||
if (focus_subtree)
|
||||
{
|
||||
LLView* focused_view = dynamic_cast<LLView*>(mKeyboardFocus);
|
||||
mFocusHistory[focus_subtree->getHandle()] = focused_view ? focused_view->getHandle() : LLHandle<LLView>();
|
||||
mImpl->mFocusHistory[focus_subtree->getHandle()] = focused_view ? focused_view->getHandle() : LLHandle<LLView>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,6 +282,8 @@ void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, BOOL lock, BOOL
|
||||
{
|
||||
lockFocus();
|
||||
}
|
||||
|
||||
focus_dirty = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -241,7 +305,7 @@ BOOL LLFocusMgr::childHasKeyboardFocus(const LLView* parent ) const
|
||||
// Returns TRUE is parent or any descedent of parent is the mouse captor.
|
||||
BOOL LLFocusMgr::childHasMouseCapture( const LLView* parent ) const
|
||||
{
|
||||
if( mMouseCaptor && mMouseCaptor->isView() )
|
||||
if( mMouseCaptor && dynamic_cast<LLView*>(mMouseCaptor) != NULL )
|
||||
{
|
||||
LLView* captor_view = (LLView*)mMouseCaptor;
|
||||
while( captor_view )
|
||||
@@ -268,65 +332,42 @@ void LLFocusMgr::removeKeyboardFocusWithoutCallback( const LLFocusableElement* f
|
||||
if( mKeyboardFocus == focus )
|
||||
{
|
||||
mKeyboardFocus = NULL;
|
||||
#ifdef _DEBUG
|
||||
mKeyboardFocusName = std::string("none");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LLFocusMgr::setMouseCapture( LLMouseHandler* new_captor )
|
||||
{
|
||||
//if (mFocusLocked)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
|
||||
if( new_captor != mMouseCaptor )
|
||||
{
|
||||
LLMouseHandler* old_captor = mMouseCaptor;
|
||||
mMouseCaptor = new_captor;
|
||||
/*
|
||||
if (new_captor)
|
||||
|
||||
if (LLView::sDebugMouseHandling)
|
||||
{
|
||||
if ( new_captor->getName() == "Stickto")
|
||||
if (new_captor)
|
||||
{
|
||||
llinfos << "New mouse captor: " << new_captor->getName() << llendl;
|
||||
}
|
||||
else
|
||||
{
|
||||
llinfos << "New mouse captor: " << new_captor->getName() << llendl;
|
||||
llinfos << "New mouse captor: NULL" << llendl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
llinfos << "New mouse captor: NULL" << llendl;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
if( old_captor )
|
||||
{
|
||||
old_captor->onMouseCaptureLost();
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
mMouseCaptorName = new_captor ? new_captor->getName() : std::string("none");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void LLFocusMgr::removeMouseCaptureWithoutCallback( const LLMouseHandler* captor )
|
||||
{
|
||||
//if (mFocusLocked)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
if( mMouseCaptor == captor )
|
||||
{
|
||||
mMouseCaptor = NULL;
|
||||
#ifdef _DEBUG
|
||||
mMouseCaptorName = std::string("none");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,13 +396,9 @@ void LLFocusMgr::setTopCtrl( LLUICtrl* new_top )
|
||||
{
|
||||
mTopCtrl = new_top;
|
||||
|
||||
#ifdef _DEBUG
|
||||
mTopCtrlName = new_top ? new_top->getName() : std::string("none");
|
||||
#endif
|
||||
|
||||
if (old_top)
|
||||
{
|
||||
old_top->onLostTop();
|
||||
old_top->onTopLost();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -371,9 +408,6 @@ void LLFocusMgr::removeTopCtrlWithoutCallback( const LLUICtrl* top_view )
|
||||
if( mTopCtrl == top_view )
|
||||
{
|
||||
mTopCtrl = NULL;
|
||||
#ifdef _DEBUG
|
||||
mTopCtrlName = std::string("none");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -389,12 +423,13 @@ void LLFocusMgr::unlockFocus()
|
||||
|
||||
F32 LLFocusMgr::getFocusFlashAmt() const
|
||||
{
|
||||
return clamp_rescale(getFocusTime(), 0.f, FOCUS_FADE_TIME, mFocusWeight, 0.f);
|
||||
return clamp_rescale(mFocusFlashTimer.getElapsedTimeF32(), 0.f, FOCUS_FADE_TIME, 1.f, 0.f);
|
||||
}
|
||||
|
||||
LLColor4 LLFocusMgr::getFocusColor() const
|
||||
{
|
||||
LLColor4 focus_color = lerp(LLUI::sColorsGroup->getColor( "FocusColor" ), LLColor4::white, getFocusFlashAmt());
|
||||
static LLCachedControl<LLColor4> focus_color_cached(*LLUI::sColorsGroup,"FocusColor", LLColor4::white);
|
||||
LLColor4 focus_color = lerp(focus_color_cached, LLColor4::white, getFocusFlashAmt());
|
||||
// de-emphasize keyboard focus when app has lost focus (to avoid typing into wrong window problem)
|
||||
if (!mAppHasFocus)
|
||||
{
|
||||
@@ -405,8 +440,7 @@ LLColor4 LLFocusMgr::getFocusColor() const
|
||||
|
||||
void LLFocusMgr::triggerFocusFlash()
|
||||
{
|
||||
mFocusTimer.reset();
|
||||
mFocusWeight = 1.f;
|
||||
mFocusFlashTimer.reset();
|
||||
}
|
||||
|
||||
void LLFocusMgr::setAppHasFocus(BOOL focus)
|
||||
@@ -428,8 +462,8 @@ LLUICtrl* LLFocusMgr::getLastFocusForGroup(LLView* subtree_root) const
|
||||
{
|
||||
if (subtree_root)
|
||||
{
|
||||
focus_history_map_t::const_iterator found_it = mFocusHistory.find(subtree_root->getHandle());
|
||||
if (found_it != mFocusHistory.end())
|
||||
focus_history_map_t::const_iterator found_it = mImpl->mFocusHistory.find(subtree_root->getHandle());
|
||||
if (found_it != mImpl->mFocusHistory.end())
|
||||
{
|
||||
// found last focus for this subtree
|
||||
return static_cast<LLUICtrl*>(found_it->second.get());
|
||||
@@ -442,6 +476,6 @@ void LLFocusMgr::clearLastFocusForGroup(LLView* subtree_root)
|
||||
{
|
||||
if (subtree_root)
|
||||
{
|
||||
mFocusHistory.erase(subtree_root->getHandle());
|
||||
mImpl->mFocusHistory.erase(subtree_root->getHandle());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,31 +2,25 @@
|
||||
* @file llfocusmgr.h
|
||||
* @brief LLFocusMgr base class
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
@@ -38,12 +32,12 @@
|
||||
#include "llstring.h"
|
||||
#include "llframetimer.h"
|
||||
#include "llui.h"
|
||||
#include "llhandle.h"
|
||||
|
||||
class LLUICtrl;
|
||||
class LLMouseHandler;
|
||||
class LLView;
|
||||
|
||||
// NOTE: the LLFocusableElement class declaration has been moved here from lluictrl.h.
|
||||
class LLFocusableElement
|
||||
{
|
||||
friend class LLFocusMgr; // allow access to focus change handlers
|
||||
@@ -54,21 +48,25 @@ public:
|
||||
virtual void setFocus( BOOL b );
|
||||
virtual BOOL hasFocus() const;
|
||||
|
||||
void setFocusLostCallback(void (*cb)(LLFocusableElement* caller, void*), void* user_data = NULL) { mFocusLostCallback = cb; mFocusCallbackUserData = user_data; }
|
||||
void setFocusReceivedCallback( void (*cb)(LLFocusableElement*, void*), void* user_data = NULL) { mFocusReceivedCallback = cb; mFocusCallbackUserData = user_data; }
|
||||
void setFocusChangedCallback( void (*cb)(LLFocusableElement*, void*), void* user_data = NULL ) { mFocusChangedCallback = cb; mFocusCallbackUserData = user_data; }
|
||||
typedef boost::signals2::signal<void(LLFocusableElement*)> focus_signal_t;
|
||||
|
||||
boost::signals2::connection setFocusLostCallback( const focus_signal_t::slot_type& cb);
|
||||
boost::signals2::connection setFocusReceivedCallback(const focus_signal_t::slot_type& cb);
|
||||
boost::signals2::connection setFocusChangedCallback(const focus_signal_t::slot_type& cb);
|
||||
boost::signals2::connection setTopLostCallback(const focus_signal_t::slot_type& cb);
|
||||
|
||||
// These were brought up the hierarchy from LLView so that we don't have to use dynamic_cast when dealing with keyboard focus.
|
||||
virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
|
||||
virtual BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent);
|
||||
|
||||
virtual void onTopLost(); // called when registered as top ctrl and user clicks elsewhere
|
||||
protected:
|
||||
virtual void onFocusReceived();
|
||||
virtual void onFocusLost();
|
||||
void (*mFocusLostCallback)( LLFocusableElement* caller, void* userdata );
|
||||
void (*mFocusReceivedCallback)( LLFocusableElement* ctrl, void* userdata );
|
||||
void (*mFocusChangedCallback)( LLFocusableElement* ctrl, void* userdata );
|
||||
void* mFocusCallbackUserData;
|
||||
focus_signal_t* mFocusLostCallback;
|
||||
focus_signal_t* mFocusReceivedCallback;
|
||||
focus_signal_t* mFocusChangedCallback;
|
||||
focus_signal_t* mTopLostCallback;
|
||||
};
|
||||
|
||||
|
||||
@@ -76,7 +74,7 @@ class LLFocusMgr
|
||||
{
|
||||
public:
|
||||
LLFocusMgr();
|
||||
~LLFocusMgr() { mFocusHistory.clear(); }
|
||||
~LLFocusMgr();
|
||||
|
||||
// Mouse Captor
|
||||
void setMouseCapture(LLMouseHandler* new_captor); // new_captor = NULL to release the mouse.
|
||||
@@ -93,7 +91,7 @@ public:
|
||||
BOOL getKeystrokesOnly() { return mKeystrokesOnly; }
|
||||
void setKeystrokesOnly(BOOL keystrokes_only) { mKeystrokesOnly = keystrokes_only; }
|
||||
|
||||
F32 getFocusTime() const { return mFocusTimer.getElapsedTimeF32(); }
|
||||
F32 getFocusTime() const { return mFocusFlashTimer.getElapsedTimeF32(); }
|
||||
F32 getFocusFlashAmt() const;
|
||||
S32 getFocusFlashWidth() const { return llround(lerp(1.f, 3.f, getFocusFlashAmt())); }
|
||||
LLColor4 getFocusColor() const;
|
||||
@@ -121,6 +119,9 @@ public:
|
||||
void unlockFocus();
|
||||
BOOL focusLocked() const { return mLockedView != NULL; }
|
||||
|
||||
|
||||
struct Impl;
|
||||
|
||||
private:
|
||||
LLUICtrl* mLockedView;
|
||||
|
||||
@@ -132,23 +133,15 @@ private:
|
||||
LLFocusableElement* mLastKeyboardFocus; // who last had focus
|
||||
LLFocusableElement* mDefaultKeyboardFocus;
|
||||
BOOL mKeystrokesOnly;
|
||||
|
||||
|
||||
// Top View
|
||||
LLUICtrl* mTopCtrl;
|
||||
|
||||
LLFrameTimer mFocusTimer;
|
||||
F32 mFocusWeight;
|
||||
LLFrameTimer mFocusFlashTimer;
|
||||
|
||||
BOOL mAppHasFocus;
|
||||
|
||||
typedef std::map<LLHandle<LLView>, LLHandle<LLView> > focus_history_map_t;
|
||||
focus_history_map_t mFocusHistory;
|
||||
|
||||
#ifdef _DEBUG
|
||||
std::string mMouseCaptorName;
|
||||
std::string mKeyboardFocusName;
|
||||
std::string mTopCtrlName;
|
||||
#endif
|
||||
Impl * mImpl;
|
||||
};
|
||||
|
||||
extern LLFocusMgr gFocusMgr;
|
||||
|
||||
@@ -156,7 +156,8 @@ LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect,
|
||||
mGLFont = LLFontGL::getFontSansSerifSmall();
|
||||
}
|
||||
|
||||
setFocusLostCallback(focus_lost_callback);
|
||||
if(focus_lost_callback)
|
||||
setFocusLostCallback(boost::bind(focus_lost_callback,_1,(void*)NULL));
|
||||
|
||||
setTextPadding(0, 0);
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const std::string& name, const LLRect& rect
|
||||
&LLLineEditor::prevalidateFloat );
|
||||
mEditor->setFollowsLeft();
|
||||
mEditor->setFollowsBottom();
|
||||
mEditor->setFocusReceivedCallback( &LLMultiSliderCtrl::onEditorGainFocus, this );
|
||||
mEditor->setFocusReceivedCallback( boost::bind(&LLMultiSliderCtrl::onFocusReceived, this) );
|
||||
mEditor->setIgnoreTab(TRUE);
|
||||
// don't do this, as selecting the entire text is single clicking in some cases
|
||||
// and double clicking in others
|
||||
@@ -151,16 +151,6 @@ LLMultiSliderCtrl::~LLMultiSliderCtrl()
|
||||
// Children all cleaned up by default view destructor.
|
||||
}
|
||||
|
||||
// static
|
||||
void LLMultiSliderCtrl::onEditorGainFocus( LLFocusableElement* caller, void *userdata )
|
||||
{
|
||||
LLMultiSliderCtrl* self = (LLMultiSliderCtrl*) userdata;
|
||||
llassert( caller == self->mEditor );
|
||||
|
||||
self->onFocusReceived();
|
||||
}
|
||||
|
||||
|
||||
void LLMultiSliderCtrl::setValue(const LLSD& value)
|
||||
{
|
||||
mMultiSlider->setValue(value);
|
||||
|
||||
@@ -126,7 +126,6 @@ public:
|
||||
static void onSliderCommit(LLUICtrl* caller, void* userdata);
|
||||
|
||||
static void onEditorCommit(LLUICtrl* ctrl, void* userdata);
|
||||
static void onEditorGainFocus(LLFocusableElement* caller, void *userdata);
|
||||
static void onEditorChangeFocus(LLUICtrl* caller, S32 direction, void *userdata);
|
||||
|
||||
private:
|
||||
|
||||
@@ -760,16 +760,6 @@ BOOL LLPanel::childHasFocus(const std::string& id)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LLPanel::childSetFocusChangedCallback(const std::string& id, void (*cb)(LLFocusableElement*, void*), void* user_data)
|
||||
{
|
||||
LLUICtrl* child = getChild<LLUICtrl>(id, true);
|
||||
if (child)
|
||||
{
|
||||
child->setFocusChangedCallback(cb, user_data);
|
||||
}
|
||||
}
|
||||
|
||||
void LLPanel::childSetCommitCallback(const std::string& id, void (*cb)(LLUICtrl*, void*), void *userdata )
|
||||
{
|
||||
LLUICtrl* child = getChild<LLUICtrl>(id, true);
|
||||
|
||||
@@ -170,7 +170,6 @@ public:
|
||||
// LLUICtrl
|
||||
void childSetFocus(const std::string& id, BOOL focus = TRUE);
|
||||
BOOL childHasFocus(const std::string& id);
|
||||
void childSetFocusChangedCallback(const std::string& id, void (*cb)(LLFocusableElement*, void*), void* user_data = NULL);
|
||||
|
||||
void childSetCommitCallback(const std::string& id, void (*cb)(LLUICtrl*, void*), void* userdata = NULL );
|
||||
void childSetDoubleClickCallback(const std::string& id, void (*cb)(void*), void* userdata = NULL );
|
||||
|
||||
@@ -578,6 +578,23 @@ void LLScrollableContainerView::setBorderVisible(BOOL b)
|
||||
mBorder->setVisible( b );
|
||||
}
|
||||
|
||||
LLRect LLScrollableContainerView::getContentWindowRect()
|
||||
{
|
||||
updateScroll();
|
||||
LLRect scroller_view_rect;
|
||||
S32 visible_width = 0;
|
||||
S32 visible_height = 0;
|
||||
BOOL show_h_scrollbar = FALSE;
|
||||
BOOL show_v_scrollbar = FALSE;
|
||||
calcVisibleSize( &visible_width, &visible_height, &show_h_scrollbar, &show_v_scrollbar );
|
||||
S32 border_width = mBorder->getBorderWidth();
|
||||
scroller_view_rect.setOriginAndSize(border_width,
|
||||
show_h_scrollbar ? mScrollbar[HORIZONTAL]->getRect().mTop : border_width,
|
||||
visible_width,
|
||||
visible_height);
|
||||
return scroller_view_rect;
|
||||
}
|
||||
|
||||
// Scroll so that as much of rect as possible is showing (where rect is defined in the space of scroller view, not scrolled)
|
||||
void LLScrollableContainerView::scrollToShowRect(const LLRect& rect, const LLCoordGL& desired_offset)
|
||||
{
|
||||
|
||||
@@ -78,7 +78,8 @@ public:
|
||||
|
||||
void scrollToShowRect( const LLRect& rect, const LLCoordGL& desired_offset );
|
||||
void setReserveScrollCorner( BOOL b ) { mReserveScrollCorner = b; }
|
||||
const LLRect& getScrolledViewRect() const { return mScrolledView->getRect(); }
|
||||
LLRect getContentWindowRect();
|
||||
const LLRect& getScrolledViewRect() const { return mScrolledView ? mScrolledView->getRect() : LLRect::null; }
|
||||
void pageUp(S32 overlap = 0);
|
||||
void pageDown(S32 overlap = 0);
|
||||
void goToTop();
|
||||
|
||||
@@ -121,7 +121,7 @@ LLSliderCtrl::LLSliderCtrl(const std::string& name, const LLRect& rect,
|
||||
&LLLineEditor::prevalidateFloat );
|
||||
mEditor->setFollowsLeft();
|
||||
mEditor->setFollowsBottom();
|
||||
mEditor->setFocusReceivedCallback( &LLSliderCtrl::onEditorGainFocus, this );
|
||||
mEditor->setFocusReceivedCallback( boost::bind(&LLSliderCtrl::onFocusReceived, this) );
|
||||
mEditor->setIgnoreTab(TRUE);
|
||||
// don't do this, as selecting the entire text is single clicking in some cases
|
||||
// and double clicking in others
|
||||
@@ -140,17 +140,6 @@ LLSliderCtrl::LLSliderCtrl(const std::string& name, const LLRect& rect,
|
||||
updateText();
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
void LLSliderCtrl::onEditorGainFocus( LLFocusableElement* caller, void *userdata )
|
||||
{
|
||||
LLSliderCtrl* self = (LLSliderCtrl*) userdata;
|
||||
llassert( caller == self->mEditor );
|
||||
|
||||
self->onFocusReceived();
|
||||
}
|
||||
|
||||
|
||||
void LLSliderCtrl::setValue(F32 v, BOOL from_event)
|
||||
{
|
||||
mSlider->setValue( v, from_event );
|
||||
|
||||
@@ -117,7 +117,6 @@ public:
|
||||
static void onSliderCommit(LLUICtrl* caller, void* userdata);
|
||||
|
||||
static void onEditorCommit(LLUICtrl* caller, void* userdata);
|
||||
static void onEditorGainFocus(LLFocusableElement* caller, void *userdata);
|
||||
static void onEditorChangeFocus(LLUICtrl* caller, S32 direction, void *userdata);
|
||||
|
||||
private:
|
||||
|
||||
@@ -126,7 +126,7 @@ LLSpinCtrl::LLSpinCtrl( const std::string& name, const LLRect& rect, const std::
|
||||
&LLLineEditor::prevalidateASCII );
|
||||
mEditor->setFollowsLeft();
|
||||
mEditor->setFollowsBottom();
|
||||
mEditor->setFocusReceivedCallback( &LLSpinCtrl::onEditorGainFocus, this );
|
||||
mEditor->setFocusReceivedCallback( boost::bind(&LLSpinCtrl::onFocusReceived, this) );
|
||||
//RN: this seems to be a BAD IDEA, as it makes the editor behavior different when it has focus
|
||||
// than when it doesn't. Instead, if you always have to double click to select all the text,
|
||||
// it's easier to understand
|
||||
@@ -243,15 +243,6 @@ void LLSpinCtrl::onDownBtn( void *userdata )
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void LLSpinCtrl::onEditorGainFocus( LLFocusableElement* caller, void *userdata )
|
||||
{
|
||||
LLSpinCtrl* self = (LLSpinCtrl*) userdata;
|
||||
llassert( caller == self->mEditor );
|
||||
|
||||
self->onFocusReceived();
|
||||
}
|
||||
|
||||
void LLSpinCtrl::setValue(const LLSD& value )
|
||||
{
|
||||
F32 v = (F32)value.asReal();
|
||||
|
||||
@@ -110,7 +110,6 @@ public:
|
||||
virtual void draw();
|
||||
|
||||
static void onEditorCommit(LLUICtrl* caller, void* userdata);
|
||||
static void onEditorGainFocus(LLFocusableElement* caller, void *userdata);
|
||||
static void onEditorChangeFocus(LLUICtrl* caller, S32 direction, void *userdata);
|
||||
|
||||
static void onUpBtn(void *userdata);
|
||||
|
||||
@@ -45,7 +45,6 @@ LLUICtrl::LLUICtrl() :
|
||||
mCommitSignal(NULL),
|
||||
mValidateSignal(NULL),
|
||||
mCommitCallback(NULL),
|
||||
mLostTopCallback(NULL),
|
||||
mValidateCallback(NULL),
|
||||
mCallbackUserData(NULL),
|
||||
mTentative(FALSE),
|
||||
@@ -64,7 +63,6 @@ LLUICtrl::LLUICtrl(const std::string& name, const LLRect& rect, BOOL mouse_opaqu
|
||||
mCommitSignal(NULL),
|
||||
mValidateSignal(NULL),
|
||||
mCommitCallback( on_commit_callback),
|
||||
mLostTopCallback( NULL ),
|
||||
mValidateCallback( NULL ),
|
||||
mCallbackUserData( callback_userdata ),
|
||||
mTentative( FALSE ),
|
||||
@@ -210,15 +208,6 @@ void LLUICtrl::onFocusLost()
|
||||
}
|
||||
}
|
||||
|
||||
void LLUICtrl::onLostTop()
|
||||
{
|
||||
if (mLostTopCallback)
|
||||
{
|
||||
mLostTopCallback(this, mCallbackUserData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// virtual
|
||||
void LLUICtrl::setTabStop( BOOL b )
|
||||
{
|
||||
|
||||
@@ -89,7 +89,6 @@ public:
|
||||
virtual void resetDirty(); //Defaults to no-op
|
||||
|
||||
// Call appropriate callbacks
|
||||
virtual void onLostTop(); // called when registered as top ctrl and user clicks elsewhere
|
||||
virtual void onCommit();
|
||||
|
||||
// Default to no-op:
|
||||
@@ -125,7 +124,6 @@ public:
|
||||
|
||||
void setCommitCallback( void (*cb)(LLUICtrl*, void*) ) { mCommitCallback = cb; }
|
||||
void setValidateBeforeCommit( BOOL(*cb)(LLUICtrl*, void*) ) { mValidateCallback = cb; }
|
||||
void setLostTopCallback( void (*cb)(LLUICtrl*, void*) ) { mLostTopCallback = cb; }
|
||||
|
||||
static LLView* fromXML(LLXMLNodePtr node, LLView* parent, class LLUICtrlFactory* factory);
|
||||
|
||||
@@ -144,7 +142,6 @@ protected:
|
||||
commit_signal_t* mCommitSignal;
|
||||
enable_signal_t* mValidateSignal;
|
||||
void (*mCommitCallback)( LLUICtrl* ctrl, void* userdata );
|
||||
void (*mLostTopCallback)( LLUICtrl* ctrl, void* userdata );
|
||||
BOOL (*mValidateCallback)( LLUICtrl* ctrl, void* userdata );
|
||||
|
||||
void* mCallbackUserData;
|
||||
|
||||
@@ -1787,6 +1787,7 @@ LLView* LLView::getRootView()
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
BOOL LLView::deleteViewByHandle(LLHandle<LLView> handle)
|
||||
{
|
||||
LLView* viewp = handle.get();
|
||||
@@ -1801,9 +1802,26 @@ BOOL LLView::deleteViewByHandle(LLHandle<LLView> handle)
|
||||
return viewp != NULL;
|
||||
}
|
||||
|
||||
LLView* LLView::findPrevSibling(LLView* child)
|
||||
{
|
||||
child_list_t::iterator prev_it = std::find(mChildList.begin(), mChildList.end(), child);
|
||||
if (prev_it != mChildList.end() && prev_it != mChildList.begin())
|
||||
{
|
||||
return *(--prev_it);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Moves the view so that it is entirely inside of constraint.
|
||||
// If the view will not fit because it's too big, aligns with the top and left.
|
||||
LLView* LLView::findNextSibling(LLView* child)
|
||||
{
|
||||
child_list_t::iterator next_it = std::find(mChildList.begin(), mChildList.end(), child);
|
||||
if (next_it != mChildList.end())
|
||||
{
|
||||
next_it++;
|
||||
}
|
||||
|
||||
return (next_it != mChildList.end()) ? *next_it : NULL;
|
||||
}
|
||||
// (Why top and left? That's where the drag bars are for floaters.)
|
||||
BOOL LLView::translateIntoRect(const LLRect& constraint, BOOL allow_partial_outside )
|
||||
{
|
||||
|
||||
@@ -372,6 +372,8 @@ public:
|
||||
LLView* getRootView();
|
||||
LLView* getParent() const { return mParentView; }
|
||||
LLView* getFirstChild() const { return (mChildList.empty()) ? NULL : *(mChildList.begin()); }
|
||||
LLView* findPrevSibling(LLView* child);
|
||||
LLView* findNextSibling(LLView* child);
|
||||
S32 getChildCount() const { return (S32)mChildList.size(); }
|
||||
template<class _Pr3> void sortChildren(_Pr3 _Pred) { mChildList.sort(_Pred); }
|
||||
BOOL hasAncestor(const LLView* parentp) const;
|
||||
|
||||
@@ -153,8 +153,8 @@ BOOL LLChatBar::postBuild()
|
||||
{
|
||||
mInputEditor->setCallbackUserData(this);
|
||||
mInputEditor->setKeystrokeCallback(&onInputEditorKeystroke);
|
||||
mInputEditor->setFocusLostCallback(&onInputEditorFocusLost, this);
|
||||
mInputEditor->setFocusReceivedCallback( &onInputEditorGainFocus, this );
|
||||
mInputEditor->setFocusLostCallback(boost::bind(&LLChatBar::onInputEditorFocusLost));
|
||||
mInputEditor->setFocusReceivedCallback(boost::bind(&LLChatBar::onInputEditorGainFocus));
|
||||
mInputEditor->setCommitOnFocusLost( FALSE );
|
||||
mInputEditor->setRevertOnEsc( FALSE );
|
||||
mInputEditor->setIgnoreTab(TRUE);
|
||||
@@ -623,14 +623,14 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata )
|
||||
}
|
||||
|
||||
// static
|
||||
void LLChatBar::onInputEditorFocusLost( LLFocusableElement* caller, void* userdata)
|
||||
void LLChatBar::onInputEditorFocusLost()
|
||||
{
|
||||
// stop typing animation
|
||||
gAgent.stopTyping();
|
||||
}
|
||||
|
||||
// static
|
||||
void LLChatBar::onInputEditorGainFocus( LLFocusableElement* caller, void* userdata )
|
||||
void LLChatBar::onInputEditorGainFocus()
|
||||
{
|
||||
LLFloaterChat::setHistoryCursorAndScrollToEnd();
|
||||
}
|
||||
|
||||
@@ -86,8 +86,8 @@ public:
|
||||
|
||||
static void onTabClick( void* userdata );
|
||||
static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata);
|
||||
static void onInputEditorFocusLost(LLFocusableElement* caller,void* userdata);
|
||||
static void onInputEditorGainFocus(LLFocusableElement* caller,void* userdata);
|
||||
static void onInputEditorFocusLost();
|
||||
static void onInputEditorGainFocus();
|
||||
|
||||
static void onCommitGesture(LLUICtrl* ctrl, void* data);
|
||||
|
||||
|
||||
@@ -1105,7 +1105,7 @@ BOOL LLPanelLandObjects::postBuild()
|
||||
mSelectedObjects = getChild<LLTextBox>("selected_objects_text");
|
||||
mCleanOtherObjectsTime = getChild<LLLineEditor>("clean other time");
|
||||
|
||||
mCleanOtherObjectsTime->setFocusLostCallback(onLostFocus, this);
|
||||
mCleanOtherObjectsTime->setFocusLostCallback(boost::bind(&LLPanelLandObjects::onLostFocus, _1, this));
|
||||
mCleanOtherObjectsTime->setCommitCallback(onCommitClean);
|
||||
|
||||
childSetPrevalidate("clean other time", LLLineEditor::prevalidateNonNegativeS32);
|
||||
|
||||
@@ -93,7 +93,7 @@ LLFloaterLandmark::LLFloaterLandmark(const LLSD& data)
|
||||
|
||||
mInventoryPanel->setFilterTypes(filter_types);
|
||||
//mInventoryPanel->setFilterPermMask(getFilterPermMask()); //Commented out due to no-copy texture loss.
|
||||
mInventoryPanel->setSelectCallback(boost::bind(onSelectionChange, _1, _2, (void*)this));
|
||||
mInventoryPanel->setSelectCallback(boost::bind(&LLFloaterLandmark::onSelectionChange, _1, _2, (void*)this));
|
||||
mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
|
||||
mInventoryPanel->setAllowMultiSelect(FALSE);
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ BOOL LLFloaterPostcard::postBuild()
|
||||
MsgField->setWordWrap(TRUE);
|
||||
|
||||
// For the first time a user focusess to .the msg box, all text will be selected.
|
||||
MsgField->setFocusChangedCallback(onMsgFormFocusRecieved, this);
|
||||
MsgField->setFocusChangedCallback(boost::bind(&LLFloaterPostcard::onMsgFormFocusRecieved, this, _1, MsgField));
|
||||
}
|
||||
|
||||
childSetFocus("to_form", TRUE);
|
||||
@@ -339,17 +339,12 @@ void LLFloaterPostcard::updateUserInfo(const std::string& email)
|
||||
}
|
||||
}
|
||||
|
||||
void LLFloaterPostcard::onMsgFormFocusRecieved(LLFocusableElement* receiver, void* data)
|
||||
void LLFloaterPostcard::onMsgFormFocusRecieved(LLFocusableElement* receiver, LLTextEditor* msg_form)
|
||||
{
|
||||
LLFloaterPostcard* self = (LLFloaterPostcard *)data;
|
||||
if(self)
|
||||
if(msg_form && msg_form == receiver && msg_form->hasFocus() && !(mHasFirstMsgFocus))
|
||||
{
|
||||
LLTextEditor* msgForm = self->getChild<LLTextEditor>("msg_form");
|
||||
if(msgForm && msgForm == receiver && msgForm->hasFocus() && !(self->mHasFirstMsgFocus))
|
||||
{
|
||||
self->mHasFirstMsgFocus = true;
|
||||
msgForm->setText(LLStringUtil::null);
|
||||
}
|
||||
mHasFirstMsgFocus = true;
|
||||
msg_form->setText(LLStringUtil::null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
|
||||
static void updateUserInfo(const std::string& email);
|
||||
|
||||
static void onMsgFormFocusRecieved(LLFocusableElement* receiver, void* data);
|
||||
void onMsgFormFocusRecieved(LLFocusableElement* receiver, LLTextEditor* msg_form);
|
||||
bool missingSubjMsgAlertCallback(const LLSD& notification, const LLSD& response);
|
||||
|
||||
void sendPostcard();
|
||||
|
||||
@@ -208,13 +208,9 @@ BOOL LLFloaterWorldMap::postBuild()
|
||||
|
||||
childSetAction("DoSearch", onLocationCommit, this);
|
||||
|
||||
childSetFocusChangedCallback("location", onLocationFocusChanged, this);
|
||||
|
||||
LLLineEditor *location_editor = getChild<LLLineEditor>("location");
|
||||
if (location_editor)
|
||||
{
|
||||
location_editor->setKeystrokeCallback( onSearchTextEntry );
|
||||
}
|
||||
location_editor->setFocusChangedCallback(boost::bind(&LLFloaterWorldMap::onLocationFocusChanged, this, _1));
|
||||
location_editor->setKeystrokeCallback( onSearchTextEntry );
|
||||
|
||||
childSetCommitCallback("search_results", onCommitSearchResult, this);
|
||||
childSetDoubleClickCallback("search_results", onClickTeleportBtn);
|
||||
@@ -1132,7 +1128,7 @@ void LLFloaterWorldMap::onComboTextEntry( LLLineEditor* ctrl, void* userdata )
|
||||
void LLFloaterWorldMap::onSearchTextEntry( LLLineEditor* ctrl, void* userdata )
|
||||
{
|
||||
onComboTextEntry(ctrl, userdata);
|
||||
updateSearchEnabled(ctrl, userdata);
|
||||
gFloaterWorldMap->updateSearchEnabled();
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -1239,24 +1235,21 @@ void LLFloaterWorldMap::onAvatarComboCommit( LLUICtrl* ctrl, void* userdata )
|
||||
}
|
||||
}
|
||||
|
||||
//static
|
||||
void LLFloaterWorldMap::onLocationFocusChanged( LLFocusableElement* focus, void* userdata )
|
||||
void LLFloaterWorldMap::onLocationFocusChanged( LLFocusableElement* focus )
|
||||
{
|
||||
updateSearchEnabled((LLUICtrl*)focus, userdata);
|
||||
updateSearchEnabled();
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterWorldMap::updateSearchEnabled( LLUICtrl* ctrl, void* userdata )
|
||||
void LLFloaterWorldMap::updateSearchEnabled()
|
||||
{
|
||||
LLFloaterWorldMap *self = gFloaterWorldMap;
|
||||
if (self->childHasKeyboardFocus("location") &&
|
||||
self->childGetValue("location").asString().length() > 0)
|
||||
if (childHasKeyboardFocus("location") &&
|
||||
childGetValue("location").asString().length() > 0)
|
||||
{
|
||||
self->setDefaultBtn("DoSearch");
|
||||
setDefaultBtn("DoSearch");
|
||||
}
|
||||
else
|
||||
{
|
||||
self->setDefaultBtn(NULL);
|
||||
setDefaultBtn(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -151,8 +151,8 @@ protected:
|
||||
void flyToAvatar();
|
||||
void teleportToAvatar();
|
||||
|
||||
static void updateSearchEnabled( LLUICtrl* ctrl, void* userdata );
|
||||
static void onLocationFocusChanged( LLFocusableElement* ctrl, void* userdata );
|
||||
void updateSearchEnabled();
|
||||
void onLocationFocusChanged( LLFocusableElement* focus );
|
||||
static void onLocationCommit( void* userdata );
|
||||
static void onCommitLocation( LLUICtrl* ctrl, void* userdata );
|
||||
static void onCommitSearchResult( LLUICtrl* ctrl, void* userdata );
|
||||
|
||||
@@ -1427,7 +1427,7 @@ void LLFolderView::startRenamingSelectedItem( void )
|
||||
mRenamer->setVisible( TRUE );
|
||||
// set focus will fail unless item is visible
|
||||
mRenamer->setFocus( TRUE );
|
||||
mRenamer->setLostTopCallback(onRenamerLost);
|
||||
mRenamer->setTopLostCallback(boost::bind(&LLFolderView::onRenamerLost, this));
|
||||
gFocusMgr.setTopCtrl( mRenamer );
|
||||
}
|
||||
}
|
||||
@@ -2168,11 +2168,9 @@ void LLFolderView::updateRenamerPosition()
|
||||
/// Local function definitions
|
||||
///----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//static
|
||||
void LLFolderView::onRenamerLost( LLUICtrl* renamer, void* user_data)
|
||||
void LLFolderView::onRenamerLost()
|
||||
{
|
||||
renamer->setVisible(FALSE);
|
||||
mRenamer->setVisible(FALSE);
|
||||
}
|
||||
|
||||
LLInventoryFilter* LLFolderView::getFilter()
|
||||
|
||||
@@ -251,7 +251,7 @@ protected:
|
||||
LLScrollableContainerView* mScrollContainer; // NULL if this is not a child of a scroll container.
|
||||
|
||||
static void commitRename( LLUICtrl* renamer, void* user_data );
|
||||
static void onRenamerLost( LLUICtrl* renamer, void* user_data);
|
||||
void onRenamerLost();
|
||||
|
||||
void finishRenamingItem( void );
|
||||
void closeRenamer( void );
|
||||
|
||||
@@ -1344,10 +1344,7 @@ LLFloaterIMPanel::~LLFloaterIMPanel()
|
||||
mVoiceChannel = NULL;
|
||||
|
||||
//delete focus lost callback
|
||||
if(mInputEditor)
|
||||
{
|
||||
mInputEditor->setFocusLostCallback( NULL );
|
||||
}
|
||||
mFocusLostSignal.disconnect();
|
||||
}
|
||||
|
||||
BOOL LLFloaterIMPanel::postBuild()
|
||||
@@ -1360,8 +1357,8 @@ BOOL LLFloaterIMPanel::postBuild()
|
||||
mRPMode = false;
|
||||
|
||||
mInputEditor = getChild<LLLineEditor>("chat_editor");
|
||||
mInputEditor->setFocusReceivedCallback( onInputEditorFocusReceived, this );
|
||||
mInputEditor->setFocusLostCallback( onInputEditorFocusLost, this );
|
||||
mInputEditor->setFocusReceivedCallback( boost::bind(&LLFloaterIMPanel::onInputEditorFocusReceived, this) );
|
||||
mFocusLostSignal = mInputEditor->setFocusLostCallback( boost::bind(&LLFloaterIMPanel::onInputEditorFocusLost, this) );
|
||||
mInputEditor->setKeystrokeCallback( onInputEditorKeystroke );
|
||||
mInputEditor->setCommitCallback( onCommitChat );
|
||||
mInputEditor->setCallbackUserData(this);
|
||||
@@ -2003,18 +2000,14 @@ void LLFloaterIMPanel::onCommitChat(LLUICtrl* caller, void* userdata)
|
||||
self->sendMsg();
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterIMPanel::onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata )
|
||||
void LLFloaterIMPanel::onInputEditorFocusReceived()
|
||||
{
|
||||
LLFloaterIMPanel* self= (LLFloaterIMPanel*) userdata;
|
||||
self->mHistoryEditor->setCursorAndScrollToEnd();
|
||||
mHistoryEditor->setCursorAndScrollToEnd();
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterIMPanel::onInputEditorFocusLost(LLFocusableElement* caller, void* userdata)
|
||||
void LLFloaterIMPanel::onInputEditorFocusLost()
|
||||
{
|
||||
LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
|
||||
self->setTyping(FALSE);
|
||||
setTyping(FALSE);
|
||||
}
|
||||
|
||||
// static
|
||||
|
||||
@@ -231,8 +231,8 @@ public:
|
||||
void *cargo_data, EAcceptance *accept,
|
||||
std::string& tooltip_msg);
|
||||
|
||||
static void onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata );
|
||||
static void onInputEditorFocusLost(LLFocusableElement* caller, void* userdata);
|
||||
void onInputEditorFocusReceived();
|
||||
void onInputEditorFocusLost();
|
||||
static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata);
|
||||
static void onCommitChat(LLUICtrl* caller, void* userdata);
|
||||
static void onTabClick( void* userdata );
|
||||
@@ -382,6 +382,10 @@ private:
|
||||
// Timer to detect when user has stopped typing.
|
||||
LLFrameTimer mLastKeystrokeTimer;
|
||||
|
||||
boost::signals2::connection mFocusLostSignal;
|
||||
|
||||
|
||||
|
||||
void disableWhileSessionStarting();
|
||||
|
||||
typedef std::map<LLUUID, LLStyleSP> styleMap;
|
||||
|
||||
@@ -255,14 +255,14 @@ BOOL LLPanelClassified::postBuild()
|
||||
mNameEditor = getChild<LLLineEditor>("given_name_editor");
|
||||
mNameEditor->setMaxTextLength(DB_PARCEL_NAME_LEN);
|
||||
mNameEditor->setCommitOnFocusLost(TRUE);
|
||||
mNameEditor->setFocusReceivedCallback(focusReceived, this);
|
||||
mNameEditor->setFocusReceivedCallback(boost::bind(focusReceived, _1, this));
|
||||
mNameEditor->setCommitCallback(onCommitAny);
|
||||
mNameEditor->setCallbackUserData(this);
|
||||
mNameEditor->setPrevalidate( LLLineEditor::prevalidateASCII );
|
||||
|
||||
mDescEditor = getChild<LLTextEditor>("desc_editor");
|
||||
mDescEditor->setCommitOnFocusLost(TRUE);
|
||||
mDescEditor->setFocusReceivedCallback(focusReceived, this);
|
||||
mDescEditor->setFocusReceivedCallback(boost::bind(focusReceived, _1, this));
|
||||
mDescEditor->setCommitCallback(onCommitAny);
|
||||
mDescEditor->setCallbackUserData(this);
|
||||
mDescEditor->setTabsToNextField(TRUE);
|
||||
|
||||
@@ -127,8 +127,8 @@ BOOL LLPanelGroupGeneral::postBuild()
|
||||
if(mEditCharter)
|
||||
{
|
||||
mEditCharter->setCommitCallback(onCommitAny);
|
||||
mEditCharter->setFocusReceivedCallback(onFocusEdit, this);
|
||||
mEditCharter->setFocusChangedCallback(onFocusEdit, this);
|
||||
mEditCharter->setFocusReceivedCallback(boost::bind(&LLPanelGroupGeneral::onFocusEdit, this));
|
||||
mEditCharter->setFocusChangedCallback(boost::bind(&LLPanelGroupGeneral::onFocusEdit, this));
|
||||
mEditCharter->setCallbackUserData(this);
|
||||
}
|
||||
|
||||
@@ -279,15 +279,12 @@ BOOL LLPanelGroupGeneral::postBuild()
|
||||
return LLPanelGroupTab::postBuild();
|
||||
}
|
||||
|
||||
// static
|
||||
void LLPanelGroupGeneral::onFocusEdit(LLFocusableElement* ctrl, void* data)
|
||||
void LLPanelGroupGeneral::onFocusEdit()
|
||||
{
|
||||
LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data;
|
||||
self->updateChanged();
|
||||
self->notifyObservers();
|
||||
updateChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
// static
|
||||
void LLPanelGroupGeneral::onCommitAny(LLUICtrl* ctrl, void* data)
|
||||
{
|
||||
LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data;
|
||||
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
virtual void draw();
|
||||
|
||||
private:
|
||||
static void onFocusEdit(LLFocusableElement* ctrl, void* data);
|
||||
void onFocusEdit();
|
||||
static void onCommitAny(LLUICtrl* ctrl, void* data);
|
||||
static void onCommitUserOnly(LLUICtrl* ctrl, void* data);
|
||||
static void onCommitTitle(LLUICtrl* ctrl, void* data);
|
||||
|
||||
@@ -1810,7 +1810,7 @@ BOOL LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root)
|
||||
mRoleDescription->setCommitOnFocusLost(TRUE);
|
||||
mRoleDescription->setCallbackUserData(this);
|
||||
mRoleDescription->setCommitCallback(onDescriptionCommit);
|
||||
mRoleDescription->setFocusReceivedCallback(onDescriptionFocus, this);
|
||||
mRoleDescription->setFocusReceivedCallback(boost::bind(&LLPanelGroupRolesSubTab::onDescriptionFocus, this));
|
||||
|
||||
setFooterEnabled(FALSE);
|
||||
|
||||
@@ -2273,14 +2273,10 @@ void LLPanelGroupRolesSubTab::onPropertiesKey(LLLineEditor* ctrl, void* user_dat
|
||||
self->notifyObservers();
|
||||
}
|
||||
|
||||
// static
|
||||
void LLPanelGroupRolesSubTab::onDescriptionFocus(LLFocusableElement* ctrl, void* user_data)
|
||||
void LLPanelGroupRolesSubTab::onDescriptionFocus()
|
||||
{
|
||||
LLPanelGroupRolesSubTab* self = static_cast<LLPanelGroupRolesSubTab*>(user_data);
|
||||
if (!self) return;
|
||||
|
||||
self->mHasRoleChange = TRUE;
|
||||
self->notifyObservers();
|
||||
mHasRoleChange = TRUE;
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
// static
|
||||
|
||||
@@ -255,7 +255,7 @@ public:
|
||||
static void onPropertiesKey(LLLineEditor*, void*);
|
||||
|
||||
static void onDescriptionCommit(LLUICtrl*, void*);
|
||||
static void onDescriptionFocus(LLFocusableElement*, void*);
|
||||
void onDescriptionFocus();
|
||||
|
||||
static void onMemberVisibilityChange(LLUICtrl*, void*);
|
||||
void handleMemberVisibilityChange(bool value);
|
||||
|
||||
@@ -263,7 +263,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
|
||||
#if !USE_VIEWER_AUTH
|
||||
LLComboBox* name_combo = sInstance->getChild<LLComboBox>("name_combo");
|
||||
name_combo->setCommitCallback(onSelectLoginEntry);
|
||||
name_combo->setFocusLostCallback(onLoginComboLostFocus);
|
||||
name_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onLoginComboLostFocus, this, name_combo));
|
||||
name_combo->setPrevalidate(LLLineEditor::prevalidatePrintableNotPipe);
|
||||
name_combo->setSuppressTentative(true);
|
||||
name_combo->setSuppressAutoComplete(true);
|
||||
@@ -1242,17 +1242,12 @@ void LLPanelLogin::onSelectLoginEntry(LLUICtrl* ctrl, void* data)
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void LLPanelLogin::onLoginComboLostFocus(LLFocusableElement* fe, void*)
|
||||
void LLPanelLogin::onLoginComboLostFocus(LLComboBox* combo_box)
|
||||
{
|
||||
if (sInstance)
|
||||
if(combo_box->isTextDirty())
|
||||
{
|
||||
LLComboBox* combo = sInstance->getChild<LLComboBox>("name_combo");
|
||||
if(fe == combo && combo->isTextDirty())
|
||||
{
|
||||
clearPassword();
|
||||
combo->resetTextDirty();
|
||||
}
|
||||
clearPassword();
|
||||
combo_box->resetTextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "llsavedlogins.h"
|
||||
|
||||
class LLUIImage;
|
||||
class LLComboBox;
|
||||
|
||||
// <edit>
|
||||
extern std::string gFullName;
|
||||
@@ -118,7 +119,7 @@ private:
|
||||
//static void onSelectServer(LLUICtrl*, void*);
|
||||
//static void onServerComboLostFocus(LLFocusableElement*, void*);
|
||||
static void onSelectLoginEntry(LLUICtrl*, void*);
|
||||
static void onLoginComboLostFocus(LLFocusableElement* fe, void*);
|
||||
void onLoginComboLostFocus(LLComboBox* combo_box);
|
||||
static void onNameCheckChanged(LLUICtrl* ctrl, void* data);
|
||||
static void clearPassword();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user