PageRenderTime 25ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 1ms

/indra/newview/llcurrencyuimanager.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 96 lines | 32 code | 16 blank | 48 comment | 0 complexity | c59079b368e853c18f6a7dcbaa735ef5 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llcurrencyuimanager.h
  3. * @brief LLCurrencyUIManager class definition
  4. *
  5. * $LicenseInfo:firstyear=2006&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLCURRENCYUIMANAGER_H
  27. #define LL_LLCURRENCYUIMANAGER_H
  28. class LLPanel;
  29. class LLCurrencyUIManager
  30. // manages the currency purchase portion of any dialog
  31. // takes control of, and assumes repsonsibility for several
  32. // fields:
  33. // 'currency_action' - the text "Buy L$" before the entry field
  34. // 'currency_amt' - the line editor for the entry amount
  35. // 'currency_est' - the estimated cost from the web site
  36. {
  37. public:
  38. LLCurrencyUIManager(LLPanel& parent);
  39. virtual ~LLCurrencyUIManager();
  40. void setAmount(int, bool noEstimate = false);
  41. int getAmount();
  42. // the amount in L$ to purchase
  43. // setting it overwrites the user's entry
  44. // if noEstimate is true, than no web request is made
  45. void setZeroMessage(const std::string& message);
  46. // sets the gray message to show when zero
  47. void setUSDEstimate(int); // deprecated in 2.0
  48. int getUSDEstimate(); // deprecated in 2.0
  49. // the amount in US$ * 100 (in otherwords, in cents)
  50. // use set when you get this information from elsewhere
  51. void setLocalEstimate(const std::string &local_est);
  52. std::string getLocalEstimate() const;
  53. // the estimated cost in the user's local currency
  54. // for example, "US$ 10.00" or "10.00 Euros"
  55. void prepare();
  56. // call once after dialog is built, from postBuild()
  57. void updateUI(bool show = true);
  58. // update all UI elements, if show is false, they are all set not visible
  59. // normally, this is done automatically, but you can force it
  60. // the show/hidden state is remembered
  61. bool process();
  62. // call periodically, for example, from draw()
  63. // returns true if the UI needs to be updated
  64. void buy(const std::string& buy_msg);
  65. // call to initiate the purchase
  66. bool inProcess(); // is a transaction in process
  67. bool canCancel(); // can we cancel it (by destructing this object)
  68. bool canBuy(); // can the user choose to buy now?
  69. bool buying(); // are we in the process of buying?
  70. bool bought(); // did the buy() transaction complete successfully
  71. bool hasError();
  72. std::string errorMessage();
  73. std::string errorURI();
  74. // error information for the user, the URI may be blank
  75. // the technical error details will have already been logged
  76. private:
  77. class Impl;
  78. Impl& impl;
  79. };
  80. #endif