Skip to content

Instantly share code, notes, and snippets.

@jmercouris
Created November 16, 2018 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmercouris/066a515c4b1aa28c769477fa65705b6c to your computer and use it in GitHub Desktop.
Save jmercouris/066a515c4b1aa28c769477fa65705b6c to your computer and use it in GitHub Desktop.
//
// 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