Archived
1

Internal Redesign:

- Combined MPExpression and MPMutableExpression
- Abstracted children of MPExpression into MPExpressionElement protocol
- Abstracted most of MPExpressionLayout and MPFunctionLayout into common superclass MPLayout
This commit is contained in:
Kim Wittenburg
2014-08-11 13:57:48 +02:00
parent 740c3fd80a
commit 60760b8b3d
31 changed files with 1222 additions and 1343 deletions

View File

@@ -2,56 +2,30 @@
// MPFunctionLayout.h
// MathPad
//
// Created by Kim Wittenburg on 22.04.14.
// Created by Kim Wittenburg on 07.08.14.
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Foundation/Foundation.h>
@import Cocoa;
#import "MPLayout.h"
@class MPFunctionLayout, MPExpressionLayout, MPExpressionStorage, MPFunction;
@interface MPFunctionLayout : MPLayout
@interface MPFunctionLayout : NSObject {
@protected
BOOL _valid;
NSSize _cachedSize;
NSMutableArray *_childCache;
}
+ (MPFunctionLayout *)functionLayoutForFunctionAtIndexPath:(NSIndexPath *)path
parent:(MPExpressionLayout *)parent;
#pragma mark Creation Methods
+ (instancetype)functionLayoutForFunctionAtIndexPath:(NSIndexPath *)functionPath
parent:(MPExpressionLayout *)parent;
- (id)initWithFunctionPath:(NSIndexPath *)functionPath
parent:(MPExpressionLayout *)parent;
#pragma mark Properties
@property (readonly, nonatomic, weak) MPExpressionLayout *parent;
@property (readonly, nonatomic, strong) NSIndexPath *functionPath;
- (MPExpressionStorage *)expressionStorage;
- (MPFunction *)function; // Convenience
- (NSLayoutManager *)layoutManager;
- (NSTextContainer *)textContainer;
- (NSTextStorage *)textStorage;
#pragma mark Cache Methods
- (void)invalidate;
- (void)editedChildAtIndex:(NSUInteger)index;
- (BOOL)hasCacheForChildAtIndex:(NSUInteger)index;
- (MPExpressionLayout *)expressionLayoutForChildAtIndex:(NSUInteger)index;
#pragma mark Size Calculation Methods
- (NSSize)sizeOfFunction;
- (NSSize)calculateSize;
#pragma mark Drawing Methods
- (void)drawFunctionAtPoint:(NSPoint)point;
@property (readonly, nonatomic, weak) MPFunction *function; // Convenience
@end
@interface MPFunctionLayout (MPSubclassOverride)
// Should also implement accessor method for special function type:
// - (MPCustomFunction *)customFunction
// {
// return (MPCustomFunction *)self.function;
// }
- (NSBezierPath *)generateBezierPath;
@end