Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(iPad only) Added a simple calculator
- Loading branch information
Ole Zorn
committed
May 9, 2010
1 parent
21cceed
commit af76f5f
Showing
18 changed files
with
672 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// | ||
// CalculatorView.h | ||
// AppSales | ||
// | ||
// Created by Ole Zorn on 09.04.10. | ||
// Copyright 2010 omz:software. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
#import <AudioToolbox/AudioToolbox.h> | ||
#import "MovableView.h" | ||
|
||
typedef enum TokenType { | ||
TokenTypeOperator, | ||
TokenTypeOperand | ||
} TokenType; | ||
|
||
typedef enum ButtonType { | ||
ButtonTypeUnknown, | ||
ButtonTypeDigit, | ||
ButtonTypeSeparator, | ||
ButtonTypeSign, | ||
ButtonTypeOperator, | ||
ButtonTypeEquals, | ||
ButtonTypeClear | ||
} ButtonType; | ||
|
||
@class CalculatorMO; | ||
|
||
@interface CalculatorView : MovableView { | ||
|
||
SystemSoundID clickSoundID; | ||
UILabel *displayLabel; | ||
|
||
NSMutableArray *stack; | ||
BOOL displaysResult; | ||
} | ||
|
||
- (void)buttonDown:(id)sender; | ||
- (void)buttonPressed:(id)sender; | ||
- (void)enterCalculatorButton:(NSString *)title; | ||
- (void)setDisplay:(NSString *)newDisplay; | ||
- (int)numberOfOperatorsOnStack; | ||
- (int)firstOperatorPrecedence; | ||
- (int)precedenceForOperator:(NSString *)op; | ||
- (void)evaluateStack; | ||
- (TokenType)tokenTypeFor:(NSString *)tokenString; | ||
- (ButtonType)buttonTypeFor:(NSString *)buttonTitle; | ||
|
||
|
||
@end |
Oops, something went wrong.