00001
00033 #ifndef LL_LLINVENTORYVIEW_H
00034 #define LL_LLINVENTORYVIEW_H
00035
00036 #include "llassetstorage.h"
00037 #include "lldarray.h"
00038 #include "llfloater.h"
00039 #include "llinventory.h"
00040 #include "llfolderview.h"
00041 #include "llinventorymodel.h"
00042 #include "llmemberlistener.h"
00043 #include "lluictrlfactory.h"
00044 #include <set>
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 class LLInventoryModel;
00055 class LLInvFVBridge;
00056 class LLMenuBarGL;
00057 class LLCheckBoxCtrl;
00058 class LLSpinCtrl;
00059 class LLScrollableContainerView;
00060 class LLTextBox;
00061 class LLIconCtrl;
00062 class LLSaveFolderState;
00063 class LLSearchEditor;
00064
00065
00066 class LLInventoryPanel : public LLPanel
00067 {
00068 public:
00069 static const LLString DEFAULT_SORT_ORDER;
00070 static const LLString RECENTITEMS_SORT_ORDER;
00071 static const LLString INHERIT_SORT_ORDER;
00072
00073 LLInventoryPanel(const LLString& name,
00074 const LLString& sort_order_setting,
00075 const LLRect& rect,
00076 LLInventoryModel* inventory,
00077 LLFolderSearchFunction search,
00078 BOOL allow_multi_select,
00079 LLView *parent_view = NULL);
00080 ~LLInventoryPanel();
00081
00082 LLInventoryModel* getModel() { return mInventory; }
00083
00084 BOOL postBuild();
00085
00086 virtual LLXMLNodePtr getXML(bool save_children = true) const;
00087 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
00088
00089
00090 BOOL handleHover(S32 x, S32 y, MASK mask);
00091 BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
00092 EDragAndDropType cargo_type,
00093 void* cargo_data,
00094 EAcceptance* accept,
00095 LLString& tooltip_msg);
00096
00097
00098 void openAllFolders();
00099 void closeAllFolders();
00100 void openDefaultFolderForType(LLAssetType::EType);
00101 void setSelection(const LLUUID& obj_id, BOOL take_keyboard_focus);
00102 void setSelectCallback(LLFolderView::SelectCallback callback, void* user_data) { if (mFolders) mFolders->setSelectCallback(callback, user_data); }
00103 void clearSelection();
00104 LLInventoryFilter* getFilter() { return mFolders->getFilter(); }
00105 void setFilterTypes(U32 filter);
00106 U32 getFilterTypes() const { return mFolders->getFilterTypes(); }
00107 void setFilterPermMask(PermissionMask filter_perm_mask);
00108 U32 getFilterPermMask() const { return mFolders->getFilterPermissions(); }
00109 void setFilterSubString(const LLString& string);
00110 const LLString getFilterSubString() { return mFolders->getFilterSubString(); }
00111 void setSortOrder(U32 order);
00112 U32 getSortOrder() { return mFolders->getSortOrder(); }
00113 void setSinceLogoff(BOOL sl);
00114 void setHoursAgo(U32 hours);
00115 BOOL getSinceLogoff() { return mFolders->getFilter()->isSinceLogoff(); }
00116
00117 void setShowFolderState(LLInventoryFilter::EFolderShow show);
00118 LLInventoryFilter::EFolderShow getShowFolderState();
00119 void setAllowMultiSelect(BOOL allow) { mFolders->setAllowMultiSelect(allow); }
00120
00121 void modelChanged(U32 mask);
00122 LLFolderView* getRootFolder() { return mFolders; }
00123 LLScrollableContainerView* getScrollableContainer() { return mScroller; }
00124
00125
00126 static void dumpSelectionInformation(void* user_data);
00127
00128 void openSelected();
00129
00130 void unSelectAll() { mFolders->setSelection(NULL, FALSE, FALSE); }
00131
00132 protected:
00133
00134 void rebuildViewsFor(const LLUUID& id, U32 mask);
00135 void buildNewViews(const LLUUID& id);
00136
00137 public:
00138
00139
00140
00141
00142 void createNewItem(const char* name,
00143 const LLUUID& parent_id,
00144 LLAssetType::EType asset_type,
00145 LLInventoryType::EType inv_type,
00146 U32 next_owner_perm = 0);
00147
00148 protected:
00149 LLInventoryModel* mInventory;
00150 LLInventoryObserver* mInventoryObserver;
00151 LLFolderView* mFolders;
00152 LLScrollableContainerView* mScroller;
00153 BOOL mAllowMultiSelect;
00154 const LLString mSortOrderSetting;
00155 LLFolderSearchFunction mSearchFunction;
00156 };
00157
00158 class LLInventoryView;
00159
00160 class LLInventoryViewFinder : public LLFloater
00161 {
00162 public:
00163 LLInventoryViewFinder(const LLString& name,
00164 const LLRect& rect,
00165 LLInventoryView* inventory_view);
00166 virtual void draw();
00167 virtual void onClose(bool app_quitting);
00168 void changeFilter(LLInventoryFilter* filter);
00169 void updateElementsFromFilter();
00170 BOOL getCheckShowEmpty();
00171 BOOL getCheckSinceLogoff();
00172
00173 static void onTimeAgo(LLUICtrl*, void *);
00174 static void onCheckSinceLogoff(LLUICtrl*, void *);
00175 static void onCloseBtn(void* user_data);
00176 static void selectAllTypes(void* user_data);
00177 static void selectNoTypes(void* user_data);
00178
00179 protected:
00180 LLInventoryView* mInventoryView;
00181 LLSpinCtrl* mSpinSinceDays;
00182 LLSpinCtrl* mSpinSinceHours;
00183 LLInventoryFilter* mFilter;
00184 };
00185
00186 class LLInventoryView : public LLFloater, LLInventoryObserver
00187 {
00188 friend class LLInventoryViewFinder;
00189
00190 public:
00191 LLInventoryView(const LLString& name, const LLString& rect,
00192 LLInventoryModel* inventory);
00193 LLInventoryView(const LLString& name, const LLRect& rect,
00194 LLInventoryModel* inventory);
00195 ~LLInventoryView();
00196
00197 void changed(U32 mask);
00198
00199 BOOL postBuild();
00200
00201
00202
00203
00204 void setFilterTextFromFilter() { mFilterText = mActivePanel->getFilter()->getFilterText(); }
00205 void startSearch();
00206
00207
00208 static LLInventoryView* showAgentInventory(BOOL take_keyboard_focus = FALSE);
00209
00210
00211
00212
00213 static LLInventoryView* getActiveInventory();
00214
00215
00216
00217 static void toggleVisibility();
00218 static void toggleVisibility(void*) { toggleVisibility(); }
00219
00220
00221 static void cleanup();
00222
00223
00224 virtual void onClose(bool app_quitting);
00225 virtual void setVisible(BOOL visible);
00226 virtual void draw();
00227 virtual BOOL handleKeyHere(KEY key, MASK mask);
00228
00229 BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
00230 EDragAndDropType cargo_type,
00231 void* cargo_data,
00232 EAcceptance* accept,
00233 LLString& tooltip_msg);
00234
00235
00236 LLInventoryPanel* getPanel() { return mActivePanel; }
00237 LLInventoryPanel* getActivePanel() { return mActivePanel; }
00238
00239 static BOOL filtersVisible(void* user_data);
00240 static void onClearSearch(void* user_data);
00241 static void onFoldersByName(void *user_data);
00242 static BOOL checkFoldersByName(void *user_data);
00243 static void onSearchEdit(const LLString& search_string, void* user_data );
00244
00245 static void onFilterSelected(void* userdata, bool from_click);
00246 static void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action, void* data);
00247 static BOOL incrementalFind(LLFolderViewItem* first_item, const char* find_text, BOOL backward);
00248
00249 const LLString getFilterSubString() { return mActivePanel->getFilterSubString(); }
00250 void setFilterSubString(const LLString& string) { mActivePanel->setFilterSubString(string); }
00251
00252
00253
00254 static BOOL sWearNewClothing;
00255 static LLUUID sWearNewClothingTransactionID;
00256
00257 void toggleFindOptions();
00258
00259 LLInventoryViewFinder* getFinder() { return (LLInventoryViewFinder*)mFinderHandle.get(); }
00260
00261 protected:
00262
00263 void init(LLInventoryModel* inventory);
00264
00265 protected:
00266 LLSearchEditor* mSearchEditor;
00267 LLTabContainer* mFilterTabs;
00268 LLHandle<LLFloater> mFinderHandle;
00269 LLInventoryPanel* mActivePanel;
00270 LLSaveFolderState* mSavedFolderState;
00271
00272 LLString mFilterText;
00273
00274
00275
00276
00277 static LLDynamicArray<LLInventoryView*> sActiveViews;
00278 };
00279
00280 class LLSelectFirstFilteredItem : public LLFolderViewFunctor
00281 {
00282 public:
00283 LLSelectFirstFilteredItem() : mItemSelected(FALSE) {}
00284 virtual ~LLSelectFirstFilteredItem() {}
00285 virtual void doFolder(LLFolderViewFolder* folder);
00286 virtual void doItem(LLFolderViewItem* item);
00287 BOOL wasItemSelected() { return mItemSelected; }
00288 protected:
00289 BOOL mItemSelected;
00290 };
00291
00292 class LLOpenFilteredFolders : public LLFolderViewFunctor
00293 {
00294 public:
00295 LLOpenFilteredFolders() {}
00296 virtual ~LLOpenFilteredFolders() {}
00297 virtual void doFolder(LLFolderViewFolder* folder);
00298 virtual void doItem(LLFolderViewItem* item);
00299 };
00300
00301 class LLSaveFolderState : public LLFolderViewFunctor
00302 {
00303 public:
00304 LLSaveFolderState() : mApply(FALSE) {}
00305 virtual ~LLSaveFolderState() {}
00306 virtual void doFolder(LLFolderViewFolder* folder);
00307 virtual void doItem(LLFolderViewItem* item) {}
00308 void setApply(BOOL apply);
00309 void clearOpenFolders() { mOpenFolders.clear(); }
00310 protected:
00311 std::set<LLUUID> mOpenFolders;
00312 BOOL mApply;
00313 };
00314
00315 class LLOpenFoldersWithSelection : public LLFolderViewFunctor
00316 {
00317 public:
00318 LLOpenFoldersWithSelection() {}
00319 virtual ~LLOpenFoldersWithSelection() {}
00320 virtual void doFolder(LLFolderViewFolder* folder);
00321 virtual void doItem(LLFolderViewItem* item);
00322 };
00323
00327
00328
00329
00330
00331 void init_inventory_actions(LLInventoryView *floater);
00332 void init_inventory_panel_actions(LLInventoryPanel *panel);
00333
00334 class LLInventoryCategory;
00335 class LLInventoryItem;
00336
00337
00338 void wear_inventory_item_on_avatar(LLInventoryItem* item);
00339 void wear_outfit_by_name(const char* name);
00340 void wear_inventory_category(LLInventoryCategory* category, bool copy, bool append);
00341
00342
00343 void open_notecard(LLViewerInventoryItem* inv_item, const LLString& title, const LLUUID& object_id, BOOL show_keep_discard, const LLUUID& source_id = LLUUID::null, BOOL take_focus = TRUE);
00344 void open_landmark(LLViewerInventoryItem* inv_item, const LLString& title, BOOL show_keep_discard, const LLUUID& source_id = LLUUID::null, BOOL take_focus = TRUE);
00345 void open_texture(const LLUUID& item_id, const LLString& title, BOOL show_keep_discard, const LLUUID& source_id = LLUUID::null, BOOL take_focus = TRUE);
00346
00347 LLString get_item_icon_name(LLAssetType::EType asset_type,
00348 LLInventoryType::EType inventory_type,
00349 U32 attachment_point,
00350 BOOL item_is_multi );
00351
00352 LLUIImagePtr get_item_icon(LLAssetType::EType asset_type,
00353 LLInventoryType::EType inventory_type,
00354 U32 attachment_point,
00355 BOOL item_is_multi );
00356
00357
00358
00359 BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
00360 const LLUUID& category_id,
00361 BOOL drop,
00362 void (*callback)(S32, void*) = NULL,
00363 void* user_data = NULL);
00364
00365 const BOOL TAKE_FOCUS_YES = TRUE;
00366 const BOOL TAKE_FOCUS_NO = FALSE;
00367
00368 void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attachment);
00369
00370 #endif // LL_LLINVENTORYVIEW_H
00371
00372
00373