onVisibilityChange renamed to handleVisibilityChange. Added setVisibleCallback to LLPanel

This commit is contained in:
Shyotl
2011-10-14 22:57:35 -05:00
parent d6d8681874
commit 4a910a8037
4 changed files with 38 additions and 6 deletions

View File

@@ -80,6 +80,7 @@ void LLPanel::init()
mPanelHandle.bind(this);
setTabStop(FALSE);
mVisibleSignal = NULL;
}
LLPanel::LLPanel()
@@ -123,6 +124,7 @@ LLPanel::LLPanel(const std::string& name, const std::string& rect_control, BOOL
LLPanel::~LLPanel()
{
storeRectControl();
delete mVisibleSignal;
}
// virtual
@@ -364,6 +366,13 @@ BOOL LLPanel::checkRequirements()
return TRUE;
}
void LLPanel::handleVisibilityChange ( BOOL new_visibility )
{
LLUICtrl::handleVisibilityChange ( new_visibility );
if (mVisibleSignal)
(*mVisibleSignal)(this, LLSD(new_visibility) ); // Pass BOOL as LLSD
}
void LLPanel::setFocus(BOOL b)
{
if( b )
@@ -1009,6 +1018,16 @@ void LLPanel::childSetControlName(const std::string& id, const std::string& cont
}
}
boost::signals2::connection LLPanel::setVisibleCallback( const commit_signal_t::slot_type& cb )
{
if (!mVisibleSignal)
{
mVisibleSignal = new commit_signal_t();
}
return mVisibleSignal->connect(cb);
}
//virtual
LLView* LLPanel::getChildView(const std::string& name, BOOL recurse, BOOL create_if_missing) const
{

View File

@@ -76,6 +76,7 @@ public:
/*virtual*/ BOOL isPanel() const;
/*virtual*/ void draw();
/*virtual*/ BOOL handleKeyHere( KEY key, MASK mask );
/*virtual*/ void handleVisibilityChange ( BOOL new_visibility );
/*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const;
// Override to set not found list:
virtual LLView* getChildView(const std::string& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const;
@@ -223,11 +224,13 @@ public:
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
boost::signals2::connection setVisibleCallback( const commit_signal_t::slot_type& cb );
protected:
// Override to set not found list
LLButton* getDefaultButton() { return mDefaultBtn; }
LLCallbackMap::map_t mFactoryMap;
commit_signal_t* mVisibleSignal; // Called when visibility changes, passes new visibility as LLSD()
private:
// common construction logic
void init();