/indra/newview/llpanelpick.h

https://bitbucket.org/lindenlab/viewer-beta/ · C++ Header · 264 lines · 96 code · 61 blank · 107 comment · 0 complexity · f5e298fe7cada642b97f5625be786e02 MD5 · raw file

  1. /**
  2. * @file llpanelpick.h
  3. * @brief LLPanelPick class definition
  4. *
  5. * $LicenseInfo:firstyear=2004&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. // Display of a "Top Pick" used both for the global top picks in the
  27. // Find directory, and also for each individual user's picks in their
  28. // profile.
  29. #ifndef LL_LLPANELPICK_H
  30. #define LL_LLPANELPICK_H
  31. #include "llpanel.h"
  32. #include "llremoteparcelrequest.h"
  33. #include "llavatarpropertiesprocessor.h"
  34. class LLIconCtrl;
  35. class LLTextureCtrl;
  36. class LLScrollContainer;
  37. class LLMessageSystem;
  38. class LLAvatarPropertiesObserver;
  39. /**
  40. * Panel for displaying Pick Information - snapshot, name, description, etc.
  41. */
  42. class LLPanelPickInfo : public LLPanel, public LLAvatarPropertiesObserver, LLRemoteParcelInfoObserver
  43. {
  44. LOG_CLASS(LLPanelPickInfo);
  45. public:
  46. // Creates new panel
  47. static LLPanelPickInfo* create();
  48. virtual ~LLPanelPickInfo();
  49. /**
  50. * Initializes panel properties
  51. *
  52. * By default Pick will be created for current Agent location.
  53. * Use setPickData to change Pick properties.
  54. */
  55. /*virtual*/ void onOpen(const LLSD& key);
  56. /*virtual*/ BOOL postBuild();
  57. /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
  58. /*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
  59. /**
  60. * Sends remote parcel info request to resolve parcel name from its ID.
  61. */
  62. void sendParcelInfoRequest();
  63. /**
  64. * Sets "Back" button click callback
  65. */
  66. virtual void setExitCallback(const commit_callback_t& cb);
  67. /**
  68. * Sets "Edit" button click callback
  69. */
  70. virtual void setEditPickCallback(const commit_callback_t& cb);
  71. //This stuff we got from LLRemoteParcelObserver, in the last one we intentionally do nothing
  72. /*virtual*/ void processParcelInfo(const LLParcelData& parcel_data);
  73. /*virtual*/ void setParcelID(const LLUUID& parcel_id) { mParcelId = parcel_id; }
  74. /*virtual*/ void setErrorStatus(U32 status, const std::string& reason) {};
  75. protected:
  76. LLPanelPickInfo();
  77. /**
  78. * Resets Pick information
  79. */
  80. virtual void resetData();
  81. /**
  82. * Resets UI controls (visibility, values)
  83. */
  84. virtual void resetControls();
  85. /**
  86. * "Location text" is actually the owner name, the original
  87. * name that owner gave the parcel, and the location.
  88. */
  89. static std::string createLocationText(
  90. const std::string& owner_name,
  91. const std::string& original_name,
  92. const std::string& sim_name,
  93. const LLVector3d& pos_global);
  94. virtual void setAvatarId(const LLUUID& avatar_id) { mAvatarId = avatar_id; }
  95. virtual LLUUID& getAvatarId() { return mAvatarId; }
  96. /**
  97. * Sets snapshot id.
  98. *
  99. * Will mark snapshot control as valid if id is not null.
  100. * Will mark snapshot control as invalid if id is null. If null id is a valid value,
  101. * you have to manually mark snapshot is valid.
  102. */
  103. virtual void setSnapshotId(const LLUUID& id);
  104. virtual void setPickId(const LLUUID& id) { mPickId = id; }
  105. virtual LLUUID& getPickId() { return mPickId; }
  106. virtual void setPickName(const std::string& name);
  107. virtual void setPickDesc(const std::string& desc);
  108. virtual void setPickLocation(const std::string& location);
  109. virtual void setPosGlobal(const LLVector3d& pos) { mPosGlobal = pos; }
  110. virtual LLVector3d& getPosGlobal() { return mPosGlobal; }
  111. /**
  112. * Callback for "Map" button, opens Map
  113. */
  114. void onClickMap();
  115. /**
  116. * Callback for "Teleport" button, teleports user to Pick location.
  117. */
  118. void onClickTeleport();
  119. void onClickBack();
  120. protected:
  121. S32 mScrollingPanelMinHeight;
  122. S32 mScrollingPanelWidth;
  123. LLScrollContainer* mScrollContainer;
  124. LLPanel* mScrollingPanel;
  125. LLTextureCtrl* mSnapshotCtrl;
  126. LLUUID mAvatarId;
  127. LLVector3d mPosGlobal;
  128. LLUUID mParcelId;
  129. LLUUID mPickId;
  130. LLUUID mRequestedId;
  131. };
  132. /**
  133. * Panel for creating/editing Pick.
  134. */
  135. class LLPanelPickEdit : public LLPanelPickInfo
  136. {
  137. LOG_CLASS(LLPanelPickEdit);
  138. public:
  139. /**
  140. * Creates new panel
  141. */
  142. static LLPanelPickEdit* create();
  143. /*virtual*/ ~LLPanelPickEdit();
  144. /*virtual*/ void onOpen(const LLSD& key);
  145. virtual void setPickData(const LLPickData* pick_data);
  146. /*virtual*/ BOOL postBuild();
  147. /**
  148. * Sets "Save" button click callback
  149. */
  150. virtual void setSaveCallback(const commit_callback_t& cb);
  151. /**
  152. * Sets "Cancel" button click callback
  153. */
  154. virtual void setCancelCallback(const commit_callback_t& cb);
  155. /**
  156. * Resets panel and all cantrols to unedited state
  157. */
  158. /*virtual*/ void resetDirty();
  159. /**
  160. * Returns true if any of Pick properties was changed by user.
  161. */
  162. /*virtual*/ BOOL isDirty() const;
  163. /*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
  164. protected:
  165. LLPanelPickEdit();
  166. /**
  167. * Sends Pick properties to server.
  168. */
  169. void sendUpdate();
  170. /**
  171. * Called when snapshot image changes.
  172. */
  173. void onSnapshotChanged();
  174. /**
  175. * Callback for Pick snapshot, name and description changed event.
  176. */
  177. void onPickChanged(LLUICtrl* ctrl);
  178. /*virtual*/ void resetData();
  179. /**
  180. * Enables/disables "Save" button
  181. */
  182. void enableSaveButton(bool enable);
  183. /**
  184. * Callback for "Set Location" button click
  185. */
  186. void onClickSetLocation();
  187. /**
  188. * Callback for "Save" button click
  189. */
  190. void onClickSave();
  191. std::string getLocationNotice();
  192. protected:
  193. bool mLocationChanged;
  194. bool mNeedData;
  195. bool mNewPick;
  196. private:
  197. void initTexturePickerMouseEvents();
  198. void onTexturePickerMouseEnter(LLUICtrl* ctrl);
  199. void onTexturePickerMouseLeave(LLUICtrl* ctrl);
  200. private:
  201. LLIconCtrl* text_icon;
  202. };
  203. #endif // LL_LLPANELPICK_H