-
Notifications
You must be signed in to change notification settings - Fork 11
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 #8 from Adrian-Samoticha/issue_6
Issue #6
- Loading branch information
Showing
9 changed files
with
201 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/// Constants that specify the style of a window. | ||
enum NSWindowStyleMask { | ||
/// The window displays none of the usual peripheral elements. Useful only for | ||
/// display or caching purposes. A window that uses | ||
/// `NSWindowStyleMaskBorderless` can't become key or main, unless the value | ||
/// of `canBecomeKey` or `canBecomeMain` is true. | ||
borderless, | ||
|
||
/// The window displays a title bar. | ||
titled, | ||
|
||
/// The window displays a close button. | ||
closable, | ||
|
||
/// The window displays a minimize button. | ||
miniaturizable, | ||
|
||
/// The window can be resized by the user. | ||
resizable, | ||
|
||
/// This constant has no effect, because all windows that include a toolbar | ||
/// use the unified style. | ||
unifiedTitleAndToolbar, | ||
|
||
/// The window can appear full screen. A fullscreen window does not draw its | ||
/// title bar, and may have special handling for its toolbar. (This mask is | ||
/// automatically toggled when `toggleFullScreen(_:)` is called.) | ||
fullScreen, | ||
|
||
/// When set, the window's contentView consumes the full size of the window. | ||
/// Although you can combine this constant with other window style masks, it | ||
/// is respected only for windows with a title bar. Note that using this mask | ||
/// opts in to layer-backing. Use the `contentLayoutRect` or the | ||
/// `contentLayoutGuide` to lay out views underneath the title bar–toolbar | ||
/// area. | ||
fullSizeContentView, | ||
|
||
/// The window is a panel or a subclass of `NSPanel`. | ||
utilityWindow, | ||
|
||
/// The window is a document-modal panel (or a subclass of `NSPanel`). | ||
docModalWindow, | ||
|
||
/// The window is a panel or a subclass of `NSPanel` that does not activate | ||
/// the owning app. | ||
nonactivatingPanel, | ||
|
||
/// The window is a HUD panel. | ||
hudWindow, | ||
} |
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,53 @@ | ||
// | ||
// StyleMaskNameToStyleMaskConverter.swift | ||
// macos_window_utils | ||
// | ||
// Created by Adrian Samoticha on 11.01.23. | ||
// | ||
|
||
import Foundation | ||
|
||
class StyleMaskNameToStyleMaskConverter { | ||
public static func getStyleMaskFromName(_ name: String) -> NSWindow.StyleMask { | ||
switch (name) { | ||
case "borderless": | ||
return .borderless | ||
|
||
case "titled": | ||
return .titled | ||
|
||
case "closable": | ||
return .closable | ||
|
||
case "miniaturizable": | ||
return .miniaturizable | ||
|
||
case "resizable": | ||
return .resizable | ||
|
||
case "unifiedTitleAndToolbar": | ||
return .unifiedTitleAndToolbar | ||
|
||
case "fullScreen": | ||
return .fullScreen | ||
|
||
case "fullSizeContentView": | ||
return .fullSizeContentView | ||
|
||
case "utilityWindow": | ||
return .utilityWindow | ||
|
||
case "docModalWindow": | ||
return .docModalWindow | ||
|
||
case "nonactivatingPanel": | ||
return .nonactivatingPanel | ||
|
||
case "hudWindow": | ||
return .hudWindow | ||
|
||
default: | ||
return .borderless | ||
} | ||
} | ||
} |
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