00001
00040 #ifndef LL_LLFOLDERVIEW_H
00041 #define LL_LLFOLDERVIEW_H
00042
00043 #include <vector>
00044 #include <map>
00045 #include <deque>
00046
00047 #include "lluictrl.h"
00048 #include "v4color.h"
00049 #include "lldarray.h"
00050
00051 #include "stdenums.h"
00052 #include "llfontgl.h"
00053 #include "lleditmenuhandler.h"
00054 #include "llviewerimage.h"
00055 #include "lldepthstack.h"
00056 #include "lltooldraganddrop.h"
00057
00058 class LLMenuGL;
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069 class LLFolderViewItem;
00070 class LLFolderView;
00071 class LLInventoryModel;
00072 class LLScrollableContainerView;
00073 typedef BOOL (*LLFolderSearchFunction)(LLFolderViewItem* first_item, const char *find_text, BOOL backward);
00074
00075 class LLFolderViewEventListener
00076 {
00077 public:
00078 virtual ~LLFolderViewEventListener( void ) {}
00079 virtual const LLString& getName() const = 0;
00080 virtual const LLString& getDisplayName() const = 0;
00081 virtual const LLUUID& getUUID() const = 0;
00082 virtual U32 getCreationDate() const = 0;
00083 virtual PermissionMask getPermissionMask() const = 0;
00084 virtual LLUIImagePtr getIcon() const = 0;
00085 virtual LLFontGL::StyleFlags getLabelStyle() const = 0;
00086 virtual LLString getLabelSuffix() const = 0;
00087 virtual void openItem( void ) = 0;
00088 virtual void previewItem( void ) = 0;
00089 virtual void selectItem(void) = 0;
00090 virtual void showProperties(void) = 0;
00091 virtual BOOL isItemRenameable() const = 0;
00092 virtual BOOL renameItem(const LLString& new_name) = 0;
00093 virtual BOOL isItemMovable( void ) = 0;
00094 virtual BOOL isItemRemovable( void ) = 0;
00095 virtual BOOL removeItem() = 0;
00096 virtual void removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batch) = 0;
00097 virtual void move( LLFolderViewEventListener* parent_listener ) = 0;
00098 virtual BOOL isItemCopyable() const = 0;
00099 virtual BOOL copyToClipboard() const = 0;
00100 virtual void cutToClipboard() = 0;
00101 virtual BOOL isClipboardPasteable() const = 0;
00102 virtual void pasteFromClipboard() = 0;
00103 virtual void buildContextMenu(LLMenuGL& menu, U32 flags) = 0;
00104 virtual BOOL isUpToDate() const = 0;
00105 virtual BOOL hasChildren() const = 0;
00106 virtual LLInventoryType::EType getInventoryType() const = 0;
00107 virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action) {}
00108
00109
00110
00111 virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const = 0;
00112
00113
00114
00115
00116
00117 virtual BOOL dragOrDrop(MASK mask, BOOL drop,
00118 EDragAndDropType cargo_type,
00119 void* cargo_data) = 0;
00120
00121
00122
00123
00124
00125
00126
00127
00128 void arrangeAndSet(LLFolderViewItem* focus, BOOL set_selection,
00129 BOOL take_keyboard_focus = TRUE);
00130 };
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140 class LLFolderViewListenerFunctor
00141 {
00142 public:
00143 virtual ~LLFolderViewListenerFunctor() {}
00144 virtual void operator()(LLFolderViewEventListener* listener) = 0;
00145 };
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156 class LLFolderViewItem;
00157 class LLFolderViewFolder;
00158
00159 class LLFolderViewFunctor
00160 {
00161 public:
00162 virtual ~LLFolderViewFunctor() {}
00163 virtual void doFolder(LLFolderViewFolder* folder) = 0;
00164 virtual void doItem(LLFolderViewItem* item) = 0;
00165 };
00166
00167 class LLInventoryFilter
00168 {
00169 public:
00170 typedef enum e_folder_show
00171 {
00172 SHOW_ALL_FOLDERS,
00173 SHOW_NON_EMPTY_FOLDERS,
00174 SHOW_NO_FOLDERS
00175 } EFolderShow;
00176
00177 typedef enum e_filter_behavior
00178 {
00179 FILTER_NONE,
00180 FILTER_RESTART,
00181 FILTER_LESS_RESTRICTIVE,
00182 FILTER_MORE_RESTRICTIVE
00183 } EFilterBehavior;
00184
00185 static const U32 SO_DATE = 1;
00186 static const U32 SO_FOLDERS_BY_NAME = 2;
00187 static const U32 SO_SYSTEM_FOLDERS_TO_TOP = 4;
00188
00189 LLInventoryFilter(const LLString& name);
00190 virtual ~LLInventoryFilter();
00191
00192 void setFilterTypes(U32 types);
00193 U32 getFilterTypes() const { return mFilterOps.mFilterTypes; }
00194
00195 void setFilterSubString(const LLString& string);
00196 const LLString getFilterSubString(BOOL trim = FALSE);
00197
00198 void setFilterPermissions(PermissionMask perms);
00199 PermissionMask getFilterPermissions() const { return mFilterOps.mPermissions; }
00200
00201 void setDateRange(U32 min_date, U32 max_date);
00202 void setDateRangeLastLogoff(BOOL sl);
00203 U32 getMinDate() const { return mFilterOps.mMinDate; }
00204 U32 getMaxDate() const { return mFilterOps.mMaxDate; }
00205
00206 void setHoursAgo(U32 hours);
00207 U32 getHoursAgo() const { return mFilterOps.mHoursAgo; }
00208
00209 void setShowFolderState( EFolderShow state);
00210 EFolderShow getShowFolderState() { return mFilterOps.mShowFolderState; }
00211
00212 void setSortOrder(U32 order);
00213 U32 getSortOrder() { return mOrder; }
00214
00215 BOOL check(LLFolderViewItem* item);
00216 std::string::size_type getStringMatchOffset() const;
00217 BOOL isActive();
00218 BOOL isNotDefault();
00219 BOOL isModified();
00220 BOOL isModifiedAndClear();
00221 BOOL isSinceLogoff();
00222 void clearModified() { mModified = FALSE; mFilterBehavior = FILTER_NONE; }
00223 const LLString getName() const { return mName; }
00224 LLString getFilterText();
00225
00226 void setFilterCount(S32 count) { mFilterCount = count; }
00227 S32 getFilterCount() { return mFilterCount; }
00228 void decrementFilterCount() { mFilterCount--; }
00229
00230 void markDefault();
00231 void resetDefault();
00232
00233 BOOL isFilterWith(LLInventoryType::EType t);
00234
00235 S32 getCurrentGeneration() const { return mFilterGeneration; }
00236 S32 getMinRequiredGeneration() const { return mMinRequiredGeneration; }
00237 S32 getMustPassGeneration() const { return mMustPassGeneration; }
00238
00239
00240 void setModified(EFilterBehavior behavior = FILTER_RESTART);
00241
00242 void toLLSD(LLSD& data);
00243 void fromLLSD(LLSD& data);
00244
00245 protected:
00246 struct filter_ops
00247 {
00248 U32 mFilterTypes;
00249 U32 mMinDate;
00250 U32 mMaxDate;
00251 U32 mHoursAgo;
00252 EFolderShow mShowFolderState;
00253 PermissionMask mPermissions;
00254 };
00255 filter_ops mFilterOps;
00256 filter_ops mDefaultFilterOps;
00257 std::string::size_type mSubStringMatchOffset;
00258 LLString mFilterSubString;
00259 U32 mOrder;
00260 const LLString mName;
00261 S32 mFilterGeneration;
00262 S32 mMustPassGeneration;
00263 S32 mMinRequiredGeneration;
00264 S32 mFilterCount;
00265 S32 mNextFilterGeneration;
00266 EFilterBehavior mFilterBehavior;
00267
00268 private:
00269 U32 mLastLogoff;
00270 BOOL mModified;
00271 BOOL mNeedTextRebuild;
00272 LLString mFilterText;
00273 };
00274
00275
00276
00277 enum EInventorySortGroup
00278 {
00279 SG_SYSTEM_FOLDER,
00280 SG_TRASH_FOLDER,
00281 SG_NORMAL_FOLDER,
00282 SG_ITEM
00283 };
00284
00285 class LLInventorySort
00286 {
00287 public:
00288 LLInventorySort()
00289 : mSortOrder(0),
00290 mByDate(false),
00291 mSystemToTop(false),
00292 mFoldersByName(false) { }
00293
00294
00295 bool updateSort(U32 order);
00296 U32 getSort() { return mSortOrder; }
00297
00298 bool operator()(LLFolderViewItem* a, LLFolderViewItem* b);
00299 private:
00300 U32 mSortOrder;
00301 bool mByDate;
00302 bool mSystemToTop;
00303 bool mFoldersByName;
00304 };
00305
00306
00307
00308
00309
00310
00311
00312
00313 class LLFontGL;
00314 class LLFolderViewFolder;
00315 class LLFolderView;
00316
00317 class LLFolderViewItem : public LLUICtrl
00318 {
00319 protected:
00320 friend class LLFolderViewEventListener;
00321
00322 static const LLFontGL* sFont;
00323 static const LLFontGL* sSmallFont;
00324 static LLColor4 sFgColor;
00325 static LLColor4 sHighlightBgColor;
00326 static LLColor4 sHighlightFgColor;
00327 static LLColor4 sFilterBGColor;
00328 static LLColor4 sFilterTextColor;
00329 static LLColor4 sSuffixColor;
00330 static LLColor4 sSearchStatusColor;
00331
00332 LLString mLabel;
00333 LLString mSearchableLabel;
00334 LLString mType;
00335 S32 mLabelWidth;
00336 U32 mCreationDate;
00337 LLFolderViewFolder* mParentFolder;
00338 LLFolderViewEventListener* mListener;
00339 BOOL mIsSelected;
00340 BOOL mIsCurSelection;
00341 BOOL mSelectPending;
00342 LLFontGL::StyleFlags mLabelStyle;
00343 LLString mLabelSuffix;
00344 LLUIImagePtr mIcon;
00345 LLString mStatusText;
00346 BOOL mHasVisibleChildren;
00347 S32 mIndentation;
00348 S32 mNumDescendantsSelected;
00349 BOOL mFiltered;
00350 S32 mLastFilterGeneration;
00351 std::string::size_type mStringMatchOffset;
00352 F32 mControlLabelRotation;
00353 LLFolderView* mRoot;
00354 BOOL mDragAndDropTarget;
00355 LLUIImagePtr mArrowImage;
00356 LLUIImagePtr mBoxImage;
00357 BOOL mIsLoading;
00358 LLTimer mTimeSinceRequestStart;
00359
00360
00361
00362
00363
00364 void setSelectionFromRoot(LLFolderViewItem* selection, BOOL open,
00365 BOOL take_keyboard_focus = TRUE);
00366
00367
00368 void changeSelectionFromRoot(LLFolderViewItem* selection, BOOL selected);
00369
00370
00371 void extendSelectionFromRoot(LLFolderViewItem* selection);
00372
00373
00374
00375 virtual BOOL addItem(LLFolderViewItem*) { return FALSE; }
00376 virtual BOOL addFolder(LLFolderViewFolder*) { return FALSE; }
00377
00378 public:
00379
00380
00381
00382 void arrangeFromRoot();
00383 void filterFromRoot( void );
00384
00385
00386 LLFolderViewItem( const LLString& name, LLUIImagePtr icon, S32 creation_date, LLFolderView* root, LLFolderViewEventListener* listener );
00387 virtual ~LLFolderViewItem( void );
00388
00389
00390 enum { ARRANGE = TRUE, DO_NOT_ARRANGE = FALSE };
00391 virtual BOOL addToFolder(LLFolderViewFolder* folder, LLFolderView* root);
00392
00393 virtual EInventorySortGroup getSortGroup();
00394
00395
00396
00397 virtual S32 arrange( S32* width, S32* height, S32 filter_generation );
00398 virtual S32 getItemHeight();
00399
00400
00401 virtual void filter( LLInventoryFilter& filter);
00402
00403
00404 S32 getLastFilterGeneration() { return mLastFilterGeneration; }
00405
00406 virtual void dirtyFilter();
00407
00408
00409
00410
00411
00412 virtual BOOL setSelection(LLFolderViewItem* selection, BOOL open,
00413 BOOL take_keyboard_focus);
00414
00415
00416
00417 virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected);
00418
00419
00420 virtual S32 extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& items){ return FALSE; }
00421
00422
00423 virtual void recursiveDeselect(BOOL deselect_self);
00424
00425
00426 virtual BOOL getSelectionList(std::set<LLUUID> &selection){return TRUE;}
00427
00428
00429 virtual BOOL isRemovable();
00430
00431
00432 virtual BOOL isMovable();
00433
00434
00435 virtual void destroyView();
00436
00437 S32 getNumSelectedDescendants() { return mNumDescendantsSelected; }
00438
00439 BOOL isSelected() { return mIsSelected; }
00440
00441 void setIsCurSelection(BOOL select) { mIsCurSelection = select; }
00442
00443 BOOL getIsCurSelection() { return mIsCurSelection; }
00444
00445 BOOL hasVisibleChildren() { return mHasVisibleChildren; }
00446
00447
00448
00449
00450 BOOL remove();
00451
00452
00453 void buildContextMenu(LLMenuGL& menu, U32 flags);
00454
00455
00456
00457 const LLString& getName( void ) const;
00458
00459 const LLString& getSearchableLabel( void ) const;
00460
00461
00462
00463
00464 const char* getLabel() const { return mLabel.c_str(); }
00465
00466
00467 virtual U32 getCreationDate() const { return mCreationDate; }
00468
00469 LLFolderViewFolder* getParentFolder( void ) { return mParentFolder; }
00470 const LLFolderViewFolder* getParentFolder( void ) const { return mParentFolder; }
00471
00472 LLFolderViewItem* getNextOpenNode( BOOL include_children = TRUE );
00473 LLFolderViewItem* getPreviousOpenNode( BOOL include_children = TRUE );
00474
00475 const LLFolderViewEventListener* getListener( void ) const { return mListener; }
00476 LLFolderViewEventListener* getListener( void ) { return mListener; }
00477
00478
00479 void rename(const LLString& new_name);
00480
00481
00482 virtual void open( void );
00483 virtual void preview(void);
00484
00485
00486 virtual void setOpen(BOOL open = TRUE) {};
00487
00488 virtual BOOL isOpen() { return FALSE; }
00489
00490 LLFolderView* getRoot();
00491 BOOL isDescendantOf( const LLFolderViewFolder* potential_ancestor );
00492 S32 getIndentation() { return mIndentation; }
00493
00494 virtual BOOL potentiallyVisible();
00495
00496 virtual BOOL getFiltered();
00497 virtual BOOL getFiltered(S32 filter_generation);
00498 virtual void setFiltered(BOOL filtered, S32 filter_generation);
00499
00500
00501 void setIcon(LLUIImagePtr icon);
00502
00503
00504 virtual void refresh();
00505
00506 virtual void applyListenerFunctorRecursively(LLFolderViewListenerFunctor& functor);
00507
00508
00509 virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
00510 virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
00511 virtual BOOL handleHover( S32 x, S32 y, MASK mask );
00512 virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask );
00513 virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
00514 virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
00515
00516
00517 virtual void draw();
00518 virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
00519 EDragAndDropType cargo_type,
00520 void* cargo_data,
00521 EAcceptance* accept,
00522 LLString& tooltip_msg);
00523 };
00524
00525
00526
00527 typedef bool (*sort_order_f)(LLFolderViewItem* a, LLFolderViewItem* b);
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538 class LLFolderViewFolder : public LLFolderViewItem
00539 {
00540 public:
00541 typedef enum e_trash
00542 {
00543 UNKNOWN, TRASH, NOT_TRASH
00544 } ETrash;
00545
00546 protected:
00547 typedef std::vector<LLFolderViewItem*> items_t;
00548 typedef std::vector<LLFolderViewFolder*> folders_t;
00549 items_t mItems;
00550 folders_t mFolders;
00551 LLInventorySort mSortFunction;
00552
00553 BOOL mIsOpen;
00554 BOOL mExpanderHighlighted;
00555 F32 mCurHeight;
00556 F32 mTargetHeight;
00557 F32 mAutoOpenCountdown;
00558 U32 mSubtreeCreationDate;
00559 ETrash mAmTrash;
00560 S32 mLastArrangeGeneration;
00561 S32 mLastCalculatedWidth;
00562 S32 mCompletedFilterGeneration;
00563 S32 mMostFilteredDescendantGeneration;
00564 public:
00565 typedef enum e_recurse_type
00566 {
00567 RECURSE_NO,
00568 RECURSE_UP,
00569 RECURSE_DOWN,
00570 RECURSE_UP_DOWN
00571 } ERecurseType;
00572
00573 LLFolderViewFolder( const LLString& name, LLUIImagePtr icon,
00574 LLFolderView* root,
00575 LLFolderViewEventListener* listener );
00576 virtual ~LLFolderViewFolder( void );
00577
00578 virtual BOOL potentiallyVisible();
00579
00580 LLFolderViewItem* getNextFromChild( LLFolderViewItem*, BOOL include_children = TRUE );
00581 LLFolderViewItem* getPreviousFromChild( LLFolderViewItem*, BOOL include_children = TRUE );
00582
00583
00584 virtual BOOL addToFolder(LLFolderViewFolder* folder, LLFolderView* root);
00585
00586
00587
00588 virtual S32 arrange( S32* width, S32* height, S32 filter_generation );
00589
00590 BOOL needsArrange();
00591
00592
00593 virtual EInventorySortGroup getSortGroup();
00594
00595 virtual void setCompletedFilterGeneration(S32 generation, BOOL recurse_up);
00596 virtual S32 getCompletedFilterGeneration() { return mCompletedFilterGeneration; }
00597
00598 BOOL hasFilteredDescendants(S32 filter_generation) { return mMostFilteredDescendantGeneration >= filter_generation; }
00599 BOOL hasFilteredDescendants();
00600
00601
00602 virtual void filter( LLInventoryFilter& filter);
00603 virtual void setFiltered(BOOL filtered, S32 filter_generation);
00604 virtual void dirtyFilter();
00605
00606
00607
00608
00609 virtual BOOL setSelection(LLFolderViewItem* selection, BOOL open,
00610 BOOL take_keyboard_focus);
00611
00612
00613
00614
00615 virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected);
00616
00617
00618 virtual S32 extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& items);
00619
00620 virtual void recursiveDeselect(BOOL deselect_self);
00621
00622
00623 virtual BOOL isRemovable();
00624
00625
00626 virtual BOOL isMovable();
00627
00628
00629 virtual void destroyView();
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639 BOOL removeItem(LLFolderViewItem* item);
00640
00641
00642
00643 void removeView(LLFolderViewItem* item);
00644
00645
00646
00647 void extractItem( LLFolderViewItem* item );
00648
00649
00650 void resort(LLFolderViewItem* item);
00651
00652 void setItemSortOrder(U32 ordering);
00653 void sortBy(U32);
00654
00655
00656 void setAutoOpenCountdown(F32 countdown) { mAutoOpenCountdown = countdown; }
00657
00658
00659
00660 virtual void toggleOpen();
00661
00662
00663 virtual void setOpen(BOOL open = TRUE);
00664
00665
00666
00667 virtual void requestArrange(BOOL include_descendants = FALSE);
00668
00669
00670
00671
00672
00673 virtual void setOpenArrangeRecursively(BOOL open, ERecurseType recurse = RECURSE_NO);
00674
00675
00676 virtual BOOL isOpen() { return mIsOpen; }
00677
00678
00679 BOOL handleDragAndDropFromChild(MASK mask,
00680 BOOL drop,
00681 EDragAndDropType cargo_type,
00682 void* cargo_data,
00683 EAcceptance* accept,
00684 LLString& tooltip_msg);
00685
00686 void applyFunctorRecursively(LLFolderViewFunctor& functor);
00687 virtual void applyListenerFunctorRecursively(LLFolderViewListenerFunctor& functor);
00688
00689 virtual void open( void );
00690 virtual BOOL addItem(LLFolderViewItem* item);
00691 virtual BOOL addFolder( LLFolderViewFolder* folder);
00692
00693
00694 virtual BOOL handleHover(S32 x, S32 y, MASK mask);
00695 virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
00696 virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
00697 virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
00698 virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
00699 EDragAndDropType cargo_type,
00700 void* cargo_data,
00701 EAcceptance* accept,
00702 LLString& tooltip_msg);
00703 virtual void draw();
00704
00705 U32 getCreationDate() const;
00706 bool isTrash();
00707 };
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717 class LLUICtrl;
00718 class LLLineEditor;
00719
00720 class LLFolderView : public LLFolderViewFolder, LLEditMenuHandler
00721 {
00722 public:
00723 typedef void (*SelectCallback)(const std::deque<LLFolderViewItem*> &items, BOOL user_action, void* data);
00724
00725 static F32 sAutoOpenTime;
00726
00727 LLFolderView( const LLString& name, LLUIImagePtr root_folder_icon, const LLRect& rect,
00728 const LLUUID& source_id, LLView *parent_view );
00729 virtual ~LLFolderView( void );
00730
00731 virtual BOOL canFocusChildren() const;
00732
00733
00734
00735 void setSortOrder(U32 order);
00736 void checkTreeResortForModelChanged();
00737 void setFilterPermMask(PermissionMask filter_perm_mask) { mFilter.setFilterPermissions(filter_perm_mask); }
00738 void setSelectCallback(SelectCallback callback, void* user_data) { mSelectCallback = callback, mUserData = user_data; }
00739 void setAllowMultiSelect(BOOL allow) { mAllowMultiSelect = allow; }
00740
00741 LLInventoryFilter* getFilter() { return &mFilter; }
00742 const LLString getFilterSubString(BOOL trim = FALSE);
00743 U32 getFilterTypes() const { return mFilter.getFilterTypes(); }
00744 PermissionMask getFilterPermissions() const { return mFilter.getFilterPermissions(); }
00745 LLInventoryFilter::EFolderShow getShowFolderState() { return mFilter.getShowFolderState(); }
00746 U32 getSortOrder() const;
00747 BOOL isFilterModified() { return mFilter.isNotDefault(); }
00748 BOOL getAllowMultiSelect() { return mAllowMultiSelect; }
00749
00750
00751 void closeAllFolders();
00752 void openFolder(const LLString& foldername);
00753
00754 virtual void toggleOpen() {};
00755 virtual void setOpenArrangeRecursively(BOOL open, ERecurseType recurse);
00756 virtual BOOL addFolder( LLFolderViewFolder* folder);
00757
00758
00759
00760 virtual S32 arrange( S32* width, S32* height, S32 filter_generation );
00761
00762 void arrangeAll() { mArrangeGeneration++; }
00763 S32 getArrangeGeneration() { return mArrangeGeneration; }
00764
00765
00766 virtual void filter( LLInventoryFilter& filter);
00767
00768
00769 virtual LLFolderViewItem* getCurSelectedItem( void );
00770
00771
00772 virtual BOOL setSelection(LLFolderViewItem* selection, BOOL open,
00773 BOOL take_keyboard_focus);
00774
00775
00776
00777 virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected);
00778
00779 virtual S32 extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& items);
00780
00781 virtual BOOL getSelectionList(std::set<LLUUID> &selection);
00782
00783
00784 void sanitizeSelection();
00785 void clearSelection();
00786 void addToSelectionList(LLFolderViewItem* item);
00787 void removeFromSelectionList(LLFolderViewItem* item);
00788
00789 BOOL startDrag(LLToolDragAndDrop::ESource source);
00790 void setDragAndDropThisFrame() { mDragAndDropThisFrame = TRUE; }
00791
00792
00793 void removeSelectedItems();
00794
00795
00796 void openSelectedItems( void );
00797 void propertiesSelectedItems( void );
00798
00799 void autoOpenItem(LLFolderViewFolder* item);
00800 void closeAutoOpenedFolders();
00801 BOOL autoOpenTest(LLFolderViewFolder* item);
00802
00803
00804 virtual void copy();
00805 virtual BOOL canCopy() const;
00806
00807 virtual void cut();
00808 virtual BOOL canCut() const;
00809
00810 virtual void paste();
00811 virtual BOOL canPaste() const;
00812
00813 virtual void doDelete();
00814 virtual BOOL canDoDelete() const;
00815
00816
00817 void startRenamingSelectedItem( void );
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828 void setFocus(BOOL focus);
00829
00830
00832 BOOL handleKeyHere( KEY key, MASK mask );
00833 BOOL handleUnicodeCharHere(llwchar uni_char);
00834 BOOL handleMouseDown( S32 x, S32 y, MASK mask );
00835 BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
00836 BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
00837 BOOL handleHover( S32 x, S32 y, MASK mask );
00838 BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
00839 EDragAndDropType cargo_type,
00840 void* cargo_data,
00841 EAcceptance* accept,
00842 LLString& tooltip_msg);
00843 void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
00844 void onFocusLost();
00845 virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
00846 virtual void draw();
00847 virtual void deleteAllChildren();
00848
00849 void scrollToShowSelection();
00850 void scrollToShowItem(LLFolderViewItem* item);
00851 void setScrollContainer( LLScrollableContainerView* parent ) { mScrollContainer = parent; }
00852 LLRect getVisibleRect();
00853
00854 BOOL search(LLFolderViewItem* first_item, const LLString &search_string, BOOL backward);
00855 void setShowSelectionContext(BOOL show) { mShowSelectionContext = show; }
00856 BOOL getShowSelectionContext();
00857 void setShowSingleSelection(BOOL show);
00858 BOOL getShowSingleSelection() { return mShowSingleSelection; }
00859 F32 getSelectionFadeElapsedTime() { return mMultiSelectionFadeTimer.getElapsedTimeF32(); }
00860
00861 void addItemID(const LLUUID& id, LLFolderViewItem* itemp);
00862 void removeItemID(const LLUUID& id);
00863 LLFolderViewItem* getItemByID(const LLUUID& id);
00864
00865 void doIdle();
00866 static void idle(void* user_data);
00867
00868 BOOL needsAutoSelect() { return mNeedsAutoSelect && !mAutoSelectOverride; }
00869 BOOL needsAutoRename() { return mNeedsAutoRename; }
00870 void setNeedsAutoRename(BOOL val) { mNeedsAutoRename = val; }
00871
00872 BOOL getDebugFilters() { return mDebugFilters; }
00873
00874
00875 void dumpSelectionInformation();
00876
00877 protected:
00878 LLScrollableContainerView* mScrollContainer;
00879
00880 static void commitRename( LLUICtrl* renamer, void* user_data );
00881 static void onRenamerLost( LLUICtrl* renamer, void* user_data);
00882
00883 void finishRenamingItem( void );
00884 void revertRenamingItem( void );
00885
00886 protected:
00887 LLHandle<LLView> mPopupMenuHandle;
00888
00889 typedef std::deque<LLFolderViewItem*> selected_items_t;
00890 selected_items_t mSelectedItems;
00891 BOOL mKeyboardSelection;
00892 BOOL mAllowMultiSelect;
00893 BOOL mShowFolderHierarchy;
00894 LLUUID mSourceID;
00895
00896
00897 LLFolderViewItem* mRenameItem;
00898 LLLineEditor* mRenamer;
00899
00900 BOOL mNeedsScroll;
00901 LLFolderViewItem* mLastScrollItem;
00902 LLCoordGL mLastScrollOffset;
00903 BOOL mNeedsAutoSelect;
00904 BOOL mAutoSelectOverride;
00905 BOOL mNeedsAutoRename;
00906
00907 BOOL mDebugFilters;
00908 U32 mSortOrder;
00909 LLDepthStack<LLFolderViewFolder> mAutoOpenItems;
00910 LLFolderViewFolder* mAutoOpenCandidate;
00911 LLFrameTimer mAutoOpenTimer;
00912 LLFrameTimer mSearchTimer;
00913 LLString mSearchString;
00914 LLInventoryFilter mFilter;
00915 BOOL mShowSelectionContext;
00916 BOOL mShowSingleSelection;
00917 LLFrameTimer mMultiSelectionFadeTimer;
00918 S32 mArrangeGeneration;
00919
00920 void* mUserData;
00921 SelectCallback mSelectCallback;
00922 S32 mSignalSelectCallback;
00923 S32 mMinWidth;
00924 std::map<LLUUID, LLFolderViewItem*> mItemMap;
00925 BOOL mDragAndDropThisFrame;
00926
00927 };
00928
00929 bool sort_item_name(LLFolderViewItem* a, LLFolderViewItem* b);
00930 bool sort_item_date(LLFolderViewItem* a, LLFolderViewItem* b);
00931
00932
00933 const U32 SUPPRESS_OPEN_ITEM = 0x1;
00934 const U32 FIRST_SELECTED_ITEM = 0x2;
00935
00936 #endif // LL_LLFOLDERVIEW_H