onVisibilityChange renamed to handleVisibilityChange. Added setVisibleCallback to LLPanel
This commit is contained in:
@@ -80,6 +80,7 @@ void LLPanel::init()
|
|||||||
|
|
||||||
mPanelHandle.bind(this);
|
mPanelHandle.bind(this);
|
||||||
setTabStop(FALSE);
|
setTabStop(FALSE);
|
||||||
|
mVisibleSignal = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLPanel::LLPanel()
|
LLPanel::LLPanel()
|
||||||
@@ -123,6 +124,7 @@ LLPanel::LLPanel(const std::string& name, const std::string& rect_control, BOOL
|
|||||||
LLPanel::~LLPanel()
|
LLPanel::~LLPanel()
|
||||||
{
|
{
|
||||||
storeRectControl();
|
storeRectControl();
|
||||||
|
delete mVisibleSignal;
|
||||||
}
|
}
|
||||||
|
|
||||||
// virtual
|
// virtual
|
||||||
@@ -364,6 +366,13 @@ BOOL LLPanel::checkRequirements()
|
|||||||
return TRUE;
|
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)
|
void LLPanel::setFocus(BOOL b)
|
||||||
{
|
{
|
||||||
if( 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
|
//virtual
|
||||||
LLView* LLPanel::getChildView(const std::string& name, BOOL recurse, BOOL create_if_missing) const
|
LLView* LLPanel::getChildView(const std::string& name, BOOL recurse, BOOL create_if_missing) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ public:
|
|||||||
/*virtual*/ BOOL isPanel() const;
|
/*virtual*/ BOOL isPanel() const;
|
||||||
/*virtual*/ void draw();
|
/*virtual*/ void draw();
|
||||||
/*virtual*/ BOOL handleKeyHere( KEY key, MASK mask );
|
/*virtual*/ BOOL handleKeyHere( KEY key, MASK mask );
|
||||||
|
/*virtual*/ void handleVisibilityChange ( BOOL new_visibility );
|
||||||
/*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const;
|
/*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const;
|
||||||
// Override to set not found list:
|
// Override to set not found list:
|
||||||
virtual LLView* getChildView(const std::string& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const;
|
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);
|
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
|
||||||
|
|
||||||
|
boost::signals2::connection setVisibleCallback( const commit_signal_t::slot_type& cb );
|
||||||
protected:
|
protected:
|
||||||
// Override to set not found list
|
// Override to set not found list
|
||||||
LLButton* getDefaultButton() { return mDefaultBtn; }
|
LLButton* getDefaultButton() { return mDefaultBtn; }
|
||||||
LLCallbackMap::map_t mFactoryMap;
|
LLCallbackMap::map_t mFactoryMap;
|
||||||
|
|
||||||
|
commit_signal_t* mVisibleSignal; // Called when visibility changes, passes new visibility as LLSD()
|
||||||
private:
|
private:
|
||||||
// common construction logic
|
// common construction logic
|
||||||
void init();
|
void init();
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ const S32 MAX_TEXTURE_DIMENSION = 2048;
|
|||||||
static LLRegisterWidget<LLMediaCtrl> r("web_browser");
|
static LLRegisterWidget<LLMediaCtrl> r("web_browser");
|
||||||
|
|
||||||
LLMediaCtrl::LLMediaCtrl( const std::string& name, const LLRect& rect ) :
|
LLMediaCtrl::LLMediaCtrl( const std::string& name, const LLRect& rect ) :
|
||||||
LLUICtrl( name, rect, FALSE, NULL, NULL ),
|
LLPanel( name, rect, FALSE ),
|
||||||
LLInstanceTracker<LLMediaCtrl, LLUUID>(LLUUID::generateNewID()),
|
LLInstanceTracker<LLMediaCtrl, LLUUID>(LLUUID::generateNewID()),
|
||||||
mTextureDepthBytes( 4 ),
|
mTextureDepthBytes( 4 ),
|
||||||
mWebBrowserImage( 0 ),
|
mWebBrowserImage( 0 ),
|
||||||
@@ -336,6 +336,15 @@ void LLMediaCtrl::onFocusLost()
|
|||||||
LLUICtrl::onFocusLost();
|
LLUICtrl::onFocusLost();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
|
||||||
|
BOOL LLMediaCtrl::postBuild ()
|
||||||
|
{
|
||||||
|
setVisibleCallback(boost::bind(&LLMediaCtrl::onVisibilityChange, this, _2));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
BOOL LLMediaCtrl::handleKeyHere( KEY key, MASK mask )
|
BOOL LLMediaCtrl::handleKeyHere( KEY key, MASK mask )
|
||||||
@@ -390,6 +399,7 @@ void LLMediaCtrl::handleVisibilityChange ( BOOL new_visibility )
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
|
||||||
BOOL LLMediaCtrl::handleUnicodeCharHere(llwchar uni_char)
|
BOOL LLMediaCtrl::handleUnicodeCharHere(llwchar uni_char)
|
||||||
{
|
{
|
||||||
BOOL result = FALSE;
|
BOOL result = FALSE;
|
||||||
@@ -407,10 +417,10 @@ BOOL LLMediaCtrl::handleUnicodeCharHere(llwchar uni_char)
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
void LLMediaCtrl::handleVisibilityChange ( BOOL new_visibility )
|
void LLMediaCtrl::onVisibilityChange ( const LLSD& new_visibility )
|
||||||
{
|
{
|
||||||
// set state of frequent updates automatically if visibility changes
|
// set state of frequent updates automatically if visibility changes
|
||||||
if ( new_visibility )
|
if ( new_visibility.asBoolean() )
|
||||||
{
|
{
|
||||||
mFrequentUpdates = true;
|
mFrequentUpdates = true;
|
||||||
}
|
}
|
||||||
@@ -418,7 +428,6 @@ void LLMediaCtrl::handleVisibilityChange ( BOOL new_visibility )
|
|||||||
{
|
{
|
||||||
mFrequentUpdates = false;
|
mFrequentUpdates = false;
|
||||||
}
|
}
|
||||||
LLUICtrl::handleVisibilityChange(new_visibility);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class LLUICtrlFactory;
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
class LLMediaCtrl :
|
class LLMediaCtrl :
|
||||||
public LLUICtrl,
|
public LLPanel,
|
||||||
public LLViewerMediaObserver,
|
public LLViewerMediaObserver,
|
||||||
public LLViewerMediaEventEmitter,
|
public LLViewerMediaEventEmitter,
|
||||||
public LLInstanceTracker<LLMediaCtrl, LLUUID>
|
public LLInstanceTracker<LLMediaCtrl, LLUUID>
|
||||||
@@ -133,7 +133,7 @@ class LLMediaCtrl :
|
|||||||
virtual BOOL handleUnicodeCharHere(llwchar uni_char);
|
virtual BOOL handleUnicodeCharHere(llwchar uni_char);
|
||||||
virtual void reshape( S32 width, S32 height, BOOL called_from_parent = TRUE);
|
virtual void reshape( S32 width, S32 height, BOOL called_from_parent = TRUE);
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
virtual void handleVisibilityChange ( BOOL curVisibilityIn );
|
virtual BOOL postBuild();
|
||||||
|
|
||||||
// focus overrides
|
// focus overrides
|
||||||
void onFocusLost();
|
void onFocusLost();
|
||||||
@@ -150,6 +150,7 @@ class LLMediaCtrl :
|
|||||||
void convertInputCoords(S32& x, S32& y);
|
void convertInputCoords(S32& x, S32& y);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void onVisibilityChange ( const LLSD& new_visibility );
|
||||||
static bool onClickLinkExternalTarget( const LLSD&, const LLSD& );
|
static bool onClickLinkExternalTarget( const LLSD&, const LLSD& );
|
||||||
|
|
||||||
const S32 mTextureDepthBytes;
|
const S32 mTextureDepthBytes;
|
||||||
|
|||||||
Reference in New Issue
Block a user