Added Lots of Documentation
Added some nice to haves Improved and Unified General Code Layout
This commit is contained in:
@@ -8,24 +8,28 @@
|
||||
|
||||
#import "MPFunctionLayout.h"
|
||||
|
||||
#import "MPExpression.h"
|
||||
#import "MPExpressionLayout.h"
|
||||
|
||||
#import "MPFunction.h"
|
||||
#import "MPSumFunction.h"
|
||||
#import "MPFractionFunction.h"
|
||||
#import "MPParenthesisFunction.h"
|
||||
#import "MPPowerFunction.h"
|
||||
#import "MPFractionFunction.h"
|
||||
#import "MPSumFunction.h"
|
||||
|
||||
#import "MPExpressionLayout.h"
|
||||
#import "MPSumFunctionLayout.h"
|
||||
#import "MPFractionFunctionLayout.h"
|
||||
#import "MPParenthesisFunctionLayout.h"
|
||||
#import "MPPowerFunctionLayout.h"
|
||||
#import "MPFractionFunctionLayout.h"
|
||||
#import "MPSumFunctionLayout.h"
|
||||
|
||||
#import "NSIndexPath+MPAdditions.h"
|
||||
|
||||
|
||||
|
||||
@implementation MPFunctionLayout
|
||||
|
||||
#pragma mark Creation Methods
|
||||
|
||||
|
||||
+ (MPFunctionLayout *)functionLayoutForFunction:(MPFunction *)function
|
||||
parent:(MPExpressionLayout *)parent
|
||||
{
|
||||
@@ -43,6 +47,7 @@
|
||||
parent:parent];
|
||||
}
|
||||
|
||||
|
||||
- (instancetype)initWithFunction:(MPFunction *)function
|
||||
parent:(MPExpressionLayout *)parent
|
||||
{
|
||||
@@ -53,7 +58,9 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Cache Methods
|
||||
|
||||
- (CTLineRef)lineForPrivateCacheIndex:(NSUInteger)index
|
||||
generator:(CTLineRef (^)())generator
|
||||
{
|
||||
@@ -67,6 +74,7 @@
|
||||
return (__bridge CTLineRef)(lineObject);
|
||||
}
|
||||
|
||||
|
||||
- (id)objectForPrivateCacheIndex:(NSUInteger)index
|
||||
generator:(id (^)())generator
|
||||
{
|
||||
@@ -74,11 +82,13 @@
|
||||
return [self cachableObjectForIndex:actualIndex generator:generator];
|
||||
}
|
||||
|
||||
|
||||
- (NSUInteger)numberOfChildren
|
||||
{
|
||||
return self.function.numberOfChildren;
|
||||
}
|
||||
|
||||
|
||||
- (MPLayout *)childLayoutAtIndex:(NSUInteger)index
|
||||
{
|
||||
return [self cachableObjectForIndex:index generator:^id{
|
||||
@@ -91,11 +101,13 @@
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)childAtIndexUsesSmallSize:(NSUInteger)index
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
- (NSIndexPath *)indexPathForMousePoint:(NSPoint)point
|
||||
{
|
||||
// A single index is used to communicate back wether the
|
||||
@@ -116,36 +128,43 @@
|
||||
return [self indexPathForLocalMousePoint:point];
|
||||
}
|
||||
|
||||
|
||||
- (NSUInteger)indexOfLeadingChild
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
- (NSUInteger)indexOfTrailingChild
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
- (NSUInteger)indexOfChildBeforeChildAtIndex:(NSUInteger)index
|
||||
{
|
||||
return NSNotFound;
|
||||
}
|
||||
|
||||
|
||||
- (NSUInteger)indexOfChildAfterChildAtIndex:(NSUInteger)index
|
||||
{
|
||||
return NSNotFound;
|
||||
}
|
||||
|
||||
|
||||
- (NSUInteger)indexOfChildBelowChildAtIndex:(NSUInteger)index
|
||||
{
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
- (NSUInteger)indexOfChildAboveChildAtIndex:(NSUInteger)index
|
||||
{
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
- (NSIndexSet *)indexesOfRemainingChildren
|
||||
{
|
||||
return [NSIndexSet indexSet];
|
||||
|
||||
Reference in New Issue
Block a user