diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llinventoryview.h | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llinventoryview.h | 346 |
1 files changed, 346 insertions, 0 deletions
diff --git a/linden/indra/newview/llinventoryview.h b/linden/indra/newview/llinventoryview.h new file mode 100644 index 0000000..38c44da --- /dev/null +++ b/linden/indra/newview/llinventoryview.h | |||
@@ -0,0 +1,346 @@ | |||
1 | /** | ||
2 | * @file llinventoryview.h | ||
3 | * @brief LLInventoryView, LLInventoryFolder, and LLInventoryItem | ||
4 | * class definition | ||
5 | * | ||
6 | * Copyright (c) 2001-2007, Linden Research, Inc. | ||
7 | * | ||
8 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
9 | * to you under the terms of the GNU General Public License, version 2.0 | ||
10 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
11 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
12 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
13 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
14 | * | ||
15 | * There are special exceptions to the terms and conditions of the GPL as | ||
16 | * it is applied to this Source Code. View the full text of the exception | ||
17 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
18 | * online at http://secondlife.com/developers/opensource/flossexception | ||
19 | * | ||
20 | * By copying, modifying or distributing this software, you acknowledge | ||
21 | * that you have read and understood your obligations described above, | ||
22 | * and agree to abide by those obligations. | ||
23 | * | ||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
26 | * COMPLETENESS OR PERFORMANCE. | ||
27 | */ | ||
28 | |||
29 | #ifndef LL_LLINVENTORYVIEW_H | ||
30 | #define LL_LLINVENTORYVIEW_H | ||
31 | |||
32 | #include "llassetstorage.h" | ||
33 | #include "lldarray.h" | ||
34 | #include "llfloater.h" | ||
35 | #include "llinventory.h" | ||
36 | #include "llfolderview.h" | ||
37 | #include "llinventorymodel.h" | ||
38 | #include "llmemberlistener.h" | ||
39 | #include "lluictrlfactory.h" | ||
40 | #include <set> | ||
41 | |||
42 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
43 | // Class LLInventoryView | ||
44 | // | ||
45 | // This is the controller class specific for handling agent | ||
46 | // inventory. It deals with the buttons and views used to navigate as | ||
47 | // well as controls the behavior of the overall object. | ||
48 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
49 | |||
50 | class LLInventoryModel; | ||
51 | class LLInvFVBridge; | ||
52 | class LLMenuBarGL; | ||
53 | class LLCheckBoxCtrl; | ||
54 | class LLSpinCtrl; | ||
55 | class LLScrollableContainerView; | ||
56 | class LLTextBox; | ||
57 | class LLIconCtrl; | ||
58 | class LLSaveFolderState; | ||
59 | class LLSearchEditor; | ||
60 | |||
61 | |||
62 | class LLInventoryPanel : public LLPanel | ||
63 | { | ||
64 | public: | ||
65 | static const LLString DEFAULT_SORT_ORDER; | ||
66 | static const LLString RECENTITEMS_SORT_ORDER; | ||
67 | static const LLString INHERIT_SORT_ORDER; | ||
68 | |||
69 | LLInventoryPanel(const LLString& name, | ||
70 | const LLString& sort_order_setting, | ||
71 | const LLRect& rect, | ||
72 | LLInventoryModel* inventory, | ||
73 | LLFolderSearchFunction search, | ||
74 | BOOL allow_multi_select, | ||
75 | LLView *parent_view = NULL); | ||
76 | ~LLInventoryPanel(); | ||
77 | |||
78 | LLInventoryModel* getModel() { return mInventory; } | ||
79 | |||
80 | BOOL postBuild(); | ||
81 | |||
82 | virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_INVENTORY_PANEL; } | ||
83 | virtual LLString getWidgetTag() const { return LL_INVENTORY_PANEL_TAG; } | ||
84 | virtual LLXMLNodePtr getXML(bool save_children = true) const; | ||
85 | static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); | ||
86 | |||
87 | // LLView methods | ||
88 | BOOL handleHover(S32 x, S32 y, MASK mask); | ||
89 | BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, | ||
90 | EDragAndDropType cargo_type, | ||
91 | void* cargo_data, | ||
92 | EAcceptance* accept, | ||
93 | LLString& tooltip_msg); | ||
94 | |||
95 | // Call this method to set the selection. | ||
96 | void openAllFolders(); | ||
97 | void closeAllFolders(); | ||
98 | void openDefaultFolderForType(LLAssetType::EType); | ||
99 | void setSelection(const LLUUID& obj_id, BOOL take_keyboard_focus); | ||
100 | void setSelectCallback(LLFolderView::SelectCallback callback, void* user_data) { if (mFolders) mFolders->setSelectCallback(callback, user_data); } | ||
101 | void clearSelection(); | ||
102 | LLInventoryFilter* getFilter() { return mFolders->getFilter(); } | ||
103 | void setFilterTypes(U32 filter); | ||
104 | U32 getFilterTypes() const { return mFolders->getFilterTypes(); } | ||
105 | void setFilterPermMask(PermissionMask filter_perm_mask); | ||
106 | U32 getFilterPermMask() const { return mFolders->getFilterPermissions(); } | ||
107 | void setFilterSubString(const LLString& string); | ||
108 | const LLString getFilterSubString() { return mFolders->getFilterSubString(); } | ||
109 | void setSortOrder(U32 order); | ||
110 | U32 getSortOrder() { return mFolders->getSortOrder(); } | ||
111 | void setSinceLogoff(BOOL sl); | ||
112 | void setHoursAgo(U32 hours); | ||
113 | BOOL getSinceLogoff() { return mFolders->getFilter()->isSinceLogoff(); } | ||
114 | |||
115 | void setShowFolderState(LLInventoryFilter::EFolderShow show); | ||
116 | LLInventoryFilter::EFolderShow getShowFolderState(); | ||
117 | void setAllowMultiSelect(BOOL allow) { mFolders->setAllowMultiSelect(allow); } | ||
118 | // This method is called when something has changed about the inventory. | ||
119 | void modelChanged(U32 mask); | ||
120 | LLFolderView* getRootFolder() { return mFolders; } | ||
121 | |||
122 | // DEBUG ONLY: | ||
123 | static void dumpSelectionInformation(void* user_data); | ||
124 | |||
125 | void openSelected(); | ||
126 | |||
127 | void unSelectAll() { mFolders->setSelection(NULL, FALSE, FALSE); } | ||
128 | |||
129 | BOOL getNeedsAutoSelect() { return mNeedsAutoSelect; } | ||
130 | void setNeedsAutoSelect(BOOL val) { mNeedsAutoSelect = val; } | ||
131 | |||
132 | void setAutoSelectOverride(bool override) { mFolders->setAutoSelectOverride(override); } | ||
133 | |||
134 | protected: | ||
135 | // Given the id and the parent, build all of the folder views. | ||
136 | void rebuildViewsFor(const LLUUID& id, U32 mask); | ||
137 | void buildNewViews(const LLUUID& id); | ||
138 | |||
139 | public: | ||
140 | // TomY TODO: Move this elsewhere? | ||
141 | // helper method which creates an item with a good description, | ||
142 | // updates the inventory, updates the server, and pushes the | ||
143 | // inventory update out to other observers. | ||
144 | void createNewItem(const char* name, | ||
145 | const LLUUID& parent_id, | ||
146 | LLAssetType::EType asset_type, | ||
147 | LLInventoryType::EType inv_type, | ||
148 | U32 next_owner_perm = 0); | ||
149 | |||
150 | protected: | ||
151 | LLInventoryModel* mInventory; | ||
152 | LLInventoryObserver* mInventoryObserver; | ||
153 | LLFolderView* mFolders; | ||
154 | LLScrollableContainerView* mScroller; | ||
155 | BOOL mAllowMultiSelect; | ||
156 | const LLString mSortOrderSetting; | ||
157 | LLFolderSearchFunction mSearchFunction; | ||
158 | BOOL mNeedsAutoSelect; | ||
159 | }; | ||
160 | |||
161 | class LLInventoryView; | ||
162 | |||
163 | class LLInventoryViewFinder : public LLFloater | ||
164 | { | ||
165 | public: | ||
166 | LLInventoryViewFinder(const LLString& name, | ||
167 | const LLRect& rect, | ||
168 | LLInventoryView* inventory_view); | ||
169 | virtual void draw(); | ||
170 | virtual void onClose(bool app_quitting); | ||
171 | void changeFilter(LLInventoryFilter* filter); | ||
172 | void updateElementsFromFilter(); | ||
173 | BOOL getCheckShowEmpty(); | ||
174 | BOOL getCheckSinceLogoff(); | ||
175 | |||
176 | static void onTimeAgo(LLUICtrl*, void *); | ||
177 | static void onCloseBtn(void* user_data); | ||
178 | static void selectAllTypes(void* user_data); | ||
179 | static void selectNoTypes(void* user_data); | ||
180 | |||
181 | protected: | ||
182 | LLInventoryView* mInventoryView; | ||
183 | LLSpinCtrl* mSpinSinceDays; | ||
184 | LLSpinCtrl* mSpinSinceHours; | ||
185 | LLInventoryFilter* mFilter; | ||
186 | }; | ||
187 | |||
188 | class LLInventoryView : public LLFloater, LLInventoryObserver | ||
189 | { | ||
190 | friend class LLInventoryViewFinder; | ||
191 | |||
192 | public: | ||
193 | LLInventoryView(const LLString& name, const LLString& rect, | ||
194 | LLInventoryModel* inventory); | ||
195 | LLInventoryView(const LLString& name, const LLRect& rect, | ||
196 | LLInventoryModel* inventory); | ||
197 | ~LLInventoryView(); | ||
198 | |||
199 | /*virtual*/ void changed(U32 mask); | ||
200 | |||
201 | BOOL postBuild(); | ||
202 | |||
203 | // | ||
204 | // Misc functions | ||
205 | // | ||
206 | void setFilterTextFromFilter() { mFilterText = mActivePanel->getFilter()->getFilterText(); } | ||
207 | void startSearch(); | ||
208 | // This method makes sure that an inventory view exists, is | ||
209 | // visible, and has focus. The view chosen is returned. | ||
210 | static LLInventoryView* showAgentInventory(BOOL take_keyboard_focus = FALSE); | ||
211 | |||
212 | // Return the active inventory view if there is one. Active is | ||
213 | // defined as the inventory that is the closest to the front, and | ||
214 | // is visible. | ||
215 | static LLInventoryView* getActiveInventory(); | ||
216 | |||
217 | // This method calls showAgentInventory() if no views are visible, | ||
218 | // or hides/destroyes them all if any are visible. | ||
219 | static void toggleVisibility(); | ||
220 | static void toggleVisibility(void*) { toggleVisibility(); } | ||
221 | |||
222 | // Final cleanup, destroy all open inventory views. | ||
223 | static void cleanup(); | ||
224 | |||
225 | // LLView & LLFloater functionality | ||
226 | virtual void onClose(bool app_quitting); | ||
227 | virtual void setVisible(BOOL visible); | ||
228 | virtual void draw(); | ||
229 | virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); | ||
230 | |||
231 | LLInventoryPanel* getPanel() { return mActivePanel; } | ||
232 | LLInventoryPanel* getActivePanel() { return mActivePanel; } | ||
233 | |||
234 | static BOOL filtersVisible(void* user_data); | ||
235 | static void onClearSearch(void* user_data); | ||
236 | static void onFoldersByName(void *user_data); | ||
237 | static BOOL checkFoldersByName(void *user_data); | ||
238 | static void onSearchEdit(const LLString& search_string, void* user_data ); | ||
239 | //static void onSearchCommit(LLUICtrl* caller, void* user_data ); | ||
240 | static void onFilterSelected(void* userdata, bool from_click); | ||
241 | static BOOL incrementalFind(LLFolderViewItem* first_item, const char* find_text, BOOL backward); | ||
242 | |||
243 | const LLString getFilterSubString() { return mActivePanel->getFilterSubString(); } | ||
244 | void setFilterSubString(const LLString& string) { mActivePanel->setFilterSubString(string); } | ||
245 | |||
246 | // HACK: Until we can route this info through the instant message hierarchy | ||
247 | //static BOOL sOpenNextNewItem; | ||
248 | static BOOL sWearNewClothing; | ||
249 | static LLUUID sWearNewClothingTransactionID; // wear all clothing in this transaction | ||
250 | |||
251 | void toggleFindOptions(); | ||
252 | |||
253 | LLInventoryViewFinder* getFinder() { return (LLInventoryViewFinder*)LLFloater::getFloaterByHandle(mFinderHandle); } | ||
254 | |||
255 | protected: | ||
256 | // internal initialization code | ||
257 | void init(LLInventoryModel* inventory); | ||
258 | |||
259 | protected: | ||
260 | LLSearchEditor* mSearchEditor; | ||
261 | LLTabContainer* mFilterTabs; | ||
262 | LLViewHandle mFinderHandle; | ||
263 | LLInventoryPanel* mActivePanel; | ||
264 | LLSaveFolderState* mSavedFolderState; | ||
265 | |||
266 | LLString mFilterText; | ||
267 | |||
268 | |||
269 | // This container is used to hold all active inventory views. This | ||
270 | // is here to support the inventory toggle show button. | ||
271 | static LLDynamicArray<LLInventoryView*> sActiveViews; | ||
272 | }; | ||
273 | |||
274 | class LLSelectFirstFilteredItem : public LLFolderViewFunctor | ||
275 | { | ||
276 | public: | ||
277 | LLSelectFirstFilteredItem() : mItemSelected(FALSE) {} | ||
278 | virtual ~LLSelectFirstFilteredItem() {} | ||
279 | virtual void doFolder(LLFolderViewFolder* folder); | ||
280 | virtual void doItem(LLFolderViewItem* item); | ||
281 | BOOL wasItemSelected() { return mItemSelected; } | ||
282 | protected: | ||
283 | BOOL mItemSelected; | ||
284 | }; | ||
285 | |||
286 | class LLOpenFilteredFolders : public LLFolderViewFunctor | ||
287 | { | ||
288 | public: | ||
289 | LLOpenFilteredFolders() {} | ||
290 | virtual ~LLOpenFilteredFolders() {} | ||
291 | virtual void doFolder(LLFolderViewFolder* folder); | ||
292 | virtual void doItem(LLFolderViewItem* item); | ||
293 | }; | ||
294 | |||
295 | ///---------------------------------------------------------------------------- | ||
296 | /// Function declarations, constants, enums, and typedefs | ||
297 | ///---------------------------------------------------------------------------- | ||
298 | |||
299 | // useful functions with the inventory view | ||
300 | // *FIX: move these methods. | ||
301 | |||
302 | void init_inventory_actions(LLInventoryView *floater); | ||
303 | void init_inventory_panel_actions(LLInventoryPanel *panel); | ||
304 | |||
305 | class LLInventoryCategory; | ||
306 | class LLInventoryItem; | ||
307 | //void wear_inventory_category_on_avatar(LLInventoryCategory* category); | ||
308 | |||
309 | void wear_inventory_item_on_avatar(LLInventoryItem* item); | ||
310 | void wear_outfit_by_name(const char* name); | ||
311 | void wear_inventory_category(LLInventoryCategory* category, bool copy, bool append); | ||
312 | |||
313 | // These methods can open items without the inventory being visible | ||
314 | void open_notecard(const LLUUID& item_id, const LLString& title, BOOL show_keep_discard, const LLUUID& source_id = LLUUID::null, BOOL take_focus = TRUE); | ||
315 | void open_landmark(const LLUUID& item_id, const LLString& title, BOOL show_keep_discard, const LLUUID& source_id = LLUUID::null, BOOL take_focus = TRUE); | ||
316 | void open_texture(const LLUUID& item_id, const LLString& title, BOOL show_keep_discard, const LLUUID& source_id = LLUUID::null, BOOL take_focus = TRUE); | ||
317 | |||
318 | LLUUID get_item_icon_uuid(LLAssetType::EType asset_type, | ||
319 | LLInventoryType::EType inventory_type, | ||
320 | U32 flags); | ||
321 | |||
322 | LLViewerImage* get_item_icon(LLAssetType::EType asset_type, | ||
323 | LLInventoryType::EType inventory_type, | ||
324 | U32 flags); | ||
325 | |||
326 | // Move items from an in-world object's "Contents" folder to a specified | ||
327 | // folder in agent inventory. | ||
328 | BOOL move_inv_category_world_to_agent(const LLUUID& object_id, | ||
329 | const LLUUID& category_id, | ||
330 | BOOL drop, | ||
331 | void (*callback)(S32, void*) = NULL, | ||
332 | void* user_data = NULL); | ||
333 | |||
334 | const BOOL TAKE_FOCUS_YES = TRUE; | ||
335 | const BOOL TAKE_FOCUS_NO = FALSE; | ||
336 | |||
337 | void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attachment); | ||
338 | |||
339 | extern const char* FIND_HINT; | ||
340 | extern const char* NAME_SEARCH_DESC; | ||
341 | extern const char* NEW_LSL_NAME; | ||
342 | extern const char* NEW_NOTECARD_NAME; | ||
343 | extern const char* NEW_GESTURE_NAME; | ||
344 | |||
345 | #endif // LL_LLINVENTORYVIEW_H | ||
346 | |||