Fix static widget modifiers not always generated

This commit is contained in:
david-swift 2024-02-04 21:12:55 +01:00
parent 8d05d22dc6
commit 4ed780bcfc
42 changed files with 169 additions and 37 deletions

View File

@ -277,3 +277,15 @@ Whether an embedded underline in the title indicates a mnemonic.
### `activated(_:)`
This signal is emitted after the row has been activated.
### `suffix(_:)`
Set the body for "suffix".
- Parameter body: The body.
- Returns: The widget.
### `prefix(_:)`
Set the body for "prefix".
- Parameter body: The body.
- Returns: The widget.

View File

@ -176,3 +176,15 @@ See [property@EntryRow:show-apply-button].
### `entryActivated(_:)`
Emitted when the embedded entry is activated.
### `suffix(_:)`
Set the body for "suffix".
- Parameter body: The body.
- Returns: The widget.
### `prefix(_:)`
Set the body for "prefix".
- Parameter body: The body.
- Returns: The widget.

View File

@ -298,3 +298,15 @@ See [signal@Gtk.SpinButton::wrapped].
### `activated(_:)`
This signal is emitted after the row has been activated.
### `suffix(_:)`
Set the body for "suffix".
- Parameter body: The body.
- Returns: The widget.
### `prefix(_:)`
Set the body for "prefix".
- Parameter body: The body.
- Returns: The widget.

View File

@ -216,3 +216,15 @@ Whether an embedded underline in the title indicates a mnemonic.
### `activated(_:)`
This signal is emitted after the row has been activated.
### `suffix(_:)`
Set the body for "suffix".
- Parameter body: The body.
- Returns: The widget.
### `prefix(_:)`
Set the body for "prefix".
- Parameter body: The body.
- Returns: The widget.

View File

@ -2,7 +2,7 @@
// ActionRow.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// Avatar.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// Banner.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// Bin.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// Box.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// Button.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// ButtonContent.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// Carousel.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// CenterBox.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// CheckButton.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// Clamp.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// ComboRow.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw
@ -378,4 +378,20 @@ public struct ComboRow: Widget {
return newSelf
}
/// Set the body for "suffix".
/// - Parameter body: The body.
/// - Returns: The widget.
public func suffix(@ViewBuilder _ body: @escaping () -> Body) -> Self {
var newSelf = self
newSelf.suffix = body
return newSelf
}
/// Set the body for "prefix".
/// - Parameter body: The body.
/// - Returns: The widget.
public func prefix(@ViewBuilder _ body: @escaping () -> Body) -> Self {
var newSelf = self
newSelf.prefix = body
return newSelf
}
}

View File

@ -2,7 +2,7 @@
// EntryRow.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// ExpanderRow.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// HeaderBar.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// Label.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// LevelBar.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// LinkButton.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// ListBox.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// Menu.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// Overlay.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// OverlaySplitView.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// PasswordEntryRow.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw
@ -246,4 +246,20 @@ public struct PasswordEntryRow: Widget {
return newSelf
}
/// Set the body for "suffix".
/// - Parameter body: The body.
/// - Returns: The widget.
public func suffix(@ViewBuilder _ body: @escaping () -> Body) -> Self {
var newSelf = self
newSelf.suffix = body
return newSelf
}
/// Set the body for "prefix".
/// - Parameter body: The body.
/// - Returns: The widget.
public func prefix(@ViewBuilder _ body: @escaping () -> Body) -> Self {
var newSelf = self
newSelf.prefix = body
return newSelf
}
}

View File

@ -2,7 +2,7 @@
// PreferencesGroup.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// PreferencesPage.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// PreferencesRow.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// ProgressBar.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// ScrolledWindow.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// SpinRow.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw
@ -434,4 +434,20 @@ public struct SpinRow: Widget {
return newSelf
}
/// Set the body for "suffix".
/// - Parameter body: The body.
/// - Returns: The widget.
public func suffix(@ViewBuilder _ body: @escaping () -> Body) -> Self {
var newSelf = self
newSelf.suffix = body
return newSelf
}
/// Set the body for "prefix".
/// - Parameter body: The body.
/// - Returns: The widget.
public func prefix(@ViewBuilder _ body: @escaping () -> Body) -> Self {
var newSelf = self
newSelf.prefix = body
return newSelf
}
}

View File

@ -2,7 +2,7 @@
// Spinner.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// SplitButton.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// StatusPage.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// SwitchRow.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw
@ -307,4 +307,20 @@ public struct SwitchRow: Widget {
return newSelf
}
/// Set the body for "suffix".
/// - Parameter body: The body.
/// - Returns: The widget.
public func suffix(@ViewBuilder _ body: @escaping () -> Body) -> Self {
var newSelf = self
newSelf.suffix = body
return newSelf
}
/// Set the body for "prefix".
/// - Parameter body: The body.
/// - Returns: The widget.
public func prefix(@ViewBuilder _ body: @escaping () -> Body) -> Self {
var newSelf = self
newSelf.prefix = body
return newSelf
}
}

View File

@ -2,7 +2,7 @@
// ToastOverlay.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// ToggleButton.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// ToolbarView.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// WindowTitle.swift
// Adwaita
//
// Created by auto-generation on 29.01.24.
// Created by auto-generation on 04.02.24.
//
import CAdw

View File

@ -290,6 +290,22 @@ extension Class {
for signal in signals(classes: classes) where !config.excludeSignals.contains(signal.name) {
content += signal.generateModifier(config: config, genConfig: genConfig)
}
content += generateWidgetModifiers(config: config, configs: configs, classes: classes)
return content
}
/// Generate the modifiers for static widgets.
/// - Parameters:
/// - config: The widget configuration.
/// - configs: The available widget configurations.
/// - classes: The available classes.
/// - Returns: The code.
func generateWidgetModifiers(
config: WidgetConfiguration,
configs: [WidgetConfiguration],
classes: [Class]
) -> String {
var content = ""
for widget in config.staticWidgets {
content += """
@ -303,6 +319,10 @@ extension Class {
}
"""
}
if let parent = parentClass(classes: classes), let config = configs.first(where: { $0.class == parent.name }) {
print("Parent: \(parent.name), Self: \(self.name)")
content += parent.generateWidgetModifiers(config: config, configs: configs, classes: classes)
}
return content
}
}