123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- //
- // KMCreateBackgroundController.swift
- // PDF Master
- //
- // Created by tangchao on 2022/12/23.
- //
- import Cocoa
- class KMCreateBackgroundController: KMWatermarkAdjectivePropertyBaseController {
-
- override func viewDidLoad() {
- super.viewDidLoad()
- // Do view setup here.
-
- self.backButtton.title = NSLocalizedString("", comment: "")
- self.showBack(show: true)
- self.titleLabel.stringValue = NSLocalizedString("Add Background", 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.items = [NSLocalizedString("Color", comment: ""),NSLocalizedString("File", comment: "")]
- self.segementControl.itemClick = {
- [self] (index: Int) in
- self.tabView.selectTabViewItem(at: index)
- }
-
- let item = NSTabViewItem(identifier: "tabID")
- item.label = "tab1";
- let controller = KMBackgroundPropertyInfoController(nibName: "KMBackgroundPropertyInfoController", bundle: nil)
- item.viewController = controller
- controller.model = KMBackgroundModel()
- controller.delegate = self
- let item2 = NSTabViewItem(identifier: "tabID2")
- item2.label = "tab2";
- let controller2 = KMBackgroundFilePropertyInfoController(nibName: "KMBackgroundFilePropertyInfoController", bundle: nil)
- item2.viewController = controller2
- controller2.model = KMBackgroundModel()
- controller2.model.type = .file
- controller2.delegate = self
-
- self.tabView.addTabViewItem(item)
- self.tabView.addTabViewItem(item2)
- childViewController.append(controller)
- childViewController.append(controller2)
- }
-
- func fetchTemplate() -> AnyObject {
- if (self.tabView.indexOfTabViewItem(self.tabView.selectedTabViewItem!) == 0) {
- let currentController: KMBackgroundPropertyInfoController = self.tabView.selectedTabViewItem?.viewController as! KMBackgroundPropertyInfoController
- return currentController.model
- } else {
- let currentController: KMBackgroundFilePropertyInfoController = self.tabView.selectedTabViewItem?.viewController as! KMBackgroundFilePropertyInfoController
- return currentController.model
- }
- }
- }
- extension KMCreateBackgroundController: KMBackgroundPropertyInfoDelegate {
- func propertyInfoDidChange(model: KMBackgroundModel) {
- if (self.delegate == nil) {
- return
- }
- self.delegate?.propertyInfoDidChange(model: model)
- }
- }
|