llfloaterpathfindingobjects.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. /**
  2. * @file llfloaterpathfindingobjects.h
  3. * @brief Base class for both the pathfinding linksets and characters floater.
  4. *
  5. * $LicenseInfo:firstyear=2012&license=viewergpl$
  6. *
  7. * Copyright (c) 2012, Linden Research, Inc.
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  17. * There are special exceptions to the terms and conditions of the GPL as
  18. * it is applied to this Source Code. View the full text of the exception
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. #ifndef LL_LLFLOATERPATHFINDINGOBJECTS_H
  33. #define LL_LLFLOATERPATHFINDINGOBJECTS_H
  34. #include "boost/signals2.hpp"
  35. #include "llavatarnamecache.h"
  36. #include "llfloater.h"
  37. #include "lluuid.h"
  38. #include "llcolor4.h"
  39. #include "llagent.h"
  40. #include "llpathfindingmanager.h"
  41. #include "llpathfindingobjectlist.h"
  42. #include "llselectmgr.h"
  43. #define PF_DEFAULT_BEACON_WIDTH 6
  44. class LLAvatarName;
  45. class LLButton;
  46. class LLCheckBoxCtrl;
  47. class LLScrollListCtrl;
  48. class LLScrollListItem;
  49. class LLSD;
  50. class LLTextBox;
  51. class LLFloaterPathfindingObjects : public LLFloater
  52. {
  53. protected:
  54. LOG_CLASS(LLFloaterPathfindingObjects);
  55. public:
  56. void onOpen() override;
  57. void onClose(bool app_quitting) override;
  58. void draw() override;
  59. protected:
  60. typedef enum
  61. {
  62. kMessagingUnknown,
  63. kMessagingGetRequestSent,
  64. kMessagingGetError,
  65. kMessagingSetRequestSent,
  66. kMessagingSetError,
  67. kMessagingComplete,
  68. kMessagingNotEnabled
  69. } EMessagingState;
  70. LLFloaterPathfindingObjects();
  71. ~LLFloaterPathfindingObjects() override;
  72. bool postBuild() override;
  73. virtual void requestGetObjects() = 0;
  74. LLPathfindingManager::request_id_t getNewRequestId();
  75. void handleNewObjectList(LLPathfindingManager::request_id_t request_id,
  76. LLPathfindingManager::ERequestStatus req_status,
  77. LLPathfindingObjectList::ptr_t pobjects);
  78. void handleUpdateObjectList(LLPathfindingManager::request_id_t request_id,
  79. LLPathfindingManager::ERequestStatus req_status,
  80. LLPathfindingObjectList::ptr_t pobjects);
  81. void rebuildObjectsScrollList(bool update_if_needed = false);
  82. virtual void addObjectsIntoScrollList(const LLPathfindingObjectList::ptr_t) = 0;
  83. virtual void resetLoadingNameObjectsList() = 0;
  84. virtual void updateControlsOnScrollListChange();
  85. virtual void updateControlsOnInWorldSelectionChange();
  86. virtual S32 getNameColumnIndex() const = 0;
  87. virtual S32 getOwnerNameColumnIndex() const = 0;
  88. virtual std::string getOwnerName(const LLPathfindingObject* obj) const = 0;
  89. LL_INLINE virtual const LLColor4& getBeaconColor() const
  90. {
  91. return mDefaultBeaconColor;
  92. }
  93. LL_INLINE virtual const LLColor4& getBeaconTextColor() const
  94. {
  95. return mDefaultBeaconTextColor;
  96. }
  97. LL_INLINE virtual S32 getBeaconWidth() const
  98. {
  99. return PF_DEFAULT_BEACON_WIDTH;
  100. }
  101. void showFloaterWithSelectionObjects();
  102. bool showBeacons() const;
  103. void clearAllObjects();
  104. void selectAllObjects();
  105. void selectNoneObjects();
  106. void teleportToSelectedObject();
  107. virtual LLPathfindingObjectList::ptr_t getEmptyObjectList() const = 0;
  108. S32 getNumSelectedObjects() const;
  109. LLPathfindingObjectList::ptr_t getSelectedObjects() const;
  110. LLPathfindingObject::ptr_t getFirstSelectedObject() const;
  111. LL_INLINE EMessagingState getMessagingState() const
  112. {
  113. return mMessagingState;
  114. }
  115. private:
  116. void setMessagingState(EMessagingState state);
  117. static void onRefreshObjectsClicked(void* data);
  118. static void onSelectAllObjectsClicked(void* data);
  119. static void onSelectNoneObjectsClicked(void* data);
  120. static void onTakeClicked(void* data);
  121. static void onTakeCopyClicked(void* data);
  122. static void onReturnClicked(void* data);
  123. static void onDeleteClicked(void* data);
  124. static void onTeleportClicked(void* data);
  125. static void onScrollListSelectionChanged(LLUICtrl* ctrl, void* data);
  126. void onInWorldSelectionListChanged();
  127. void onRegionBoundaryCrossed();
  128. void onGodLevelChange(U8 level);
  129. void updateMessagingStatus();
  130. void updateStateOnListControls();
  131. void updateStateOnActionControls();
  132. void selectScrollListItemsInWorld();
  133. void handleReturnItemsResponse(const LLSD& notif, const LLSD& response);
  134. void handleDeleteItemsResponse(const LLSD& notif, const LLSD& response);
  135. LLPathfindingObject::ptr_t findObject(const LLScrollListItem* item) const;
  136. protected:
  137. LLScrollListCtrl* mObjectsScrollList;
  138. private:
  139. LLTextBox* mMessagingStatus;
  140. LLButton* mRefreshListButton;
  141. LLButton* mSelectAllButton;
  142. LLButton* mSelectNoneButton;
  143. LLCheckBoxCtrl* mShowBeaconCheckBox;
  144. LLButton* mTakeButton;
  145. LLButton* mTakeCopyButton;
  146. LLButton* mReturnButton;
  147. LLButton* mDeleteButton;
  148. LLButton* mTeleportButton;
  149. LLColor4 mGoodTextColor;
  150. LLColor4 mDefaultBeaconColor;
  151. LLColor4 mDefaultBeaconTextColor;
  152. LLColor4 mErrorTextColor;
  153. LLColor4 mWarningTextColor;
  154. EMessagingState mMessagingState;
  155. LLPathfindingManager::request_id_t mMessagingRequestId;
  156. LLPathfindingObjectList::ptr_t mObjectList;
  157. LLObjectSelectionHandle mObjectsSelection;
  158. bool mHasObjectsToBeSelected;
  159. uuid_vec_t mObjectsToBeSelected;
  160. boost::signals2::connection mSelectionUpdateSlot;
  161. boost::signals2::connection mRegionBoundaryCrossingSlot;
  162. LLAgent::god_level_change_slot_t mGodLevelChangeSlot;
  163. };
  164. #endif // LL_LLFLOATERPATHFINDINGOBJECTS_H