Created
November 16, 2018 21:15
-
-
Save jmercouris/066a515c4b1aa28c769477fa65705b6c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Copyright © 2017-2018 Atlas Engineer LLC. | |
// Use of this file is governed by the license that can be found in LICENSE. | |
// | |
#import "Base.h" | |
#import "Minibuffer.h" | |
@implementation Base | |
@synthesize minibuffer; | |
@synthesize buffer; | |
@synthesize minibufferHeightConstraint; | |
- (instancetype)init | |
{ | |
self = [super init]; | |
[self setOrientation:NSUserInterfaceLayoutOrientationVertical]; | |
[self setTranslatesAutoresizingMaskIntoConstraints:NO]; | |
[self setSpacing:0]; | |
[self setMinibuffer:[[Minibuffer alloc] init]]; | |
[self setMinibufferHeightConstraint: | |
[NSLayoutConstraint constraintWithItem:self.minibuffer | |
attribute:NSLayoutAttributeHeight | |
relatedBy:NSLayoutRelationEqual | |
toItem:nil | |
attribute:NSLayoutAttributeNotAnAttribute | |
multiplier:1.0f | |
constant:0]]; | |
[self setBuffer:[[Buffer alloc] init]]; | |
[[self minibuffer] addConstraint:[self minibufferHeightConstraint]]; | |
[self addArrangedSubview:[self buffer]]; | |
[self addArrangedSubview:[self minibuffer]]; | |
return self; | |
} | |
- (void)setActiveBuffer:(Buffer*)buffer | |
{ | |
[self replaceSubview:[self buffer] with:buffer]; | |
[self setBuffer:buffer]; | |
} | |
- (int)setMinibufferHeight:(int)height | |
{ | |
[[self minibufferHeightConstraint] setConstant:height]; | |
return height; | |
} | |
-(BOOL) acceptsFirstResponder | |
{ | |
return YES; | |
} | |
-(BOOL) becomeFirstResponder | |
{ | |
return YES; | |
} | |
-(BOOL) resignFirstResponder | |
{ | |
return YES; | |
} | |
-(void)keyDown:(NSEvent *)event | |
{ | |
return; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment