Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: design quickslot and editor view #132

Merged
merged 2 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 26 additions & 17 deletions Box42/FunctionButton/View/PinButtonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,44 @@ import SnapKit
class PinButtonView: NSView {

private var callback: (() -> Void)?
private var pinBoxButton: NSButton!
private var pinBoxLabel: NSTextField!
private let pinBoxButton: NSButton = {
let button = NSButton()
return button
}()

init(image: NSImage, completion: @escaping () -> Void) {
super.init(frame: .zero)

pinBoxButton = NSButton(image: image, target: self, action: #selector(pin))
pinBoxButton.image = image
pinBoxButton.imagePosition = .imageLeading
pinBoxButton.image?.alignmentRect = NSRect(x: 0, y: 7, width: 22, height: 22)

pinBoxButton.target = self
pinBoxButton.action = #selector(pin)

pinBoxButton.isBordered = false
pinBoxButton.wantsLayer = true
pinBoxButton.layer?.backgroundColor = NSColor.clear.cgColor

pinBoxButton.bezelStyle = .inline
let pinBoxTitle = "Pin Box"

let attributes: [NSAttributedString.Key: Any] = [
NSAttributedString.Key.font: NSFont.systemFont(ofSize: 14.0, weight: .semibold), // 원하는 폰트 및 무게로 설정
NSAttributedString.Key.foregroundColor: NSColor(red: 0.41, green: 0.41, blue: 0.41, alpha: 1),
]

let attributedTitle = NSAttributedString(string: pinBoxTitle, attributes: attributes)

pinBoxButton.attributedTitle = attributedTitle
pinBoxButton.attributedAlternateTitle = attributedTitle

self.addSubview(pinBoxButton)

pinBoxLabel = NSTextField(labelWithString: "Pin Box")
pinBoxLabel.font = NSFont(name: "Inter", size: 14)
pinBoxLabel.textColor = NSColor(hex: "#696969")
pinBoxLabel.backgroundColor = NSColor.clear
pinBoxLabel.isBordered = false

self.addSubview(pinBoxLabel)

pinBoxButton.snp.makeConstraints { make in
make.left.equalToSuperview()
make.centerY.equalToSuperview()
}

pinBoxLabel.snp.makeConstraints { make in
make.left.equalTo(pinBoxButton.snp.right).offset(2)
make.centerY.equalToSuperview()
make.width.equalTo(89)
make.height.equalTo(27)
}

self.callback = completion
Expand Down
Loading