llfloatergroups.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /**
  2. * @file llfloatergroups.h
  3. * @brief LLFloaterGroups class definition
  4. *
  5. * $LicenseInfo:firstyear=2002&license=viewergpl$
  6. *
  7. * Copyright (c) 2002-2009, 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_LLFLOATERGROUPS_H
  33. #define LL_LLFLOATERGROUPS_H
  34. #include "llevents.h"
  35. #include "llfloater.h"
  36. class LLButton;
  37. class LLScrollListCtrl;
  38. class LLFloaterGroupPicker final : public LLFloater
  39. {
  40. public:
  41. ~LLFloaterGroupPicker() override;
  42. bool postBuild() override;
  43. typedef fast_hset<LLFloaterGroupPicker*> instances_list_t;
  44. typedef void(*callback_t)(LLUUID, void*);
  45. static LLFloaterGroupPicker* show(callback_t callback, void* userdata);
  46. void setPowersMask(U64 powers_mask);
  47. private:
  48. // Do not call this directly. Use the show() method above.
  49. LLFloaterGroupPicker(callback_t callback, void* userdata);
  50. static void onBtnOK(void* userdata);
  51. static void onBtnCancel(void* userdata);
  52. private:
  53. LLScrollListCtrl* mGroupsList;
  54. U64 mPowersMask;
  55. void (*mSelectCallback)(LLUUID id, void* userdata);
  56. void* mCallbackUserdata;
  57. static instances_list_t sInstances;
  58. };
  59. class LLFloaterGroups final : public LLFloater,
  60. public LLFloaterSingleton<LLFloaterGroups>,
  61. public LLOldEvents::LLSimpleListener
  62. {
  63. friend class LLUISingleton<LLFloaterGroups, VisibilityPolicy<LLFloater> >;
  64. public:
  65. ~LLFloaterGroups() override;
  66. bool postBuild() override;
  67. // LLEventListener interface
  68. bool handleEvent(LLPointer<LLOldEvents::LLEvent> event,
  69. const LLSD&) override;
  70. private:
  71. // Open only via LLFloaterSingleton interface, i.e. showInstance() or
  72. // toggleInstance().
  73. LLFloaterGroups(const LLSD&);
  74. void reset(); // Rebuilds the groups list.
  75. void enableButtons();
  76. static void onGroupList(LLUICtrl*, void* userdata);
  77. static void onSearchEdit(const std::string& search_string, void* userdata);
  78. static bool callbackLeaveGroup(const LLSD& notification,
  79. const LLSD& response);
  80. static void onBtnLeave(void* userdata);
  81. static void onBtnActivate(void* userdata);
  82. static void onBtnInfo(void* userdata);
  83. static void onBtnIM(void* userdata);
  84. static void onBtnCreate(void*);
  85. static void onBtnSearch(void*);
  86. static void onBtnTitles(void*);
  87. static void onBtnClose(void* userdata);
  88. private:
  89. LLButton* mActivateBtn;
  90. LLButton* mLeaveBtn;
  91. LLButton* mCreateBtn;
  92. LLButton* mInfoBtn;
  93. LLButton* mIMBtn;
  94. LLScrollListCtrl* mGroupsList;
  95. std::string mFilterString;
  96. };
  97. #endif // LL_LLFLOATERGROUPS_H