diff options
author | Jacek Antonelli | 2008-08-15 23:45:27 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:27 -0500 |
commit | a8a62201ba762e98dff92cf49033e577fc34d8d4 (patch) | |
tree | 11f8513c5cdc222f2fac0c93eb724c089803c200 /linden/indra/llui/llscrolllistctrl.h | |
parent | Second Life viewer sources 1.18.6.4-RC (diff) | |
download | meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.zip meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.gz meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.bz2 meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.xz |
Second Life viewer sources 1.19.0.0
Diffstat (limited to 'linden/indra/llui/llscrolllistctrl.h')
-rw-r--r-- | linden/indra/llui/llscrolllistctrl.h | 197 |
1 files changed, 113 insertions, 84 deletions
diff --git a/linden/indra/llui/llscrolllistctrl.h b/linden/indra/llui/llscrolllistctrl.h index c548727..ada4f9b 100644 --- a/linden/indra/llui/llscrolllistctrl.h +++ b/linden/indra/llui/llscrolllistctrl.h | |||
@@ -12,12 +12,12 @@ | |||
12 | * ("GPL"), unless you have obtained a separate licensing agreement | 12 | * ("GPL"), unless you have obtained a separate licensing agreement |
13 | * ("Other License"), formally executed by you and Linden Lab. Terms of | 13 | * ("Other License"), formally executed by you and Linden Lab. Terms of |
14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | 14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or |
15 | * online at http://secondlife.com/developers/opensource/gplv2 | 15 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 |
16 | * | 16 | * |
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlife.com/developers/opensource/flossexception | 20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception |
21 | * | 21 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 22 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 23 | * that you have read and understood your obligations described above, |
@@ -56,20 +56,26 @@ class LLResizeBar; | |||
56 | class LLScrollListCell | 56 | class LLScrollListCell |
57 | { | 57 | { |
58 | public: | 58 | public: |
59 | LLScrollListCell(S32 width = 0) : mWidth(width) {}; | ||
59 | virtual ~LLScrollListCell() {}; | 60 | virtual ~LLScrollListCell() {}; |
60 | virtual void drawToWidth(S32 width, const LLColor4& color, const LLColor4& highlight_color) const = 0; // truncate to given width, if possible | 61 | virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const = 0; // truncate to given width, if possible |
61 | virtual S32 getWidth() const = 0; | 62 | virtual S32 getWidth() const {return mWidth;} |
63 | virtual S32 getContentWidth() const { return 0; } | ||
62 | virtual S32 getHeight() const = 0; | 64 | virtual S32 getHeight() const = 0; |
63 | virtual const LLString& getText() const { return LLString::null; } | 65 | virtual const LLSD getValue() const { return LLString::null; } |
64 | virtual const LLString& getTextLower() const { return LLString::null; } | 66 | virtual void setValue(LLSD value) { } |
65 | virtual BOOL getVisible() const { return TRUE; } | 67 | virtual BOOL getVisible() const { return TRUE; } |
66 | virtual void setWidth(S32 width) = 0; | 68 | virtual void setWidth(S32 width) { mWidth = width; } |
67 | virtual void highlightText(S32 offset, S32 num_chars) {} | 69 | virtual void highlightText(S32 offset, S32 num_chars) {} |
68 | virtual BOOL isText() = 0; | 70 | virtual BOOL isText() = 0; |
69 | virtual void setColor(const LLColor4&) = 0; | 71 | virtual void setColor(const LLColor4&) {} |
72 | virtual void onCommit() {}; | ||
70 | 73 | ||
71 | virtual BOOL handleClick() { return FALSE; } | 74 | virtual BOOL handleClick() { return FALSE; } |
72 | virtual void setEnabled(BOOL enable) { } | 75 | virtual void setEnabled(BOOL enable) { } |
76 | |||
77 | protected: | ||
78 | S32 mWidth; | ||
73 | }; | 79 | }; |
74 | 80 | ||
75 | class LLScrollListSeparator : public LLScrollListCell | 81 | class LLScrollListSeparator : public LLScrollListCell |
@@ -77,15 +83,9 @@ class LLScrollListSeparator : public LLScrollListCell | |||
77 | public: | 83 | public: |
78 | LLScrollListSeparator(S32 width); | 84 | LLScrollListSeparator(S32 width); |
79 | virtual ~LLScrollListSeparator() {}; | 85 | virtual ~LLScrollListSeparator() {}; |
80 | virtual void drawToWidth(S32 width, const LLColor4& color, const LLColor4& highlight_color) const; // truncate to given width, if possible | 86 | virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const; // truncate to given width, if possible |
81 | virtual S32 getWidth() const {return mWidth;} | ||
82 | virtual S32 getHeight() const { return 5; }; | 87 | virtual S32 getHeight() const { return 5; }; |
83 | virtual void setWidth(S32 width) {mWidth = width; } | ||
84 | virtual void setColor(const LLColor4&) {}; | ||
85 | virtual BOOL isText() { return FALSE; } | 88 | virtual BOOL isText() { return FALSE; } |
86 | |||
87 | protected: | ||
88 | S32 mWidth; | ||
89 | }; | 89 | }; |
90 | 90 | ||
91 | class LLScrollListText : public LLScrollListCell | 91 | class LLScrollListText : public LLScrollListCell |
@@ -94,24 +94,25 @@ public: | |||
94 | 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); | 94 | 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); |
95 | /*virtual*/ ~LLScrollListText(); | 95 | /*virtual*/ ~LLScrollListText(); |
96 | 96 | ||
97 | virtual void drawToWidth(S32 width, const LLColor4& color, const LLColor4& highlight_color) const; | 97 | virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const; |
98 | virtual S32 getWidth() const { return mWidth; } | 98 | virtual S32 getContentWidth() const; |
99 | virtual void setWidth(S32 width) { mWidth = width; } | ||
100 | virtual S32 getHeight() const { return llround(mFont->getLineHeight()); } | 99 | virtual S32 getHeight() const { return llround(mFont->getLineHeight()); } |
101 | virtual const LLString& getText() const { return mText.getString(); } | 100 | virtual const LLSD getValue() const { return LLSD(mText.getString()); } |
102 | virtual BOOL getVisible() const { return mVisible; } | 101 | virtual BOOL getVisible() const { return mVisible; } |
103 | virtual void highlightText(S32 offset, S32 num_chars) {mHighlightOffset = offset; mHighlightCount = num_chars;} | 102 | virtual void highlightText(S32 offset, S32 num_chars) {mHighlightOffset = offset; mHighlightCount = num_chars;} |
104 | void setText(const LLStringExplicit& text); | 103 | |
105 | virtual void setColor(const LLColor4&); | 104 | virtual void setColor(const LLColor4&); |
106 | virtual BOOL isText() { return TRUE; } | 105 | virtual BOOL isText() { return TRUE; } |
107 | 106 | ||
107 | void setText(const LLStringExplicit& text); | ||
108 | void setFontStyle(const U8 font_style) { mFontStyle = font_style; } | ||
109 | |||
108 | private: | 110 | private: |
109 | LLUIString mText; | 111 | LLUIString mText; |
110 | const LLFontGL* mFont; | 112 | const LLFontGL* mFont; |
111 | LLColor4* mColor; | 113 | LLColor4* mColor; |
112 | const U8 mFontStyle; | 114 | U8 mFontStyle; |
113 | LLFontGL::HAlign mFontAlignment; | 115 | LLFontGL::HAlign mFontAlignment; |
114 | S32 mWidth; | ||
115 | BOOL mVisible; | 116 | BOOL mVisible; |
116 | S32 mHighlightCount; | 117 | S32 mHighlightCount; |
117 | S32 mHighlightOffset; | 118 | S32 mHighlightOffset; |
@@ -124,21 +125,20 @@ private: | |||
124 | class LLScrollListIcon : public LLScrollListCell | 125 | class LLScrollListIcon : public LLScrollListCell |
125 | { | 126 | { |
126 | public: | 127 | public: |
127 | LLScrollListIcon( LLImageGL* icon, S32 width = 0, LLUUID image_id = LLUUID::null); | 128 | LLScrollListIcon( const LLUUID& icon_id, S32 width = 0); |
128 | /*virtual*/ ~LLScrollListIcon(); | 129 | /*virtual*/ ~LLScrollListIcon(); |
129 | virtual void drawToWidth(S32 width, const LLColor4& color, const LLColor4& highlight_color) const; | 130 | virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const; |
130 | virtual S32 getWidth() const { return mWidth; } | 131 | virtual S32 getWidth() const; |
131 | virtual S32 getHeight() const { return mIcon->getHeight(); } | 132 | virtual S32 getHeight() const { return mIcon ? mIcon->getHeight() : 0; } |
132 | virtual const LLString& getText() const { return mImageUUID; } | 133 | // used as sort criterion |
133 | virtual const LLString& getTextLower() const { return mImageUUID; } | 134 | virtual const LLSD getValue() const { return LLSD(mImageUUID); } |
134 | virtual void setWidth(S32 width) { mWidth = width; } | ||
135 | virtual void setColor(const LLColor4&); | 135 | virtual void setColor(const LLColor4&); |
136 | virtual BOOL isText() { return FALSE; } | 136 | virtual BOOL isText() { return FALSE; } |
137 | virtual void setValue(LLSD value); | ||
137 | 138 | ||
138 | private: | 139 | private: |
139 | LLPointer<LLImageGL> mIcon; | 140 | LLPointer<LLImageGL> mIcon; |
140 | LLString mImageUUID; | 141 | LLUUID mImageUUID; |
141 | S32 mWidth; | ||
142 | LLColor4 mColor; | 142 | LLColor4 mColor; |
143 | }; | 143 | }; |
144 | 144 | ||
@@ -147,21 +147,20 @@ class LLScrollListCheck : public LLScrollListCell | |||
147 | public: | 147 | public: |
148 | LLScrollListCheck( LLCheckBoxCtrl* check_box, S32 width = 0); | 148 | LLScrollListCheck( LLCheckBoxCtrl* check_box, S32 width = 0); |
149 | /*virtual*/ ~LLScrollListCheck(); | 149 | /*virtual*/ ~LLScrollListCheck(); |
150 | virtual void drawToWidth(S32 width, const LLColor4& color, const LLColor4& highlight_color) const; | 150 | virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const; |
151 | virtual S32 getWidth() const { return mWidth; } | ||
152 | virtual S32 getHeight() const { return 0; } | 151 | virtual S32 getHeight() const { return 0; } |
153 | virtual void setWidth(S32 width) { mWidth = width; } | 152 | virtual const LLSD getValue() const { return mCheckBox->getValue(); } |
153 | virtual void setValue(LLSD value) { mCheckBox->setValue(value); } | ||
154 | virtual void onCommit() { mCheckBox->onCommit(); } | ||
154 | 155 | ||
155 | virtual BOOL handleClick(); | 156 | virtual BOOL handleClick(); |
156 | virtual void setEnabled(BOOL enable) { if (mCheckBox) mCheckBox->setEnabled(enable); } | 157 | virtual void setEnabled(BOOL enable) { mCheckBox->setEnabled(enable); } |
157 | virtual void setColor(const LLColor4& color) {}; | ||
158 | 158 | ||
159 | LLCheckBoxCtrl* getCheckBox() { return mCheckBox; } | 159 | LLCheckBoxCtrl* getCheckBox() { return mCheckBox; } |
160 | virtual BOOL isText() { return FALSE; } | 160 | virtual BOOL isText() { return FALSE; } |
161 | 161 | ||
162 | private: | 162 | private: |
163 | LLCheckBoxCtrl* mCheckBox; | 163 | LLCheckBoxCtrl* mCheckBox; |
164 | S32 mWidth; | ||
165 | }; | 164 | }; |
166 | 165 | ||
167 | class LLScrollListColumn | 166 | class LLScrollListColumn |
@@ -266,6 +265,7 @@ public: | |||
266 | 265 | ||
267 | /*virtual*/ void draw(); | 266 | /*virtual*/ void draw(); |
268 | /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); | 267 | /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); |
268 | |||
269 | /*virtual*/ void showList(); | 269 | /*virtual*/ void showList(); |
270 | /*virtual*/ LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding); | 270 | /*virtual*/ LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding); |
271 | /*virtual*/ void userSetShape(const LLRect& new_rect); | 271 | /*virtual*/ void userSetShape(const LLRect& new_rect); |
@@ -319,8 +319,8 @@ public: | |||
319 | 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) | 319 | 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) |
320 | { mColumns.push_back( new LLScrollListText(text, font, width, font_style, font_alignment, LLColor4::black, FALSE, visible) ); } | 320 | { mColumns.push_back( new LLScrollListText(text, font, width, font_style, font_alignment, LLColor4::black, FALSE, visible) ); } |
321 | 321 | ||
322 | void addColumn( LLImageGL* icon, S32 width = 0 ) | 322 | void addColumn( const LLUUID& icon_id, S32 width = 0 ) |
323 | { mColumns.push_back( new LLScrollListIcon(icon, width) ); } | 323 | { mColumns.push_back( new LLScrollListIcon(icon_id, width) ); } |
324 | 324 | ||
325 | void addColumn( LLCheckBoxCtrl* check, S32 width = 0 ) | 325 | void addColumn( LLCheckBoxCtrl* check, S32 width = 0 ) |
326 | { mColumns.push_back( new LLScrollListCheck(check,width) ); } | 326 | { mColumns.push_back( new LLScrollListCheck(check,width) ); } |
@@ -333,10 +333,10 @@ public: | |||
333 | 333 | ||
334 | LLScrollListCell *getColumn(const S32 i) const { if (0 <= i && i < (S32)mColumns.size()) { return mColumns[i]; } return NULL; } | 334 | LLScrollListCell *getColumn(const S32 i) const { if (0 <= i && i < (S32)mColumns.size()) { return mColumns[i]; } return NULL; } |
335 | 335 | ||
336 | virtual BOOL handleClick(S32 x, S32 y, MASK mask); | ||
337 | |||
338 | LLString getContentsCSV(); | 336 | LLString getContentsCSV(); |
339 | 337 | ||
338 | virtual void draw(const LLRect& rect, const LLColor4& fg_color, const LLColor4& bg_color, const LLColor4& highlight_color, S32 column_padding); | ||
339 | |||
340 | private: | 340 | private: |
341 | BOOL mSelected; | 341 | BOOL mSelected; |
342 | BOOL mEnabled; | 342 | BOOL mEnabled; |
@@ -345,6 +345,23 @@ private: | |||
345 | std::vector<LLScrollListCell *> mColumns; | 345 | std::vector<LLScrollListCell *> mColumns; |
346 | }; | 346 | }; |
347 | 347 | ||
348 | class LLScrollListItemComment : public LLScrollListItem | ||
349 | { | ||
350 | public: | ||
351 | LLScrollListItemComment(const LLString& comment_string, const LLColor4& color); | ||
352 | |||
353 | /*virtual*/ void draw(const LLRect& rect, const LLColor4& fg_color, const LLColor4& bg_color, const LLColor4& highlight_color, S32 column_padding); | ||
354 | private: | ||
355 | LLColor4 mColor; | ||
356 | }; | ||
357 | |||
358 | class LLScrollListItemSeparator : public LLScrollListItem | ||
359 | { | ||
360 | public: | ||
361 | LLScrollListItemSeparator(); | ||
362 | |||
363 | /*virtual*/ void draw(const LLRect& rect, const LLColor4& fg_color, const LLColor4& bg_color, const LLColor4& highlight_color, S32 column_padding); | ||
364 | }; | ||
348 | 365 | ||
349 | class LLScrollListCtrl : public LLUICtrl, public LLEditMenuHandler, | 366 | class LLScrollListCtrl : public LLUICtrl, public LLEditMenuHandler, |
350 | public LLCtrlListInterface, public LLCtrlScrollInterface | 367 | public LLCtrlListInterface, public LLCtrlScrollInterface |
@@ -370,9 +387,8 @@ public: | |||
370 | void deleteAllItems() { clearRows(); } | 387 | void deleteAllItems() { clearRows(); } |
371 | 388 | ||
372 | // Sets an array of column descriptors | 389 | // Sets an array of column descriptors |
373 | void setColumnHeadings(LLSD headings); | 390 | void setColumnHeadings(LLSD headings); |
374 | // Numerical based sort by column function (used by LLComboBox) | 391 | void sortByColumn(U32 column, BOOL ascending); |
375 | void sortByColumn(U32 column, BOOL ascending); | ||
376 | 392 | ||
377 | // LLCtrlListInterface functions | 393 | // LLCtrlListInterface functions |
378 | virtual S32 getItemCount() const; | 394 | virtual S32 getItemCount() const; |
@@ -390,7 +406,6 @@ public: | |||
390 | virtual LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL); | 406 | virtual LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL); |
391 | // Simple add element. Takes a single array of: | 407 | // Simple add element. Takes a single array of: |
392 | // [ "value" => value, "font" => font, "font-style" => style ] | 408 | // [ "value" => value, "font" => font, "font-style" => style ] |
393 | virtual LLScrollListItem* addSimpleElement(const LLString& value, EAddPosition pos = ADD_BOTTOM, const LLSD& id = LLSD()); | ||
394 | virtual void clearRows(); // clears all elements | 409 | virtual void clearRows(); // clears all elements |
395 | virtual void sortByColumn(LLString name, BOOL ascending); | 410 | virtual void sortByColumn(LLString name, BOOL ascending); |
396 | 411 | ||
@@ -421,18 +436,20 @@ public: | |||
421 | BOOL isSorted(); | 436 | BOOL isSorted(); |
422 | 437 | ||
423 | virtual BOOL isSelected(LLSD value); | 438 | virtual BOOL isSelected(LLSD value); |
424 | 439 | ||
440 | BOOL handleClick(S32 x, S32 y, MASK mask); | ||
425 | BOOL selectFirstItem(); | 441 | BOOL selectFirstItem(); |
426 | BOOL selectNthItem( S32 index ); | 442 | BOOL selectNthItem( S32 index ); |
427 | BOOL selectItemAt(S32 x, S32 y, MASK mask); | 443 | BOOL selectItemAt(S32 x, S32 y, MASK mask); |
428 | 444 | ||
429 | void deleteSingleItem( S32 index ) ; | 445 | void deleteSingleItem( S32 index ); |
446 | void deleteItems(const LLSD& sd); | ||
430 | void deleteSelectedItems(); | 447 | void deleteSelectedItems(); |
431 | void deselectAllItems(BOOL no_commit_on_change = FALSE); // by default, go ahead and commit on selection change | 448 | void deselectAllItems(BOOL no_commit_on_change = FALSE); // by default, go ahead and commit on selection change |
432 | 449 | ||
433 | void highlightNthItem( S32 index ); | 450 | void highlightNthItem( S32 index ); |
434 | void setDoubleClickCallback( void (*cb)(void*) ) { mOnDoubleClickCallback = cb; } | 451 | void setDoubleClickCallback( void (*cb)(void*) ) { mOnDoubleClickCallback = cb; } |
435 | void setMaxiumumSelectCallback( void (*cb)(void*) ) { mOnMaximumSelectCallback = cb; } | 452 | void setMaximumSelectCallback( void (*cb)(void*) ) { mOnMaximumSelectCallback = cb; } |
436 | void setSortChangedCallback( void (*cb)(void*) ) { mOnSortChangedCallback = cb; } | 453 | void setSortChangedCallback( void (*cb)(void*) ) { mOnSortChangedCallback = cb; } |
437 | 454 | ||
438 | void swapWithNext(S32 index); | 455 | void swapWithNext(S32 index); |
@@ -444,19 +461,21 @@ public: | |||
444 | S32 getItemIndex( LLScrollListItem* item ); | 461 | S32 getItemIndex( LLScrollListItem* item ); |
445 | S32 getItemIndex( LLUUID& item_id ); | 462 | S32 getItemIndex( LLUUID& item_id ); |
446 | 463 | ||
464 | LLScrollListItem* addCommentText( const LLString& comment_text, EAddPosition pos = ADD_BOTTOM); | ||
465 | LLScrollListItem* addSeparator(EAddPosition pos); | ||
466 | |||
447 | // "Simple" interface: use this when you're creating a list that contains only unique strings, only | 467 | // "Simple" interface: use this when you're creating a list that contains only unique strings, only |
448 | // one of which can be selected at a time. | 468 | // one of which can be selected at a time. |
449 | LLScrollListItem* addSimpleItem( const LLString& item_text, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE ); | 469 | virtual LLScrollListItem* addSimpleElement(const LLString& value, EAddPosition pos = ADD_BOTTOM, const LLSD& id = LLSD()); |
450 | // Add an item with an associated LLSD | 470 | |
451 | LLScrollListItem* addSimpleItem(const LLString& item_text, LLSD sd, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE, S32 column_width = 0 ); | ||
452 | 471 | ||
453 | BOOL selectSimpleItem( const LLString& item, BOOL case_sensitive = TRUE ); // FALSE if item not found | 472 | BOOL selectItemByLabel( const LLString& item, BOOL case_sensitive = TRUE ); // FALSE if item not found |
454 | BOOL selectSimpleItemByPrefix(const LLString& target, BOOL case_sensitive); | 473 | BOOL selectItemByPrefix(const LLString& target, BOOL case_sensitive = TRUE); |
455 | BOOL selectSimpleItemByPrefix(const LLWString& target, BOOL case_sensitive); | 474 | BOOL selectItemByPrefix(const LLWString& target, BOOL case_sensitive = TRUE); |
456 | const LLString& getSimpleSelectedItem(S32 column = 0) const; | 475 | const LLString getSelectedItemLabel(S32 column = 0) const; |
457 | LLSD getSimpleSelectedValue(); | 476 | LLSD getSelectedValue(); |
458 | 477 | ||
459 | // DEPRECATED: Use LLSD versions of addSimpleItem() and getSimpleSelectedValue(). | 478 | // DEPRECATED: Use LLSD versions of addCommentText() and getSelectedValue(). |
460 | // "StringUUID" interface: use this when you're creating a list that contains non-unique strings each of which | 479 | // "StringUUID" interface: use this when you're creating a list that contains non-unique strings each of which |
461 | // has an associated, unique UUID, and only one of which can be selected at a time. | 480 | // has an associated, unique UUID, and only one of which can be selected at a time. |
462 | LLScrollListItem* addStringUUIDItem(const LLString& item_text, const LLUUID& id, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE, S32 column_width = 0); | 481 | LLScrollListItem* addStringUUIDItem(const LLString& item_text, const LLUUID& id, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE, S32 column_width = 0); |
@@ -472,6 +491,8 @@ public: | |||
472 | LLScrollListItem* getFirstData() const; | 491 | LLScrollListItem* getFirstData() const; |
473 | LLScrollListItem* getLastData() const; | 492 | LLScrollListItem* getLastData() const; |
474 | std::vector<LLScrollListItem*> getAllData() const; | 493 | std::vector<LLScrollListItem*> getAllData() const; |
494 | |||
495 | LLScrollListItem* getItem(const LLSD& sd) const; | ||
475 | 496 | ||
476 | void setAllowMultipleSelection(BOOL mult ) { mAllowMultipleSelection = mult; } | 497 | void setAllowMultipleSelection(BOOL mult ) { mAllowMultipleSelection = mult; } |
477 | 498 | ||
@@ -501,28 +522,34 @@ public: | |||
501 | 522 | ||
502 | S32 getSearchColumn() { return mSearchColumn; } | 523 | S32 getSearchColumn() { return mSearchColumn; } |
503 | void setSearchColumn(S32 column) { mSearchColumn = column; } | 524 | void setSearchColumn(S32 column) { mSearchColumn = column; } |
525 | S32 getColumnIndexFromOffset(S32 x); | ||
526 | S32 getColumnOffsetFromIndex(S32 index); | ||
527 | S32 getRowOffsetFromIndex(S32 index); | ||
504 | 528 | ||
505 | void clearSearchString() { mSearchString.clear(); } | 529 | void clearSearchString() { mSearchString.clear(); } |
506 | 530 | ||
507 | // Overridden from LLView | 531 | // Overridden from LLView |
508 | virtual void draw(); | 532 | /*virtual*/ void draw(); |
509 | virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); | 533 | /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); |
510 | virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); | 534 | /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); |
511 | virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); | 535 | /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); |
512 | virtual BOOL handleHover(S32 x, S32 y, MASK mask); | 536 | /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); |
513 | virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); | 537 | /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); |
514 | virtual BOOL handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent); | 538 | /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent); |
515 | virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); | 539 | /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); |
516 | virtual void setEnabled(BOOL enabled); | 540 | /*virtual*/ BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect); |
517 | virtual void setFocus( BOOL b ); | 541 | /*virtual*/ void setEnabled(BOOL enabled); |
518 | virtual void onFocusReceived(); | 542 | /*virtual*/ void setFocus( BOOL b ); |
519 | virtual void onFocusLost(); | 543 | /*virtual*/ void onFocusReceived(); |
544 | /*virtual*/ void onFocusLost(); | ||
545 | /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); | ||
520 | 546 | ||
521 | virtual BOOL isDirty() const; | 547 | virtual BOOL isDirty() const; |
522 | virtual void resetDirty(); // Clear dirty state | 548 | virtual void resetDirty(); // Clear dirty state |
523 | 549 | ||
524 | virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); | 550 | virtual void updateLayout(); |
525 | virtual void arrange(S32 max_width, S32 max_height); | 551 | virtual void fitContents(S32 max_width, S32 max_height); |
552 | |||
526 | virtual LLRect getRequiredRect(); | 553 | virtual LLRect getRequiredRect(); |
527 | static BOOL rowPreceeds(LLScrollListItem *new_row, LLScrollListItem *test_row); | 554 | static BOOL rowPreceeds(LLScrollListItem *new_row, LLScrollListItem *test_row); |
528 | 555 | ||
@@ -534,12 +561,12 @@ public: | |||
534 | static void onClickColumn(void *userdata); | 561 | static void onClickColumn(void *userdata); |
535 | 562 | ||
536 | void updateColumns(); | 563 | void updateColumns(); |
537 | void updateMaxContentWidth(LLScrollListItem* changed_item); | 564 | void calcMaxContentWidth(LLScrollListItem* changed_item); |
565 | S32 getMaxContentWidth() { return mMaxContentWidth; } | ||
538 | 566 | ||
539 | void setDisplayHeading(BOOL display); | 567 | void setDisplayHeading(BOOL display); |
540 | void setHeadingHeight(S32 heading_height); | 568 | void setHeadingHeight(S32 heading_height); |
541 | void setCollapseEmptyColumns(BOOL collapse); | 569 | void setCollapseEmptyColumns(BOOL collapse); |
542 | void setIsPopup(BOOL is_popup) { mIsPopup = is_popup; } | ||
543 | 570 | ||
544 | LLScrollListItem* hitItem(S32 x,S32 y); | 571 | LLScrollListItem* hitItem(S32 x,S32 y); |
545 | virtual void scrollToShowSelected(); | 572 | virtual void scrollToShowSelected(); |
@@ -564,9 +591,11 @@ public: | |||
564 | void setTotalStaticColumnWidth(int width) { mTotalStaticColumnWidth = width; } | 591 | void setTotalStaticColumnWidth(int width) { mTotalStaticColumnWidth = width; } |
565 | 592 | ||
566 | std::string getSortColumnName(); | 593 | std::string getSortColumnName(); |
567 | BOOL getSortAscending() { return mSortAscending; } | 594 | BOOL getSortAscending() { return mSortColumns.empty() ? TRUE : mSortColumns.back().second; } |
595 | BOOL needsSorting(); | ||
568 | 596 | ||
569 | S32 selectMultiple( LLDynamicArray<LLUUID> ids ); | 597 | S32 selectMultiple( LLDynamicArray<LLUUID> ids ); |
598 | void sortItems(); | ||
570 | 599 | ||
571 | protected: | 600 | protected: |
572 | // "Full" interface: use this when you're creating a list that has one or more of the following: | 601 | // "Full" interface: use this when you're creating a list that has one or more of the following: |
@@ -584,7 +613,7 @@ protected: | |||
584 | // to the caller to delete the item) | 613 | // to the caller to delete the item) |
585 | 614 | ||
586 | // returns FALSE if item faile to be added to list, does NOT delete 'item' | 615 | // returns FALSE if item faile to be added to list, does NOT delete 'item' |
587 | BOOL addItem( LLScrollListItem* item, EAddPosition pos = ADD_BOTTOM ); | 616 | BOOL addItem( LLScrollListItem* item, EAddPosition pos = ADD_BOTTOM, BOOL requires_column = TRUE ); |
588 | void selectPrevItem(BOOL extend_selection); | 617 | void selectPrevItem(BOOL extend_selection); |
589 | void selectNextItem(BOOL extend_selection); | 618 | void selectNextItem(BOOL extend_selection); |
590 | void drawItems(); | 619 | void drawItems(); |
@@ -596,6 +625,7 @@ protected: | |||
596 | void deselectItem(LLScrollListItem* itemp); | 625 | void deselectItem(LLScrollListItem* itemp); |
597 | void commitIfChanged(); | 626 | void commitIfChanged(); |
598 | void setSorted(BOOL sorted); | 627 | void setSorted(BOOL sorted); |
628 | BOOL setSort(S32 column, BOOL ascending); | ||
599 | 629 | ||
600 | protected: | 630 | protected: |
601 | S32 mCurIndex; // For get[First/Next]Data | 631 | S32 mCurIndex; // For get[First/Next]Data |
@@ -615,8 +645,6 @@ protected: | |||
615 | BOOL mNeedsScroll; | 645 | BOOL mNeedsScroll; |
616 | BOOL mCanSelect; | 646 | BOOL mCanSelect; |
617 | BOOL mDisplayColumnHeaders; | 647 | BOOL mDisplayColumnHeaders; |
618 | BOOL mCollapseEmptyColumns; | ||
619 | BOOL mIsPopup; | ||
620 | 648 | ||
621 | typedef std::deque<LLScrollListItem *> item_list; | 649 | typedef std::deque<LLScrollListItem *> item_list; |
622 | item_list mItemList; | 650 | item_list mItemList; |
@@ -626,7 +654,7 @@ protected: | |||
626 | S32 mMaxItemCount; | 654 | S32 mMaxItemCount; |
627 | 655 | ||
628 | LLRect mItemListRect; | 656 | LLRect mItemListRect; |
629 | 657 | S32 mMaxContentWidth; | |
630 | S32 mColumnPadding; | 658 | S32 mColumnPadding; |
631 | 659 | ||
632 | BOOL mBackgroundVisible; | 660 | BOOL mBackgroundVisible; |
@@ -652,22 +680,23 @@ protected: | |||
652 | LLWString mSearchString; | 680 | LLWString mSearchString; |
653 | LLFrameTimer mSearchTimer; | 681 | LLFrameTimer mSearchTimer; |
654 | 682 | ||
655 | LLString mDefaultColumn; | ||
656 | |||
657 | S32 mSearchColumn; | 683 | S32 mSearchColumn; |
658 | S32 mNumDynamicWidthColumns; | 684 | S32 mNumDynamicWidthColumns; |
659 | S32 mTotalStaticColumnWidth; | 685 | S32 mTotalStaticColumnWidth; |
660 | 686 | ||
661 | S32 mSortColumn; | ||
662 | BOOL mSortAscending; | ||
663 | BOOL mSorted; | 687 | BOOL mSorted; |
664 | 688 | ||
665 | std::map<LLString, LLScrollListColumn> mColumns; | 689 | std::map<LLString, LLScrollListColumn> mColumns; |
666 | std::vector<LLScrollListColumn*> mColumnsIndexed; | ||
667 | 690 | ||
668 | BOOL mDirty; | 691 | BOOL mDirty; |
669 | S32 mOriginalSelection; | 692 | S32 mOriginalSelection; |
670 | 693 | ||
694 | typedef std::vector<LLScrollListColumn*> ordered_columns_t; | ||
695 | ordered_columns_t mColumnsIndexed; | ||
696 | |||
697 | typedef std::pair<S32, BOOL> sort_column_t; | ||
698 | std::vector<sort_column_t> mSortColumns; | ||
699 | |||
671 | public: | 700 | public: |
672 | // HACK: Did we draw one selected item this frame? | 701 | // HACK: Did we draw one selected item this frame? |
673 | BOOL mDrewSelected; | 702 | BOOL mDrewSelected; |