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 void SetTextRect(BRect rect); 36 37 // InputTextView 38 virtual void RevertChanges(); 39 virtual void ApplyChanges(); 40 41 // ExpressionTextView 42 void AddKeypadLabel(const char* label); 43 44 void SetExpression(const char* expression); 45 void SetValue(const char* value); 46 47 void BackSpace(); 48 void Clear(); 49 50 void AddExpressionToHistory(const char* expression); 51 void PreviousExpression(); 52 void NextExpression(); 53 54 void LoadSettings(const BMessage* archive); 55 status_t SaveSettings(BMessage* archive) const; 56 57 private: 58 CalcView* fCalcView; 59 BString fKeypadLabels; 60 61 BList fPreviousExpressions; 62 int32 fHistoryPos; 63 BString fCurrentExpression; 64 BString fCurrentValue; 65 66 bool fChangesApplied; 67 }; 68 69 #endif // EXPRESSION_TEXT_VIEW_H 70