//
//  KMRedactMutilPageFlagWindowController.swift
//  PDF Master
//
//  Created by tangchao on 2023/1/19.
//

import Cocoa

class KMRedactMutilPageFlagWindowController: KMRedactBaseWindowController {

    var pageType: Int = 1
    var pageString: String = ""
    
    override func windowDidLoad() {
        super.windowDidLoad()
    
        self.setContentSize(NSSize(width: 404, height: 266))
        
        self.titleLabel.stringValue = NSLocalizedString("Repeat Mark Across Pages", comment: "")
        self.funcButton.title = NSLocalizedString("Apply", comment: "")
        self.funcButton.layer?.backgroundColor = NSColor.black.cgColor
        self.funcButton.attributedTitle = NSMutableAttributedString(string: self.funcButton.title, attributes: [NSAttributedString.Key.foregroundColor : NSColor.white])
        
        
        let contentView = KMRedactMutilPageFlagContentView.createFromNib()
        contentView?.frame = self.contentBox.contentView!.bounds
        contentView?.autoresizingMask = [.width,.height]
        self.contentBox.contentView?.addSubview(contentView!)
        self.contentView = contentView
        contentView?.pageCount = self.pageCount
        
        contentView?.itemClick = {[weak self] index, value in
            if (index == 1) { /// 所有页面
                self!.pageType = 1
            } else if (index == 2) { /// 奇数页
                self!.pageType = 2
            } else if (index == 3) { /// 偶数页
                self!.pageType = 3
            } else if (index == 4) { /// 自定义页面范围
                self!.pageType = 4
            } else if (index == 5) { /// 自定义页面范围输入
                self?.pageString = value as! String
            }
        }
    }

}