llgroupnotify.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /**
  2. * @file llgroupnotify.h
  3. * @brief Non-blocking notification that does not take keyboard focus.
  4. *
  5. * $LicenseInfo:firstyear=2006&license=viewergpl$
  6. *
  7. * Copyright (c) 2006-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_LLGROUPNOTIFY_H
  33. #define LL_LLGROUPNOTIFY_H
  34. #include "llinitdestroyclass.h"
  35. #include "llnotifications.h"
  36. #include "llpanel.h"
  37. #include "lltimer.h"
  38. class LLButton;
  39. class LLOfferInfo;
  40. // NotifyBox - for notifications that require a response from the user.
  41. class LLGroupNotifyBox final : public LLPanel,
  42. public LLInitClass<LLGroupNotifyBox>
  43. {
  44. protected:
  45. LOG_CLASS(LLGroupNotifyBox);
  46. public:
  47. void close();
  48. static void initClass();
  49. static void destroyClass();
  50. static bool onNewNotification(const LLSD& notification);
  51. static LL_INLINE S32 getGroupNotifyBoxCount() { return sGroupNotifyBoxCount; }
  52. protected:
  53. // Non-transient messages. You can specify non-default button layouts (like
  54. // one for script dialogs) by passing various numbers in for "layout".
  55. LLGroupNotifyBox(const std::string& subject, const std::string& message,
  56. const std::string& from_name, const LLUUID& group_id,
  57. const LLUUID& group_insign, const std::string& group_name,
  58. const LLDate& time_stamp, bool has_inventory,
  59. const std::string& inv_name, const LLSD& inventory_offer);
  60. ~LLGroupNotifyBox() override;
  61. // A right click on the notification sends it to the back of the pile
  62. bool handleRightMouseDown(S32, S32, MASK) override;
  63. // Animate as sliding onto the screen.
  64. void draw() override;
  65. void moveToBack();
  66. // Returns the rect, relative to gNotifyView, where this notify box should
  67. // be placed.
  68. static LLRect getGroupNotifyRect();
  69. // Internal handler for button being clicked
  70. static void onClickOk(void* data);
  71. static void onClickGroupInfo(void* data);
  72. static void onClickSaveInventory(void* data);
  73. // For "next" button
  74. static void onClickNext(void* data);
  75. private:
  76. LLButton* mNextBtn;
  77. LLButton* mSaveInventoryBtn;
  78. LLOfferInfo* mInventoryOffer;
  79. LLUUID mGroupID;
  80. // Time since this notification was displayed. This is a LLTimer not a
  81. // frame timer because I am concerned that I could be out-of-sync by one
  82. // frame in the animation.
  83. LLTimer mTimer;
  84. bool mHasInventory;
  85. bool mAnimating; // Are we sliding onscreen ?
  86. static S32 sGroupNotifyBoxCount;
  87. };
  88. constexpr S32 GROUP_LAYOUT_DEFAULT = 0;
  89. constexpr S32 GROUP_LAYOUT_SCRIPT_DIALOG = 1;
  90. #endif