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.h118
1 files changed, 30 insertions, 88 deletions
diff --git a/linden/indra/llui/llscrolllistctrl.h b/linden/indra/llui/llscrolllistctrl.h
index f276562..72d8894 100644
--- a/linden/indra/llui/llscrolllistctrl.h
+++ b/linden/indra/llui/llscrolllistctrl.h
@@ -16,7 +16,8 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
@@ -47,6 +48,7 @@
47#include "llcombobox.h" 48#include "llcombobox.h"
48#include "llscrollbar.h" 49#include "llscrollbar.h"
49#include "llresizebar.h" 50#include "llresizebar.h"
51#include "lldate.h"
50 52
51/* 53/*
52 * Represents a cell in a scrollable table. 54 * Represents a cell in a scrollable table.
@@ -133,6 +135,18 @@ private:
133 static U32 sCount; 135 static U32 sCount;
134}; 136};
135 137
138
139class LLScrollListDate : public LLScrollListText
140{
141public:
142 LLScrollListDate( const LLDate& date, 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);
143 virtual void setValue(const LLSD& value);
144 virtual const LLSD getValue() const;
145
146private:
147 LLDate mDate;
148};
149
136/* 150/*
137 * Cell displaying an image. 151 * Cell displaying an image.
138 */ 152 */
@@ -185,88 +199,11 @@ private:
185class LLScrollListColumn 199class LLScrollListColumn
186{ 200{
187public: 201public:
188 // Default constructor 202 LLScrollListColumn();
189 LLScrollListColumn() : 203 LLScrollListColumn(const LLSD &sd, LLScrollListCtrl* parent);
190 mName(), 204
191 mSortingColumn(), 205 void setWidth(S32 width);
192 mSortAscending(TRUE), 206 S32 getWidth() const { return mWidth; }
193 mLabel(),
194 mWidth(-1),
195 mRelWidth(-1.0),
196 mDynamicWidth(FALSE),
197 mMaxContentWidth(0),
198 mIndex(-1),
199 mParentCtrl(NULL),
200 mHeader(NULL),
201 mFontAlignment(LLFontGL::LEFT)
202 { }
203
204 LLScrollListColumn(std::string name, std::string label, S32 width, F32 relwidth) :
205 mName(name),
206 mSortingColumn(name),
207 mSortAscending(TRUE),
208 mLabel(label),
209 mWidth(width),
210 mRelWidth(relwidth),
211 mDynamicWidth(FALSE),
212 mMaxContentWidth(0),
213 mIndex(-1),
214 mParentCtrl(NULL),
215 mHeader(NULL),
216 mFontAlignment(LLFontGL::LEFT)
217 { }
218
219 LLScrollListColumn(const LLSD &sd)
220 {
221 mMaxContentWidth = 0;
222
223 mName = sd.get("name").asString();
224 mSortingColumn = mName;
225 if (sd.has("sort"))
226 {
227 mSortingColumn = sd.get("sort").asString();
228 }
229 mSortAscending = TRUE;
230 if (sd.has("sort_ascending"))
231 {
232 mSortAscending = sd.get("sort_ascending").asBoolean();
233 }
234 mLabel = sd.get("label").asString();
235 if (sd.has("relwidth") && (F32)sd.get("relwidth").asReal() > 0)
236 {
237 mRelWidth = (F32)sd.get("relwidth").asReal();
238 if (mRelWidth < 0) mRelWidth = 0;
239 if (mRelWidth > 1) mRelWidth = 1;
240 mDynamicWidth = FALSE;
241 mWidth = 0;
242 }
243 else if(sd.has("dynamicwidth") && (BOOL)sd.get("dynamicwidth").asBoolean() == TRUE)
244 {
245 mDynamicWidth = TRUE;
246 mRelWidth = -1;
247 mWidth = 0;
248 }
249 else
250 {
251 mWidth = sd.get("width").asInteger();
252 mDynamicWidth = FALSE;
253 mRelWidth = -1;
254 }
255
256 if (sd.has("halign"))
257 {
258 mFontAlignment = (LLFontGL::HAlign)llclamp(sd.get("halign").asInteger(), (S32)LLFontGL::LEFT, (S32)LLFontGL::HCENTER);
259 }
260 else
261 {
262 mFontAlignment = LLFontGL::LEFT;
263 }
264
265 mIndex = -1;
266 mParentCtrl = NULL;
267 mHeader = NULL;
268 mFontAlignment = LLFontGL::LEFT;
269 }
270 207
271 // Public data is fine so long as this remains a simple struct-like data class. 208 // Public data is fine so long as this remains a simple struct-like data class.
272 // If it ever gets any smarter than that, these should all become private 209 // If it ever gets any smarter than that, these should all become private
@@ -275,7 +212,6 @@ public:
275 std::string mSortingColumn; 212 std::string mSortingColumn;
276 BOOL mSortAscending; 213 BOOL mSortAscending;
277 std::string mLabel; 214 std::string mLabel;
278 S32 mWidth;
279 F32 mRelWidth; 215 F32 mRelWidth;
280 BOOL mDynamicWidth; 216 BOOL mDynamicWidth;
281 S32 mMaxContentWidth; 217 S32 mMaxContentWidth;
@@ -283,6 +219,10 @@ public:
283 LLScrollListCtrl* mParentCtrl; 219 LLScrollListCtrl* mParentCtrl;
284 class LLColumnHeader* mHeader; 220 class LLColumnHeader* mHeader;
285 LLFontGL::HAlign mFontAlignment; 221 LLFontGL::HAlign mFontAlignment;
222
223private:
224 S32 mWidth;
225
286}; 226};
287 227
288class LLColumnHeader : public LLComboBox 228class LLColumnHeader : public LLComboBox
@@ -301,6 +241,7 @@ public:
301 void setImage(const std::string &image_name); 241 void setImage(const std::string &image_name);
302 LLScrollListColumn* getColumn() { return mColumn; } 242 LLScrollListColumn* getColumn() { return mColumn; }
303 void setHasResizableElement(BOOL resizable); 243 void setHasResizableElement(BOOL resizable);
244 void updateResizeBars();
304 BOOL canResize(); 245 BOOL canResize();
305 void enableResizeBar(BOOL enable); 246 void enableResizeBar(BOOL enable);
306 std::string getLabel() { return mOrigLabel; } 247 std::string getLabel() { return mOrigLabel; }
@@ -551,8 +492,7 @@ public:
551 492
552 virtual S32 getScrollPos() const; 493 virtual S32 getScrollPos() const;
553 virtual void setScrollPos( S32 pos ); 494 virtual void setScrollPos( S32 pos );
554 495 S32 getSearchColumn();
555 S32 getSearchColumn() { return mSearchColumn; }
556 void setSearchColumn(S32 column) { mSearchColumn = column; } 496 void setSearchColumn(S32 column) { mSearchColumn = column; }
557 S32 getColumnIndexFromOffset(S32 x); 497 S32 getColumnIndexFromOffset(S32 x);
558 S32 getColumnOffsetFromIndex(S32 index); 498 S32 getColumnOffsetFromIndex(S32 index);
@@ -613,8 +553,9 @@ public:
613 virtual void deselect(); 553 virtual void deselect();
614 virtual BOOL canDeselect() const; 554 virtual BOOL canDeselect() const;
615 555
616 void setNumDynamicColumns(int num) { mNumDynamicWidthColumns = num; } 556 void setNumDynamicColumns(S32 num) { mNumDynamicWidthColumns = num; }
617 void setTotalStaticColumnWidth(int width) { mTotalStaticColumnWidth = width; } 557 void updateStaticColumnWidth(LLScrollListColumn* col, S32 new_width);
558 S32 getTotalStaticColumnWidth() { return mTotalStaticColumnWidth; }
618 559
619 std::string getSortColumnName(); 560 std::string getSortColumnName();
620 BOOL getSortAscending() { return mSortColumns.empty() ? TRUE : mSortColumns.back().second; } 561 BOOL getSortAscending() { return mSortColumns.empty() ? TRUE : mSortColumns.back().second; }
@@ -719,6 +660,7 @@ private:
719 S32 mSearchColumn; 660 S32 mSearchColumn;
720 S32 mNumDynamicWidthColumns; 661 S32 mNumDynamicWidthColumns;
721 S32 mTotalStaticColumnWidth; 662 S32 mTotalStaticColumnWidth;
663 S32 mTotalColumnPadding;
722 664
723 BOOL mSorted; 665 BOOL mSorted;
724 666