106 lines
No EOL
4.5 KiB
Swift
106 lines
No EOL
4.5 KiB
Swift
import Adw
|
|
|
|
extension WidgetView where Target: Adw.SplitButton {
|
|
/// Applies the `.suggested-action` style class.
|
|
///
|
|
/// Accent colors; denotes the important/affirmative action. Keeps its raised appearance inside a toolbar.
|
|
///
|
|
/// - Parameter enabled: Whether the style class is applied.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func suggestedAction(_ enabled: Bool = true) -> Self {
|
|
styleClass("suggested-action", enabled)
|
|
}
|
|
|
|
/// Applies the `.suggested-action` style class.
|
|
///
|
|
/// Accent colors; denotes the important/affirmative action. Keeps its raised appearance inside a toolbar.
|
|
///
|
|
/// - Parameter enabled: A binding that controls whether the class is applied.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func suggestedAction(_ enabled: Binding<Bool>) -> Self {
|
|
styleClass("suggested-action", enabled)
|
|
}
|
|
|
|
/// Applies the `.destructive-action` style class.
|
|
///
|
|
/// Destructive colors, warning the user about damaging consequences. Combines with ``flat``. Keeps its default appearance inside a toolbar.
|
|
///
|
|
/// - Parameter enabled: Whether the style class is applied.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func destructiveAction(_ enabled: Bool = true) -> Self {
|
|
styleClass("destructive-action", enabled)
|
|
}
|
|
|
|
/// Applies the `.destructive-action` style class.
|
|
///
|
|
/// Destructive colors, warning the user about damaging consequences. Combines with ``flat``. Keeps its default appearance inside a toolbar.
|
|
///
|
|
/// - Parameter enabled: A binding that controls whether the class is applied.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func destructiveAction(_ enabled: Binding<Bool>) -> Self {
|
|
styleClass("destructive-action", enabled)
|
|
}
|
|
|
|
/// Applies the `.flat` style class.
|
|
///
|
|
/// Flat appearance, looking like a label or icon until hovered. Split buttons inside toolbars are flat by default.
|
|
///
|
|
/// - Parameter enabled: Whether the style class is applied.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func flat(_ enabled: Bool = true) -> Self {
|
|
styleClass("flat", enabled)
|
|
}
|
|
|
|
/// Applies the `.flat` style class.
|
|
///
|
|
/// Flat appearance, looking like a label or icon until hovered. Split buttons inside toolbars are flat by default.
|
|
///
|
|
/// - Parameter enabled: A binding that controls whether the class is applied.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func flat(_ enabled: Binding<Bool>) -> Self {
|
|
styleClass("flat", enabled)
|
|
}
|
|
|
|
/// Applies the `.raised` style class.
|
|
///
|
|
/// Regular appearance instead of the flat one; only useful inside toolbars and similar widgets.
|
|
///
|
|
/// - Parameter enabled: Whether the style class is applied.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func raised(_ enabled: Bool = true) -> Self {
|
|
styleClass("raised", enabled)
|
|
}
|
|
|
|
/// Applies the `.raised` style class.
|
|
///
|
|
/// Regular appearance instead of the flat one; only useful inside toolbars and similar widgets.
|
|
///
|
|
/// - Parameter enabled: A binding that controls whether the class is applied.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func raised(_ enabled: Binding<Bool>) -> Self {
|
|
styleClass("raised", enabled)
|
|
}
|
|
|
|
/// Applies the `.opaque` style class.
|
|
///
|
|
/// Opaque background intended to be paired with custom `background-color`/`color` overrides.
|
|
///
|
|
/// - Parameter enabled: Whether the style class is applied.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
@available(*, deprecated, message: "Deprecated since libadwaita 1.6. Use suggestedAction() and override the accent color instead.")
|
|
public func opaque(_ enabled: Bool = true) -> Self {
|
|
styleClass("opaque", enabled)
|
|
}
|
|
|
|
/// Applies the `.opaque` style class.
|
|
///
|
|
/// Opaque background intended to be paired with custom `background-color`/`color` overrides.
|
|
///
|
|
/// - Parameter enabled: A binding that controls whether the class is applied.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
@available(*, deprecated, message: "Deprecated since libadwaita 1.6. Use suggestedAction() and override the accent color instead.")
|
|
public func opaque(_ enabled: Binding<Bool>) -> Self {
|
|
styleClass("opaque", enabled)
|
|
}
|
|
|
|
} |