1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- //
- // KMCloudFileEmptyView.swift
- // PDF Master
- //
- // Created by tangchao on 2023/2/14.
- //
- import Cocoa
- class KMCloudFileEmptyView: NSView {
- var imageView = NSImageView()
- var titleLabel = NSTextField(labelWithString: "")
- var despLabel = NSTextField(labelWithString: "")
-
- 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.imageView)
- self.addSubview(self.titleLabel)
- self.addSubview(self.despLabel)
-
- self.titleLabel.alignment = .center
- self.titleLabel.stringValue = NSLocalizedString("There are no files in this folder", comment: "")
- self.despLabel.alignment = .center
- self.despLabel.stringValue = NSLocalizedString("no files here.", comment: "")
- }
-
- override func layout() {
- super.layout()
- let width: CGFloat = NSWidth(self.bounds)
-
- let imageSize: NSSize = NSMakeSize(80, 80)
- self.imageView.frame = NSMakeRect((width-imageSize.width)*0.5, 20, imageSize.width, imageSize.height)
-
- self.titleLabel.frame = NSMakeRect(0, self.imageView.frame.maxY+20, width, 22)
- self.despLabel.frame = NSMakeRect(0, self.titleLabel.frame.maxY+2, width, 20)
- }
- }
|