-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from 42Box/49-toolbar-group-view-controller
fix: toolbar 관련 사항 변경
- Loading branch information
Showing
13 changed files
with
286 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// WindowCloseButton.swift | ||
// Box42 | ||
// | ||
// Created by Chanhee Kim on 8/23/23. | ||
// | ||
|
||
import AppKit | ||
|
||
class WindowCloseButton: NSButton { | ||
|
||
private var callback: (() -> Void)? | ||
|
||
init(image: NSImage, completion: @escaping () -> Void) { | ||
super.init(frame: .zero) | ||
|
||
self.title = "X" // 기본적인 X 모양으로 표시. 이미지나 다른 디자인을 원하시면 변경하실 수 있습니다. | ||
self.bezelStyle = .texturedRounded | ||
self.target = self | ||
self.action = #selector(closeAction) | ||
self.callback = completion | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
@objc func closeAction() { | ||
callback?() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// WindowMaximizeButton.swift | ||
// Box42 | ||
// | ||
// Created by Chanhee Kim on 8/23/23. | ||
// | ||
|
||
import AppKit | ||
|
||
class WindowMaximizeButton: NSButton { | ||
|
||
private var callback: (() -> Void)? | ||
|
||
init(image: NSImage, completion: @escaping () -> Void) { | ||
super.init(frame: .zero) | ||
|
||
self.title = "□" // 기본적인 □ 모양으로 표시. 변경 가능. | ||
self.bezelStyle = .texturedRounded | ||
self.target = self | ||
self.action = #selector(maximizeAction) | ||
self.callback = completion | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
@objc func maximizeAction() { | ||
callback?() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// WindowMinimizeButton.swift | ||
// Box42 | ||
// | ||
// Created by Chanhee Kim on 8/23/23. | ||
// | ||
|
||
import AppKit | ||
|
||
class WindowMinimizeButton: NSButton { | ||
|
||
private var callback: (() -> Void)? | ||
|
||
init(image: NSImage, completion: @escaping () -> Void) { | ||
super.init(frame: .zero) | ||
|
||
self.title = "_" // 기본적인 _ 모양으로 표시. 변경 가능. | ||
self.bezelStyle = .texturedRounded | ||
self.target = self | ||
self.action = #selector(minimizeAction) | ||
self.callback = completion | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
@objc func minimizeAction() { | ||
callback?() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// | ||
// WindowViewGroup.swift | ||
// Box42 | ||
// | ||
// Created by Chanhee Kim on 8/23/23. | ||
// | ||
|
||
import AppKit | ||
import SnapKit | ||
|
||
class WindowViewGroup: NSView { | ||
lazy var windowClose: WindowCloseButton = WindowCloseButton(image: NSImage(imageLiteralResourceName: "sidebar.leading"), completion: { self.close?() }) | ||
lazy var windowMinimize: WindowMinimizeButton = WindowMinimizeButton(image: NSImage(imageLiteralResourceName: "arrow.left"), completion: { self.minimize?()} ) | ||
lazy var windowMaximize: WindowMaximizeButton = WindowMaximizeButton(image: NSImage(imageLiteralResourceName: "arrow.right"), completion: { self.maximize?() }) | ||
|
||
var close: (() -> Void)? | ||
var minimize: (() -> Void)? | ||
var maximize: (() -> Void)? | ||
|
||
override init(frame: NSRect) { | ||
super.init(frame: frame) | ||
setupViews() | ||
setupConstraints() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
super.init(coder: coder) | ||
setupViews() | ||
setupConstraints() | ||
} | ||
|
||
private func setupViews() { | ||
self.addSubview(windowClose) | ||
self.addSubview(windowMinimize) | ||
self.addSubview(windowMaximize) | ||
} | ||
|
||
private func setupConstraints() { | ||
|
||
windowClose.snp.makeConstraints { make in | ||
make.top.left.bottom.equalToSuperview() | ||
make.width.equalTo(windowMinimize) | ||
} | ||
|
||
windowMinimize.snp.makeConstraints { make in | ||
make.top.bottom.equalTo(windowClose) | ||
make.left.equalTo(windowClose.snp.right).offset(10) | ||
make.width.equalTo(windowMaximize) | ||
} | ||
|
||
windowMaximize.snp.makeConstraints { make in | ||
make.top.right.bottom.equalToSuperview() | ||
make.left.equalTo(windowMinimize.snp.right).offset(10) | ||
} | ||
} | ||
} |
Oops, something went wrong.