93 lines
2.9 KiB
Swift
93 lines
2.9 KiB
Swift
//
|
|
// Separator.swift
|
|
// Adwaita
|
|
//
|
|
// Created by auto-generation on 03.08.24.
|
|
//
|
|
|
|
import CAdw
|
|
import LevenshteinTransformations
|
|
|
|
/// `GtkSeparator` is a horizontal or vertical separator widget.
|
|
///
|
|
/// 
|
|
///
|
|
/// A `GtkSeparator` can be used to group the widgets within a window.
|
|
/// It displays a line with a shadow to make it appear sunken into the
|
|
/// interface.
|
|
///
|
|
/// # CSS nodes
|
|
///
|
|
/// `GtkSeparator` has a single CSS node with name separator. The node
|
|
/// gets one of the .horizontal or .vertical style classes.
|
|
///
|
|
/// # Accessibility
|
|
///
|
|
/// `GtkSeparator` uses the %GTK_ACCESSIBLE_ROLE_SEPARATOR role.
|
|
public struct Separator: AdwaitaWidget {
|
|
|
|
/// Additional update functions for type extensions.
|
|
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
|
/// Additional appear functions for type extensions.
|
|
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
|
|
|
/// The accessible role of the given `GtkAccessible` implementation.
|
|
///
|
|
/// The accessible role cannot be changed once set.
|
|
var accessibleRole: String?
|
|
/// The application.
|
|
var app: AdwaitaApp?
|
|
/// The window.
|
|
var window: AdwaitaWindow?
|
|
|
|
/// Initialize `Separator`.
|
|
public init() {
|
|
}
|
|
|
|
/// The view storage.
|
|
/// - Parameters:
|
|
/// - modifiers: Modify views before being updated.
|
|
/// - type: The type of the app storage.
|
|
/// - Returns: The view storage.
|
|
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
|
let storage = ViewStorage(gtk_separator_new(GTK_ORIENTATION_VERTICAL)?.opaque())
|
|
for function in appearFunctions {
|
|
function(storage, modifiers)
|
|
}
|
|
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
|
|
|
return storage
|
|
}
|
|
|
|
/// Update the stored content.
|
|
/// - Parameters:
|
|
/// - storage: The storage to update.
|
|
/// - modifiers: Modify views before being updated
|
|
/// - updateProperties: Whether to update the view's properties.
|
|
/// - type: The type of the app storage.
|
|
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
|
storage.modify { widget in
|
|
|
|
|
|
|
|
}
|
|
for function in updateFunctions {
|
|
function(storage, modifiers, updateProperties)
|
|
}
|
|
if updateProperties {
|
|
storage.previousState = self
|
|
}
|
|
}
|
|
|
|
/// 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
|
|
}
|
|
|
|
}
|