123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- //
- // KMWatermarkAdjectivePropertyBaseController.swift
- // PDF Master
- //
- // Created by tangchao on 2022/12/15.
- //
- import Cocoa
- protocol KMWatermarkAdjectivePropertyDelegate: NSObjectProtocol {
- func propertyInfoDidChange(model: AnyObject)
- }
- typealias KMWatermarkAdjectivePropertyRightButtonClick = (_ index: Int)->()
- typealias KMWatermarkAdjectivePropertyBackButtonClick = ()->()
- /// 水印相关 属性控制器(基类)
- class KMWatermarkAdjectivePropertyBaseController: NSViewController {
- @IBOutlet weak var backButtton: NSButton!
-
- @IBOutlet weak var backButtonWidthConst: NSLayoutConstraint!
- @IBOutlet weak var titleLabel: NSTextField!
- @IBOutlet weak var addButton: NSButton!
-
- @IBOutlet weak var contentBox: NSBox!
- @IBOutlet weak var segementControl: KMWatermarkAdjectiveSegementControl!
- @IBOutlet weak var segementControlHeightConst: NSLayoutConstraint!
-
- @IBOutlet weak var tabView: NSTabView!
- var childViewController: Array<NSViewController> = []
-
- var rightButtonClick: KMWatermarkAdjectivePropertyRightButtonClick!
- var backClick: KMWatermarkAdjectivePropertyBackButtonClick!
-
- weak var delegate: KMWatermarkAdjectivePropertyDelegate?
-
- var preView: CPDFView!
- var model: AnyObject!
-
- /// 存储标记模型 【恢复功能】
- var flagModel: AnyObject?
-
- init() {
- super.init(nibName: "KMWatermarkAdjectivePropertyBaseController", bundle: nil)
- }
-
- required init?(coder: NSCoder) {
- super.init(nibName: "KMWatermarkAdjectivePropertyBaseController", bundle: nil)
- }
-
- override func viewDidLoad() {
- super.viewDidLoad()
- self.view.wantsLayer = true
- self.view.layer?.backgroundColor = NSColor(white: 243.0/255.0, alpha: 1.0).cgColor
-
- self.backButtton.target = self
- self.backButtton.action = #selector(backButttonAction)
-
- self.addButton.title = NSLocalizedString("+", comment: "")
- self.addButton.target = self
- self.addButton.action = #selector(addButtonAction)
-
- self.tabView.delegate = self;
- }
-
- func showBack(show: Bool) {
- if (show) {
- self.backButtton.isHidden = false
- self.backButtonWidthConst.constant = 20
- } else {
- self.backButtton.isHidden = true
- self.backButtonWidthConst.constant = 0
- }
- }
-
- func initDatas() {
-
- }
-
- func updateDatas() {
-
- }
-
- @objc func addButtonAction() {
- guard let callback = rightButtonClick else {
- return
- }
-
- callback(self.tabView.indexOfTabViewItem(self.tabView.selectedTabViewItem!))
- }
-
- @objc func backButttonAction() {
- guard let callback = backClick else {
- return
- }
-
- callback()
- }
-
- func selectTabIndex(index: Int) {
- if (index < self.tabView.numberOfTabViewItems) {
- self.segementControl.selectItemIndex = index
- self.tabView.selectTabViewItem(at: index)
- }
- }
-
- // MARK: 恢复
- public func resume() {
-
- }
-
- public func needResume() -> Bool {
- if (self.flagModel == nil) {
- return false
- }
- if (childViewController.count <= 0) {
- return false
- }
- return true
- }
- }
- extension KMWatermarkAdjectivePropertyBaseController: NSTabViewDelegate {
-
- }
|