NetNewsWire/Evergreen/ProgressWindow/IndeterminateProgressWindow...

39 lines
899 B
Swift
Raw Normal View History

2017-05-27 19:43:27 +02:00
//
// IndeterminateProgressWindowController.swift
// Evergreen
//
// Created by Brent Simmons on 8/28/16.
// Copyright © 2016 Ranchero Software, LLC. All rights reserved.
2017-05-27 19:43:27 +02:00
//
import Cocoa
class IndeterminateProgressWindowController: NSWindowController {
@IBOutlet var messageLabel: NSTextField!
@IBOutlet var progressIndicator: NSProgressIndicator!
2017-09-17 21:34:10 +02:00
@objc dynamic var message = ""
2017-05-27 19:43:27 +02:00
convenience init(message: String) {
2017-09-17 21:54:08 +02:00
self.init(windowNibName: NSNib.Name(rawValue: "IndeterminateProgressWindow"))
2017-05-27 19:43:27 +02:00
self.message = message
}
override func windowDidLoad() {
progressIndicator.startAnimation(self)
}
}
func runIndeterminateProgressWithMessage(_ message: String) {
let windowController = IndeterminateProgressWindowController(message: message)
2017-09-17 21:54:08 +02:00
NSApplication.shared.runModal(for: windowController.window!)
2017-05-27 19:43:27 +02:00
}
func stopIndeterminateProgress() {
2017-09-17 21:54:08 +02:00
NSApplication.shared.stopModal()
2017-05-27 19:43:27 +02:00
}