00001 00032 #ifndef LL_LLCURRENCYUIMANAGER_H 00033 #define LL_LLCURRENCYUIMANAGER_H 00034 00035 class LLPanel; 00036 00037 00038 class LLCurrencyUIManager 00039 // manages the currency purchase portion of any dialog 00040 // takes control of, and assumes repsonsibility for several 00041 // fields: 00042 // 'currency_action' - the text "Buy L$" before the entry field 00043 // 'currency_amt' - the line editor for the entry amount 00044 // 'currency_est' - the estimated cost from the web site 00045 { 00046 public: 00047 LLCurrencyUIManager(LLPanel& parent); 00048 virtual ~LLCurrencyUIManager(); 00049 00050 void setAmount(int, bool noEstimate = false); 00051 int getAmount(); 00052 // the amount in L$ to purchase 00053 // setting it overwrites the user's entry 00054 // if noEstimate is true, than no web request is made 00055 00056 void setZeroMessage(const std::string& message); 00057 // sets the gray message to show when zero 00058 00059 void setEstimate(int); 00060 int getEstimate(); 00061 // the amount in US$ * 100 (in otherwords, in cents) 00062 // use set when you get this information from elsewhere 00063 00064 void prepare(); 00065 // call once after dialog is built, from postBuild() 00066 void updateUI(bool show = true); 00067 // update all UI elements, if show is false, they are all set not visible 00068 // normally, this is done automatically, but you can force it 00069 // the show/hidden state is remembered 00070 bool process(); 00071 // call periodically, for example, from draw() 00072 // returns true if the UI needs to be updated 00073 00074 void buy(const LLString& buy_msg); 00075 // call to initiate the purchase 00076 00077 bool inProcess(); // is a transaction in process 00078 bool canCancel(); // can we cancel it (by destructing this object) 00079 bool canBuy(); // can the user choose to buy now? 00080 bool buying(); // are we in the process of buying? 00081 bool bought(); // did the buy() transaction complete successfully 00082 00083 bool hasError(); 00084 std::string errorMessage(); 00085 std::string errorURI(); 00086 // error information for the user, the URI may be blank 00087 // the technical error details will have already been logged 00088 00089 private: 00090 class Impl; 00091 Impl& impl; 00092 }; 00093 00094 #endif 00095 00096