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 LLViewerImage* 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) = 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 typedef bool(*comparison_function_t)(LLInventorySort*self, LLFolderViewItem* a, LLFolderViewItem* b);
00289
00290 LLInventorySort()
00291 : mSortOrder(0) { setComparisonFunction(compare); }
00292
00293
00294 bool updateSort(U32 order);
00295 U32 getSort() { return mSortOrder; }
00296
00297 bool isByDate() const { return mByDate; }
00298 bool isSystemToTop() const { return mSystemToTop; }
00299 bool isFoldersByName() const { return mFoldersByName; }
00300
00301
00302 bool operator()(LLFolderViewItem* a, LLFolderViewItem* b);
00303
00304 void setComparisonFunction(comparison_function_t func) { mComparisonFunction = func; }
00305 static bool compare(LLInventorySort*self, LLFolderViewItem* a, LLFolderViewItem* b);
00306 private:
00307 comparison_function_t mComparisonFunction;
00308
00309 U32 mSortOrder;
00310 bool mByDate;
00311 bool mSystemToTop;
00312 bool mFoldersByName;
00313 };
00314
00315
00316
00317
00318
00319
00320
00321
00322 class LLFontGL;
00323 class LLFolderViewFolder;
00324 class LLFolderView;
00325
00326 class LLFolderViewItem : public LLUICtrl
00327 {
00328 protected:
00329 friend class LLFolderViewEventListener;
00330
00331 static const LLFontGL* sFont;
00332 static const LLFontGL* sSmallFont;
00333 static LLColor4 sFgColor;
00334 static LLColor4 sHighlightBgColor;
00335 static LLColor4 sHighlightFgColor;
00336 static LLColor4 sFilterBGColor;
00337 static LLColor4 sFilterTextColor;
00338
00339 LLString mLabel;
00340 LLString mSearchableLabel;
00341 LLString mType;
00342 S32 mLabelWidth;
00343 U32 mCreationDate;
00344 LLFolderViewFolder* mParentFolder;
00345 LLFolderViewEventListener* mListener;
00346 BOOL mIsSelected;
00347 BOOL mIsCurSelection;
00348 BOOL mSelectPending;
00349 LLFontGL::StyleFlags mLabelStyle;
00350 LLString mLabelSuffix;
00351 LLPointer<LLViewerImage> mIcon;
00352 LLString mStatusText;
00353 BOOL mHasVisibleChildren;
00354 S32 mIndentation;
00355 S32 mNumDescendantsSelected;
00356 BOOL mFiltered;
00357 S32 mLastFilterGeneration;
00358 std::string::size_type mStringMatchOffset;
00359 F32 mControlLabelRotation;
00360 LLFolderView* mRoot;
00361 BOOL mDragAndDropTarget;
00362 LLPointer<LLViewerImage> mArrowImage;
00363 LLPointer<LLViewerImage> mBoxImage;
00364
00365
00366
00367
00368
00369 void setSelectionFromRoot(LLFolderViewItem* selection, BOOL open,
00370 BOOL take_keyboard_focus = TRUE);
00371
00372
00373 void changeSelectionFromRoot(LLFolderViewItem* selection, BOOL selected);
00374
00375
00376 void extendSelectionFromRoot(LLFolderViewItem* selection);
00377
00378
00379
00380 virtual BOOL addItem(LLFolderViewItem*) { return FALSE; }
00381 virtual BOOL addFolder(LLFolderViewFolder*) { return FALSE; }
00382
00383 public:
00384
00385
00386
00387 void arrangeFromRoot();
00388 void filterFromRoot( void );
00389
00390
00391 LLFolderViewItem( const LLString& name, LLViewerImage* icon, S32 creation_date, LLFolderView* root, LLFolderViewEventListener* listener );
00392 virtual ~LLFolderViewItem( void );
00393
00394 virtual EWidgetType getWidgetType() const;
00395 virtual LLString getWidgetTag() const;
00396
00397
00398 enum { ARRANGE = TRUE, DO_NOT_ARRANGE = FALSE };
00399 virtual BOOL addToFolder(LLFolderViewFolder* folder, LLFolderView* root);
00400
00401 virtual EInventorySortGroup getSortGroup();
00402
00403
00404
00405 virtual S32 arrange( S32* width, S32* height, S32 filter_generation );
00406 virtual S32 getItemHeight();
00407
00408
00409 virtual void filter( LLInventoryFilter& filter);
00410
00411
00412 S32 getLastFilterGeneration() { return mLastFilterGeneration; }
00413
00414 virtual void dirtyFilter();
00415
00416
00417
00418
00419
00420 virtual BOOL setSelection(LLFolderViewItem* selection, BOOL open,
00421 BOOL take_keyboard_focus);
00422
00423
00424
00425 virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected);
00426
00427
00428 virtual S32 extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& items){ return FALSE; }
00429
00430
00431 virtual void recursiveDeselect(BOOL deselect_self);
00432
00433
00434 virtual BOOL getSelectionList(std::set<LLUUID> &selection){return TRUE;}
00435
00436
00437 virtual BOOL isRemovable();
00438
00439
00440 virtual BOOL isMovable();
00441
00442
00443 virtual void destroyView();
00444
00445 S32 getNumSelectedDescendants() { return mNumDescendantsSelected; }
00446
00447 BOOL isSelected() { return mIsSelected; }
00448
00449 void setIsCurSelection(BOOL select) { mIsCurSelection = select; }
00450
00451 BOOL getIsCurSelection() { return mIsCurSelection; }
00452
00453 BOOL hasVisibleChildren() { return mHasVisibleChildren; }
00454
00455
00456
00457
00458 BOOL remove();
00459
00460
00461 void buildContextMenu(LLMenuGL& menu, U32 flags);
00462
00463
00464
00465 const LLString& getName( void ) const;
00466
00467 const LLString& getSearchableLabel( void ) const;
00468
00469
00470
00471
00472 const char* getLabel() const { return mLabel.c_str(); }
00473
00474
00475 virtual U32 getCreationDate() const { return mCreationDate; }
00476
00477 LLFolderViewFolder* getParentFolder( void );
00478 LLFolderViewItem* getNextOpenNode( BOOL include_children = TRUE );
00479 LLFolderViewItem* getPreviousOpenNode( BOOL include_children = TRUE );
00480
00481 LLFolderViewEventListener* getListener( void );
00482
00483
00484 void rename(const LLString& new_name);
00485
00486
00487 virtual void open( void );
00488 virtual void preview(void);
00489
00490
00491 virtual void setOpen(BOOL open = TRUE) {};
00492
00493 virtual BOOL isOpen() { return FALSE; }
00494
00495 LLFolderView* getRoot();
00496 BOOL isDescendantOf( const LLFolderViewFolder* potential_ancestor );
00497 S32 getIndentation() { return mIndentation; }
00498
00499 virtual BOOL potentiallyVisible();
00500
00501 virtual BOOL getFiltered();
00502 virtual BOOL getFiltered(S32 filter_generation);
00503 virtual void setFiltered(BOOL filtered, S32 filter_generation);
00504
00505
00506 void setIcon(LLViewerImage* icon);
00507
00508
00509 virtual void refresh();
00510
00511 virtual void applyListenerFunctorRecursively(LLFolderViewListenerFunctor& functor);
00512
00513
00514 virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
00515 virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
00516 virtual BOOL handleHover( S32 x, S32 y, MASK mask );
00517 virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask );
00518 virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
00519 virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
00520
00521
00522 virtual void draw();
00523 virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
00524 EDragAndDropType cargo_type,
00525 void* cargo_data,
00526 EAcceptance* accept,
00527 LLString& tooltip_msg);
00528 };
00529
00530
00531
00532 typedef bool (*sort_order_f)(LLFolderViewItem* a, LLFolderViewItem* b);
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543 class LLFolderViewFolder : public LLFolderViewItem
00544 {
00545 public:
00546 typedef enum e_trash
00547 {
00548 UNKNOWN, TRASH, NOT_TRASH
00549 } ETrash;
00550
00551 protected:
00552 typedef std::vector<LLFolderViewItem*> items_t;
00553 typedef std::vector<LLFolderViewFolder*> folders_t;
00554 items_t mItems;
00555 folders_t mFolders;
00556 LLInventorySort mSortFunction;
00557
00558 BOOL mIsOpen;
00559 BOOL mExpanderHighlighted;
00560 F32 mCurHeight;
00561 F32 mTargetHeight;
00562 F32 mAutoOpenCountdown;
00563 U32 mSubtreeCreationDate;
00564 ETrash mAmTrash;
00565 S32 mLastArrangeGeneration;
00566 S32 mLastCalculatedWidth;
00567 S32 mCompletedFilterGeneration;
00568 S32 mMostFilteredDescendantGeneration;
00569 public:
00570 typedef enum e_recurse_type
00571 {
00572 RECURSE_NO,
00573 RECURSE_UP,
00574 RECURSE_DOWN,
00575 RECURSE_UP_DOWN
00576 } ERecurseType;
00577
00578 LLFolderViewFolder( const LLString& name, LLViewerImage* icon,
00579 LLFolderView* root,
00580 LLFolderViewEventListener* listener );
00581 virtual ~LLFolderViewFolder( void );
00582
00583 virtual EWidgetType getWidgetType() const;
00584 virtual LLString getWidgetTag() const;
00585
00586 virtual BOOL potentiallyVisible();
00587
00588 LLFolderViewItem* getNextFromChild( LLFolderViewItem*, BOOL include_children = TRUE );
00589 LLFolderViewItem* getPreviousFromChild( LLFolderViewItem*, BOOL include_children = TRUE );
00590
00591
00592 virtual BOOL addToFolder(LLFolderViewFolder* folder, LLFolderView* root);
00593
00594
00595
00596 virtual S32 arrange( S32* width, S32* height, S32 filter_generation );
00597
00598 BOOL needsArrange();
00599
00600
00601 virtual EInventorySortGroup getSortGroup();
00602
00603 virtual void setCompletedFilterGeneration(S32 generation, BOOL recurse_up);
00604 virtual S32 getCompletedFilterGeneration() { return mCompletedFilterGeneration; }
00605
00606 BOOL hasFilteredDescendants(S32 filter_generation) { return mMostFilteredDescendantGeneration >= filter_generation; }
00607 BOOL hasFilteredDescendants();
00608
00609
00610 virtual void filter( LLInventoryFilter& filter);
00611 virtual void setFiltered(BOOL filtered, S32 filter_generation);
00612 virtual void dirtyFilter();
00613
00614
00615
00616
00617 virtual BOOL setSelection(LLFolderViewItem* selection, BOOL open,
00618 BOOL take_keyboard_focus);
00619
00620
00621
00622
00623 virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected);
00624
00625
00626 virtual S32 extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& items);
00627
00628 virtual void recursiveDeselect(BOOL deselect_self);
00629
00630
00631 virtual BOOL isRemovable();
00632
00633
00634 virtual BOOL isMovable();
00635
00636
00637 virtual void destroyView();
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647 BOOL removeItem(LLFolderViewItem* item);
00648
00649
00650
00651 void removeView(LLFolderViewItem* item);
00652
00653
00654
00655 void extractItem( LLFolderViewItem* item );
00656
00657
00658 void resort(LLFolderViewItem* item);
00659
00660 void setItemSortOrder(U32 ordering);
00661 void sortBy(U32);
00662
00663
00664 void setAutoOpenCountdown(F32 countdown) { mAutoOpenCountdown = countdown; }
00665
00666
00667
00668 virtual void toggleOpen();
00669
00670
00671 virtual void setOpen(BOOL open = TRUE);
00672
00673
00674
00675 virtual void requestArrange(BOOL include_descendants = FALSE);
00676
00677
00678
00679
00680
00681 virtual void setOpenArrangeRecursively(BOOL open, ERecurseType recurse = RECURSE_NO);
00682
00683
00684 virtual BOOL isOpen() { return mIsOpen; }
00685
00686
00687 BOOL handleDragAndDropFromChild(MASK mask,
00688 BOOL drop,
00689 EDragAndDropType cargo_type,
00690 void* cargo_data,
00691 EAcceptance* accept,
00692 LLString& tooltip_msg);
00693
00694 void applyFunctorRecursively(LLFolderViewFunctor& functor);
00695 virtual void applyListenerFunctorRecursively(LLFolderViewListenerFunctor& functor);
00696
00697 virtual void open( void );
00698 virtual BOOL addItem(LLFolderViewItem* item);
00699 virtual BOOL addFolder( LLFolderViewFolder* folder);
00700
00701
00702 virtual BOOL handleHover(S32 x, S32 y, MASK mask);
00703 virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
00704 virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
00705 virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
00706 virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
00707 EDragAndDropType cargo_type,
00708 void* cargo_data,
00709 EAcceptance* accept,
00710 LLString& tooltip_msg);
00711 virtual void draw();
00712
00713 U32 getCreationDate() const;
00714 bool isTrash();
00715
00716 LLInventorySort *getSortFunction() { return &mSortFunction; }
00717 };
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727 class LLUICtrl;
00728 class LLLineEditor;
00729
00730 class LLFolderView : public LLFolderViewFolder, LLEditMenuHandler
00731 {
00732 public:
00733 typedef void (*SelectCallback)(const std::deque<LLFolderViewItem*> &items, BOOL user_action, void* data);
00734
00735 static F32 sAutoOpenTime;
00736
00737 LLFolderView( const LLString& name, LLViewerImage* root_folder_icon, const LLRect& rect,
00738 const LLUUID& source_id, LLView *parent_view );
00739 virtual ~LLFolderView( void );
00740
00741 virtual EWidgetType getWidgetType() const;
00742 virtual LLString getWidgetTag() const;
00743 virtual BOOL canFocusChildren() const;
00744
00745
00746
00747 void setSortOrder(U32 order);
00748 void checkTreeResortForModelChanged();
00749 void setFilterPermMask(PermissionMask filter_perm_mask) { mFilter.setFilterPermissions(filter_perm_mask); }
00750 void setSelectCallback(SelectCallback callback, void* user_data) { mSelectCallback = callback, mUserData = user_data; }
00751 void setAllowMultiSelect(BOOL allow) { mAllowMultiSelect = allow; }
00752
00753 LLInventoryFilter* getFilter() { return &mFilter; }
00754 const LLString getFilterSubString(BOOL trim = FALSE);
00755 U32 getFilterTypes() const { return mFilter.getFilterTypes(); }
00756 PermissionMask getFilterPermissions() const { return mFilter.getFilterPermissions(); }
00757 LLInventoryFilter::EFolderShow getShowFolderState() { return mFilter.getShowFolderState(); }
00758 U32 getSortOrder() const;
00759 BOOL isFilterModified() { return mFilter.isNotDefault(); }
00760 BOOL getAllowMultiSelect() { return mAllowMultiSelect; }
00761
00762
00763 void closeAllFolders();
00764 void openFolder(const LLString& foldername);
00765
00766 virtual void toggleOpen() {};
00767 virtual void setOpenArrangeRecursively(BOOL open, ERecurseType recurse);
00768 virtual BOOL addFolder( LLFolderViewFolder* folder);
00769
00770
00771
00772 virtual S32 arrange( S32* width, S32* height, S32 filter_generation );
00773
00774 void arrangeAll() { mArrangeGeneration++; }
00775 S32 getArrangeGeneration() { return mArrangeGeneration; }
00776
00777
00778 virtual void filter( LLInventoryFilter& filter);
00779
00780
00781 virtual LLFolderViewItem* getCurSelectedItem( void );
00782
00783
00784 virtual BOOL setSelection(LLFolderViewItem* selection, BOOL open,
00785 BOOL take_keyboard_focus);
00786
00787
00788
00789 virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected);
00790
00791 virtual S32 extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& items);
00792
00793 virtual BOOL getSelectionList(std::set<LLUUID> &selection);
00794
00795
00796 void sanitizeSelection();
00797 void clearSelection();
00798 void addToSelectionList(LLFolderViewItem* item);
00799 void removeFromSelectionList(LLFolderViewItem* item);
00800
00801 BOOL startDrag(LLToolDragAndDrop::ESource source);
00802 void setDragAndDropThisFrame() { mDragAndDropThisFrame = TRUE; }
00803
00804
00805 void removeSelectedItems();
00806
00807
00808 void openSelectedItems( void );
00809 void propertiesSelectedItems( void );
00810
00811 void autoOpenItem(LLFolderViewFolder* item);
00812 void closeAutoOpenedFolders();
00813 BOOL autoOpenTest(LLFolderViewFolder* item);
00814
00815
00816 virtual void copy();
00817 virtual BOOL canCopy();
00818
00819 virtual void cut();
00820 virtual BOOL canCut();
00821
00822 virtual void paste();
00823 virtual BOOL canPaste();
00824
00825 virtual void doDelete();
00826 virtual BOOL canDoDelete();
00827
00828
00829 void startRenamingSelectedItem( void );
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840 void setFocus(BOOL focus);
00841
00842
00844 BOOL handleKeyHere( KEY key, MASK mask, BOOL called_from_parent );
00845 BOOL handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent);
00846 BOOL handleMouseDown( S32 x, S32 y, MASK mask );
00847 BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
00848 BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
00849 BOOL handleHover( S32 x, S32 y, MASK mask );
00850 BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
00851 EDragAndDropType cargo_type,
00852 void* cargo_data,
00853 EAcceptance* accept,
00854 LLString& tooltip_msg);
00855 void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
00856 void onFocusLost();
00857 virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
00858 virtual void draw();
00859 virtual void deleteAllChildren();
00860
00861 void scrollToShowSelection();
00862 void scrollToShowItem(LLFolderViewItem* item);
00863 void setScrollContainer( LLScrollableContainerView* parent ) { mScrollContainer = parent; }
00864 LLRect getVisibleRect();
00865
00866 BOOL search(LLFolderViewItem* first_item, const LLString &search_string, BOOL backward);
00867 void setShowSelectionContext(BOOL show) { mShowSelectionContext = show; }
00868 BOOL getShowSelectionContext();
00869 void setShowSingleSelection(BOOL show);
00870 BOOL getShowSingleSelection() { return mShowSingleSelection; }
00871 F32 getSelectionFadeElapsedTime() { return mMultiSelectionFadeTimer.getElapsedTimeF32(); }
00872
00873 void addItemID(const LLUUID& id, LLFolderViewItem* itemp);
00874 void removeItemID(const LLUUID& id);
00875 LLFolderViewItem* getItemByID(const LLUUID& id);
00876
00877 void doIdle();
00878 static void idle(void* user_data);
00879
00880 BOOL needsAutoSelect() { return mNeedsAutoSelect && !mAutoSelectOverride; }
00881 BOOL needsAutoRename() { return mNeedsAutoRename; }
00882 void setNeedsAutoRename(BOOL val) { mNeedsAutoRename = val; }
00883
00884 BOOL getDebugFilters() { return mDebugFilters; }
00885
00886
00887 void dumpSelectionInformation();
00888
00889 protected:
00890 LLScrollableContainerView* mScrollContainer;
00891
00892 static void commitRename( LLUICtrl* renamer, void* user_data );
00893 void finishRenamingItem( void );
00894 void revertRenamingItem( void );
00895
00896 protected:
00897 LLViewHandle mPopupMenuHandle;
00898
00899 typedef std::deque<LLFolderViewItem*> selected_items_t;
00900 selected_items_t mSelectedItems;
00901 BOOL mKeyboardSelection;
00902 BOOL mAllowMultiSelect;
00903 BOOL mShowFolderHierarchy;
00904 LLUUID mSourceID;
00905
00906
00907 LLFolderViewItem* mRenameItem;
00908 LLLineEditor* mRenamer;
00909
00910 BOOL mNeedsScroll;
00911 LLFolderViewItem* mLastScrollItem;
00912 LLCoordGL mLastScrollOffset;
00913 BOOL mNeedsAutoSelect;
00914 BOOL mAutoSelectOverride;
00915 BOOL mNeedsAutoRename;
00916
00917 BOOL mDebugFilters;
00918 U32 mSortOrder;
00919 LLDepthStack<LLFolderViewFolder> mAutoOpenItems;
00920 LLFolderViewFolder* mAutoOpenCandidate;
00921 LLFrameTimer mAutoOpenTimer;
00922 LLFrameTimer mSearchTimer;
00923 LLString mSearchString;
00924 LLInventoryFilter mFilter;
00925 BOOL mShowSelectionContext;
00926 BOOL mShowSingleSelection;
00927 LLFrameTimer mMultiSelectionFadeTimer;
00928 S32 mArrangeGeneration;
00929
00930 void* mUserData;
00931 SelectCallback mSelectCallback;
00932 BOOL mSelectionChanged;
00933 S32 mMinWidth;
00934 std::map<LLUUID, LLFolderViewItem*> mItemMap;
00935 BOOL mDragAndDropThisFrame;
00936
00937 };
00938
00939 bool sort_item_name(LLFolderViewItem* a, LLFolderViewItem* b);
00940 bool sort_item_date(LLFolderViewItem* a, LLFolderViewItem* b);
00941
00942
00943 const U32 SUPPRESS_OPEN_ITEM = 0x1;
00944 const U32 FIRST_SELECTED_ITEM = 0x2;
00945
00946 #endif // LL_LLFOLDERVIEW_H