]> git.r.bdr.sh - rbdr/captura/blame - Captura/Presentation/Popovers/HelpPopoverViewController.swift
Add multimonitor support
[rbdr/captura] / Captura / Presentation / Popovers / HelpPopoverViewController.swift
CommitLineData
a4e80427
RBR
1import Cocoa
2
3class HelpPopoverViewController: NSViewController {
4
5 var labelString: String = "Captura"
6 let textField = NSTextField()
7
8 override func loadView() {
9 self.view = NSView()
10 self.view.frame = NSRect(x: 0, y: 0, width: 250, height: 40)
11
12 textField.stringValue = labelString
13 textField.font = NSFont(name: "Hiragino Mincho ProN", size: 12)
14 textField.isEditable = false
15 textField.isBezeled = false
16 textField.isSelectable = false
17 textField.backgroundColor = NSColor.clear
18 textField.sizeToFit()
19
20 let x = (view.frame.width - textField.frame.width) / 2
21 let y = (view.frame.height - textField.frame.height) / 2
22 textField.frame.origin = NSPoint(x: x, y: y)
23
24 self.view.addSubview(textField)
25 }
26
27 func updateLabel(_ newLabel: String) {
28 labelString = newLabel
29 textField.stringValue = labelString
30 textField.sizeToFit()
31
32 let x = (view.frame.width - textField.frame.width) / 2
33 let y = (view.frame.height - textField.frame.height) / 2
34 textField.frame.origin = NSPoint(x: x, y: y)
35 }
36}