summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorMonroe Williams <monroe@lindenlab.com>2009-08-27 19:00:18 +0000
committerMonroe Williams <monroe@lindenlab.com>2009-08-27 19:00:18 +0000
commit745845f79987e4b4ab7f5728746a0eda8898930f (patch)
treef10efd4a638a6a7eda92a960cdb97e5256ff736a /indra/llui
parent71344b233d5ae3d5262a492b636af04544952611 (diff)
svn merge -r 129841:129910 svn+ssh://svn.lindenlab.com/svn/linden/branches/moss/pluginapi_05-merge@129910
svn merge -r 129913:131718 svn+ssh://svn.lindenlab.com/svn/linden/branches/pluginapi/pluginapi_05 Some branch shenannigans in the pluginapi_05 branch caused this to become a two-part merge.
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/CMakeLists.txt2
-rw-r--r--indra/llui/llbutton.cpp10
-rw-r--r--indra/llui/llbutton.h3
-rw-r--r--indra/llui/llfloater.cpp6
-rw-r--r--indra/llui/llfocusmgr.cpp95
-rw-r--r--indra/llui/llfocusmgr.h54
-rw-r--r--indra/llui/lliconctrl.cpp8
-rw-r--r--indra/llui/lliconctrl.h2
-rw-r--r--indra/llui/lllineeditor.cpp1
-rw-r--r--indra/llui/llmultisliderctrl.cpp3
-rw-r--r--indra/llui/llpanel.cpp19
-rw-r--r--indra/llui/llpanel.h6
-rw-r--r--indra/llui/llsliderctrl.cpp2
-rw-r--r--indra/llui/llspinctrl.cpp1
-rw-r--r--indra/llui/lltexteditor.cpp2
-rw-r--r--indra/llui/llui.cpp1
-rw-r--r--indra/llui/lluictrl.cpp61
-rw-r--r--indra/llui/lluictrl.h32
-rw-r--r--indra/llui/llview.cpp6
-rw-r--r--indra/llui/llview.h14
20 files changed, 194 insertions, 134 deletions
diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt
index 7f71ff6a53..8b0fcc68c4 100644
--- a/indra/llui/CMakeLists.txt
+++ b/indra/llui/CMakeLists.txt
@@ -3,7 +3,6 @@
project(llui)
include(00-Common)
-include(LLAudio)
include(LLCommon)
include(LLImage)
include(LLMath)
@@ -15,7 +14,6 @@ include(LLXML)
include(LLXUIXML)
include_directories(
- ${LLAUDIO_INCLUDE_DIRS}
${LLCOMMON_INCLUDE_DIRS}
${LLIMAGE_INCLUDE_DIRS}
${LLMATH_INCLUDE_DIRS}
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index b13b250c75..98e8c9a988 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -937,6 +937,16 @@ void LLButton::setColor(const LLColor4& color)
setImageColor(color);
}
+void LLButton::setAlpha(F32 alpha)
+{
+ LLColor4 temp = mImageColor.get();
+ temp.setAlpha(alpha);
+ mImageColor.set(temp);
+
+ temp = mDisabledImageColor.get();
+ temp.setAlpha(alpha * 0.5f);
+ mDisabledImageColor.set(temp);
+}
void LLButton::setImageDisabled(LLPointer<LLUIImage> image)
{
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index 249882013a..e51cd443fa 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -190,7 +190,8 @@ public:
void setImageColor(const std::string& color_control);
void setImageColor(const LLColor4& c);
- virtual void setColor(const LLColor4& c);
+ /*virtual*/ void setColor(const LLColor4& c);
+ /*virtual*/ void setAlpha(F32 alpha);
void setImages(const std::string &image_name, const std::string &selected_name);
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 2679143bbc..ca3829e1bd 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -1595,9 +1595,9 @@ void LLFloater::draw()
{
if (hasFocus() && getDefaultButton()->getEnabled())
{
- LLUICtrl* focus_ctrl = gFocusMgr.getKeyboardFocus();
+ LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus();
// is this button a direct descendent and not a nested widget (e.g. checkbox)?
- BOOL focus_is_child_button = dynamic_cast<LLButton*>(focus_ctrl) != NULL && focus_ctrl->getParent() == this;
+ BOOL focus_is_child_button = dynamic_cast<LLButton*>(focus_ctrl) != NULL && dynamic_cast<LLButton*>(focus_ctrl)->getParent() == this;
// only enable default button when current focus is not a button
getDefaultButton()->setBorderEnabled(!focus_is_child_button);
}
@@ -1617,7 +1617,7 @@ void LLFloater::draw()
else
{
// draw children
- LLView* focused_child = gFocusMgr.getKeyboardFocus();
+ LLView* focused_child = dynamic_cast<LLView*>(gFocusMgr.getKeyboardFocus());
BOOL focused_child_visible = FALSE;
if (focused_child && focused_child->getParent() == this)
{
diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp
index b8142216fc..60ddbc6cb3 100644
--- a/indra/llui/llfocusmgr.cpp
+++ b/indra/llui/llfocusmgr.cpp
@@ -38,6 +38,77 @@
const F32 FOCUS_FADE_TIME = 0.3f;
+// NOTE: the LLFocusableElement implementation has been moved here from lluictrl.cpp.
+
+LLFocusableElement::LLFocusableElement()
+: mFocusLostCallback(NULL),
+ mFocusReceivedCallback(NULL),
+ mFocusChangedCallback(NULL),
+ mTopLostCallback(NULL),
+ mFocusCallbackUserData(NULL)
+{
+}
+
+// virtual
+BOOL LLFocusableElement::handleKey(KEY key, MASK mask, BOOL called_from_parent)
+{
+ return FALSE;
+}
+
+// virtual
+BOOL LLFocusableElement::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent)
+{
+ return FALSE;
+}
+
+// virtual
+LLFocusableElement::~LLFocusableElement()
+{
+}
+
+void LLFocusableElement::onFocusReceived()
+{
+ if( mFocusReceivedCallback )
+ {
+ mFocusReceivedCallback( this, mFocusCallbackUserData );
+ }
+ if( mFocusChangedCallback )
+ {
+ mFocusChangedCallback( this, mFocusCallbackUserData );
+ }
+}
+
+void LLFocusableElement::onFocusLost()
+{
+ if( mFocusLostCallback )
+ {
+ mFocusLostCallback( this, mFocusCallbackUserData );
+ }
+
+ if( mFocusChangedCallback )
+ {
+ mFocusChangedCallback( this, mFocusCallbackUserData );
+ }
+}
+
+void LLFocusableElement::onTopLost()
+{
+ if (mTopLostCallback)
+ {
+ mTopLostCallback(this, mFocusCallbackUserData);
+ }
+}
+
+BOOL LLFocusableElement::hasFocus() const
+{
+ return gFocusMgr.getKeyboardFocus() == this;
+}
+
+void LLFocusableElement::setFocus(BOOL b)
+{
+}
+
+
LLFocusMgr gFocusMgr;
LLFocusMgr::LLFocusMgr()
@@ -86,7 +157,7 @@ void LLFocusMgr::releaseFocusIfNeeded( const LLView* view )
}
-void LLFocusMgr::setKeyboardFocus(LLUICtrl* new_focus, BOOL lock, BOOL keystrokes_only)
+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
@@ -96,7 +167,9 @@ void LLFocusMgr::setKeyboardFocus(LLUICtrl* new_focus, BOOL lock, BOOL keystroke
if (mLockedView &&
(new_focus == NULL ||
- (new_focus != mLockedView && !new_focus->hasAncestor(mLockedView))))
+ (new_focus != mLockedView
+ && dynamic_cast<LLView*>(new_focus)
+ && !dynamic_cast<LLView*>(new_focus)->hasAncestor(mLockedView))))
{
// don't allow focus to go to anything that is not the locked focus
// or one of its descendants
@@ -115,7 +188,7 @@ void LLFocusMgr::setKeyboardFocus(LLUICtrl* new_focus, BOOL lock, BOOL keystroke
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 = mKeyboardFocus; ctrl && ctrl != LLUI::getRootView(); ctrl = ctrl->getParent())
+ for (LLView* ctrl = dynamic_cast<LLView*>(mKeyboardFocus); ctrl && ctrl != LLUI::getRootView(); ctrl = ctrl->getParent())
{
if (ctrl)
{
@@ -167,7 +240,8 @@ void LLFocusMgr::setKeyboardFocus(LLUICtrl* new_focus, BOOL lock, BOOL keystroke
}
#ifdef _DEBUG
- mKeyboardFocusName = new_focus ? new_focus->getName() : std::string("none");
+ LLUICtrl* focus_ctrl = dynamic_cast<LLUICtrl*>(new_focus);
+ mKeyboardFocusName = focus_ctrl ? focus_ctrl->getName() : std::string("none");
#endif
// If we've got a default keyboard focus, and the caller is
@@ -177,8 +251,8 @@ void LLFocusMgr::setKeyboardFocus(LLUICtrl* new_focus, BOOL lock, BOOL keystroke
mDefaultKeyboardFocus->setFocus(TRUE);
}
- LLView* focus_subtree = mKeyboardFocus;
- LLView* viewp = mKeyboardFocus;
+ LLView* focus_subtree = dynamic_cast<LLView*>(mKeyboardFocus);
+ LLView* viewp = dynamic_cast<LLView*>(mKeyboardFocus);
// find root-most focus root
while(viewp)
{
@@ -192,7 +266,8 @@ void LLFocusMgr::setKeyboardFocus(LLUICtrl* new_focus, BOOL lock, BOOL keystroke
if (focus_subtree)
{
- mFocusHistory[focus_subtree->getHandle()] = mKeyboardFocus ? mKeyboardFocus->getHandle() : LLHandle<LLView>();
+ LLView* focused_view = dynamic_cast<LLView*>(mKeyboardFocus);
+ mFocusHistory[focus_subtree->getHandle()] = focused_view ? focused_view->getHandle() : LLHandle<LLView>();
}
}
@@ -208,7 +283,7 @@ void LLFocusMgr::setKeyboardFocus(LLUICtrl* new_focus, BOOL lock, BOOL keystroke
// Returns TRUE is parent or any descedent of parent has keyboard focus.
BOOL LLFocusMgr::childHasKeyboardFocus(const LLView* parent ) const
{
- LLView* focus_view = mKeyboardFocus;
+ LLView* focus_view = dynamic_cast<LLView*>(mKeyboardFocus);
while( focus_view )
{
if( focus_view == parent )
@@ -238,7 +313,7 @@ BOOL LLFocusMgr::childHasMouseCapture( const LLView* parent ) const
return FALSE;
}
-void LLFocusMgr::removeKeyboardFocusWithoutCallback( const LLView* focus )
+void LLFocusMgr::removeKeyboardFocusWithoutCallback( const LLFocusableElement* focus )
{
// should be ok to unlock here, as you have to know the locked view
// in order to unlock it
@@ -356,7 +431,7 @@ void LLFocusMgr::removeTopCtrlWithoutCallback( const LLUICtrl* top_view )
void LLFocusMgr::lockFocus()
{
- mLockedView = mKeyboardFocus;
+ mLockedView = dynamic_cast<LLUICtrl*>(mKeyboardFocus);
}
void LLFocusMgr::unlockFocus()
diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h
index fbe0d22084..d0adadd6d3 100644
--- a/indra/llui/llfocusmgr.h
+++ b/indra/llui/llfocusmgr.h
@@ -37,10 +37,44 @@
#include "llstring.h"
#include "llframetimer.h"
-#include "llview.h"
+#include "llui.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
+public:
+ LLFocusableElement();
+ virtual ~LLFocusableElement();
+
+ virtual void setFocus( BOOL b );
+ virtual BOOL hasFocus() const;
+
+ typedef boost::function<void(LLFocusableElement*, void*)> focus_callback_t;
+ void setFocusLostCallback(focus_callback_t cb, void* user_data = NULL) { mFocusLostCallback = cb; mFocusCallbackUserData = user_data; }
+ void setFocusReceivedCallback(focus_callback_t cb, void* user_data = NULL) { mFocusReceivedCallback = cb; mFocusCallbackUserData = user_data; }
+ void setFocusChangedCallback(focus_callback_t cb, void* user_data = NULL ) { mFocusChangedCallback = cb; mFocusCallbackUserData = user_data; }
+ void setTopLostCallback(focus_callback_t cb, void* user_data = NULL ) { mTopLostCallback = cb; mFocusCallbackUserData = user_data; }
+
+ // 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);
+
+protected:
+ virtual void onFocusReceived();
+ virtual void onFocusLost();
+ virtual void onTopLost(); // called when registered as top ctrl and user clicks elsewhere
+ focus_callback_t mFocusLostCallback;
+ focus_callback_t mFocusReceivedCallback;
+ focus_callback_t mFocusChangedCallback;
+ focus_callback_t mTopLostCallback;
+ void* mFocusCallbackUserData;
+};
+
class LLFocusMgr
{
@@ -55,11 +89,11 @@ public:
BOOL childHasMouseCapture( const LLView* parent ) const;
// Keyboard Focus
- void setKeyboardFocus(LLUICtrl* new_focus, BOOL lock = FALSE, BOOL keystrokes_only = FALSE); // new_focus = NULL to release the focus.
- LLUICtrl* getKeyboardFocus() const { return mKeyboardFocus; }
- LLUICtrl* getLastKeyboardFocus() const { return mLastKeyboardFocus; }
+ void setKeyboardFocus(LLFocusableElement* new_focus, BOOL lock = FALSE, BOOL keystrokes_only = FALSE); // new_focus = NULL to release the focus.
+ LLFocusableElement* getKeyboardFocus() const { return mKeyboardFocus; }
+ LLFocusableElement* getLastKeyboardFocus() const { return mLastKeyboardFocus; }
BOOL childHasKeyboardFocus( const LLView* parent ) const;
- void removeKeyboardFocusWithoutCallback( const LLView* focus );
+ void removeKeyboardFocusWithoutCallback( const LLFocusableElement* focus );
BOOL getKeystrokesOnly() { return mKeystrokesOnly; }
void setKeystrokesOnly(BOOL keystrokes_only) { mKeystrokesOnly = keystrokes_only; }
@@ -74,8 +108,8 @@ public:
// If setKeyboardFocus(NULL) is called, and there is a non-NULL default
// keyboard focus view, focus goes there. JC
- void setDefaultKeyboardFocus(LLUICtrl* default_focus) { mDefaultKeyboardFocus = default_focus; }
- LLUICtrl* getDefaultKeyboardFocus() const { return mDefaultKeyboardFocus; }
+ void setDefaultKeyboardFocus(LLFocusableElement* default_focus) { mDefaultKeyboardFocus = default_focus; }
+ LLFocusableElement* getDefaultKeyboardFocus() const { return mDefaultKeyboardFocus; }
// Top View
@@ -97,9 +131,9 @@ private:
LLMouseHandler* mMouseCaptor; // Mouse events are premptively routed to this object
// Keyboard Focus
- LLUICtrl* mKeyboardFocus; // Keyboard events are preemptively routed to this object
- LLUICtrl* mLastKeyboardFocus; // who last had focus
- LLUICtrl* mDefaultKeyboardFocus;
+ LLFocusableElement* mKeyboardFocus; // Keyboard events are preemptively routed to this object
+ LLFocusableElement* mLastKeyboardFocus; // who last had focus
+ LLFocusableElement* mDefaultKeyboardFocus;
BOOL mKeystrokesOnly;
// caching list of keyboard focus ancestors for calling onFocusReceived and onFocusLost
diff --git a/indra/llui/lliconctrl.cpp b/indra/llui/lliconctrl.cpp
index 5c6ea663f3..673c742e7a 100644
--- a/indra/llui/lliconctrl.cpp
+++ b/indra/llui/lliconctrl.cpp
@@ -80,6 +80,14 @@ void LLIconCtrl::draw()
LLUICtrl::draw();
}
+// virtual
+void LLIconCtrl::setAlpha(F32 alpha)
+{
+ LLColor4 temp = mColor.get();
+ temp.setAlpha(alpha);
+ mColor.set(temp);
+}
+
// virtual
// value might be a string or a UUID
void LLIconCtrl::setValue(const LLSD& value )
diff --git a/indra/llui/lliconctrl.h b/indra/llui/lliconctrl.h
index ff25b0d53e..aceb70b9d5 100644
--- a/indra/llui/lliconctrl.h
+++ b/indra/llui/lliconctrl.h
@@ -71,6 +71,8 @@ public:
std::string getImageName() const;
+ /*virtual*/ void setAlpha(F32 alpha);
+
void setColor(const LLColor4& color) { mColor = color; }
private:
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 6926415c6d..5435b9ffbf 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -37,7 +37,6 @@
#include "lllineeditor.h"
#include "lltexteditor.h"
-#include "audioengine.h"
#include "llmath.h"
#include "llfontgl.h"
#include "llgl.h"
diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp
index 1523d5d527..01a3b5fdc7 100644
--- a/indra/llui/llmultisliderctrl.cpp
+++ b/indra/llui/llmultisliderctrl.cpp
@@ -34,9 +34,6 @@
#include "llmultisliderctrl.h"
-#include "audioengine.h"
-#include "sound_ids.h"
-
#include "llmath.h"
#include "llfontgl.h"
#include "llgl.h"
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 667a3e10c4..0b987bfcb5 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -190,14 +190,19 @@ void LLPanel::draw()
LLView::draw();
}
+/*virtual*/
+void LLPanel::setAlpha(F32 alpha)
+{
+ mBgColorOpaque.setAlpha(alpha);
+}
+
void LLPanel::updateDefaultBtn()
{
if( mDefaultBtn)
{
if (gFocusMgr.childHasKeyboardFocus( this ) && mDefaultBtn->getEnabled())
{
- LLUICtrl* focus_ctrl = gFocusMgr.getKeyboardFocus();
- LLButton* buttonp = dynamic_cast<LLButton*>(focus_ctrl);
+ LLButton* buttonp = dynamic_cast<LLButton*>(gFocusMgr.getKeyboardFocus());
BOOL focus_is_child_button = buttonp && buttonp->getCommitOnReturn();
// only enable default button when current focus is not a return-capturing button
mDefaultBtn->setBorderEnabled(!focus_is_child_button);
@@ -245,7 +250,7 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask )
{
BOOL handled = FALSE;
- LLUICtrl* cur_focus = gFocusMgr.getKeyboardFocus();
+ LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
// handle user hitting ESC to defocus
if (key == KEY_ESCAPE)
@@ -696,6 +701,14 @@ void LLPanel::childSetColor(const std::string& id, const LLColor4& color)
child->setColor(color);
}
}
+void LLPanel::childSetAlpha(const std::string& id, F32 alpha)
+{
+ LLUICtrl* child = getChild<LLUICtrl>(id, true);
+ if (child)
+ {
+ child->setAlpha(alpha);
+ }
+}
LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(const std::string& id) const
{
diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h
index 3ee11483c3..28cd4d2799 100644
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -117,6 +117,8 @@ public:
// From LLFocusableElement
/*virtual*/ void setFocus( BOOL b );
+ virtual void setAlpha(F32 alpha);
+
// New virtuals
virtual void refresh(); // called in setFocus()
@@ -145,6 +147,7 @@ public:
void setCtrlsEnabled(BOOL b);
+
LLHandle<LLPanel> getHandle() const { return mPanelHandle; }
const LLCallbackMap::map_t& getFactoryMap() const { return mFactoryMap; }
@@ -186,6 +189,7 @@ public:
void childSetValidate(const std::string& id, boost::function<bool (const LLSD& data)> cb );
void childSetColor(const std::string& id, const LLColor4& color);
+ void childSetAlpha(const std::string& id, F32 alpha);
LLCtrlSelectionInterface* childGetSelectionInterface(const std::string& id) const;
LLCtrlListInterface* childGetListInterface(const std::string& id) const;
@@ -239,7 +243,7 @@ protected:
CommitCallbackRegistry::ScopedRegistrar mCommitCallbackRegistrar;
EnableCallbackRegistry::ScopedRegistrar mEnableCallbackRegistrar;
- commit_signal_t mVisibleSignal; // Called when visibilit changes, passes new visibility as LLSD()
+ commit_signal_t mVisibleSignal; // Called when visibility changes, passes new visibility as LLSD()
private:
// Unified error reporting for the child* functions
diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp
index 12953fc261..15584c8dc7 100644
--- a/indra/llui/llsliderctrl.cpp
+++ b/indra/llui/llsliderctrl.cpp
@@ -34,8 +34,6 @@
#include "llsliderctrl.h"
-#include "audioengine.h"
-
#include "llmath.h"
#include "llfontgl.h"
#include "llgl.h"
diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp
index 2d70432182..7b96446fa1 100644
--- a/indra/llui/llspinctrl.cpp
+++ b/indra/llui/llspinctrl.cpp
@@ -45,7 +45,6 @@
#include "lltextbox.h"
#include "llkeyboard.h"
#include "llmath.h"
-#include "audioengine.h"
#include "llcontrol.h"
#include "llfocusmgr.h"
#include "llresmgr.h"
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index a97899f270..921041d17f 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -46,7 +46,6 @@
#include "lltimer.h"
#include "llmath.h"
-#include "audioengine.h"
#include "llclipboard.h"
#include "llscrollbar.h"
#include "llstl.h"
@@ -60,6 +59,7 @@
#include "lltextparser.h"
#include "llscrollcontainer.h"
#include "llpanel.h"
+
#include <queue>
#include "llcombobox.h"
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 7e4df892c4..1d62ed93f9 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -38,7 +38,6 @@
#include <map>
// Linden library includes
-#include "audioengine.h"
#include "v2math.h"
#include "v4color.h"
#include "llrender.h"
diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp
index 4a9fec3191..7ff942268d 100644
--- a/indra/llui/lluictrl.cpp
+++ b/indra/llui/lluictrl.cpp
@@ -54,61 +54,7 @@ LLUICtrl::Params::Params()
addSynonym(initial_value, "initial_value");
}
-LLFocusableElement::LLFocusableElement()
-: mFocusLostCallback(NULL),
- mFocusReceivedCallback(NULL),
- mFocusChangedCallback(NULL),
- mTopLostCallback(NULL),
- mFocusCallbackUserData(NULL)
-{
-}
-
-//virtual
-LLFocusableElement::~LLFocusableElement()
-{
-}
-
-void LLFocusableElement::onFocusReceived()
-{
- if( mFocusReceivedCallback )
- {
- mFocusReceivedCallback( this, mFocusCallbackUserData );
- }
- if( mFocusChangedCallback )
- {
- mFocusChangedCallback( this, mFocusCallbackUserData );
- }
-}
-
-void LLFocusableElement::onFocusLost()
-{
- if( mFocusLostCallback )
- {
- mFocusLostCallback( this, mFocusCallbackUserData );
- }
-
- if( mFocusChangedCallback )
- {
- mFocusChangedCallback( this, mFocusCallbackUserData );
- }
-}
-
-void LLFocusableElement::onTopLost()
-{
- if (mTopLostCallback)
- {
- mTopLostCallback(this, mFocusCallbackUserData);
- }
-}
-
-BOOL LLFocusableElement::hasFocus() const
-{
- return FALSE;
-}
-
-void LLFocusableElement::setFocus(BOOL b)
-{
-}
+// NOTE: the LLFocusableElement implementation has been moved from here to llfocusmgr.cpp.
//static
const LLUICtrl::Params& LLUICtrl::getDefaultParams()
@@ -560,7 +506,7 @@ void LLUICtrl::onFocusReceived()
// find first view in hierarchy above new focus that is a LLUICtrl
LLView* viewp = getParent();
- LLUICtrl* last_focus = gFocusMgr.getLastKeyboardFocus();
+ LLUICtrl* last_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getLastKeyboardFocus());
while (viewp && !viewp->isCtrl())
{
@@ -886,6 +832,9 @@ BOOL LLUICtrl::getTentative() const
void LLUICtrl::setColor(const LLColor4& color)
{ }
+// virtual
+void LLUICtrl::setAlpha(F32 alpha)
+{ }
namespace LLInitParam
diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h
index a4f539af14..3e2e1f41a1 100644
--- a/indra/llui/lluictrl.h
+++ b/indra/llui/lluictrl.h
@@ -46,35 +46,10 @@
const BOOL TAKE_FOCUS_YES = TRUE;
const BOOL TAKE_FOCUS_NO = FALSE;
-class LLFocusableElement
-{
- friend class LLFocusMgr; // allow access to focus change handlers
-public:
- LLFocusableElement();
- virtual ~LLFocusableElement();
-
- virtual void setFocus( BOOL b );
- virtual BOOL hasFocus() const;
-
- typedef boost::function<void(LLFocusableElement*, void*)> focus_callback_t;
- void setFocusLostCallback(focus_callback_t cb, void* user_data = NULL) { mFocusLostCallback = cb; mFocusCallbackUserData = user_data; }
- void setFocusReceivedCallback(focus_callback_t cb, void* user_data = NULL) { mFocusReceivedCallback = cb; mFocusCallbackUserData = user_data; }
- void setFocusChangedCallback(focus_callback_t cb, void* user_data = NULL ) { mFocusChangedCallback = cb; mFocusCallbackUserData = user_data; }
- void setTopLostCallback(focus_callback_t cb, void* user_data = NULL ) { mTopLostCallback = cb; mFocusCallbackUserData = user_data; }
-
-protected:
- virtual void onFocusReceived();
- virtual void onFocusLost();
- virtual void onTopLost(); // called when registered as top ctrl and user clicks elsewhere
- focus_callback_t mFocusLostCallback;
- focus_callback_t mFocusReceivedCallback;
- focus_callback_t mFocusChangedCallback;
- focus_callback_t mTopLostCallback;
- void* mFocusCallbackUserData;
-};
+// NOTE: the LLFocusableElement class declaration has been moved from here to llfocusmgr.h.
class LLUICtrl
- : public LLView, public LLFocusableElement, public boost::signals2::trackable
+ : public LLView, public boost::signals2::trackable
{
public:
@@ -237,6 +212,7 @@ public:
virtual void onTabInto();
virtual void clear();
virtual void setColor(const LLColor4& color);
+ virtual void setAlpha(F32 alpha);
BOOL focusNextItem(BOOL text_entry_only);
BOOL focusPrevItem(BOOL text_entry_only);
@@ -266,7 +242,7 @@ public:
// *TODO: Deprecate; for backwards compatability only:
boost::signals2::connection setCommitCallback( boost::function<void (LLUICtrl*,void*)> cb, void* data);
boost::signals2::connection setValidateBeforeCommit( boost::function<bool (const LLSD& data)> cb );
-
+
LLUICtrl* findRootMostFocusRoot();
class LLTextInputFilter : public LLQueryFilter, public LLSingleton<LLTextInputFilter>
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index e2dc85d03f..4770807ac7 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -145,12 +145,6 @@ LLView::~LLView()
// llassert_always(sDepth == 0); // avoid deleting views while drawing! It can subtly break list iterators
- if( gFocusMgr.getKeyboardFocus() == this )
- {
- //llwarns << "View holding keyboard focus deleted: " << getName() << ". Keyboard focus removed." << llendl;
- gFocusMgr.removeKeyboardFocusWithoutCallback( this );
- }
-
if( hasMouseCapture() )
{
//llwarns << "View holding mouse capture deleted: " << getName() << ". Mouse capture removed." << llendl;
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index 6247bf036c..ecc6bf47da 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -54,6 +54,7 @@
#include "llcursortypes.h"
#include "lluictrlfactory.h"
#include "lltreeiterators.h"
+#include "llfocusmgr.h"
#include <list>
@@ -141,7 +142,7 @@ virtual BOOL handleUnicodeCharHere(llwchar uni_char);
class LLViewWidgetRegistry : public LLChildRegistry<LLViewWidgetRegistry>
{};
-class LLView : public LLMouseHandler, public LLMortician
+class LLView : public LLMouseHandler, public LLMortician, public LLFocusableElement
{
public:
struct Follows : public LLInitParam::Choice<Follows>
@@ -413,8 +414,10 @@ public:
virtual BOOL canSnapTo(const LLView* other_view);
virtual void setSnappedTo(const LLView* snap_view);
- virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
- virtual BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent);
+ // inherited from LLFocusableElement
+ /* virtual */ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
+ /* virtual */ BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent);
+
virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
EDragAndDropType cargo_type,
void* cargo_data,
@@ -432,8 +435,9 @@ public:
BOOL getSaveToXML() const { return mSaveToXML; }
void setSaveToXML(BOOL b) { mSaveToXML = b; }
- virtual void onFocusLost();
- virtual void onFocusReceived();
+ // inherited from LLFocusableElement
+ /* virtual */ void onFocusLost();
+ /* virtual */ void onFocusReceived();
typedef enum e_hit_test_type
{