summaryrefslogtreecommitdiff
path: root/calculator.h
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2007-12-19 05:14:14 +0000
committerMatt Turner <mattst88@gmail.com>2007-12-19 05:14:14 +0000
commit3cc37b8c54fd467e9004f69c4dc20f8231701a1d (patch)
tree90fe0badab8c3a879eede55423765debbf719b10 /calculator.h
parent4745d778aede297ccaaeaaf4421d654d8109ca3e (diff)
Calculator works. Almost version 1.0.
git-svn-id: svn://mattst88.com/svn/calculator/trunk@7 40705d3a-cdd4-446d-8ced-669f9f7342eb
Diffstat (limited to 'calculator.h')
-rwxr-xr-xcalculator.h41
1 files changed, 25 insertions, 16 deletions
diff --git a/calculator.h b/calculator.h
index 2332669..e043274 100755
--- a/calculator.h
+++ b/calculator.h
@@ -1,27 +1,28 @@
#include <gui/ApplicationWindow.h>
#include <gui/Application.h>
#include <gui/TextView.h>
+#include <cstdlib>
using namespace SkyGI;
#define BUTTON_ZERO 0
#define BUTTON_ONE 1
#define BUTTON_TWO 2
-#define BUTTON_THREE 3
+#define BUTTON_THREE 3
#define BUTTON_FOUR 4
#define BUTTON_FIVE 5
-#define BUTTON_SIX 6
-#define BUTTON_SEVEN 7
-#define BUTTON_EIGHT 8
+#define BUTTON_SIX 6
+#define BUTTON_SEVEN 7
+#define BUTTON_EIGHT 8
#define BUTTON_NINE 9
#define BUTTON_PLUS 10
-#define BUTTON_MINUS 11
-#define BUTTON_TIMES 12
-#define BUTTON_DIVIDE 13
+#define BUTTON_MINUS 11
+#define BUTTON_TIMES 12
+#define BUTTON_DIVIDE 13
#define BUTTON_EQUALS 14
-#define BUTTON_POINT 15
+#define BUTTON_POINT 15
#define BUTTON_SIGN 16
-#define BUTTON_CLEAR 17
+#define BUTTON_CLEAR 17
class Calculator : public Application {
public:
@@ -30,11 +31,19 @@ class Calculator : public Application {
class CalculatorWindow : public ApplicationWindow {
public:
- CalculatorWindow( const Rect &rFrame,
- const String& szTitle,
- unsigned int nWindowLayoutFlags,
- unsigned int uiFlags = 0);
- void OnCommand( const MessageCommand *pMessage);
-
- TextView * pText;
+ CalculatorWindow( const Rect &rFrame,
+ const String& szTitle,
+ unsigned int nWindowLayoutFlags,
+ unsigned int uiFlags = 0);
+ void OnCommand( const MessageCommand *pMessage);
+ private:
+ void Clear();
+ void doOperation( int next_operation);
+
+ TextView * pText;
+ String * line;
+ double total;
+ double operand;
+ int operation;
+ bool new_operand;
};