PageRenderTime 24ms CodeModel.GetById 11ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llpanellandmarks.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 183 lines | 96 code | 25 blank | 62 comment | 0 complexity | 12dcd2e14ba7f1f41c43b3eea0cf51f9 MD5 | raw file
  1/**
  2 * @file llpanellandmarks.h
  3 * @brief Landmarks tab for Side Bar "Places" panel
  4 * class definition
  5 *
  6 * $LicenseInfo:firstyear=2009&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_LLPANELLANDMARKS_H
 29#define LL_LLPANELLANDMARKS_H
 30
 31#include "lllandmark.h"
 32
 33// newview
 34#include "llinventorymodel.h"
 35#include "lllandmarklist.h"
 36#include "llpanelplacestab.h"
 37#include "llpanelpick.h"
 38#include "llremoteparcelrequest.h"
 39
 40class LLAccordionCtrlTab;
 41class LLFolderViewItem;
 42class LLMenuButton;
 43class LLMenuGL;
 44class LLToggleableMenu;
 45class LLInventoryPanel;
 46class LLPlacesInventoryPanel;
 47
 48class LLLandmarksPanel : public LLPanelPlacesTab, LLRemoteParcelInfoObserver
 49{
 50public:
 51	LLLandmarksPanel();
 52	virtual ~LLLandmarksPanel();
 53
 54	/*virtual*/ BOOL postBuild();
 55	/*virtual*/ void onSearchEdit(const std::string& string);
 56	/*virtual*/ void onShowOnMap();
 57	/*virtual*/ void onShowProfile();
 58	/*virtual*/ void onTeleport();
 59	/*virtual*/ void updateVerbs();
 60	/*virtual*/ bool isSingleItemSelected();
 61
 62	void onSelectionChange(LLPlacesInventoryPanel* inventory_list, const std::deque<LLFolderViewItem*> &items, BOOL user_action);
 63	void onSelectorButtonClicked();
 64	void setCurrentSelectedList(LLPlacesInventoryPanel* inventory_list)
 65	{
 66		mCurrentSelectedList = inventory_list;
 67	}
 68
 69	/**
 70	 * 	Update filter ShowFolderState setting to show empty folder message
 71	 *  if Landmarks inventory folder is empty.
 72	 */
 73	void updateShowFolderState();
 74
 75	/**
 76	 * Selects item with "obj_id" in one of accordion tabs.
 77	 */
 78	void setItemSelected(const LLUUID& obj_id, BOOL take_keyboard_focus);
 79
 80	LLPlacesInventoryPanel* getLibraryInventoryPanel() { return mLibraryInventoryPanel; }
 81
 82protected:
 83	/**
 84	 * @return true - if current selected panel is not null and selected item is a landmark
 85	 */
 86	bool isLandmarkSelected() const;
 87	bool isReceivedFolderSelected() const;
 88	void doActionOnCurSelectedLandmark(LLLandmarkList::loaded_callback_t cb);
 89	LLFolderViewItem* getCurSelectedItem() const;
 90
 91	/**
 92	 * Selects item with "obj_id" in "inventory_list" and scrolls accordion
 93	 * scrollbar to show the item.
 94	 * Returns pointer to the item if it is found in "inventory_list", otherwise NULL.
 95	 */
 96	LLFolderViewItem* selectItemInAccordionTab(LLPlacesInventoryPanel* inventory_list,
 97											   const std::string& tab_name,
 98											   const LLUUID& obj_id,
 99											   BOOL take_keyboard_focus) const;
100
101	void updateSortOrder(LLInventoryPanel* panel, bool byDate);
102
103	//LLRemoteParcelInfoObserver interface
104	/*virtual*/ void processParcelInfo(const LLParcelData& parcel_data);
105	/*virtual*/ void setParcelID(const LLUUID& parcel_id);
106	/*virtual*/ void setErrorStatus(U32 status, const std::string& reason);
107	
108private:
109	void initFavoritesInventoryPanel();
110	void initLandmarksInventoryPanel();
111	void initMyInventoryPanel();
112	void initLibraryInventoryPanel();
113	void initLandmarksPanel(LLPlacesInventoryPanel* inventory_list);
114	LLAccordionCtrlTab* initAccordion(const std::string& accordion_tab_name, LLPlacesInventoryPanel* inventory_list, bool expand_tab);
115	void onAccordionExpandedCollapsed(const LLSD& param, LLPlacesInventoryPanel* inventory_list);
116	void deselectOtherThan(const LLPlacesInventoryPanel* inventory_list);
117
118	// List Commands Handlers
119	void initListCommandsHandlers();
120	void updateListCommands();
121	void onActionsButtonClick();
122	void showActionMenu(LLMenuGL* menu, std::string spawning_view_name);
123	void onTrashButtonClick() const;
124	void onAddAction(const LLSD& command_name) const;
125	void onClipboardAction(const LLSD& command_name) const;
126	void onFoldingAction(const LLSD& command_name);
127	bool isActionChecked(const LLSD& userdata) const;
128	bool isActionEnabled(const LLSD& command_name) const;
129	void onCustomAction(const LLSD& command_name);
130
131	/**
132	 * Updates context menu depending on the selected items location.
133	 *
134	 * For items in Trash category the menu includes the "Restore Item"
135	 * context menu entry.
136	 */
137	void onMenuVisibilityChange(LLUICtrl* ctrl, const LLSD& param);
138
139	/**
140	 * Determines if an item can be modified via context/gear menu.
141	 *
142	 * It validates Places Landmarks rules first. And then LLFolderView permissions.
143	 * For now it checks cut/rename/delete/paste actions.
144	 */
145	bool canItemBeModified(const std::string& command_name, LLFolderViewItem* item) const;
146	void onPickPanelExit( LLPanelPickEdit* pick_panel, LLView* owner, const LLSD& params);
147
148	/**
149	 * Processes drag-n-drop of the Landmarks and folders into trash button.
150	 */
151	bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept);
152
153	/**
154	 * Landmark actions callbacks. Fire when a landmark is loaded from the list.
155	 */
156	void doShowOnMap(LLLandmark* landmark);
157	void doProcessParcelInfo(LLLandmark* landmark,
158							 LLFolderViewItem* cur_item,
159							 LLInventoryItem* inv_item,
160							 const LLParcelData& parcel_data);
161	void doCreatePick(LLLandmark* landmark);
162
163private:
164	LLPlacesInventoryPanel*		mFavoritesInventoryPanel;
165	LLPlacesInventoryPanel*		mLandmarksInventoryPanel;
166	LLPlacesInventoryPanel*		mMyInventoryPanel;
167	LLPlacesInventoryPanel*		mLibraryInventoryPanel;
168	LLMenuButton*				mGearButton;
169	LLToggleableMenu*			mGearLandmarkMenu;
170	LLToggleableMenu*			mGearFolderMenu;
171	LLMenuGL*					mMenuAdd;
172	LLPlacesInventoryPanel*		mCurrentSelectedList;
173	LLInventoryObserver*		mInventoryObserver;
174
175	LLPanel*					mListCommands;
176	
177	typedef	std::vector<LLAccordionCtrlTab*> accordion_tabs_t;
178	accordion_tabs_t			mAccordionTabs;
179
180	LLAccordionCtrlTab*			mMyLandmarksAccordionTab;
181};
182
183#endif //LL_LLPANELLANDMARKS_H