Replace GtkSpinner with AdwSpinner
This commit is contained in:
parent
ced07e4293
commit
356eec00a9
@ -2,7 +2,7 @@
|
||||
// ActionRow.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// AspectFrame.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Avatar.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Banner.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Bin.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Box.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Button.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// ButtonContent.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Carousel.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// CenterBox.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// CheckButton.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Clamp.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// ComboRow.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// EntryRow.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// ExpanderRow.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Fixed.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// FlowBox.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// HeaderBar.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Label.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// LevelBar.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// LinkButton.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// ListBox.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Menu.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// NavigationView.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Overlay.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// OverlaySplitView.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// PasswordEntryRow.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Picture.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Popover.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// PreferencesGroup.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// PreferencesPage.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// PreferencesRow.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// ProgressBar.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// ScrolledWindow.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// SearchBar.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// SearchEntry.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Separator.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// SpinRow.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,27 +2,36 @@
|
||||
// Spinner.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
import LevenshteinTransformations
|
||||
|
||||
/// A `GtkSpinner` widget displays an icon-size spinning animation.
|
||||
/// A widget showing a loading spinner.
|
||||
///
|
||||
/// It is often used as an alternative to a [class@Gtk.ProgressBar]
|
||||
/// for displaying indefinite activity, instead of actual progress.
|
||||
/// <picture><source srcset="spinner-dark.png" media="(prefers-color-scheme: dark)"><img src="spinner.png" alt="spinner"></picture>
|
||||
///
|
||||
/// 
|
||||
/// The size of the spinner depends on the available size, never smaller than
|
||||
/// 16×16 pixels and never larger than 64×64 pixels.
|
||||
///
|
||||
/// To start the animation, use [method@Gtk.Spinner.start], to stop it
|
||||
/// use [method@Gtk.Spinner.stop].
|
||||
/// Use the [property@Gtk.Widget:halign] and [property@Gtk.Widget:valign]
|
||||
/// properties in combination with [property@Gtk.Widget:width-request] and
|
||||
/// [property@Gtk.Widget:height-request] for fine sizing control.
|
||||
///
|
||||
/// # CSS nodes
|
||||
/// For example, the following snippet shows the spinner at 48×48 pixels:
|
||||
///
|
||||
/// `GtkSpinner` has a single CSS node with the name spinner.
|
||||
/// When the animation is active, the :checked pseudoclass is
|
||||
/// added to this node.
|
||||
/// ```xml
|
||||
/// <object class="AdwSpinner"><property name="halign">center</property><property name="valign">center</property><property name="width-request">48</property><property name="height-request">48</property></object>
|
||||
/// ```
|
||||
///
|
||||
/// See [class@SpinnerPaintable] for cases where using a widget is impractical or
|
||||
/// impossible, such as [property@StatusPage:paintable].
|
||||
///
|
||||
/// ## CSS nodes
|
||||
///
|
||||
/// `AdwSpinner` has a single node with the name `image` and the style class
|
||||
/// `.spinner`.
|
||||
public struct Spinner: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
@ -30,12 +39,6 @@ public struct Spinner: AdwaitaWidget {
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The accessible role of the given `GtkAccessible` implementation.
|
||||
///
|
||||
/// The accessible role cannot be changed once set.
|
||||
var accessibleRole: String?
|
||||
/// Whether the spinner is spinning
|
||||
var spinning: Bool?
|
||||
|
||||
/// Initialize `Spinner`.
|
||||
public init() {
|
||||
@ -47,7 +50,7 @@ public struct Spinner: AdwaitaWidget {
|
||||
/// - type: The view render data type.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(gtk_spinner_new()?.opaque())
|
||||
let storage = ViewStorage(adw_spinner_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, data)
|
||||
}
|
||||
@ -65,9 +68,6 @@ public struct Spinner: AdwaitaWidget {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
if let spinning, updateProperties, (storage.previousState as? Self)?.spinning != spinning {
|
||||
gtk_spinner_set_spinning(widget, spinning.cBool)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -79,20 +79,4 @@ public struct Spinner: AdwaitaWidget {
|
||||
}
|
||||
}
|
||||
|
||||
/// The accessible role of the given `GtkAccessible` implementation.
|
||||
///
|
||||
/// The accessible role cannot be changed once set.
|
||||
public func accessibleRole(_ accessibleRole: String?) -> Self {
|
||||
var newSelf = self
|
||||
newSelf.accessibleRole = accessibleRole
|
||||
return newSelf
|
||||
}
|
||||
|
||||
/// Whether the spinner is spinning
|
||||
public func spinning(_ spinning: Bool? = true) -> Self {
|
||||
var newSelf = self
|
||||
newSelf.spinning = spinning
|
||||
return newSelf
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// SplitButton.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// StatusPage.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// SwitchRow.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// ToastOverlay.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// ToggleButton.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// ToolbarView.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// WindowTitle.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 22.10.24.
|
||||
// Created by auto-generation on 26.10.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
// swiftlint:disable missing_docs implicitly_unwrapped_optional no_magic_numbers
|
||||
|
||||
import Adwaita
|
||||
import CAdw
|
||||
import Foundation
|
||||
|
||||
@main
|
||||
@ -72,6 +73,7 @@ struct Demo: App {
|
||||
@State private var sidebarVisible = true
|
||||
@State private var width = 650
|
||||
@State private var height = 550
|
||||
@State private var wide = true
|
||||
@State private var maximized = false
|
||||
@State private var about = false
|
||||
var window: AdwaitaWindow
|
||||
@ -125,6 +127,8 @@ struct Demo: App {
|
||||
}
|
||||
.toast("This is a toast!", signal: toast)
|
||||
}
|
||||
.collapsed(!wide)
|
||||
.breakpoint(minWidth: 550, matches: $wide)
|
||||
.aboutDialog(
|
||||
visible: $about,
|
||||
app: "Demo",
|
||||
|
||||
@ -154,7 +154,8 @@ struct GenerationConfiguration {
|
||||
.init(
|
||||
class: "NavigationView",
|
||||
excludeProperties: ["navigation-stack", "visible-page"]
|
||||
)
|
||||
),
|
||||
.init(class: "Spinner")
|
||||
]
|
||||
|
||||
/// The Gtk widgets.
|
||||
@ -185,7 +186,6 @@ struct GenerationConfiguration {
|
||||
excludeProperties: ["baseline-position", "orientation"],
|
||||
cast: true
|
||||
),
|
||||
.init(class: "Spinner"),
|
||||
.init(class: "LevelBar", excludeProperties: ["mode", "orientation"]),
|
||||
.init(
|
||||
class: "ListBox",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user