123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- //
- // KMBatchoperateConvertCollectionViewItem.swift
- // Cisdem PDFMaster
- //
- // Created by kdanmobile on 2023/11/1.
- //
- import Cocoa
- class KMBatchoperateConvertCollectionViewItem: NSCollectionViewItem{
- var selectLayer: CALayer?
-
- @IBOutlet var advancedButton: NSButton!
-
- @IBOutlet var containerView: NSView!
-
- @IBOutlet var moreInfoTextField: NSTextField!
-
- @IBOutlet var icomIV: NSImageView!
-
- @IBOutlet var nameTF: NSTextField!
-
- override func viewDidLoad() {
- super.viewDidLoad()
- self.nameTF!.font = NSFont.systemFont(ofSize: 12)
- nameTF!.textColor = KMAppearance.Layout.h1Color()
- moreInfoTextField.font = NSFont.boldSystemFont(ofSize: 9)
- moreInfoTextField.textColor = KMAppearance.Layout.mColor()
- view.wantsLayer = true
- selectLayer = CALayer()
- view.layer?.addSublayer(selectLayer!)
- selectLayer?.frame = CGRect(x: 0, y: 0, width: 64, height: 76)
- selectLayer!.backgroundColor = KMAppearance.Status.selColor().cgColor
- selectLayer?.cornerRadius = 6
- selectLayer!.isHidden = true
- moreInfoTextField.sizeToFit()
- containerView.wantsLayer = true
- containerView.layer?.cornerRadius = moreInfoTextField.bounds.height / 2
- }
- override var isSelected: Bool{
- get{
- return super.isSelected
- }
- set{
- super.isSelected = newValue
- self.selectLayer?.isHidden = !newValue
- }
- }
-
- @IBAction func buttonClicked_AdvancedClicked(_ sender: Any) {
- if !IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
- KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
- }
- }
- func updateInterface(_ type: KMConvertWithPDFType) {
- var titleString: String? = nil
- var moreInfoString: String? = nil
- var image = NSImage(named: KMImageNameUXIconPropertybarFileWord)
- advancedButton.isHidden = true
- containerView.isHidden = true
- switch type {
- case .WordStandard:
- titleString = "Word"
- moreInfoString = NSLocalizedString("Standard", comment: "")
- containerView.isHidden = false
- moreInfoTextField.textColor = KMAppearance.Layout.h0Color()
- containerView.layer?.backgroundColor = KMAppearance.Else.textTagColor().cgColor
- case .WordAdvance:
- titleString = "Word"
- if !IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
- moreInfoString = NSLocalizedString("Advanced", comment: "")
- containerView.isHidden = false
- }
- moreInfoTextField.textColor = KMAppearance.Layout.w0Color()
- containerView.layer?.backgroundColor = KMAppearance.Interactive.a0Color().cgColor
- case .Excel:
- image = NSImage(named: KMImageNameUXIconPropertybarFileExcel)
- titleString = "Excel"
- case .PowerPoint:
- image = NSImage(named: KMImageNameUXIconPropertybarFilePPT)
- titleString = "PowerPoint"
- case .RTF:
- image = NSImage(named: KMImageNameUXIconPropertybarFileElse)
- titleString = "RTF"
- case .CSV:
- image = NSImage(named: KMImageNameUXIconPropertybarFileCSV)
- titleString = "CSV"
- case .HTML:
- image = NSImage(named: KMImageNameUXIconPropertybarFileHTML)
- titleString = "HTML"
- case .Text:
- image = NSImage(named: KMImageNameUXIconPropertybarFileTXT)
- titleString = "Text"
- case .JPEG:
- image = NSImage(named: KMImageNameUXIconPropertybarFileJPEG)
- titleString = "JPEG"
- case .JPG:
- image = NSImage(named: KMImageNameUXIconPropertybarFileJPG)
- titleString = "JPG"
- case .PNG:
- image = NSImage(named: KMImageNameUXIconPropertybarFilePNG)
- titleString = "PNG"
- case .GIF:
- image = NSImage(named: KMImageNameUXIconPropertybarFileGIF)
- titleString = "GIF"
- case .TIFF:
- image = NSImage(named: KMImageNameUXIconPropertybarFileTIFF)
- titleString = "TIFF"
- case .TGA:
- image = NSImage(named: KMImageNameUXIconPropertybarFileTGA)
- titleString = "TGA"
- case .BMP:
- image = NSImage(named: KMImageNameUXIconPropertybarFileBMP)
- titleString = "BMP"
- case .JPEG2000:
- image = NSImage(named: KMImageNameUXIconPropertybarFileJP2)
- titleString = "JPEG2000"
- }
-
- nameTF?.stringValue = titleString ?? ""
- moreInfoTextField.stringValue = moreInfoString ?? ""
- moreInfoTextField.toolTip = moreInfoString ?? ""
- icomIV?.image = image
- }
-
- }
|