-
-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: divide preferences by topic (closes #130)
- Loading branch information
Showing
7 changed files
with
109 additions
and
75 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import Cocoa | ||
import Foundation | ||
|
||
class TabViewController: NSTabViewController { | ||
override func tabView(_ tabView: NSTabView, didSelect tabViewItem: NSTabViewItem?) { | ||
super.tabView(tabView, didSelect: tabViewItem) | ||
guard let tabViewItem = tabViewItem, let window = view.window else { return } | ||
window.title = tabViewItem.label | ||
resizeWindowToFit(tabViewItem, window) | ||
} | ||
|
||
private func resizeWindowToFit(_ tabViewItem: NSTabViewItem, _ window: NSWindow) { | ||
let contentFrame = window.frameRect(forContentRect: NSRect(origin: .zero, size: tabViewItem.view!.frame.size)) | ||
let toolbarHeight = window.frame.size.height - contentFrame.size.height | ||
let newOrigin = NSPoint(x: window.frame.origin.x, y: window.frame.origin.y + toolbarHeight) | ||
let newFrame = NSRect(origin: newOrigin, size: contentFrame.size) | ||
window.setFrame(newFrame, display: false, animate: true) | ||
} | ||
} |
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