forked from aparoksha/adwaita-swift
Add modifier for window devel style
This commit is contained in:
parent
be9cf996a0
commit
f53c194045
@ -43,6 +43,8 @@ public struct Window: WindowScene {
|
||||
var setDefaultSize = false
|
||||
/// Whether the window is maximized.
|
||||
var maximized: Binding<Bool>?
|
||||
/// Whether the window uses the development style.
|
||||
var devel = false
|
||||
|
||||
/// Create a window type with a certain identifier and user interface.
|
||||
/// - Parameters:
|
||||
@ -66,6 +68,9 @@ public struct Window: WindowScene {
|
||||
windowStorage.destroy = true
|
||||
}
|
||||
windowStorage.parentID = parentID
|
||||
if devel {
|
||||
gtk_widget_add_css_class(window.pointer?.cast(), "devel")
|
||||
}
|
||||
return windowStorage
|
||||
}
|
||||
|
||||
@ -341,6 +346,15 @@ public struct Window: WindowScene {
|
||||
return newSelf
|
||||
}
|
||||
|
||||
/// Whether the window used the development style.
|
||||
/// - Parameter active: Whether the style is active.
|
||||
/// - Returns: The window.
|
||||
public func devel(_ active: Bool = true) -> Self {
|
||||
var newSelf = self
|
||||
newSelf.devel = active
|
||||
return newSelf
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// swiftlint:enable discouraged_optional_collection
|
||||
|
||||
@ -22,6 +22,7 @@ struct Demo: App {
|
||||
Window(id: "main") { window in
|
||||
DemoContent(window: window, app: app, pictureURL: pictureURL)
|
||||
}
|
||||
.devel()
|
||||
HelperWindows()
|
||||
FileDialog(importer: "picture", extensions: ["jpg", "jpeg", "png", "svg"]) { pictureURL = $0 } onClose: { }
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user