STORM-717 FIXED Made nearby chat toasts respect transparency settings:

* Normally toasts are as opaque as specified by "inactive floater opacity" setting.
* When mouse is hovering a toast, the toast uses "active floater opacity" setting.
* Fading toasts have 1/2 of "inactive floater opacity".
master
Vadim ProductEngine 2010-12-04 13:07:51 +02:00
parent d0ec374e15
commit b9fa0e9bbe
4 changed files with 51 additions and 5 deletions

View File

@ -944,6 +944,10 @@ F32 LLUICtrl::getCurrentTransparency()
case TT_INACTIVE:
alpha = sInactiveControlTransparency;
break;
case TT_FADING:
alpha = sInactiveControlTransparency / 2;
break;
}
return alpha;

View File

@ -123,8 +123,9 @@ public:
enum ETypeTransparency
{
TT_DEFAULT,
TT_ACTIVE,
TT_INACTIVE
TT_ACTIVE, // focused floater
TT_INACTIVE, // other floaters
TT_FADING, // fading toast
};
/*virtual*/ ~LLUICtrl();

View File

@ -165,11 +165,20 @@ public:
: LLToast(p),
mNearbyChatScreenChannelp(nc_channelp)
{
updateTransparency();
setMouseEnterCallback(boost::bind(&LLNearbyChatToast::updateTransparency, this));
setMouseLeaveCallback(boost::bind(&LLNearbyChatToast::updateTransparency, this));
}
/*virtual*/ void onClose(bool app_quitting);
/*virtual*/ void setBackgroundOpaque(BOOL b);
protected:
/*virtual*/ void setTransparentState(bool transparent);
private:
void updateTransparency();
LLNearbyChatScreenChannel* mNearbyChatScreenChannelp;
};
@ -597,4 +606,34 @@ void LLNearbyChatToast::onClose(bool app_quitting)
mNearbyChatScreenChannelp->onToastDestroyed(this, app_quitting);
}
// virtual
void LLNearbyChatToast::setBackgroundOpaque(BOOL b)
{
// We don't want background changes: transparency is handled differently.
LLToast::setBackgroundOpaque(TRUE);
}
// virtual
void LLNearbyChatToast::setTransparentState(bool transparent)
{
LLToast::setTransparentState(transparent);
updateTransparency();
}
void LLNearbyChatToast::updateTransparency()
{
ETypeTransparency transparency_type;
if (isHovered())
{
transparency_type = TT_ACTIVE;
}
else
{
transparency_type = getTransparentState() ? TT_FADING : TT_INACTIVE;
}
LLFloater::updateTransparency(transparency_type);
}
// EOF

View File

@ -141,7 +141,7 @@ public:
//
virtual void setVisible(BOOL show);
/*virtual*/ void setBackgroundOpaque(BOOL b);
virtual void setBackgroundOpaque(BOOL b);
//
virtual void hide();
@ -198,6 +198,10 @@ public:
LLHandle<LLToast> getHandle() { mHandle.bind(this); return mHandle; }
bool getTransparentState() const { return mIsTransparent; }
virtual void setTransparentState(bool transparent);
private:
void onToastMouseEnter();
@ -206,8 +210,6 @@ private:
void expire();
void setTransparentState(bool transparent);
LLUUID mNotificationID;
LLUUID mSessionID;
LLNotificationPtr mNotification;