From d72e3b127818565275640e667c8797812dc99ad5 Mon Sep 17 00:00:00 2001
From: Matt Turner <mattst88@gmail.com>
Date: Mon, 17 Dec 2007 00:07:15 +0000
Subject: Add TextView.

git-svn-id: svn://mattst88.com/svn/calculator/trunk@5 40705d3a-cdd4-446d-8ced-669f9f7342eb
---
 calculator.cpp | 19 ++++++++-----------
 calculator.h   |  3 +++
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/calculator.cpp b/calculator.cpp
index c17fb50..45ab6ce 100755
--- a/calculator.cpp
+++ b/calculator.cpp
@@ -1,6 +1,4 @@
-#include <gui/ApplicationWindow.h>
-#include <gui/Application.h>
-
+#include <cstdlib>
 #include "calculator.h"
 
 CalculatorWindow::CalculatorWindow(	const Rect &rFrame,
@@ -9,6 +7,10 @@ CalculatorWindow::CalculatorWindow(	const Rect &rFrame,
 						unsigned int uiFlags
 	): ApplicationWindow(rFrame, szTitle, nWindowLayoutFlags)
 {
+	pText = new TextView(this, Rect(15, 30, 160, 50), WINDOW_LAYOUT_FOLLOW_RIGHT , TEXTVIEW_FLAG_SINGLE_LINE);
+	pText->Enable(false);
+	pText->Set("0.0");
+
 	Button	* pButton;
 
 	pButton	= new Button(this, Rect(Point(15, 60), Point(40, 82)), "7", 0, new MessageCommand(BUTTON_SEVEN));	
@@ -32,11 +34,6 @@ CalculatorWindow::CalculatorWindow(	const Rect &rFrame,
 	pButton	= new Button(this, Rect(Point(45, 141), Point(70, 163)), ".", 0, new MessageCommand(BUTTON_POINT));
 	pButton	= new Button(this, Rect(Point(75, 141), Point(100, 164)), "\u00B1", 0, new MessageCommand(BUTTON_SIGN));
 	pButton = new Button(this, Rect(Point(105, 141), Point(160, 164)), "=", 0, new MessageCommand(BUTTON_EQUALS));
-/*
-	pButton	= new Button(this, Point(10,10), "1", 0, new MessageCommand(BUTTON_ONE));
-	pButton	= new Button(this, Point(10,10), "1", 0, new MessageCommand(BUTTON_ONE));
-	pButton	= new Button(this, Point(10,10), "1", 0, new MessageCommand(BUTTON_ONE));
-	pButton	= new Button(this, Point(10,10), "1", 0, new MessageCommand(BUTTON_ONE));*/
 }
 
 void CalculatorWindow::OnCommand(const MessageCommand *pMessage) {
@@ -58,10 +55,10 @@ void CalculatorWindow::OnCommand(const MessageCommand *pMessage) {
 		case BUTTON_EQUALS:
 		case BUTTON_POINT:
 		case BUTTON_SIGN:
-		case BUTTON_CLEAR:
-			printf("Button %d clicked\n", pMessage->GetID());
-		default:
 			break;
+		case BUTTON_CLEAR:
+			pText->Set("0.0");
+			break; 
 	}
 }
 
diff --git a/calculator.h b/calculator.h
index f6edfaa..87cd49a 100755
--- a/calculator.h
+++ b/calculator.h
@@ -1,5 +1,6 @@
 #include <gui/ApplicationWindow.h>
 #include <gui/Application.h>
+#include <gui/TextView.h>
 
 using namespace SkyGI;
 
@@ -35,4 +36,6 @@ class CalculatorWindow : public ApplicationWindow {
 					unsigned int uiFlags = 0);
 		void    OnCommand(	const MessageCommand *pMessage);
 
+		TextView * pText;
+
 };
-- 
cgit v1.2.3