NetNewsWire/Mac/MainWindow/Timeline/Cell/TimelineCellAppearance.swift

72 lines
1.9 KiB
Swift
Raw Normal View History

2017-05-27 19:43:27 +02:00
//
// TimelineCellAppearance.swift
2018-08-29 07:18:24 +02:00
// NetNewsWire
2017-05-27 19:43:27 +02:00
//
// Created by Brent Simmons on 2/6/16.
// Copyright © 2016 Ranchero Software, LLC. All rights reserved.
//
import AppKit
2017-05-27 19:43:27 +02:00
struct TimelineCellAppearance: Equatable {
2017-05-27 19:43:27 +02:00
let showIcon: Bool
let cellPadding: NSEdgeInsets
2017-05-27 19:43:27 +02:00
let feedNameFont: NSFont
2017-05-27 19:43:27 +02:00
let dateFont: NSFont
let dateMarginLeft: CGFloat = 8.0
2017-05-27 19:43:27 +02:00
let titleFont: NSFont
let titleBottomMargin: CGFloat = 1.0
let titleNumberOfLines = 3
2017-05-27 19:43:27 +02:00
let textFont: NSFont
let textOnlyFont: NSFont
let unreadCircleDimension: CGFloat = 8.0
let unreadCircleMarginRight: CGFloat = 8.0
let starDimension: CGFloat = 13.0
let drawsGrid = false
let iconSize = NSSize(width: 48, height: 48)
let iconMarginLeft: CGFloat = 8.0
let iconMarginRight: CGFloat = 8.0
let iconAdjustmentTop: CGFloat = 4.0
let iconCornerRadius: CGFloat = 4.0
let boxLeftMargin: CGFloat
init(showIcon: Bool, fontSize: FontSize) {
2017-05-27 19:43:27 +02:00
let actualFontSize = AppDefaults.shared.actualFontSize(for: fontSize)
let smallItemFontSize = floor(actualFontSize * 0.90)
let largeItemFontSize = actualFontSize
2018-02-19 05:28:31 +01:00
self.feedNameFont = NSFont.systemFont(ofSize: smallItemFontSize, weight: NSFont.Weight.bold)
self.dateFont = NSFont.systemFont(ofSize: smallItemFontSize, weight: NSFont.Weight.bold)
2020-03-24 03:58:35 +01:00
self.titleFont = NSFont.systemFont(ofSize: largeItemFontSize, weight: NSFont.Weight.semibold)
self.textFont = NSFont.systemFont(ofSize: largeItemFontSize)
2018-02-19 05:28:31 +01:00
self.textOnlyFont = NSFont.systemFont(ofSize: largeItemFontSize)
self.showIcon = showIcon
cellPadding = NSEdgeInsets(top: 8.0, left: 4.0, bottom: 10.0, right: 4.0)
let margin = self.cellPadding.left + self.unreadCircleDimension + self.unreadCircleMarginRight
self.boxLeftMargin = margin
}
2017-05-27 19:43:27 +02:00
}
extension NSEdgeInsets: Equatable {
public static func ==(lhs: NSEdgeInsets, rhs: NSEdgeInsets) -> Bool {
return lhs.left == rhs.left && lhs.top == rhs.top && lhs.right == rhs.right && lhs.bottom == rhs.bottom
}
}