PageRenderTime 36ms CodeModel.GetById 20ms app.highlight 12ms RepoModel.GetById 1ms app.codeStats 1ms

/indra/newview/llpanelmaininventory.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 163 lines | 90 code | 28 blank | 45 comment | 0 complexity | 8e51467ac4887c3e312f6bc85afaa838 MD5 | raw file
  1/** 
  2 * @file llpanelmaininventory.h
  3 * @brief llpanelmaininventory.h
  4 * class definition
  5 *
  6 * $LicenseInfo:firstyear=2001&license=viewerlgpl$
  7 * Second Life Viewer Source Code
  8 * Copyright (C) 2010, Linden Research, Inc.
  9 * 
 10 * This library is free software; you can redistribute it and/or
 11 * modify it under the terms of the GNU Lesser General Public
 12 * License as published by the Free Software Foundation;
 13 * version 2.1 of the License only.
 14 * 
 15 * This library is distributed in the hope that it will be useful,
 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 18 * Lesser General Public License for more details.
 19 * 
 20 * You should have received a copy of the GNU Lesser General Public
 21 * License along with this library; if not, write to the Free Software
 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 23 * 
 24 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 25 * $/LicenseInfo$
 26 */
 27
 28#ifndef LL_LLPANELMAININVENTORY_H
 29#define LL_LLPANELMAININVENTORY_H
 30
 31#include "llpanel.h"
 32#include "llinventoryobserver.h"
 33#include "lldndbutton.h"
 34
 35#include "llfolderview.h"
 36
 37class LLFolderViewItem;
 38class LLInventoryPanel;
 39class LLSaveFolderState;
 40class LLFilterEditor;
 41class LLTabContainer;
 42class LLFloaterInventoryFinder;
 43class LLMenuButton;
 44class LLMenuGL;
 45class LLToggleableMenu;
 46class LLFloater;
 47
 48//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 49// Class LLPanelMainInventory
 50//
 51// This is a panel used to view and control an agent's inventory,
 52// including all the fixin's (e.g. AllItems/RecentItems tabs, filter floaters).
 53//
 54//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 55class LLPanelMainInventory : public LLPanel, LLInventoryObserver
 56{
 57public:
 58	friend class LLFloaterInventoryFinder;
 59
 60	LLPanelMainInventory(const LLPanel::Params& p = getDefaultParams());
 61	~LLPanelMainInventory();
 62
 63	BOOL postBuild();
 64
 65	virtual BOOL handleKeyHere(KEY key, MASK mask);
 66
 67	// Inherited functionality
 68	/*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 69									   EDragAndDropType cargo_type,
 70									   void* cargo_data,
 71									   EAcceptance* accept,
 72									   std::string& tooltip_msg);
 73	/*virtual*/ void changed(U32);
 74	/*virtual*/ void draw();
 75
 76	LLInventoryPanel* getPanel() { return mActivePanel; }
 77	LLInventoryPanel* getActivePanel() { return mActivePanel; }
 78	const LLInventoryPanel* getActivePanel() const { return mActivePanel; }
 79
 80	const std::string& getFilterText() const { return mFilterText; }
 81	
 82	void setSelectCallback(const LLFolderView::signal_t::slot_type& cb);
 83
 84	void onFilterEdit(const std::string& search_string );
 85protected:
 86	//
 87	// Misc functions
 88	//
 89	void setFilterTextFromFilter();
 90	void startSearch();
 91	
 92	void toggleFindOptions();
 93	void onSelectionChange(LLInventoryPanel *panel, const std::deque<LLFolderViewItem*>& items, BOOL user_action);
 94
 95	static BOOL filtersVisible(void* user_data);
 96	void onClearSearch();
 97	static void onFoldersByName(void *user_data);
 98	static BOOL checkFoldersByName(void *user_data);
 99	
100	static BOOL incrementalFind(LLFolderViewItem* first_item, const char *find_text, BOOL backward);
101	void onFilterSelected();
102
103	const std::string getFilterSubString();
104	void setFilterSubString(const std::string& string);
105	
106	// menu callbacks
107	void doToSelected(const LLSD& userdata);
108	void closeAllFolders();
109	void newWindow();
110	void doCreate(const LLSD& userdata);
111	void resetFilters();
112	void setSortBy(const LLSD& userdata);
113	void saveTexture(const LLSD& userdata);
114	bool isSaveTextureEnabled(const LLSD& userdata);
115	void updateItemcountText();
116
117	void onFocusReceived();
118
119private:
120	LLFloaterInventoryFinder* getFinder();
121
122	LLFilterEditor*				mFilterEditor;
123	LLTabContainer*				mFilterTabs;
124	LLHandle<LLFloater>			mFinderHandle;
125	LLInventoryPanel*			mActivePanel;
126	bool						mResortActivePanel;
127	LLSaveFolderState*			mSavedFolderState;
128	std::string					mFilterText;
129	std::string					mFilterSubString;
130
131
132	//////////////////////////////////////////////////////////////////////////////////
133	// List Commands                                                                //
134protected:
135	void initListCommandsHandlers();
136	void updateListCommands();
137	void onAddButtonClick();
138	void showActionMenu(LLMenuGL* menu, std::string spawning_view_name);
139	void onTrashButtonClick();
140	void onClipboardAction(const LLSD& userdata);
141	BOOL isActionEnabled(const LLSD& command_name);
142	BOOL isActionChecked(const LLSD& userdata);
143	void onCustomAction(const LLSD& command_name);
144	bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept);
145	/**
146	 * Set upload cost in "Upload" sub menu.
147	 */
148	void setUploadCostIfNeeded();
149private:
150	LLDragAndDropButton*		mTrashButton;
151	LLToggleableMenu*			mMenuGearDefault;
152	LLMenuGL*					mMenuAdd;
153	LLMenuButton*				mGearMenuButton;
154
155	bool						mNeedUploadCost;
156	// List Commands                                                              //
157	////////////////////////////////////////////////////////////////////////////////
158};
159
160#endif // LL_LLPANELMAININVENTORY_H
161
162
163