summaryrefslogtreecommitdiff
path: root/indra/llui/lltextbase.h
diff options
context:
space:
mode:
authorAndrew Dyukov <adyukov@productengine.com>2010-07-26 18:10:29 +0300
committerAndrew Dyukov <adyukov@productengine.com>2010-07-26 18:10:29 +0300
commit4919f0b341804680a90818386b8f8ccf0a5f5f81 (patch)
treeb63308e612da0a6fdab7d4192ae4c51082404795 /indra/llui/lltextbase.h
parent8f64727254355a7734e6b3443b2b6ed6f94b2a57 (diff)
EXT-8010 FIXED Implemented special behaviour of avatar links.
Avatar links are now underlined only on hover. Also they have the same color as other links. - Underlining text and getting it back to normal are done in handleHover() and draw() of new LLOnHoverChangeableTextSegment class derived from LLNormalTextSegment. This class has two pointers to styles- one for style which will be used for text on hover, and another otherwise. This special type of text segment is used if link's boolean member mUnderlineOnHoverOnly is true. So it is URL's flag depending on which textbase adds new text segment(like it currently happens with mDisabledLink). - Changed avatar link color in colors.xml to emphasis (because it was white before and was inconsistent with other links). Reviewed by Richard Nelson at https://codereview.productengine.com/secondlife/r/749/ --HG-- branch : product-engine
Diffstat (limited to 'indra/llui/lltextbase.h')
-rw-r--r--indra/llui/lltextbase.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index 86f0e55a1d..4b83d5effb 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -145,6 +145,21 @@ protected:
boost::signals2::connection mImageLoadedConnection;
};
+// Text segment that changes it's style depending of mouse pointer position ( is it inside or outside segment)
+class LLOnHoverChangeableTextSegment : public LLNormalTextSegment
+{
+public:
+ LLOnHoverChangeableTextSegment( LLStyleConstSP style, LLStyleConstSP normal_style, S32 start, S32 end, LLTextBase& editor );
+ /*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
+ /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
+protected:
+ // Style used for text when mouse pointer is over segment
+ LLStyleConstSP mHoveredStyle;
+ // Style used for text when mouse pointer is outside segment
+ LLStyleConstSP mNormalStyle;
+
+};
+
class LLIndexSegment : public LLTextSegment
{
public:
@@ -443,7 +458,7 @@ protected:
S32 insertStringNoUndo(S32 pos, const LLWString &wstr, segment_vec_t* segments = NULL); // returns num of chars actually inserted
S32 removeStringNoUndo(S32 pos, S32 length);
S32 overwriteCharNoUndo(S32 pos, llwchar wc);
- void appendAndHighlightText(const std::string &new_text, S32 highlight_part, const LLStyle::Params& stylep);
+ void appendAndHighlightText(const std::string &new_text, S32 highlight_part, const LLStyle::Params& stylep, bool underline_on_hover_only = false);
// manage segments
@@ -486,7 +501,7 @@ protected:
void replaceUrlLabel(const std::string &url, const std::string &label);
void appendTextImpl(const std::string &new_text, const LLStyle::Params& input_params = LLStyle::Params());
- void appendAndHighlightTextImpl(const std::string &new_text, S32 highlight_part, const LLStyle::Params& style_params);
+ void appendAndHighlightTextImpl(const std::string &new_text, S32 highlight_part, const LLStyle::Params& style_params, bool underline_on_hover_only = false);
protected: