llfloateravatarpicker.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /**
  2. * @file llfloateravatarpicker.h
  3. * @brief was llavatarpicker.h and also replaces LL's llfloaterbanduration.h
  4. *
  5. * $LicenseInfo:firstyear=2003&license=viewergpl$
  6. *
  7. * Copyright (c) 2003-2019, 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 LLFLOATERAVATARPICKER_H
  33. #define LLFLOATERAVATARPICKER_H
  34. #include <deque>
  35. #include <vector>
  36. #include "llfloater.h"
  37. class LLButton;
  38. class LLFolderView;
  39. class LLInventoryPanel;
  40. class LLLineEditor;
  41. class LLMessageSystem;
  42. class LLScrollListCtrl;
  43. class LLTabContainer;
  44. class LLUICtrl;
  45. class LLFloaterAvatarPicker final : public LLFloater
  46. {
  47. protected:
  48. LOG_CLASS(LLFloaterAvatarPicker);
  49. public:
  50. ~LLFloaterAvatarPicker() override;
  51. bool postBuild() override;
  52. void draw() override;
  53. bool handleKeyHere(KEY key, MASK mask) override;
  54. typedef void(*callback_t)(const std::vector<std::string>&,
  55. const uuid_vec_t&, void*);
  56. // Call this to select an avatar. The callback function will be called with
  57. // an avatar name and UUID. Whenever 'search_name' is passed and non-empty,
  58. // a search for that avatar name is also automatically launched on floater
  59. // opening.
  60. static LLFloaterAvatarPicker* show(callback_t callback, void* userdata,
  61. bool allow_multiple = false,
  62. bool close_on_select = false,
  63. const std::string& search_name =
  64. LLStringUtil::null);
  65. static LLFloaterAvatarPicker* findInstance(const LLUUID& query_id);
  66. static void processAvatarPickerReply(LLMessageSystem* msg, void**);
  67. private:
  68. // Do not call this directly. Use the show() method above.
  69. LLFloaterAvatarPicker(callback_t callback, void* userdata);
  70. void populateNearMe();
  71. void populateFriends();
  72. // Returns true if any items in the current tab are selected:
  73. bool visibleItemsSelected() const;
  74. void setAllowMultiple(bool allow_multiple);
  75. void doCallingCardSelectionChange(LLFolderView* folderp);
  76. void find();
  77. void processResponse(const LLUUID& query_id, const LLSD& content);
  78. static void findCoro(const std::string& url, LLUUID query_id);
  79. static void onCallingCardSelectionChange(LLFolderView* folderp,
  80. bool user_action, void* userdata);
  81. static void editKeystroke(LLLineEditor* caller, void* user_data);
  82. static void onBtnFind(void* userdata);
  83. static void onBtnSelect(void* userdata);
  84. static void onBtnRefresh(void* userdata);
  85. static void onRangeAdjust(LLUICtrl* source, void* userdata);
  86. static void onBtnClose(void* userdata);
  87. static void onList(LLUICtrl* ctrl, void* userdata);
  88. static void onTabChanged(void* userdata, bool from_click);
  89. private:
  90. LLTabContainer* mResidentChooserTabs;
  91. LLPanel* mSearchPanel;
  92. LLPanel* mFriendsPanel;
  93. LLPanel* mCallingCardsPanel;
  94. LLPanel* mNearMePanel;
  95. LLScrollListCtrl* mSearchResults;
  96. LLScrollListCtrl* mFriends;
  97. LLScrollListCtrl* mNearMe;
  98. LLInventoryPanel* mInventoryPanel;
  99. LLButton* mSelect;
  100. LLButton* mFind;
  101. LLLineEditor* mEdit;
  102. uuid_vec_t mSelectedInventoryAvatarIDs;
  103. std::vector<std::string> mSelectedInventoryAvatarNames;
  104. LLUUID mQueryID;
  105. bool mNearMeListComplete;
  106. bool mCloseOnSelect;
  107. void (*mCallback)(const std::vector<std::string>& name,
  108. const uuid_vec_t& id,
  109. void* userdata);
  110. void* mCallbackUserdata;
  111. typedef fast_hset<LLFloaterAvatarPicker*> instances_list_t;
  112. static instances_list_t sInstances;
  113. };
  114. #endif