40 lines
833 B
Swift
40 lines
833 B
Swift
//
|
|
// AnyView+Overflow.swift
|
|
// Luminate
|
|
//
|
|
// Created by Brendan Szymanski on 6/8/26.
|
|
//
|
|
|
|
import Adwaita
|
|
import CAdw
|
|
|
|
/// The overflow behavior for a widget.
|
|
public enum Overflow: Int {
|
|
|
|
/// Content is not clipped.
|
|
case visible
|
|
/// Content is clipped to the widget's bounds.
|
|
case hidden
|
|
|
|
/// Get the GtkOverflow value.
|
|
public var cValue: GtkOverflow {
|
|
switch self {
|
|
case .visible:
|
|
CAdw.GTK_OVERFLOW_VISIBLE
|
|
case .hidden:
|
|
CAdw.GTK_OVERFLOW_HIDDEN
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
extension AnyView {
|
|
|
|
/// Set the overflow behavior of the widget.
|
|
public func overflow(_ overflow: Overflow) -> AnyView {
|
|
wrapModifier(properties: [overflow]) { storage in
|
|
gtk_widget_set_overflow(storage.opaquePointer?.cast(), overflow.cValue)
|
|
}
|
|
}
|
|
|
|
}
|