- Combined MPExpression and MPMutableExpression - Abstracted children of MPExpression into MPExpressionElement protocol - Abstracted most of MPExpressionLayout and MPFunctionLayout into common superclass MPLayout
56 lines
1.6 KiB
Objective-C
56 lines
1.6 KiB
Objective-C
//
|
|
// MPDrawable.h
|
|
// MathPad
|
|
//
|
|
// Created by Kim Wittenburg on 07.08.14.
|
|
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
|
|
//
|
|
|
|
@import Cocoa;
|
|
#import "MPExpressionStorage.h"
|
|
|
|
#define MPNull [NSNull null]
|
|
|
|
@interface MPLayout : NSObject
|
|
|
|
#pragma mark Creation Methods
|
|
- (instancetype)init;
|
|
- (instancetype)initWithPath:(NSIndexPath *)path
|
|
parent:(MPLayout *)parent;
|
|
|
|
#pragma mark Text System Objects
|
|
@property (readonly, nonatomic, weak) MPExpressionStorage *expressionStorage;
|
|
@property (readonly, nonatomic, weak) NSLayoutManager *layoutManager;
|
|
@property (readonly, nonatomic, weak) NSTextContainer *textContainer;
|
|
@property (readonly, nonatomic, weak) NSTextStorage *textStorage;
|
|
|
|
#pragma mark Cache Tree
|
|
@property (readonly, nonatomic, weak) MPLayout *parent;
|
|
@property (readonly, nonatomic, strong) NSIndexPath *path;
|
|
|
|
#pragma mark Cache Methods
|
|
// Querying Caches
|
|
- (id)cachableObjectForIndex:(NSUInteger)index
|
|
generator:(id(^)())generator;
|
|
|
|
// Clearing Caches
|
|
- (void)clearCacheInRange:(NSRange)range
|
|
replacementLength:(NSUInteger)replacementLength;
|
|
- (void)invalidate;
|
|
|
|
#pragma mark Calculation and Drawing Methods
|
|
// @property (nonatomic) BOOL usesSmallSize;
|
|
- (NSSize)size;
|
|
|
|
- (NSBezierPath *)bezierPath;
|
|
- (NSBezierPath *)bezierPathAtOrigin:(NSPoint)point;
|
|
|
|
- (void)drawAtPoint:(NSPoint)point;
|
|
|
|
@end
|
|
|
|
@interface MPLayout (MPSubclassImplement)
|
|
- (MPLayout *)childLayoutAtIndex:(NSUInteger)index; // To be implemented
|
|
- (NSSize)sizeForChildAtIndex:(NSUInteger)index; // To be implemented
|
|
- (NSBezierPath *)generateBezierPath; // To be implemented
|
|
@end |