adwaita-swift/Tests/WindowsDemo.swift
david-swift 2249ef2d6a Add additional window modifiers
Set a window's default size, title, resizability and deletability
2023-12-07 22:27:28 +01:00

50 lines
982 B
Swift

//
// WindowsDemo.swift
// Adwaita
//
// Created by david-swift on 25.09.23.
//
// swiftlint:disable missing_docs implicitly_unwrapped_optional
import Adwaita
struct WindowsDemo: View {
var app: GTUIApp!
var view: Body {
HStack {
VStack {
Button("Show Window") {
app.showWindow("content")
}
.hexpand()
Button("Add Window") {
app.addWindow("main")
}
.hexpand()
}
.valign(.center)
.style("linked")
.padding()
}
.frame(maxSize: 100)
}
struct WindowContent: View {
var view: Body {
Text("This window exists at most once.")
.padding()
.topToolbar {
HeaderBar.empty()
}
}
}
}
// swiftlint:enable missing_docs implicitly_unwrapped_optional