1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- //
- // KMConvertSettingLimitTipView.swift
- // Cisdem PDFMaster
- //
- // Created by tangchao on 2023/6/26.
- //
- import Cocoa
- class KMConvertSettingLimitTipView: NSView {
- private var _contentView = NSView()
- private var _iconIv = NSImageView()
- private var _textField = NSTextField(labelWithString: "")
- private var _funcBox = NSBox()
-
- // private var _funcButtonVC: KMDesignButton?
-
- var contentView: NSView {
- get {
- return self._contentView
- }
- }
-
- var itemClick: KMCommonClickBlock?
-
- override init(frame frameRect: NSRect) {
- super.init(frame: frameRect)
-
- self.initSubViews()
- self.initDefaultValue()
- }
-
- required init?(coder: NSCoder) {
- super.init(coder: coder)
-
- self.initSubViews()
- self.initDefaultValue()
- }
-
- func initSubViews() {
- self.addSubview(self.contentView)
-
- self.contentView.addSubview(self._iconIv)
- self.contentView.addSubview(self._textField)
- self.contentView.addSubview(self._funcBox)
-
- // self._funcButtonVC = KMDesignButton(withType: .Text)
- // self._funcBox.contentView = self._funcButtonVC!.view
- // self._funcButtonVC?.stringValue = NSLocalizedString("Unlock", comment: "")
- // self._funcButtonVC?.button(type: .Text, size: .m)
- // self._funcButtonVC?.target = self
- // self._funcButtonVC?.action = #selector(funcAction)
-
- self.contentView.km_add_inset_constraint()
-
- self._iconIv.km_add_leading_constraint(constant: 10)
- self._iconIv.km_add_centerY_constraint()
-
- self._textField.km_add_leading_constraint(equalTo: self._iconIv, attribute: .trailing, constant: 5)
- self._textField.km_add_centerY_constraint(equalTo: self._iconIv)
-
- self._funcBox.km_add_leading_constraint(equalTo: self._textField, attribute: .trailing)
- self._funcBox.km_add_centerY_constraint(equalTo: self._iconIv)
- self._funcBox.km_add_size_constraint(size: NSMakeSize(60, 30))
- }
-
- func initDefaultValue() {
- self._iconIv.image = NSImage(named: "KMImageNameTipNormal")
-
- self._textField.stringValue = NSLocalizedString("Convert the first 10 pages for free", comment: "")
- self._textField.font = .SFProTextRegularFont(12)
- self._textField.textColor = KMAppearance.titleColor()
- self._textField.textColor = NSColor.km_init(hex: "#F3465B")
-
- self._funcBox.boxType = .custom
- self._funcBox.titlePosition = .noTitle
- self._funcBox.borderWidth = 0.0
- }
-
- @objc private func funcAction() {
- guard let callback = self.itemClick else {
- return
- }
- callback(1)
- }
- }
|