PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 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
27#ifndef LL_LLCURRENCYUIMANAGER_H
28#define LL_LLCURRENCYUIMANAGER_H
29
30class LLPanel;
31
32
33class LLCurrencyUIManager
34	// manages the currency purchase portion of any dialog
35	// takes control of, and assumes repsonsibility for several
36	// fields:
37	// 	'currency_action' - the text "Buy L$" before the entry field
38	// 	'currency_amt' - the line editor for the entry amount
39	// 	'currency_est' - the estimated cost from the web site
40{
41public:
42	LLCurrencyUIManager(LLPanel& parent);
43	virtual ~LLCurrencyUIManager();
44
45	void setAmount(int, bool noEstimate = false);
46	int getAmount();
47		// the amount in L$ to purchase
48		// setting it overwrites the user's entry
49		// if noEstimate is true, than no web request is made
50	
51	void setZeroMessage(const std::string& message);
52		// sets the gray message to show when zero
53		
54	void setUSDEstimate(int);  // deprecated in 2.0
55	int getUSDEstimate();      // deprecated in 2.0
56		// the amount in US$ * 100 (in otherwords, in cents)
57		// use set when you get this information from elsewhere
58		
59	void setLocalEstimate(const std::string &local_est);
60	std::string getLocalEstimate() const;
61		// the estimated cost in the user's local currency
62		// for example, "US$ 10.00" or "10.00 Euros"
63		
64	void prepare();
65		// call once after dialog is built, from postBuild()
66	void updateUI(bool show = true);
67		// update all UI elements, if show is false, they are all set not visible
68		// normally, this is done automatically, but you can force it
69		// the show/hidden state is remembered
70	bool process();
71		// call periodically, for example, from draw()
72		// returns true if the UI needs to be updated
73	
74	void buy(const std::string& buy_msg);
75		// call to initiate the purchase
76	
77	bool inProcess();	// is a transaction in process
78	bool canCancel();	// can we cancel it (by destructing this object)
79	bool canBuy();		// can the user choose to buy now?
80	bool buying();		// are we in the process of buying?
81	bool bought();		// did the buy() transaction complete successfully
82
83	bool hasError();
84	std::string errorMessage();
85	std::string errorURI();
86		// error information for the user, the URI may be blank
87		// the technical error details will have already been logged
88
89private:
90	class Impl;
91	Impl& impl;
92};
93
94#endif 
95
96