// // MPFunctionLayout.h // MathPad // // Created by Kim Wittenburg on 22.04.14. // Copyright (c) 2014 Kim Wittenburg. All rights reserved. // #import @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; - (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; @end