1
1
mirror of https://github.com/qvacua/vimr.git synced 2025-01-08 06:58:50 +03:00

GH-485 Add the rep icon and the title manually when in the themed mode

This commit is contained in:
Tae Won Ha 2017-09-03 16:21:54 +02:00
parent 1f5d98cfb4
commit f1643dfd21
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44

View File

@ -36,11 +36,30 @@ class WindowController: NSWindowController, NSWindowDelegate {
window.titleVisibility = .hidden
window.styleMask.insert(.fullSizeContentView)
button.removeFromSuperview() // remove the rep icon from the original superview and add it to content view
contentView.addSubview(button)
button.autoPinEdge(toSuperviewEdge: .right, withInset: 24)
button.autoPinEdge(toSuperviewEdge: .top, withInset: 3)
button.autoSetDimension(.width, toSize: 16)
button.autoSetDimension(.height, toSize: 16)
button.autoPinEdge(toSuperviewEdge: .top, withInset: 3)
let title = NSTextField(labelWithString: window.title)
title.configureForAutoLayout()
contentView.addSubview(title)
title.autoPinEdge(toSuperviewEdge: .top, withInset: 2)
// Center the rep icon and the title side by side in the content view:
// rightView.left = leftView.right + gap
// rightView.right = parentView.centerX + (leftView.width + gap + rightView.width) / 2
contentView.addConstraint(NSLayoutConstraint(item: title, attribute: .left,
relatedBy: .equal,
toItem: button, attribute: .right,
multiplier: 1,
constant: gap))
contentView.addConstraint(NSLayoutConstraint(item: title, attribute: .right,
relatedBy: .equal,
toItem: contentView, attribute: .centerX,
multiplier: 1,
constant: (button.frame.width + gap + title.frame.width) / 2))
contentView.addSubview(self.root)
self.root.autoPinEdge(toSuperviewEdge: .top, withInset: 22)
@ -134,3 +153,4 @@ class ColorView: NSView {
}
}
fileprivate let gap = CGFloat(4.0)