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:
parent
b156bbdf53
commit
41e76872aa
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user