xref: /haiku/src/apps/deskcalc/ExpressionTextView.h (revision 2222d0559df303a9846a2fad53741f8b20b14d7c)
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 	// TextView
32 	virtual	void				GetDragParameters(BMessage* dragMessage,
33 									BBitmap** bitmap, BPoint* point,
34 									BHandler** handler);
35 
36 	// InputTextView
37 	virtual	void				RevertChanges();
38 	virtual	void				ApplyChanges();
39 
40 	// ExpressionTextView
41 			void				AddKeypadLabel(const char* label);
42 
43 			void				SetExpression(const char* expression);
44 
45 			void				BackSpace();
46 			void				Clear();
47 
48 			void				AddExpressionToHistory(const char* expression);
49 			void				PreviousExpression();
50 			void				NextExpression();
51 
52 			void				LoadSettings(const BMessage* archive);
53 			status_t			SaveSettings(BMessage* archive) const;
54 
55  private:
56 			CalcView*			fCalcView;
57 			BString				fKeypadLabels;
58 
59 			BList				fPreviousExpressions;
60 			int32				fHistoryPos;
61 			BString				fCurrentExpression;
62 };
63 
64 #endif // EXPRESSION_TEXT_VIEW_H
65