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