1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-27 15:53:31 +03:00
vimr/VimR/MainWindowManager.swift
2016-07-24 22:31:48 +02:00

31 lines
844 B
Swift

/**
* Tae Won Ha - http://taewon.de - @hataewon
* See LICENSE
*/
import Cocoa
import RxSwift
class MainWindowManager {
private let prefWindowComponent: PrefWindowComponent
private var mainWindowComponents = [String:MainWindowComponent]()
init(prefWindowComponent: PrefWindowComponent) {
self.prefWindowComponent = prefWindowComponent
}
func newMainWindow() {
let mainWindowComponent = MainWindowComponent(source: self.prefWindowComponent.sink, manager: self)
self.mainWindowComponents[mainWindowComponent.uuid] = mainWindowComponent
}
func closeMainWindow(mainWindowComponent: MainWindowComponent) {
self.mainWindowComponents.removeValueForKey(mainWindowComponent.uuid)
}
func hasDirtyWindows() -> Bool {
return self.mainWindowComponents.values.reduce(false) { $0 ? true : $1.isDirty() }
}
}