Archived
1

Fundamental Redesign of the View and Controller

This commit is contained in:
Kim Wittenburg
2014-08-22 00:54:13 +02:00
parent a37d587e1f
commit c024886241
12 changed files with 255 additions and 150 deletions

View File

@@ -13,7 +13,7 @@
#import "MPSumFunction.h"
@interface MPExpressionView (MPCursor)
@property (nonatomic, strong) NSTimer *cursorTimer;
@end
@implementation MPExpressionView
@@ -49,8 +49,9 @@
- (void)initializeObjects
{
MPExpressionStorage *expressionStorage = [[MPExpressionStorage alloc] initWithElements:@[@"12345", [[MPSumFunction alloc] init], [[MPSumFunction alloc] init]]];
MPExpressionStorage *expressionStorage = [[MPExpressionStorage alloc] initWithExpressionView:self elements:@[@"12345", [[MPSumFunction alloc] init], [[MPSumFunction alloc] init]]];
_expressionStorage = expressionStorage;
_caretLocation = [[NSIndexPath alloc] initWithIndex:0];
}
#pragma mark Properties
@@ -60,9 +61,25 @@
return NO;
}
- (void)setExpressionStorage:(MPExpressionStorage *)expressionStorage
- (BOOL)acceptsFirstResponder
{
_expressionStorage = expressionStorage;
return YES;
}
- (BOOL)canBecomeKeyView
{
return YES;
}
#pragma mark Event Handling
- (void)keyDown:(NSEvent *)theEvent
{
[self interpretKeyEvents:@[theEvent]];
}
- (void)moveRight:(id)sender
{
[self.expressionStorage deleteElementsInRange:NSMakeRange(0, 1)];
}
#pragma mark Drawing Methods