Archived
1
This repository has been archived on 2022-08-08. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
mathpad/MathPad/MPExpressionLayout.h
Kim Wittenburg 740c3fd80a Some small corrections
Added example expression (hardcoded for development)
Added example change for expressions (hardcoded for development)
2014-05-18 01:10:50 +02:00

66 lines
1.9 KiB
Objective-C

//
// MPExpressionLayout.h
// MathPad
//
// Created by Kim Wittenburg on 22.04.14.
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Foundation/Foundation.h>
@class MPExpressionLayout, MPFunctionLayout, MPExpressionStorage, MPExpressionView, MPExpression;
@interface MPExpressionLayout : NSObject {
BOOL _valid;
NSSize _cachedSize;
NSMutableArray *_symbolCache;
}
#pragma mark Creation Methods
// -init not supported
- (id)initRootLayoutWithExpressionStorage:(MPExpressionStorage *)expressionStorage;
- (id)initWithExpressionPath:(NSIndexPath *)expressionPath
parent:(MPFunctionLayout *)parent;
#pragma mark Properties
@property (readonly, nonatomic, weak) MPFunctionLayout *parent;
@property (readonly, nonatomic, weak) MPExpressionStorage *expressionStorage;
@property (readonly, nonatomic, strong) NSIndexPath *expressionPath;
@property (nonatomic, weak) MPExpressionView *expressionView;
- (MPExpression *)expression; // Convenience
- (NSLayoutManager *)layoutManager;
- (NSTextContainer *)textContainer;
- (NSTextStorage *)textStorage;
#pragma mark Cache Methods
- (void)invalidate;
- (void)editedExpressionInRange:(NSRange)range
replacementLength:(NSUInteger)length;
- (BOOL)hasCacheForSymbolAtIndex:(NSUInteger)index;
- (MPFunctionLayout *)functionLayoutForFunctionAtIndex:(NSUInteger)index;
- (NSSize)cachedSizeForSymbolAtIndex:(NSUInteger)index;
- (void)cacheSize:(NSSize)size forSymbolAtIndex:(NSUInteger)index;
#pragma mark Sizes Calculation Methods
- (NSSize)sizeForAllSymbols;
- (NSSize)sizeForSymbolAtIndex:(NSUInteger)index;
- (NSSize)sizeForSymbolsInRange:(NSRange)range;
#pragma mark Drawing Methods
- (void)drawSymbolAtIndex:(NSUInteger)index
atPoint:(NSPoint)point;
- (void)drawSymbolsInRange:(NSRange)range
atPoint:(NSPoint)point;
- (void)drawAllSymbolsAtPoint:(NSPoint)point;
@end