1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-11-28 02:54:31 +03:00

GH-282 Restructure

This commit is contained in:
Tae Won Ha 2016-09-25 08:53:10 +02:00
parent b156bbdf53
commit 41e76872aa
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44

View File

@ -13,12 +13,12 @@ enum WorkspaceBarLocation {
case left
}
struct MainViewConfig {
let minimumSize: CGSize
}
class Workspace: NSView {
struct Config {
let mainViewMinimumSize: CGSize
}
private(set) var isBarVisible = true {
didSet {
self.relayout()
@ -33,11 +33,11 @@ class Workspace: NSView {
// MARK: - API
let mainView: NSView
let mainViewConfig: MainViewConfig
let config: Config
init(mainView: NSView, config: MainViewConfig = MainViewConfig(minimumSize: CGSize(width: 100, height: 100))) {
init(mainView: NSView, config: Config = Config(mainViewMinimumSize: CGSize(width: 100, height: 100))) {
self.config = config
self.mainView = mainView
self.mainViewConfig = config
self.bars = [
.top: WorkspaceBar(location: .top),
@ -76,8 +76,9 @@ extension Workspace {
let mainView = self.mainView
self.addSubview(mainView)
mainView.autoSetDimension(.Width, toSize: self.mainViewConfig.minimumSize.width, relation: .GreaterThanOrEqual)
mainView.autoSetDimension(.Height, toSize: self.mainViewConfig.minimumSize.height, relation: .GreaterThanOrEqual)
mainView.autoSetDimension(.Width, toSize: self.config.mainViewMinimumSize.width, relation: .GreaterThanOrEqual)
mainView.autoSetDimension(.Height, toSize: self.config.mainViewMinimumSize.height, relation: .GreaterThanOrEqual)
guard self.isBarVisible else {
mainView.autoPinEdgesToSuperviewEdges()