aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/llscrolllistctrl.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llui/llscrolllistctrl.h')
-rw-r--r--linden/indra/llui/llscrolllistctrl.h48
1 files changed, 29 insertions, 19 deletions
diff --git a/linden/indra/llui/llscrolllistctrl.h b/linden/indra/llui/llscrolllistctrl.h
index d097cb5..a1c4853 100644
--- a/linden/indra/llui/llscrolllistctrl.h
+++ b/linden/indra/llui/llscrolllistctrl.h
@@ -57,7 +57,7 @@ public:
57 virtual const LLString& getTextLower() const { return LLString::null; } 57 virtual const LLString& getTextLower() const { return LLString::null; }
58 virtual const BOOL getVisible() const { return TRUE; } 58 virtual const BOOL getVisible() const { return TRUE; }
59 virtual void setWidth(S32 width) = 0; 59 virtual void setWidth(S32 width) = 0;
60 virtual void highlightText(S32 num_chars) {} 60 virtual void highlightText(S32 offset, S32 num_chars) {}
61 61
62 virtual BOOL handleClick() { return FALSE; } 62 virtual BOOL handleClick() { return FALSE; }
63 virtual void setEnabled(BOOL enable) { } 63 virtual void setEnabled(BOOL enable) { }
@@ -65,9 +65,8 @@ public:
65 65
66class LLScrollListText : public LLScrollListCell 66class LLScrollListText : public LLScrollListCell
67{ 67{
68 static U32 sCount;
69public: 68public:
70 LLScrollListText( const LLString& text, const LLFontGL* font, S32 width = 0, U8 font_style = LLFontGL::NORMAL, LLColor4& color = LLColor4::black, BOOL use_color = FALSE, BOOL visible = TRUE); 69 LLScrollListText( const LLString& text, const LLFontGL* font, S32 width = 0, U8 font_style = LLFontGL::NORMAL, LLFontGL::HAlign font_alignment = LLFontGL::LEFT, LLColor4& color = LLColor4::black, BOOL use_color = FALSE, BOOL visible = TRUE);
71 /*virtual*/ ~LLScrollListText(); 70 /*virtual*/ ~LLScrollListText();
72 71
73 virtual void drawToWidth(S32 width, const LLColor4& color, const LLColor4& highlight_color) const; 72 virtual void drawToWidth(S32 width, const LLColor4& color, const LLColor4& highlight_color) const;
@@ -76,7 +75,7 @@ public:
76 virtual S32 getHeight() const { return llround(mFont->getLineHeight()); } 75 virtual S32 getHeight() const { return llround(mFont->getLineHeight()); }
77 virtual const LLString& getText() const { return mText.getString(); } 76 virtual const LLString& getText() const { return mText.getString(); }
78 virtual const BOOL getVisible() const { return mVisible; } 77 virtual const BOOL getVisible() const { return mVisible; }
79 virtual void highlightText(S32 num_chars) {mHighlightChars = num_chars;} 78 virtual void highlightText(S32 offset, S32 num_chars) {mHighlightOffset = offset; mHighlightCount = num_chars;}
80 void setText(const LLString& text); 79 void setText(const LLString& text);
81 80
82private: 81private:
@@ -84,12 +83,15 @@ private:
84 const LLFontGL* mFont; 83 const LLFontGL* mFont;
85 LLColor4* mColor; 84 LLColor4* mColor;
86 const U8 mFontStyle; 85 const U8 mFontStyle;
86 LLFontGL::HAlign mFontAlignment;
87 S32 mWidth; 87 S32 mWidth;
88 S32 mEllipsisWidth; // in pixels, of "..."
89 BOOL mVisible; 88 BOOL mVisible;
90 S32 mHighlightChars; 89 S32 mHighlightCount;
90 S32 mHighlightOffset;
91 91
92 LLPointer<LLImageGL> mRoundedRectImage; 92 LLPointer<LLImageGL> mRoundedRectImage;
93
94 static U32 sCount;
93}; 95};
94 96
95class LLScrollListIcon : public LLScrollListCell 97class LLScrollListIcon : public LLScrollListCell
@@ -134,9 +136,10 @@ class LLScrollListColumn
134{ 136{
135public: 137public:
136 // Default constructor 138 // Default constructor
137 LLScrollListColumn() : mName(""), mSortingColumn(""), mLabel(""), mWidth(-1), mRelWidth(-1.0), mDynamicWidth(FALSE), mIndex(-1), mParentCtrl(NULL), mButton(NULL) { } 139 LLScrollListColumn() : mName(""), mSortingColumn(""), mLabel(""), mWidth(-1), mRelWidth(-1.0), mDynamicWidth(FALSE), mIndex(-1), mParentCtrl(NULL), mButton(NULL), mFontAlignment(LLFontGL::LEFT)
140 { }
138 141
139 LLScrollListColumn(LLString name, LLString label, S32 width, F32 relwidth) 142 LLScrollListColumn(LLString name, LLString label, S32 width, F32 relwidth)
140 : mName(name), mSortingColumn(name), mLabel(label), mWidth(width), mRelWidth(relwidth), mDynamicWidth(FALSE), mIndex(-1), mParentCtrl(NULL), mButton(NULL) { } 143 : mName(name), mSortingColumn(name), mLabel(label), mWidth(width), mRelWidth(relwidth), mDynamicWidth(FALSE), mIndex(-1), mParentCtrl(NULL), mButton(NULL) { }
141 144
142 LLScrollListColumn(const LLSD &sd) 145 LLScrollListColumn(const LLSD &sd)
@@ -168,20 +171,27 @@ public:
168 mDynamicWidth = FALSE; 171 mDynamicWidth = FALSE;
169 mRelWidth = -1; 172 mRelWidth = -1;
170 } 173 }
174
175 if (sd.has("halign"))
176 {
177 mFontAlignment = (LLFontGL::HAlign)llclamp(sd.get("halign").asInteger(), (S32)LLFontGL::LEFT, (S32)LLFontGL::HCENTER);
178 }
179
171 mIndex = -1; 180 mIndex = -1;
172 mParentCtrl = NULL; 181 mParentCtrl = NULL;
173 mButton = NULL; 182 mButton = NULL;
174 } 183 }
175 184
176 LLString mName; 185 LLString mName;
177 LLString mSortingColumn; 186 LLString mSortingColumn;
178 LLString mLabel; 187 LLString mLabel;
179 S32 mWidth; 188 S32 mWidth;
180 F32 mRelWidth; 189 F32 mRelWidth;
181 BOOL mDynamicWidth; 190 BOOL mDynamicWidth;
182 S32 mIndex; 191 S32 mIndex;
183 LLScrollListCtrl *mParentCtrl; 192 LLScrollListCtrl* mParentCtrl;
184 LLButton *mButton; 193 LLButton* mButton;
194 LLFontGL::HAlign mFontAlignment;
185}; 195};
186 196
187class LLScrollListItem 197class LLScrollListItem
@@ -208,8 +218,8 @@ public:
208 218
209 // If width = 0, just use the width of the text. Otherwise override with 219 // If width = 0, just use the width of the text. Otherwise override with
210 // specified width in pixels. 220 // specified width in pixels.
211 void addColumn( const LLString& text, const LLFontGL* font, S32 width = 0 , U8 font_style = LLFontGL::NORMAL, BOOL visible = TRUE) 221 void addColumn( const LLString& text, const LLFontGL* font, S32 width = 0 , U8 font_style = LLFontGL::NORMAL, LLFontGL::HAlign font_alignment = LLFontGL::LEFT, BOOL visible = TRUE)
212 { mColumns.push_back( new LLScrollListText(text, font, width, font_style, LLColor4::black, FALSE, visible) ); } 222 { mColumns.push_back( new LLScrollListText(text, font, width, font_style, font_alignment, LLColor4::black, FALSE, visible) ); }
213 223
214 void addColumn( LLImageGL* icon, S32 width = 0 ) 224 void addColumn( LLImageGL* icon, S32 width = 0 )
215 { mColumns.push_back( new LLScrollListIcon(icon, width) ); } 225 { mColumns.push_back( new LLScrollListIcon(icon, width) ); }