Prepared to implement improved keyboard navigation
This commit is contained in:
@@ -37,4 +37,12 @@
|
||||
- (NSRect)generateBounds; // To be implemented
|
||||
- (void)drawAtPoint:(NSPoint)point; // To be implemented
|
||||
|
||||
// Specify the child that is used when the cursor enters the function from the left or right respectively
|
||||
- (NSUInteger)indexOfLeadingChild; // To be implemented
|
||||
- (NSUInteger)indexOfTrailingChild; // To be implemented
|
||||
|
||||
// The index of the child before (left) or after (right) the child at @c index. return NSNotFound if there is no child before or after @c index.
|
||||
- (NSUInteger)indexOfChildBeforeChildAtIndex:(NSUInteger)index; // May be implemented
|
||||
- (NSUInteger)indexOfChildAfterChildAtIndex:(NSUInteger)index; // May be implemented
|
||||
|
||||
@end
|
||||
@@ -72,15 +72,14 @@
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark Size and Drawing Methods
|
||||
- (NSRect)generateBounds
|
||||
- (NSUInteger)indexOfChildBeforeChildAtIndex:(NSUInteger)index
|
||||
{
|
||||
return NSZeroRect;
|
||||
return NSNotFound;
|
||||
}
|
||||
|
||||
- (void)draw
|
||||
- (NSUInteger)indexOfChildAfterChildAtIndex:(NSUInteger)index
|
||||
{
|
||||
|
||||
return NSNotFound;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -23,6 +23,16 @@
|
||||
return (MPSumFunction *)self.function;
|
||||
}
|
||||
|
||||
- (NSUInteger)indexOfLeadingChild
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
- (NSUInteger)indexOfTrailingChild
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
- (CTLineRef)line
|
||||
{
|
||||
CTLineRef line = [self lineForPrivateCacheIndex:0 generator:^CTLineRef{
|
||||
@@ -75,7 +85,7 @@
|
||||
childBounds.origin.x += childOffset.x;
|
||||
childBounds.origin.y += childOffset.y;
|
||||
if (NSMouseInRect(point, childBounds, self.flipped)) {
|
||||
NSPoint pointInChild = NSMakePoint(point.x + childOffset.x, point.y + childOffset.y);
|
||||
NSPoint pointInChild = NSMakePoint(point.x - childOffset.x, point.y - childOffset.y);
|
||||
NSIndexPath *subPath = [childLayout indexPathForMousePoint:pointInChild];
|
||||
return [subPath indexPathByPreceedingIndex:index];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user