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.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/llui/llscrolllistcell.h') diff --git a/indra/llui/llscrolllistcell.h b/indra/llui/llscrolllistcell.h index 758623f121..cff8434b32 100644 --- a/indra/llui/llscrolllistcell.h +++ b/indra/llui/llscrolllistcell.h @@ -66,6 +66,7 @@ public: Optional userdata; Optional value; + Optional tool_tip; Optional font; Optional font_color; @@ -80,6 +81,7 @@ public: enabled("enabled", true), visible("visible", true), value("value"), + tool_tip("tool_tip", ""), font("font", LLFontGL::getFontSansSerifSmall()), font_color("font_color", LLColor4::black), color("color", LLColor4::white), @@ -87,6 +89,7 @@ public: { addSynonym(column, "name"); addSynonym(font_color, "font-color"); + addSynonym(tool_tip, "tooltip"); } }; @@ -101,11 +104,13 @@ public: virtual S32 getHeight() const { return 0; } virtual const LLSD getValue() const; virtual void setValue(const LLSD& value) { } + virtual const std::string &getToolTip() const { return mToolTip; } + virtual void setToolTip(const std::string &str) { mToolTip = str; } virtual BOOL getVisible() const { return TRUE; } virtual void setWidth(S32 width) { mWidth = width; } virtual void highlightText(S32 offset, S32 num_chars) {} virtual BOOL isText() const { return FALSE; } - virtual BOOL needsToolTip() const { return FALSE; } + virtual BOOL needsToolTip() const { return ! mToolTip.empty(); } virtual void setColor(const LLColor4&) {} virtual void onCommit() {}; @@ -114,6 +119,7 @@ public: private: S32 mWidth; + std::string mToolTip; }; class LLScrollListSpacer : public LLScrollListCell @@ -143,6 +149,7 @@ public: /*virtual*/ void setColor(const LLColor4&); /*virtual*/ BOOL isText() const; + /*virtual*/ const std::string & getToolTip() const; /*virtual*/ BOOL needsToolTip() const; void setText(const LLStringExplicit& text); -- cgit v1.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 ++- indra/llui/llscrolllistcell.h | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui/llscrolllistcell.h') 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 diff --git a/indra/llui/llscrolllistcell.h b/indra/llui/llscrolllistcell.h index cff8434b32..5fecf5aade 100644 --- a/indra/llui/llscrolllistcell.h +++ b/indra/llui/llscrolllistcell.h @@ -89,7 +89,6 @@ public: { addSynonym(column, "name"); addSynonym(font_color, "font-color"); - addSynonym(tool_tip, "tooltip"); } }; -- cgit v1.3