summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-07-09 12:05:50 -0700
committerMerov Linden <merov@lindenlab.com>2012-07-09 12:05:50 -0700
commit1d41ff232870428022006875e98df5be21731c68 (patch)
tree3e3f54f33795492ab3ac5a69ba46485444ba8034 /indra
parentb490266226ac79cc7570ff7ee921506e941cce16 (diff)
parentc9e11635488720626601b7b4a7926f09031a6908 (diff)
Pull from richard/viewer-chui-folderview
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/llfolderview.cpp2
-rw-r--r--indra/llui/llfolderviewmodel.h207
2 files changed, 104 insertions, 105 deletions
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp
index 92e3b7a8e9..8ade17b763 100644
--- a/indra/llui/llfolderview.cpp
+++ b/indra/llui/llfolderview.cpp
@@ -1927,7 +1927,7 @@ void LLFolderView::updateRenamerPosition()
screenPointToLocal( x, y, &x, &y );
mRenamer->setOrigin( x, y );
- LLRect scroller_rect(0, 0, LLUI::getWindowSize().mV[VX], 0);
+ LLRect scroller_rect(0, 0, (S32)LLUI::getWindowSize().mV[VX], 0);
if (mScrollContainer)
{
scroller_rect = mScrollContainer->getContentWindowRect();
diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h
index 0f5f9a1f50..268ae8eea8 100644
--- a/indra/llui/llfolderviewmodel.h
+++ b/indra/llui/llfolderviewmodel.h
@@ -107,110 +107,6 @@ public:
virtual S32 getFirstRequiredGeneration() const = 0;
};
-class LLFolderViewModelInterface
-{
-public:
- virtual ~LLFolderViewModelInterface() {}
- virtual void requestSortAll() = 0;
-
- virtual void sort(class LLFolderViewFolder*) = 0;
- virtual void filter() = 0;
-
- virtual bool contentsReady() = 0;
- virtual void setFolderView(LLFolderView* folder_view) = 0;
- virtual LLFolderViewFilter* getFilter() = 0;
- virtual const LLFolderViewFilter* getFilter() const = 0;
- virtual std::string getStatusText() = 0;
-
- virtual bool startDrag(std::vector<LLFolderViewModelItem*>& items) = 0;
-};
-
-class LLFolderViewModelCommon : public LLFolderViewModelInterface
-{
-public:
- LLFolderViewModelCommon()
- : mTargetSortVersion(0),
- mFolderView(NULL)
- {}
-
- virtual void requestSortAll()
- {
- // sort everything
- mTargetSortVersion++;
- }
- virtual std::string getStatusText();
- virtual void filter();
-
- void setFolderView(LLFolderView* folder_view) { mFolderView = folder_view;}
-
-protected:
- bool needsSort(class LLFolderViewModelItem* item);
-
- S32 mTargetSortVersion;
- LLFolderView* mFolderView;
-
-};
-
-template <typename SORT_TYPE, typename ITEM_TYPE, typename FOLDER_TYPE, typename FILTER_TYPE>
-class LLFolderViewModel : public LLFolderViewModelCommon
-{
-public:
- LLFolderViewModel(){}
- virtual ~LLFolderViewModel() {}
-
- typedef SORT_TYPE SortType;
- typedef ITEM_TYPE ItemType;
- typedef FOLDER_TYPE FolderType;
- typedef FILTER_TYPE FilterType;
-
- virtual SortType& getSorter() { return mSorter; }
- virtual const SortType& getSorter() const { return mSorter; }
- virtual void setSorter(const SortType& sorter) { mSorter = sorter; requestSortAll(); }
-
- virtual FilterType* getFilter() { return &mFilter; }
- virtual const FilterType* getFilter() const { return &mFilter; }
- virtual void setFilter(const FilterType& filter) { mFilter = filter; }
-
- // TODO RN: remove this and put all filtering logic in view model
- // add getStatusText and isFiltering()
- virtual bool contentsReady() { return true; }
-
-
- struct ViewModelCompare
- {
- ViewModelCompare(const SortType& sorter)
- : mSorter(sorter)
- {}
-
- bool operator () (const LLFolderViewItem* a, const LLFolderViewItem* b) const
- {
- return mSorter(static_cast<const ItemType*>(a->getViewModelItem()), static_cast<const ItemType*>(b->getViewModelItem()));
- }
-
- bool operator () (const LLFolderViewFolder* a, const LLFolderViewFolder* b) const
- {
- return mSorter(static_cast<const ItemType*>(a->getViewModelItem()), static_cast<const ItemType*>(b->getViewModelItem()));
- }
-
- const SortType& mSorter;
- };
-
- void sort(LLFolderViewFolder* folder)
- {
- if (needsSort(folder->getViewModelItem()))
- {
- folder->sortFolders(ViewModelCompare(getSorter()));
- folder->sortItems(ViewModelCompare(getSorter()));
- folder->getViewModelItem()->setSortVersion(mTargetSortVersion);
- folder->requestArrange();
- }
- }
-
-protected:
- SortType mSorter;
- FilterType mFilter;
-};
-
// This is am abstract base class that users of the folderview classes
// would use to bridge the folder view with the underlying data
class LLFolderViewModelItem
@@ -349,5 +245,108 @@ protected:
LLFolderViewItem* mFolderViewItem;
};
+class LLFolderViewModelInterface
+{
+public:
+ virtual ~LLFolderViewModelInterface() {}
+ virtual void requestSortAll() = 0;
+
+ virtual void sort(class LLFolderViewFolder*) = 0;
+ virtual void filter() = 0;
+
+ virtual bool contentsReady() = 0;
+ virtual void setFolderView(LLFolderView* folder_view) = 0;
+ virtual LLFolderViewFilter* getFilter() = 0;
+ virtual const LLFolderViewFilter* getFilter() const = 0;
+ virtual std::string getStatusText() = 0;
+
+ virtual bool startDrag(std::vector<LLFolderViewModelItem*>& items) = 0;
+};
+
+class LLFolderViewModelCommon : public LLFolderViewModelInterface
+{
+public:
+ LLFolderViewModelCommon()
+ : mTargetSortVersion(0),
+ mFolderView(NULL)
+ {}
+
+ virtual void requestSortAll()
+ {
+ // sort everything
+ mTargetSortVersion++;
+ }
+ virtual std::string getStatusText();
+ virtual void filter();
+
+ void setFolderView(LLFolderView* folder_view) { mFolderView = folder_view;}
+
+protected:
+ bool needsSort(class LLFolderViewModelItem* item);
+
+ S32 mTargetSortVersion;
+ LLFolderView* mFolderView;
+
+};
+
+template <typename SORT_TYPE, typename ITEM_TYPE, typename FOLDER_TYPE, typename FILTER_TYPE>
+class LLFolderViewModel : public LLFolderViewModelCommon
+{
+public:
+ LLFolderViewModel(){}
+ virtual ~LLFolderViewModel() {}
+
+ typedef SORT_TYPE SortType;
+ typedef ITEM_TYPE ItemType;
+ typedef FOLDER_TYPE FolderType;
+ typedef FILTER_TYPE FilterType;
+
+ virtual SortType& getSorter() { return mSorter; }
+ virtual const SortType& getSorter() const { return mSorter; }
+ virtual void setSorter(const SortType& sorter) { mSorter = sorter; requestSortAll(); }
+
+ virtual FilterType* getFilter() { return &mFilter; }
+ virtual const FilterType* getFilter() const { return &mFilter; }
+ virtual void setFilter(const FilterType& filter) { mFilter = filter; }
+
+ // TODO RN: remove this and put all filtering logic in view model
+ // add getStatusText and isFiltering()
+ virtual bool contentsReady() { return true; }
+
+
+ struct ViewModelCompare
+ {
+ ViewModelCompare(const SortType& sorter)
+ : mSorter(sorter)
+ {}
+
+ bool operator () (const LLFolderViewItem* a, const LLFolderViewItem* b) const
+ {
+ return mSorter(static_cast<const ItemType*>(a->getViewModelItem()), static_cast<const ItemType*>(b->getViewModelItem()));
+ }
+
+ bool operator () (const LLFolderViewFolder* a, const LLFolderViewFolder* b) const
+ {
+ return mSorter(static_cast<const ItemType*>(a->getViewModelItem()), static_cast<const ItemType*>(b->getViewModelItem()));
+ }
+
+ const SortType& mSorter;
+ };
+
+ void sort(LLFolderViewFolder* folder)
+ {
+ if (needsSort(folder->getViewModelItem()))
+ {
+ folder->sortFolders(ViewModelCompare(getSorter()));
+ folder->sortItems(ViewModelCompare(getSorter()));
+ folder->getViewModelItem()->setSortVersion(mTargetSortVersion);
+ folder->requestArrange();
+ }
+ }
+
+protected:
+ SortType mSorter;
+ FilterType mFilter;
+};
#endif // LLFOLDERVIEWMODEL_H