1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- //
- // KMPageEditBaseItemView.swift
- // PDF Master
- //
- // Created by tangchao on 2023/1/11.
- //
- import Cocoa
- typealias KMPageEditItemViewItemClick = (_ index: Int, _ value: Any) -> ()
- class KMPageEditBaseItemView: NSView {
- lazy var titleLabel: NSTextField = {
- let label = NSTextField(labelWithString: "")
- label.font = NSFont.systemFont(ofSize: 14)
- return label
- }()
-
- private var myContentInset: NSEdgeInsets = NSEdgeInsetsMake(8, 16, 0, 0)
- var contentInset: NSEdgeInsets {
- get {
- return myContentInset
- }
- set {
- self.myContentInset = newValue
-
- self.layoutSubtreeIfNeeded()
- }
- }
-
- var itemClick: KMPageEditItemViewItemClick!
-
- override var isFlipped: Bool {
- return true
- }
-
- override init(frame frameRect: NSRect) {
- super.init(frame: frameRect)
-
- initSubviews()
- }
-
- required init?(coder: NSCoder) {
- super.init(coder: coder)
-
- initSubviews()
- }
-
- public func initSubviews() {
- self.addSubview(self.titleLabel)
- }
-
- override func layout() {
- super.layout()
-
- self.titleLabel.frame = NSMakeRect(self.contentInset.left, self.contentInset.top, NSWidth(self.bounds)-self.contentInset.left-self.contentInset.right, 22)
- }
-
- }
|