diff options
author | richard <none@none> | 2009-11-23 11:42:32 -0800 |
---|---|---|
committer | richard <none@none> | 2009-11-23 11:42:32 -0800 |
commit | 7fd1488c6218ddbd82de0eea86297e65f2561bc7 (patch) | |
tree | a7a29812c0ed94c6a07c396f5e516dcf0950c99f /indra/llui/llpanel.cpp | |
parent | e0a364b7bf836191f25604ef9c3783be46c1ce55 (diff) |
convert signals to allocate on demand in order to speed up widget construction
reviewed by James
Diffstat (limited to 'indra/llui/llpanel.cpp')
-rw-r--r-- | indra/llui/llpanel.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 89c4656297..063822dd56 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -106,7 +106,8 @@ LLPanel::LLPanel(const LLPanel::Params& p) mHelpTopic(p.help_topic), mCommitCallbackRegistrar(false), mEnableCallbackRegistrar(false), - mXMLFilename(p.filename) + mXMLFilename(p.filename), + mVisibleSignal(NULL) // *NOTE: Be sure to also change LLPanel::initFromParams(). We have too // many classes derived from LLPanel to retrofit them all to pass in params. { @@ -118,6 +119,11 @@ LLPanel::LLPanel(const LLPanel::Params& p) mPanelHandle.bind(this); } +LLPanel::~LLPanel() +{ + delete mVisibleSignal; +} + // virtual BOOL LLPanel::isPanel() const { @@ -332,7 +338,8 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask ) void LLPanel::handleVisibilityChange ( BOOL new_visibility ) { LLUICtrl::handleVisibilityChange ( new_visibility ); - mVisibleSignal(this, LLSD(new_visibility) ); // Pass BOOL as LLSD + if (mVisibleSignal) + (*mVisibleSignal)(this, LLSD(new_visibility) ); // Pass BOOL as LLSD } void LLPanel::setFocus(BOOL b) @@ -424,7 +431,9 @@ void LLPanel::initFromParams(const LLPanel::Params& p) // visible callback if (p.visible_callback.isProvided()) - initCommitCallback(p.visible_callback, mVisibleSignal); + { + setVisibleCallback(initCommitCallback(p.visible_callback)); + } for (LLInitParam::ParamIterator<LocalizedString>::const_iterator it = p.strings().begin(); it != p.strings().end(); @@ -907,3 +916,13 @@ void LLPanel::childSetControlName(const std::string& id, const std::string& cont view->setControlName(control_name, NULL); } } + +boost::signals2::connection LLPanel::setVisibleCallback( const commit_signal_t::slot_type& cb ) +{ + if (!mVisibleSignal) + { + mVisibleSignal = new commit_signal_t(); + } + + return mVisibleSignal->connect(cb); +} |