Skip to content
Snippets Groups Projects
Commit ed84101a authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files

Introduce LLView::isAvailable() to test enabled & visible.

Better term? The point of the method is to verify that a user could
actually interact with the LLView in question.
parent 2a5c25cb
Branches
Tags
No related merge requests found
...@@ -438,6 +438,18 @@ void LLView::setEnabled(BOOL enabled) ...@@ -438,6 +438,18 @@ void LLView::setEnabled(BOOL enabled)
mEnabled = enabled; mEnabled = enabled;
} }
//virtual
bool LLView::isAvailable() const
{
return isInEnabledChain() && isInVisibleChain();
}
//static
bool LLView::isAvailable(const LLView* view)
{
return view && view->isAvailable();
}
//virtual //virtual
BOOL LLView::setLabelArg( const std::string& key, const LLStringExplicit& text ) BOOL LLView::setLabelArg( const std::string& key, const LLStringExplicit& text )
{ {
......
...@@ -304,6 +304,11 @@ class LLView : public LLMouseHandler, public LLMortician, public LLFocusableElem ...@@ -304,6 +304,11 @@ class LLView : public LLMouseHandler, public LLMortician, public LLFocusableElem
BOOL getVisible() const { return mVisible; } BOOL getVisible() const { return mVisible; }
virtual void setEnabled(BOOL enabled); virtual void setEnabled(BOOL enabled);
BOOL getEnabled() const { return mEnabled; } BOOL getEnabled() const { return mEnabled; }
/// 'available' in this context means 'visible and enabled': in other
/// words, can a user actually interact with this?
virtual bool isAvailable() const;
/// The static isAvailable() tests an LLView* that could be NULL.
static bool isAvailable(const LLView* view);
U8 getSoundFlags() const { return mSoundFlags; } U8 getSoundFlags() const { return mSoundFlags; }
virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment