123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- //
- // CDSignatureTextViewController.swift
- // PDF Reader Pro Edition
- //
- // Created by Niehaoyu on 2023/10/16.
- //
- import Cocoa
- class CDSignatureTextViewController: NSViewController {
- @IBOutlet weak var signTextField: NSTextField!
- @IBOutlet weak var cancelButton: NSButton!
- @IBOutlet weak var applyButton: NSButton!
- @IBOutlet weak var clearButton: NSButton!
-
- var drawText: String!
-
- var actionBlock: ((_ textVC: CDSignatureTextViewController, _ inputText: String)->Void)?
-
- override func viewDidAppear() {
- super.viewDidAppear()
-
- self.view.window?.title = "";
- // self.view.window?.styleMask = [self.view.window?.styleMask, .fullSizeContentView]
- self.view.window?.titlebarAppearsTransparent = true
- self.view.window?.backgroundColor = NSColor(red: 252.0/255.0, green: 253.0/255.0, blue: 255.0/255.0, alpha: 1.0)
-
- self.view.window?.standardWindowButton(.closeButton)?.isHidden = true
- self.view.window?.standardWindowButton(.miniaturizeButton)?.isHidden = true
- self.view.window?.standardWindowButton(.zoomButton)?.isHidden = true
-
- self.signTextField.textColor = NSColor.labelColor
- self.signTextField.stringValue = self.drawText! as String
-
- }
-
- override func viewDidLoad() {
- super.viewDidLoad()
- // Do view setup here.
-
- self.cancelButton.title = NSLocalizedString("Cancel", comment: "")
- self.applyButton.title = NSLocalizedString("Save", comment: "")
- self.clearButton.title = NSLocalizedString("Clear", comment: "")
-
- }
-
- //MARK: IBACtion
- @IBAction func closeAction(_ sender: Any) {
- self.dismiss(self)
- }
-
- @IBAction func clearAction(_ sender: Any) {
- self.signTextField.stringValue = ""
- }
-
- @IBAction func cancelAction(_ sender: Any) {
- self.dismiss(self)
- }
-
- @IBAction func saveAction(_ sender: Any) {
- guard let callBack = self.actionBlock else {
- return
- }
- callBack(self, self.signTextField.stringValue)
-
- self.cancelAction(NSButton())
- }
- }
|