bap-poc-phase-4/Sources/PMCalc/PMCalc.swift

103 lines
3.8 KiB
Swift
Raw Normal View History

2025-04-28 07:58:27 +00:00
// The Swift Programming Language
// https://docs.swift.org/swift-book
import Adwaita
import CMath
2025-04-28 07:58:27 +00:00
@main
struct PMCalc: App {
let app = AdwaitaApp(id: "me.thealgorithm476.PMCalc.PMCalc")
2025-04-28 07:58:27 +00:00
var scene: Scene {
Window(id: "main") { window in
VStack(spacing: 8) {
Text("Calculations here...")
.selectable(false)
VStack(spacing: 8) {
HStack(spacing: 8) {
Button("AC") {}
.keyboardShortcut("c", app: app)
.hexpand()
.destructive()
Button("") {}
.hexpand()
.flat()
Button("%") {}
.keyboardShortcut("percent", app: app)
.hexpand()
Button("/") {}
.keyboardShortcut("slash", app: app)
.hexpand()
}
.vexpand()
HStack(spacing: 8) {
Button("7") {}
.keyboardShortcut("7", app: app)
.hexpand()
Button("8") {}
.keyboardShortcut("8", app: app)
.hexpand()
Button("9") {}
.keyboardShortcut("9", app: app)
.hexpand()
Button("*") {}
.keyboardShortcut("asterisk", app: app)
.hexpand()
}
.vexpand()
HStack(spacing: 8) {
Button("4") {}
.keyboardShortcut("4", app: app)
.hexpand()
Button("5") {}
.keyboardShortcut("5", app: app)
.hexpand()
Button("6") {}
.keyboardShortcut("6", app: app)
.hexpand()
Button("-") {}
.keyboardShortcut("minus", app: app)
.hexpand()
}
.vexpand()
HStack(spacing: 8) {
Button("1") {}
.keyboardShortcut("1", app: app)
.hexpand()
Button("2") {}
.keyboardShortcut("2", app: app)
.hexpand()
Button("3") {}
.keyboardShortcut("3", app: app)
.hexpand()
Button("+") {}
.keyboardShortcut("plus", app: app)
.hexpand()
}
.vexpand()
HStack(spacing: 8) {
Button("0") {}
.keyboardShortcut("0", app: app)
.hexpand()
Button("") {}
.hexpand()
.flat()
Button(",") {}
.keyboardShortcut("comma", app: app)
.hexpand()
Button("=") {}
.keyboardShortcut("equal", app: app)
.hexpand()
}
.vexpand()
}
}
.padding()
.topToolbar {
ToolbarView(app: app, window: window)
}
}
}
}