2020-04-07 22:25:33 +02:00
|
|
|
//
|
|
|
|
// ExtensionPoint.swift
|
|
|
|
// NetNewsWire
|
|
|
|
//
|
|
|
|
// Created by Maurice Parker on 4/7/20.
|
|
|
|
// Copyright © 2020 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
import RSCore
|
|
|
|
|
2020-04-08 17:12:06 +02:00
|
|
|
protocol ExtensionPoint {
|
|
|
|
|
2020-04-14 23:47:05 +02:00
|
|
|
static var isSinglton: Bool { get }
|
|
|
|
static var title: String { get }
|
|
|
|
static var templateImage: RSImage { get }
|
|
|
|
static var description: NSAttributedString { get }
|
|
|
|
|
2020-04-15 05:33:05 +02:00
|
|
|
var title: String { get }
|
2020-04-08 17:12:06 +02:00
|
|
|
var extensionPointID: ExtensionPointIdentifer { get }
|
|
|
|
|
|
|
|
}
|
2020-04-07 22:25:33 +02:00
|
|
|
|
2020-04-08 17:12:06 +02:00
|
|
|
extension ExtensionPoint {
|
|
|
|
|
2020-04-15 05:33:05 +02:00
|
|
|
var templateImage: RSImage {
|
|
|
|
return extensionPointID.type.templateImage
|
2020-04-08 17:12:06 +02:00
|
|
|
}
|
2020-04-14 23:47:05 +02:00
|
|
|
|
2020-04-15 05:33:05 +02:00
|
|
|
var description: NSAttributedString {
|
|
|
|
return extensionPointID.type.description
|
|
|
|
}
|
|
|
|
|
2020-04-14 23:47:05 +02:00
|
|
|
static func makeAttrString(_ text: String) -> NSMutableAttributedString {
|
|
|
|
let paragraphStyle = NSMutableParagraphStyle()
|
|
|
|
paragraphStyle.alignment = .center
|
|
|
|
|
|
|
|
let attrs = [
|
|
|
|
NSAttributedString.Key.paragraphStyle: paragraphStyle,
|
|
|
|
NSAttributedString.Key.font: NSFont.systemFont(ofSize: NSFont.systemFontSize),
|
|
|
|
NSAttributedString.Key.foregroundColor: NSColor.textColor
|
|
|
|
]
|
|
|
|
|
|
|
|
return NSMutableAttributedString(string: text, attributes: attrs)
|
|
|
|
}
|
2020-04-08 17:12:06 +02:00
|
|
|
|
2020-04-07 22:25:33 +02:00
|
|
|
}
|