123456789101112131415161718192021222324252627282930313233343536373839404142 |
- //
- // KMTabStripView.swift
- // PDF Reader Pro
- //
- // Created by wanjun on 2022/12/12.
- //
- import Cocoa
- class KMTabStripView: CTTabStripView {
- override func awakeFromNib() {
- super.awakeFromNib()
-
- if self.addTabButton != nil {
- self.addTabButton.wantsLayer = true
- self.addTabButton.layer?.cornerRadius = 4
- // self.addTabButton.toolTip = String(format: "%@(%@O)", KMLocalizedString("Open File", nil),kCommandString)
-
- let view = KMCoverButton()
- self.addTabButton.addSubview(view)
- view.km_add_inset_constraint()
- view.wantsLayer = true
- view.title = ""
- view.isEnabled = false
- view.layer?.backgroundColor = .clear
- view.isBordered = false
- view.coverAction = { [weak self] button, action in
- if (action == .enter) {
- var color = NSColor(red: 237/255.0, green: 238/255.0, blue: 240/255.0, alpha: 1)
- if KMAppearance.isDarkMode() {
- color = NSColor(white: 0.35, alpha: 1)
- }
- self?.addTabButton.layer?.backgroundColor = color.cgColor
- } else if (action == .exit) {
- self?.addTabButton.layer?.backgroundColor = .clear
- }
- }
- }
- }
- }
|