From d023672e597770671720f8b68f7799b662f82175 Mon Sep 17 00:00:00 2001 From: Rick Pasetto Date: Wed, 11 Nov 2009 15:08:00 -0800 Subject: Add ToolTip functionality to LLScrollListCell This change enables a user to set a custom tool tip on a particular scroll list cell by calling setToolTip(). Then, this tool tip is used. If this is not done, the existing tooltip functionality is left alone. Reviewed by Richard --- indra/llui/llscrolllistcell.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'indra/llui/llscrolllistcell.cpp') diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp index a7c268758a..9f169ac777 100644 --- a/indra/llui/llscrolllistcell.cpp +++ b/indra/llui/llscrolllistcell.cpp @@ -71,7 +71,7 @@ LLScrollListCell* LLScrollListCell::create(const LLScrollListCell::Params& cell_ LLScrollListCell::LLScrollListCell(const LLScrollListCell::Params& p) -: mWidth(p.width) +: mWidth(p.width), mToolTip(p.tool_tip) {} // virtual @@ -204,13 +204,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 { - // show tooltips for truncated text + // 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 { -- cgit v1.2.3 From e3356c069557a91fc0a2c24875db23eaf64358da Mon Sep 17 00:00:00 2001 From: Rick Pasetto Date: Wed, 11 Nov 2009 16:07:02 -0800 Subject: some minor changes based on Richard's code review Code Collab #34 --- indra/llui/llscrolllistcell.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llui/llscrolllistcell.cpp') diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp index 9f169ac777..544352176a 100644 --- a/indra/llui/llscrolllistcell.cpp +++ b/indra/llui/llscrolllistcell.cpp @@ -71,7 +71,8 @@ LLScrollListCell* LLScrollListCell::create(const LLScrollListCell::Params& cell_ LLScrollListCell::LLScrollListCell(const LLScrollListCell::Params& p) -: mWidth(p.width), mToolTip(p.tool_tip) +: mWidth(p.width), + mToolTip(p.tool_tip) {} // virtual -- cgit v1.2.3