diff options
Diffstat (limited to 'indra/llui/llscrolllistctrl.h')
-rw-r--r-- | indra/llui/llscrolllistctrl.h | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index d2d2379328..ebdc82115f 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -73,6 +73,30 @@ public: // *TODO: Add callbacks to Params typedef boost::function<void (void)> callback_t; + + template<typename T> struct maximum + { + typedef T result_type; + + template<typename InputIterator> + T operator()(InputIterator first, InputIterator last) const + { + // If there are no slots to call, just return the + // default-constructed value + if(first == last ) return T(); + T max_value = *first++; + while (first != last) { + if (max_value < *first) + max_value = *first; + ++first; + } + + return max_value; + } + }; + + + typedef boost::signals2::signal<S32 (S32,const LLScrollListItem*,const LLScrollListItem*),maximum<S32> > sort_signal_t; struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> { @@ -195,7 +219,10 @@ public: void deselectAllItems(BOOL no_commit_on_change = FALSE); // by default, go ahead and commit on selection change void clearHighlightedItems(); - void mouseOverHighlightNthItem( S32 index ); + + virtual void mouseOverHighlightNthItem( S32 index ); + + S32 getHighlightedItemInx() const { return mHighlightedItem; } void setDoubleClickCallback( callback_t cb ) { mOnDoubleClickCallback = cb; } void setMaximumSelectCallback( callback_t cb) { mOnMaximumSelectCallback = cb; } @@ -362,6 +389,13 @@ public: void setNeedsSort(bool val = true) { mSorted = !val; } void dirtyColumns(); // some operation has potentially affected column layout or ordering + boost::signals2::connection setSortCallback(sort_signal_t::slot_type cb ) + { + if (!mSortCallback) mSortCallback = new sort_signal_t(); + return mSortCallback->connect(cb); + } + + protected: // "Full" interface: use this when you're creating a list that has one or more of the following: // * contains icons @@ -474,6 +508,8 @@ private: typedef std::pair<S32, BOOL> sort_column_t; std::vector<sort_column_t> mSortColumns; + + sort_signal_t* mSortCallback; }; // end class LLScrollListCtrl #endif // LL_SCROLLLISTCTRL_H |