PageRenderTime 28ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/llpanelclassified.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 296 lines | 165 code | 102 blank | 29 comment | 0 complexity | 81825b2b455591d500112faaee3a8bc3 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llpanelclassified.h
  3. * @brief LLPanelClassified class definition
  4. *
  5. * $LicenseInfo:firstyear=2005&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 classified used both for the global view in the
  27. // Find directory, and also for each individual user's classified in their
  28. // profile.
  29. #ifndef LL_LLPANELCLASSIFIED_H
  30. #define LL_LLPANELCLASSIFIED_H
  31. #include "llavatarpropertiesprocessor.h"
  32. #include "llclassifiedinfo.h"
  33. #include "llfloater.h"
  34. #include "llpanel.h"
  35. #include "llrect.h"
  36. #include "lluuid.h"
  37. #include "v3dmath.h"
  38. class LLScrollContainer;
  39. class LLTextureCtrl;
  40. class LLUICtrl;
  41. class LLPublishClassifiedFloater : public LLFloater
  42. {
  43. public:
  44. LLPublishClassifiedFloater(const LLSD& key);
  45. virtual ~LLPublishClassifiedFloater();
  46. /*virtual*/ BOOL postBuild();
  47. void setPrice(S32 price);
  48. S32 getPrice();
  49. void setPublishClickedCallback(const commit_signal_t::slot_type& cb);
  50. void setCancelClickedCallback(const commit_signal_t::slot_type& cb);
  51. private:
  52. };
  53. class LLPanelClassifiedInfo : public LLPanel, public LLAvatarPropertiesObserver
  54. {
  55. LOG_CLASS(LLPanelClassifiedInfo);
  56. public:
  57. static LLPanelClassifiedInfo* create();
  58. virtual ~LLPanelClassifiedInfo();
  59. /*virtual*/ void onOpen(const LLSD& key);
  60. /*virtual*/ BOOL postBuild();
  61. /*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
  62. void setAvatarId(const LLUUID& avatar_id) { mAvatarId = avatar_id; }
  63. LLUUID& getAvatarId() { return mAvatarId; }
  64. void setSnapshotId(const LLUUID& id);
  65. LLUUID getSnapshotId();
  66. void setClassifiedId(const LLUUID& id) { mClassifiedId = id; }
  67. LLUUID& getClassifiedId() { return mClassifiedId; }
  68. void setClassifiedName(const std::string& name);
  69. std::string getClassifiedName();
  70. void setDescription(const std::string& desc);
  71. std::string getDescription();
  72. void setClassifiedLocation(const std::string& location);
  73. std::string getClassifiedLocation();
  74. void setPosGlobal(const LLVector3d& pos) { mPosGlobal = pos; }
  75. LLVector3d& getPosGlobal() { return mPosGlobal; }
  76. void setParcelId(const LLUUID& id) { mParcelId = id; }
  77. LLUUID getParcelId() { return mParcelId; }
  78. void setSimName(const std::string& sim_name) { mSimName = sim_name; }
  79. std::string getSimName() { return mSimName; }
  80. void setFromSearch(bool val) { mFromSearch = val; }
  81. bool fromSearch() { return mFromSearch; }
  82. bool getInfoLoaded() { return mInfoLoaded; }
  83. void setInfoLoaded(bool loaded) { mInfoLoaded = loaded; }
  84. static void setClickThrough(
  85. const LLUUID& classified_id,
  86. S32 teleport,
  87. S32 map,
  88. S32 profile,
  89. bool from_new_table);
  90. static void sendClickMessage(
  91. const std::string& type,
  92. bool from_search,
  93. const LLUUID& classified_id,
  94. const LLUUID& parcel_id,
  95. const LLVector3d& global_pos,
  96. const std::string& sim_name);
  97. void setExitCallback(const commit_callback_t& cb);
  98. void setEditClassifiedCallback(const commit_callback_t& cb);
  99. /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
  100. /*virtual*/ void draw();
  101. protected:
  102. LLPanelClassifiedInfo();
  103. virtual void resetData();
  104. virtual void resetControls();
  105. static std::string createLocationText(
  106. const std::string& original_name,
  107. const std::string& sim_name,
  108. const LLVector3d& pos_global);
  109. void stretchSnapshot();
  110. void sendClickMessage(const std::string& type);
  111. LLRect getDefaultSnapshotRect();
  112. void scrollToTop();
  113. void onMapClick();
  114. void onTeleportClick();
  115. void onExit();
  116. bool mSnapshotStreched;
  117. LLRect mSnapshotRect;
  118. LLTextureCtrl* mSnapshotCtrl;
  119. private:
  120. LLUUID mAvatarId;
  121. LLUUID mClassifiedId;
  122. LLVector3d mPosGlobal;
  123. LLUUID mParcelId;
  124. std::string mSimName;
  125. bool mFromSearch;
  126. bool mInfoLoaded;
  127. LLScrollContainer* mScrollContainer;
  128. LLPanel* mScrollingPanel;
  129. S32 mScrollingPanelMinHeight;
  130. S32 mScrollingPanelWidth;
  131. // Needed for stat tracking
  132. S32 mTeleportClicksOld;
  133. S32 mMapClicksOld;
  134. S32 mProfileClicksOld;
  135. S32 mTeleportClicksNew;
  136. S32 mMapClicksNew;
  137. S32 mProfileClicksNew;
  138. typedef std::list<LLPanelClassifiedInfo*> panel_list_t;
  139. static panel_list_t sAllPanels;
  140. };
  141. class LLPanelClassifiedEdit : public LLPanelClassifiedInfo
  142. {
  143. LOG_CLASS(LLPanelClassifiedEdit);
  144. public:
  145. static LLPanelClassifiedEdit* create();
  146. virtual ~LLPanelClassifiedEdit();
  147. /*virtual*/ BOOL postBuild();
  148. void fillIn(const LLSD& key);
  149. /*virtual*/ void onOpen(const LLSD& key);
  150. /*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
  151. /*virtual*/ BOOL isDirty() const;
  152. /*virtual*/ void resetDirty();
  153. void setSaveCallback(const commit_signal_t::slot_type& cb);
  154. void setCancelCallback(const commit_signal_t::slot_type& cb);
  155. /*virtual*/ void resetControls();
  156. bool isNew() { return mIsNew; }
  157. bool isNewWithErrors() { return mIsNewWithErrors; }
  158. bool canClose();
  159. void draw();
  160. void stretchSnapshot();
  161. U32 getCategory();
  162. void setCategory(U32 category);
  163. U32 getContentType();
  164. void setContentType(U32 content_type);
  165. bool getAutoRenew();
  166. S32 getPriceForListing();
  167. protected:
  168. LLPanelClassifiedEdit();
  169. void sendUpdate();
  170. void enableVerbs(bool enable);
  171. void enableEditing(bool enable);
  172. void showEditing(bool show);
  173. std::string makeClassifiedName();
  174. void setPriceForListing(S32 price);
  175. U8 getFlags();
  176. std::string getLocationNotice();
  177. bool isValidName();
  178. void notifyInvalidName();
  179. void onSetLocationClick();
  180. void onChange();
  181. void onSaveClick();
  182. void doSave();
  183. void onPublishFloaterPublishClicked();
  184. void onTexturePickerMouseEnter(LLUICtrl* ctrl);
  185. void onTexturePickerMouseLeave(LLUICtrl* ctrl);
  186. void onTextureSelected();
  187. private:
  188. bool mIsNew;
  189. bool mIsNewWithErrors;
  190. bool mCanClose;
  191. LLPublishClassifiedFloater* mPublishFloater;
  192. commit_signal_t mSaveButtonClickedSignal;
  193. };
  194. #endif // LL_LLPANELCLASSIFIED_H