Archived
1

Added MPExpressionLayout, MPFunctionLayout and MPExpressionStorage as Rendering System for Expressions

This commit is contained in:
Kim Wittenburg
2014-04-23 03:13:55 +02:00
parent 8605a6ac7b
commit 3116925315
8 changed files with 597 additions and 6 deletions

View File

@@ -0,0 +1,56 @@
//
// MPFunctionLayout.h
// MathPad
//
// Created by Kim Wittenburg on 22.04.14.
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Foundation/Foundation.h>
@class MPFunctionLayout, MPExpressionLayout, MPExpressionStorage, MPFunction;
@interface MPFunctionLayout : NSObject {
@protected
BOOL _valid;
NSSize _cachedSize;
NSMutableArray *_childCache;
}
#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;
- (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;
@end