12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- //
- // KMCreateBatesController.swift
- // PDF Reader Pro
- //
- // Created by tangchao on 2022/12/28.
- //
- import Cocoa
- typealias KMCreateBatesModelDidChange = (_ model: KMHeaderFooterObject) -> ()
- class KMCreateBatesController: KMWatermarkAdjectivePropertyBaseController {
-
- /// 是否是编辑类型
- var isEdit: Bool = false
- /// 是否已编辑
- var isEdited: Bool = false
-
- var modelDidChange: KMCreateBatesModelDidChange!
-
- override func viewWillAppear() {
- super.viewWillAppear()
-
- let controller: KMBatesPropertyInfoController = childViewController[0] as! KMBatesPropertyInfoController
- controller.model = self.model as! KMHeaderFooterObject
- }
- override func viewDidLoad() {
- super.viewDidLoad()
-
- self.backButtton.title = NSLocalizedString("", comment: "")
- self.showBack(show: true)
- if (self.isEdit) {
- self.titleLabel.stringValue = NSLocalizedString("Edit Bates Number", comment: "")
- self.addButton.attributedTitle = NSAttributedString(string: NSLocalizedString("", comment: ""), attributes: [NSAttributedString.Key.foregroundColor : NSColor(red: 24.0/255.0, green: 160.0/255.0, blue: 251.0/255.0, alpha: 1.0),NSAttributedString.Key.font : NSFont.systemFont(ofSize: 12), NSAttributedString.Key.underlineStyle : true])
- } else {
- self.titleLabel.stringValue = NSLocalizedString("Add Bates Number", comment: "")
- self.addButton.attributedTitle = NSAttributedString(string: NSLocalizedString("", comment: ""), attributes: [NSAttributedString.Key.foregroundColor : NSColor(red: 24.0/255.0, green: 160.0/255.0, blue: 251.0/255.0, alpha: 1.0),NSAttributedString.Key.font : NSFont.systemFont(ofSize: 12), NSAttributedString.Key.underlineStyle : true])
- }
-
- self.segementControl.isHidden = true
- self.segementControlHeightConst.constant = 0
-
- let item = NSTabViewItem(identifier: "tabID")
- item.label = "tab1";
- let controller = KMBatesPropertyInfoController()
- item.viewController = controller
- controller.delegate = self
- self.tabView.addTabViewItem(item)
- childViewController.append(controller)
- }
-
- override func resume() {
- if (self.needResume() == false) {
- return
- }
-
- (childViewController[0] as! KMBatesPropertyInfoController).model = self.flagModel?.copy() as! KMHeaderFooterObject
- }
- }
- extension KMCreateBatesController: KMWatermarkAdjectivePropertyDelegate {
- func propertyInfoDidChange(model: AnyObject) {
- self.isEdited = true
-
- guard let callback = modelDidChange else {
- return
- }
-
- callback(model as! KMHeaderFooterObject)
- }
- }
|