123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- //
- // KMUserFbListHeaderItemView.swift
- // PDF Reader Pro Edition
- //
- // Created by tangchao on 2024/7/11.
- //
- import Cocoa
- class KMUserFbListHeaderItemView: NSView, NibLoadable {
- @IBOutlet weak var checkButton: NSButton!
- @IBOutlet weak var lineView: NSBox!
- @IBOutlet weak var label: NSTextField!
- @IBOutlet weak var helpButton: KMCoverButton!
- @IBOutlet weak var addButton: NSButton!
-
- var itemClick: ((_ idx: Int)->Void)?
- var helpHoverCallback: ((_ action: KMCoverAction)->Void)?
-
- @IBOutlet weak var lineTopConst: NSLayoutConstraint!
-
- override func awakeFromNib() {
- super.awakeFromNib()
-
- self.checkButton.title = NSLocalizedString("With the log file", comment: "")
- self.checkButton.target = self
- self.checkButton.action = #selector(_checkButtonAction)
-
- #if !VERSION_DMG
- self.checkButton.isHidden = true
- self.lineTopConst.constant = -16
- #endif
-
- self.label.stringValue = NSLocalizedString("Add or delete documents", comment: "")
- self.helpButton.target = self
- self.helpButton.action = #selector(_helpButtonAction)
- self.helpButton.coverAction = {[weak self] button, action in
- self?.helpHoverCallback?(action)
- }
-
- self.addButton.title = "+ \(NSLocalizedString("Add Files", comment: ""))"
- self.addButton.target = self
- self.addButton.action = #selector(_addButtonAction)
- }
-
- @objc private func _checkButtonAction() {
- self.itemClick?(1)
- }
-
- @objc private func _helpButtonAction() {
- self.itemClick?(2)
- }
-
- @objc private func _addButtonAction() {
- self.itemClick?(3)
- }
- }
|