Skip to content
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
13 changes: 10 additions & 3 deletions Box42/FunctionButton/BoxFunctionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@
import Cocoa

class BoxFunctionViewController: NSViewController {

var pinButtonView: PinButtonView?

override func loadView() {
let functionViewGroup = BoxFunctionViewGroup()

pinButtonView = functionViewGroup.pinButton
functionViewGroup.preferenceAction = preference
functionViewGroup.pinAction = pin
functionViewGroup.quitAction = quit
Expand All @@ -30,11 +34,14 @@ class BoxFunctionViewController: NSViewController {
func pin() {
StateManager.shared.togglePin()

let newImage: NSImage
if StateManager.shared.pin {
// image on
newImage = NSImage(imageLiteralResourceName: "pin-box-ver")
} else {
// image off
newImage = NSImage(imageLiteralResourceName: "pin-box")
}

pinButtonView?.changePinImage(to: newImage) // 이미지 변경
print("pin")
}

Expand All @@ -44,7 +51,7 @@ class BoxFunctionViewController: NSViewController {
}

weak var delegate: BoxFunctionViewControllerDelegate?

func box() {
print("box")
delegate?.didTapBoxButton()
Expand Down
4 changes: 4 additions & 0 deletions Box42/FunctionButton/View/PinButtonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class PinButtonView: NSView {
fatalError("init(coder:) has not been implemented")
}

func changePinImage(to image: NSImage) {
pinBoxButton.image = image
}

@objc func pin() {
callback?()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scale" : "1x"
},
{
"filename" : "Bookmark icon.png",
"filename" : "bookmark icon.png",
"idiom" : "universal",
"scale" : "2x"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scale" : "1x"
},
{
"filename" : "Star 3.png",
"filename" : "star.png",
"idiom" : "universal",
"scale" : "2x"
},
Expand Down