xref: /haiku/src/apps/deskcalc/ExpressionTextView.h (revision 1acbe440b8dd798953bec31d18ee589aa3f71b73)
1 /*
2  * Copyright 2006 Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Stephan Aßmus <superstippi@gmx.de>
7  */
8 
9 #ifndef EXPRESSION_TEXT_VIEW_H
10 #define EXPRESSION_TEXT_VIEW_H
11 
12 #include <List.h>
13 #include <String.h>
14 
15 #include "InputTextView.h"
16 
17 class CalcView;
18 
19 class ExpressionTextView : public InputTextView {
20  public:
21 								ExpressionTextView(BRect frame,
22 												   CalcView* calcView);
23 	virtual						~ExpressionTextView();
24 
25 	// BView
26 	virtual	void				MakeFocus(bool focused = true);
27 	virtual	void				KeyDown(const char* bytes, int32 numBytes);
28 
29 	virtual	void				MouseDown(BPoint where);
30 
31 	// InputTextView
32 	virtual	void				RevertChanges();
33 	virtual	void				ApplyChanges();
34 
35 	// ExpressionTextView
36 			void				AddKeypadLabel(const char* label);
37 
38 			void				SetExpression(const char* expression);
39 
40 			void				BackSpace();
41 			void				Clear();
42 
43 			void				AddExpressionToHistory(const char* expression);
44 			void				PreviousExpression();
45 			void				NextExpression();
46 
47 			void				LoadSettings(const BMessage* archive);
48 			status_t			SaveSettings(BMessage* archive) const;
49 
50  private:
51 			CalcView*			fCalcView;
52 			BString				fKeypadLabels;
53 
54 			BList				fPreviousExpressions;
55 			int32				fHistoryPos;
56 			BString				fCurrentExpression;
57 };
58 
59 #endif // EXPRESSION_TEXT_VIEW_H
60