Move tooltip hosting from llscrolllistitem to llscrolllistcell

This commit is contained in:
Lirusaito
2013-07-15 22:24:34 -04:00
parent 1ef0cba32c
commit cb01bbb8ef
6 changed files with 36 additions and 17 deletions

View File

@@ -33,7 +33,8 @@
LLScrollListCell::LLScrollListCell(S32 width)
: mWidth(width)
: mWidth(width),
mToolTip()
{}
// virtual
@@ -159,6 +160,28 @@ BOOL LLScrollListText::isText() const
return TRUE;
}
//virtual
const std::string &LLScrollListText::getToolTip() const
{
// If base class has a tooltip, return that
if (! LLScrollListCell::getToolTip().empty())
return LLScrollListCell::getToolTip();
// ...otherwise, return the value itself as the tooltip
return mText.getString();
}
// virtual
BOOL LLScrollListText::needsToolTip() const
{
// If base class has a tooltip, return that
if (LLScrollListCell::needsToolTip())
return LLScrollListCell::needsToolTip();
// ...otherwise, show tooltips for truncated text
return mFont->getWidth(mText.getString()) > getWidth();
}
//virtual
BOOL LLScrollListText::getVisible() const
{