hbfloatergrouptitles.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /**
  2. * @file hbfloatergrouptitles.h
  3. * @brief HBFloaterGroupTitles class definition
  4. *
  5. * This class implements a floater where all available group titles are
  6. * listed, allowing the user to activate any via simple double-click.
  7. *
  8. * $LicenseInfo:firstyear=2010&license=viewergpl$
  9. *
  10. * Copyright (c) 2010, Henri Beauchamp.
  11. *
  12. * Second Life Viewer Source Code
  13. * The source code in this file ("Source Code") is provided by Linden Lab
  14. * to you under the terms of the GNU General Public License, version 2.0
  15. * ("GPL"), unless you have obtained a separate licensing agreement
  16. * ("Other License"), formally executed by you and Linden Lab. Terms of
  17. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  18. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  19. *
  20. * There are special exceptions to the terms and conditions of the GPL as
  21. * it is applied to this Source Code. View the full text of the exception
  22. * in the file doc/FLOSS-exception.txt in this software distribution, or
  23. * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
  24. *
  25. * By copying, modifying or distributing this software, you acknowledge
  26. * that you have read and understood your obligations described above,
  27. * and agree to abide by those obligations.
  28. *
  29. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  30. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  31. * COMPLETENESS OR PERFORMANCE.
  32. * $/LicenseInfo$
  33. */
  34. #ifndef LL_HBFLOATERGROUPTITLES_H
  35. #define LL_HBFLOATERGROUPTITLES_H
  36. #include "llevent.h"
  37. #include "llfloater.h"
  38. #include "llgroupmgr.h"
  39. class HBFloaterGroupTitles;
  40. class LLScrollListCtrl;
  41. class HBFloaterGroupTitlesObserver final : public LLGroupMgrObserver
  42. {
  43. public:
  44. HBFloaterGroupTitlesObserver(HBFloaterGroupTitles* instance,
  45. const LLUUID& group_id);
  46. ~HBFloaterGroupTitlesObserver() override;
  47. protected:
  48. void changed(LLGroupChange gc) override;
  49. private:
  50. HBFloaterGroupTitles* mFloaterInstance;
  51. };
  52. class HBFloaterGroupTitles final
  53. : public LLFloater,
  54. public LLFloaterSingleton<HBFloaterGroupTitles>,
  55. public LLOldEvents::LLSimpleListener
  56. {
  57. friend class LLUISingleton<HBFloaterGroupTitles,
  58. VisibilityPolicy<LLFloater> >;
  59. protected:
  60. LOG_CLASS(HBFloaterGroupTitles);
  61. public:
  62. ~HBFloaterGroupTitles() override;
  63. void setDirty() { mIsDirty = true; }
  64. private:
  65. // Open only via LLFloaterSingleton interface, i.e. showInstance() or
  66. // toggleInstance().
  67. HBFloaterGroupTitles(const LLSD&);
  68. bool postBuild() override;
  69. void draw() override;
  70. // LLSimpleListener interface
  71. bool handleEvent(LLPointer<LLOldEvents::LLEvent> event,
  72. const LLSD& userdata) override;
  73. static void onActivate(void* data);
  74. static void onRefreshButtonPressed(void* data);
  75. static void onCloseButtonPressed(void* data);
  76. enum TITLES_COLUMN_ORDER
  77. {
  78. LIST_TITLE = 0,
  79. LIST_GROUP_NAME,
  80. LIST_GROUP_ID
  81. };
  82. private:
  83. typedef fast_hmap<LLUUID, HBFloaterGroupTitlesObserver*> observers_map_t;
  84. observers_map_t mObservers;
  85. LLScrollListCtrl* mTitlesList;
  86. bool mIsDirty;
  87. };
  88. #endif