llfloaterpay.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /**
  2. * @file llfloaterpay.h
  3. * @brief LLFloaterPay class header file
  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_LLFLOATERPAY_H
  33. #define LL_LLFLOATERPAY_H
  34. #include "llfloater.h"
  35. #include "lllslconstants.h"
  36. #include "llsafehandle.h"
  37. #include "lluuid.h"
  38. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  39. // Class LLFloaterPay
  40. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  41. class LLButton;
  42. class LLLineEditor;
  43. class LLMessageSystem;
  44. class LLObjectSelection;
  45. class LLTextBox;
  46. class LLViewerRegion;
  47. struct LLGiveMoneyInfo;
  48. typedef void (*money_callback)(const LLUUID&, LLViewerRegion*, S32, bool, S32,
  49. const std::string&);
  50. class LLFloaterPay : public LLFloater
  51. {
  52. public:
  53. LLFloaterPay(const std::string& name, money_callback callback,
  54. const LLUUID& target_id, bool target_is_object);
  55. virtual ~LLFloaterPay();
  56. // Pay into an in-world object, which will trigger scripts and eventually
  57. // transfer the L$ to the resident or group that owns the object. Object
  58. // must be selected. Must pass object id, because it may be a child of the
  59. // selected object.
  60. static void payViaObject(money_callback callback, const LLUUID& object_id);
  61. // Pay an avatar or group directly, not via an object in the world.
  62. // Scripts are not notified, L$ can be direcly transferred.
  63. static void payDirectly(money_callback callback, const LLUUID& target_id,
  64. bool is_group);
  65. private:
  66. bool give(S32 amount);
  67. static void onCancel(void* data);
  68. static void onKeystroke(LLLineEditor*, void* data);
  69. static void onGive(void* data);
  70. static void processPayPriceReply(LLMessageSystem* msg, void** userdata);
  71. static void onCacheOwnerName(const LLUUID& owner_id,
  72. const std::string& full_name, bool is_group,
  73. LLFloaterPay* self);
  74. void finishPayUI(const LLUUID& target_id, bool is_group);
  75. protected:
  76. LLUUID mTargetUUID;
  77. LLGiveMoneyInfo* mQuickPayInfo[MAX_PAY_BUTTONS];
  78. LLButton* mQuickPayButton[MAX_PAY_BUTTONS];
  79. LLTextBox* mObjectNameText;
  80. LLLineEditor* mPayMessageText;
  81. LLSafeHandle<LLObjectSelection> mObjectSelection;
  82. money_callback mCallback;
  83. std::vector<LLGiveMoneyInfo*> mCallbackData;
  84. bool mTargetIsObject;
  85. bool mTargetIsGroup;
  86. bool mHaveName;
  87. static S32 sLastAmount;
  88. private:
  89. static std::set<LLFloaterPay*> sInstances;
  90. };
  91. #endif // LL_LLFLOATERPAY_H