89 lines
2.7 KiB
Swift

//
// Separator.swift
// Adwaita
//
// Created by auto-generation on 15.08.24.
//
import CAdw
import LevenshteinTransformations
/// `GtkSeparator` is a horizontal or vertical separator widget.
///
/// ![An example GtkSeparator](separator.png)
///
/// 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, WidgetData, Bool) -> Void] = []
/// 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?
/// Initialize `Separator`.
public init() {
}
/// The view storage.
/// - Parameters:
/// - modifiers: Modify views before being updated.
/// - 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_separator_new(GTK_ORIENTATION_VERTICAL)?.opaque())
for function in appearFunctions {
function(storage, data)
}
update(storage, data: data, 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 view render data type.
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
storage.modify { widget in
}
for function in updateFunctions {
function(storage, data, 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
}
}