diff options
author | Merov Linden <merov@lindenlab.com> | 2010-09-20 17:24:33 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2010-09-20 17:24:33 -0700 |
commit | 136029821ca37dbe7d7707a0fb0422612a31bae6 (patch) | |
tree | 6f8adb30c0f4cb4c5a96f2de0f7a1b7befa873d4 /indra/newview/llfolderviewitem.h | |
parent | 85f69fbd8620c98f67a39e9ac09c9946c87251d8 (diff) |
STORM-162 : Makes the folder code more resilient
Diffstat (limited to 'indra/newview/llfolderviewitem.h')
-rw-r--r-- | indra/newview/llfolderviewitem.h | 63 |
1 files changed, 39 insertions, 24 deletions
diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h index 11b644e3aa..9e819aaaaa 100644 --- a/indra/newview/llfolderviewitem.h +++ b/indra/newview/llfolderviewitem.h @@ -121,6 +121,9 @@ public: // Mostly for debugging printout purposes. const std::string& getSearchableLabel() { return mSearchableLabel; } +private: + BOOL mIsSelected; + protected: friend class LLUICtrlFactory; friend class LLFolderViewEventListener; @@ -134,7 +137,6 @@ protected: time_t mCreationDate; LLFolderViewFolder* mParentFolder; LLFolderViewEventListener* mListener; - BOOL mIsSelected; BOOL mIsCurSelection; BOOL mSelectPending; LLFontGL::StyleFlags mLabelStyle; @@ -212,20 +214,24 @@ public: virtual void dirtyFilter(); - // If the selection is 'this' then note that otherwise - // ignore. Returns TRUE if this object was affected. If open is - // TRUE, then folders are opened up along the way to the - // selection. - virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, - BOOL take_keyboard_focus); - - // This method is used to toggle the selection of an item. If - // selection is 'this', then note selection, and return TRUE. + // If 'selection' is 'this' then note that otherwise ignore. + // Returns TRUE if this item ends up being selected. + virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus); + + // This method is used to set the selection state of an item. + // If 'selection' is 'this' then note selection. + // Returns TRUE if the selection state of this item was changed. virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected); - + // this method is used to group select items - virtual S32 extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& items){ return FALSE; } - + virtual void extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& items) { } + + // this method is used to deselect this element + void deselectItem(); + + // this method is used to select this element + void selectItem(); + // gets multiple-element selection virtual std::set<LLUUID> getSelectionList() const; @@ -238,7 +244,7 @@ public: // destroys this item recursively virtual void destroyView(); - BOOL isSelected() { return mIsSelected; } + BOOL isSelected() const { return mIsSelected; } void setUnselected() { mIsSelected = FALSE; } @@ -359,6 +365,13 @@ public: UNKNOWN, TRASH, NOT_TRASH } ETrash; +private: + S32 mNumDescendantsSelected; + +public: // Accessed needed by LLFolderViewItem + void recursiveIncrementNumDescendantsSelected(S32 increment); + S32 numSelected(void) const { return mNumDescendantsSelected + (isSelected() ? 1 : 0); } + protected: typedef std::list<LLFolderViewItem*> items_t; typedef std::list<LLFolderViewFolder*> folders_t; @@ -420,18 +433,19 @@ public: virtual void dirtyFilter(); // Passes selection information on to children and record - // selection information if necessary. Returns TRUE if this object - // (or a child) was affected. - virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, - BOOL take_keyboard_focus); - - // This method is used to change the selection of an item. If - // selection is 'this', then note selection as true. Returns TRUE - // if this or a child is now selected. + // selection information if necessary. + // Returns TRUE if this object (or a child) ends up being selected. + // If 'openitem' is TRUE then folders are opened up along the way to the selection. + virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus); + + // This method is used to change the selection of an item. + // Recursively traverse all children; if 'selection' is 'this' then change + // the select status if necessary. + // Returns TRUE if the selection state of this folder, or of a child, was changed. virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected); - + // this method is used to group select items - virtual S32 extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& items); + virtual void extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& items); // Returns true is this object and all of its children can be removed. virtual BOOL isRemovable(); @@ -521,6 +535,7 @@ public: time_t getCreationDate() const; bool isTrash() const; + S32 getNumSelectedDescendants(void) const { return mNumDescendantsSelected; } }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |