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