PageRenderTime 32ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/llpanelpicks.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 314 lines | 181 code | 93 blank | 40 comment | 0 complexity | 8981cceb20c25b02a76522177619fe3d MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llpanelpicks.h
  3. * @brief LLPanelPicks and related class definitions
  4. *
  5. * $LicenseInfo:firstyear=2009&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. #ifndef LL_LLPANELPICKS_H
  27. #define LL_LLPANELPICKS_H
  28. #include "llpanel.h"
  29. #include "v3dmath.h"
  30. #include "lluuid.h"
  31. #include "llavatarpropertiesprocessor.h"
  32. #include "llpanelavatar.h"
  33. #include "llregistry.h"
  34. class LLAccordionCtrlTab;
  35. class LLPanelProfile;
  36. class LLMessageSystem;
  37. class LLVector3d;
  38. class LLPanelProfileTab;
  39. class LLAgent;
  40. class LLMenuGL;
  41. class LLPickItem;
  42. class LLClassifiedItem;
  43. class LLFlatListView;
  44. class LLPanelPickInfo;
  45. class LLPanelPickEdit;
  46. class LLToggleableMenu;
  47. class LLPanelClassifiedInfo;
  48. class LLPanelClassifiedEdit;
  49. // *TODO
  50. // Panel Picks has been consolidated with Classifieds (EXT-2095), give LLPanelPicks
  51. // and corresponding files (cpp, h, xml) a new name. (new name is TBD at the moment)
  52. class LLPanelPicks
  53. : public LLPanelProfileTab
  54. {
  55. public:
  56. LLPanelPicks();
  57. ~LLPanelPicks();
  58. static void* create(void* data);
  59. /*virtual*/ BOOL postBuild(void);
  60. /*virtual*/ void onOpen(const LLSD& key);
  61. /*virtual*/ void onClosePanel();
  62. void processProperties(void* data, EAvatarProcessorType type);
  63. void updateData();
  64. // returns the selected pick item
  65. LLPickItem* getSelectedPickItem();
  66. LLClassifiedItem* getSelectedClassifiedItem();
  67. LLClassifiedItem* findClassifiedById(const LLUUID& classified_id);
  68. //*NOTE top down approch when panel toggling is done only by
  69. // parent panels failed to work (picks related code was in my profile panel)
  70. void setProfilePanel(LLPanelProfile* profile_panel);
  71. void createNewPick();
  72. void createNewClassified();
  73. protected:
  74. /*virtual*/void updateButtons();
  75. private:
  76. void onClickDelete();
  77. void onClickTeleport();
  78. void onClickMap();
  79. void onPlusMenuItemClicked(const LLSD& param);
  80. bool isActionEnabled(const LLSD& userdata) const;
  81. bool isClassifiedPublished(LLClassifiedItem* c_item);
  82. void onListCommit(const LLFlatListView* f_list);
  83. void onAccordionStateChanged(const LLAccordionCtrlTab* acc_tab);
  84. //------------------------------------------------
  85. // Callbacks which require panel toggling
  86. //------------------------------------------------
  87. void onClickPlusBtn();
  88. void onClickInfo();
  89. void onPanelPickClose(LLPanel* panel);
  90. void onPanelPickSave(LLPanel* panel);
  91. void onPanelClassifiedSave(LLPanelClassifiedEdit* panel);
  92. void onPanelClassifiedClose(LLPanelClassifiedInfo* panel);
  93. void openPickEdit(const LLSD& params);
  94. void onPanelPickEdit();
  95. void onPanelClassifiedEdit();
  96. void editClassified(const LLUUID& classified_id);
  97. void onClickMenuEdit();
  98. bool onEnableMenuItem(const LLSD& user_data);
  99. void openPickInfo();
  100. void openClassifiedInfo();
  101. void openClassifiedInfo(const LLSD& params);
  102. void openClassifiedEdit(const LLSD& params);
  103. friend class LLPanelProfile;
  104. void showAccordion(const std::string& name, bool show);
  105. void buildPickPanel();
  106. bool callbackDeletePick(const LLSD& notification, const LLSD& response);
  107. bool callbackDeleteClassified(const LLSD& notification, const LLSD& response);
  108. bool callbackTeleport(const LLSD& notification, const LLSD& response);
  109. virtual void onDoubleClickPickItem(LLUICtrl* item);
  110. virtual void onDoubleClickClassifiedItem(LLUICtrl* item);
  111. virtual void onRightMouseUpItem(LLUICtrl* item, S32 x, S32 y, MASK mask);
  112. LLPanelProfile* getProfilePanel();
  113. void createPickInfoPanel();
  114. void createPickEditPanel();
  115. void createClassifiedInfoPanel();
  116. void createClassifiedEditPanel(LLPanelClassifiedEdit** panel);
  117. LLMenuGL* mPopupMenu;
  118. LLPanelProfile* mProfilePanel;
  119. LLPanelPickInfo* mPickPanel;
  120. LLFlatListView* mPicksList;
  121. LLFlatListView* mClassifiedsList;
  122. LLPanelPickInfo* mPanelPickInfo;
  123. LLPanelClassifiedInfo* mPanelClassifiedInfo;
  124. LLPanelPickEdit* mPanelPickEdit;
  125. LLToggleableMenu* mPlusMenu;
  126. LLUICtrl* mNoItemsLabel;
  127. // <classified_id, edit_panel>
  128. typedef std::map<LLUUID, LLPanelClassifiedEdit*> panel_classified_edit_map_t;
  129. // This map is needed for newly created classifieds. The purpose of panel is to
  130. // sit in this map and listen to LLPanelClassifiedEdit::processProperties callback.
  131. panel_classified_edit_map_t mEditClassifiedPanels;
  132. LLAccordionCtrlTab* mPicksAccTab;
  133. LLAccordionCtrlTab* mClassifiedsAccTab;
  134. //true if picks list is empty after processing picks
  135. bool mNoPicks;
  136. //true if classifieds list is empty after processing classifieds
  137. bool mNoClassifieds;
  138. };
  139. class LLPickItem : public LLPanel, public LLAvatarPropertiesObserver
  140. {
  141. public:
  142. LLPickItem();
  143. static LLPickItem* create();
  144. void init(LLPickData* pick_data);
  145. void setPickName(const std::string& name);
  146. void setPickDesc(const std::string& descr);
  147. void setPickId(const LLUUID& id);
  148. void setCreatorId(const LLUUID& id) {mCreatorID = id;};
  149. void setSnapshotId(const LLUUID& id) {mSnapshotID = id;};
  150. void setNeedData(bool need){mNeedData = need;};
  151. const LLUUID& getPickId();
  152. const std::string& getPickName();
  153. const LLUUID& getCreatorId();
  154. const LLUUID& getSnapshotId();
  155. const LLVector3d& getPosGlobal();
  156. const std::string getDescription();
  157. const std::string& getSimName() { return mSimName; }
  158. const std::string& getUserName() { return mUserName; }
  159. const std::string& getOriginalName() { return mOriginalName; }
  160. const std::string& getPickDesc() { return mPickDescription; }
  161. /*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
  162. void update();
  163. ~LLPickItem();
  164. /*virtual*/ BOOL postBuild();
  165. /** setting on/off background icon to indicate selected state */
  166. /*virtual*/ void setValue(const LLSD& value);
  167. protected:
  168. LLUUID mPickID;
  169. LLUUID mCreatorID;
  170. LLUUID mParcelID;
  171. LLUUID mSnapshotID;
  172. LLVector3d mPosGlobal;
  173. bool mNeedData;
  174. std::string mPickName;
  175. std::string mUserName;
  176. std::string mOriginalName;
  177. std::string mPickDescription;
  178. std::string mSimName;
  179. };
  180. class LLClassifiedItem : public LLPanel, public LLAvatarPropertiesObserver
  181. {
  182. public:
  183. LLClassifiedItem(const LLUUID& avatar_id, const LLUUID& classified_id);
  184. virtual ~LLClassifiedItem();
  185. /*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
  186. /*virtual*/ BOOL postBuild();
  187. /*virtual*/ void setValue(const LLSD& value);
  188. void fillIn(LLPanelClassifiedEdit* panel);
  189. LLUUID getAvatarId() {return mAvatarId;}
  190. void setAvatarId(const LLUUID& avatar_id) {mAvatarId = avatar_id;}
  191. LLUUID getClassifiedId() {return mClassifiedId;}
  192. void setClassifiedId(const LLUUID& classified_id) {mClassifiedId = classified_id;}
  193. void setPosGlobal(const LLVector3d& pos) { mPosGlobal = pos; }
  194. const LLVector3d getPosGlobal() { return mPosGlobal; }
  195. void setLocationText(const std::string location) { mLocationText = location; }
  196. std::string getLocationText() { return mLocationText; }
  197. void setClassifiedName (const std::string& name);
  198. std::string getClassifiedName() { return getChild<LLUICtrl>("name")->getValue().asString(); }
  199. void setDescription(const std::string& desc);
  200. std::string getDescription() { return getChild<LLUICtrl>("description")->getValue().asString(); }
  201. void setSnapshotId(const LLUUID& snapshot_id);
  202. LLUUID getSnapshotId();
  203. void setCategory(U32 cat) { mCategory = cat; }
  204. U32 getCategory() { return mCategory; }
  205. void setContentType(U32 ct) { mContentType = ct; }
  206. U32 getContentType() { return mContentType; }
  207. void setAutoRenew(U32 renew) { mAutoRenew = renew; }
  208. bool getAutoRenew() { return mAutoRenew; }
  209. void setPriceForListing(S32 price) { mPriceForListing = price; }
  210. S32 getPriceForListing() { return mPriceForListing; }
  211. private:
  212. LLUUID mAvatarId;
  213. LLUUID mClassifiedId;
  214. LLVector3d mPosGlobal;
  215. std::string mLocationText;
  216. U32 mCategory;
  217. U32 mContentType;
  218. bool mAutoRenew;
  219. S32 mPriceForListing;
  220. };
  221. #endif // LL_LLPANELPICKS_H