Add Adwaita style class view modifiers
This commit is contained in:
parent
c35d039634
commit
4f31f74a7d
29 changed files with 2485 additions and 8 deletions
|
|
@ -23,7 +23,7 @@ struct ExampleApp: App {
|
|||
.onPageChanged { page in currentPage = page }
|
||||
|
||||
Label("Page \(currentPage + 1) of 3")
|
||||
.cssClass("dim-label")
|
||||
.dimmed()
|
||||
.halign(.center)
|
||||
.margin(8)
|
||||
}
|
||||
|
|
@ -37,12 +37,12 @@ struct ExampleApp: App {
|
|||
StatusPage {
|
||||
VStack(spacing: 6) {
|
||||
Label("Declarative GTK apps in Swift")
|
||||
.cssClass("title-3")
|
||||
.title3()
|
||||
.marginTop(16)
|
||||
Label("A familiar SwiftUI-like API, zero GObject boilerplate")
|
||||
.marginBottom(16)
|
||||
}
|
||||
.cssClass("card")
|
||||
.card()
|
||||
}
|
||||
.title("Welcome to Portico")
|
||||
.description("Swipe to explore")
|
||||
|
|
@ -57,11 +57,11 @@ struct ExampleApp: App {
|
|||
StatusPage {
|
||||
HStack(spacing: 12) {
|
||||
Button("-") { count -= 1 }
|
||||
.cssClass("circular")
|
||||
.circular()
|
||||
Label("Count: \(count)")
|
||||
.cssClass("title-1")
|
||||
.title1()
|
||||
Button("+") { count += 1 }
|
||||
.cssClass("circular")
|
||||
.circular()
|
||||
}
|
||||
.halign(.center)
|
||||
}
|
||||
|
|
@ -78,7 +78,7 @@ struct ExampleApp: App {
|
|||
StatusPage {
|
||||
VStack(spacing: 12) {
|
||||
Label("Name: \(name), Dark mode: \(darkMode), Volume: \(volume)")
|
||||
.cssClass("title-2")
|
||||
.title2()
|
||||
ListBox {
|
||||
EntryRow()
|
||||
.title("Your Name")
|
||||
|
|
@ -90,7 +90,7 @@ struct ExampleApp: App {
|
|||
.title("Volume")
|
||||
.value($volume)
|
||||
}
|
||||
.cssClass("boxed-list")
|
||||
.boxedList()
|
||||
}
|
||||
}
|
||||
.title("Quick Settings")
|
||||
|
|
|
|||
24
Sources/Portico/Extensions/ActionRow+Extras.swift
Normal file
24
Sources/Portico/Extensions/ActionRow+Extras.swift
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import Adw
|
||||
|
||||
extension WidgetView where Target: Adw.ActionRow {
|
||||
/// Applies the `.property` style class.
|
||||
///
|
||||
/// De-emphasizes the row title and emphasizes the subtitle, for read-only properties; typically paired with a selectable subtitle. Since libadwaita 1.4.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func property(_ enabled: Bool = true) -> Self {
|
||||
styleClass("property", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.property` style class.
|
||||
///
|
||||
/// De-emphasizes the row title and emphasizes the subtitle, for read-only properties; typically paired with a selectable subtitle. Since libadwaita 1.4.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func property(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("property", enabled)
|
||||
}
|
||||
|
||||
}
|
||||
176
Sources/Portico/Extensions/Box+Extras.swift
Normal file
176
Sources/Portico/Extensions/Box+Extras.swift
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
import Gtk
|
||||
|
||||
extension WidgetView where Target: Gtk.Box {
|
||||
/// Applies the `.linked` style class.
|
||||
///
|
||||
/// Children appear as a single group; the box must have no spacing. Works horizontally and vertically.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func linked(_ enabled: Bool = true) -> Self {
|
||||
styleClass("linked", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.linked` style class.
|
||||
///
|
||||
/// Children appear as a single group; the box must have no spacing. Works horizontally and vertically.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func linked(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("linked", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.toolbar` style class.
|
||||
///
|
||||
/// Horizontal box only; same appearance Adw.HeaderBar and similar widgets use automatically. Adds 6px margins and spacing; pair with ``spacer`` to separate groups. Combine with ``osd`` for a floating toolbar.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func toolbar(_ enabled: Bool = true) -> Self {
|
||||
styleClass("toolbar", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.toolbar` style class.
|
||||
///
|
||||
/// Horizontal box only; same appearance Adw.HeaderBar and similar widgets use automatically. Adds 6px margins and spacing; pair with ``spacer`` to separate groups. Combine with ``osd`` for a floating toolbar.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func toolbar(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("toolbar", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.app-notification` style class.
|
||||
///
|
||||
/// Gives the box osd appearance with rounded bottom corners; historically combined with Gtk.Overlay and Gtk.Revealer for in-app notifications.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
@available(*, deprecated, message: "Deprecated by libadwaita. Use Adw.ToastOverlay instead.")
|
||||
public func appNotification(_ enabled: Bool = true) -> Self {
|
||||
styleClass("app-notification", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.app-notification` style class.
|
||||
///
|
||||
/// Gives the box osd appearance with rounded bottom corners; historically combined with Gtk.Overlay and Gtk.Revealer for in-app notifications.
|
||||
///
|
||||
/// - 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 by libadwaita. Use Adw.ToastOverlay instead.")
|
||||
public func appNotification(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("app-notification", enabled)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public extension HStack {
|
||||
/// Applies the `.linked` style class.
|
||||
///
|
||||
/// Children appear as a single group; the box must have no spacing. Works horizontally and vertically.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
func linked(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("linked", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.linked` style class.
|
||||
///
|
||||
/// Children appear as a single group; the box must have no spacing. Works horizontally and vertically.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
func linked(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("linked", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.toolbar` style class.
|
||||
///
|
||||
/// Horizontal box only; same appearance Adw.HeaderBar and similar widgets use automatically. Adds 6px margins and spacing; pair with ``spacer`` to separate groups. Combine with ``osd`` for a floating toolbar.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
func toolbar(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("toolbar", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.toolbar` style class.
|
||||
///
|
||||
/// Horizontal box only; same appearance Adw.HeaderBar and similar widgets use automatically. Adds 6px margins and spacing; pair with ``spacer`` to separate groups. Combine with ``osd`` for a floating toolbar.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
func toolbar(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("toolbar", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.app-notification` style class.
|
||||
///
|
||||
/// Gives the box osd appearance with rounded bottom corners; historically combined with Gtk.Overlay and Gtk.Revealer for in-app notifications.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
@available(*, deprecated, message: "Deprecated by libadwaita. Use Adw.ToastOverlay instead.")
|
||||
func appNotification(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("app-notification", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.app-notification` style class.
|
||||
///
|
||||
/// Gives the box osd appearance with rounded bottom corners; historically combined with Gtk.Overlay and Gtk.Revealer for in-app notifications.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
@available(*, deprecated, message: "Deprecated by libadwaita. Use Adw.ToastOverlay instead.")
|
||||
func appNotification(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("app-notification", enabled)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public extension VStack {
|
||||
/// Applies the `.linked` style class.
|
||||
///
|
||||
/// Children appear as a single group; the box must have no spacing. Works horizontally and vertically.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
func linked(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("linked", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.linked` style class.
|
||||
///
|
||||
/// Children appear as a single group; the box must have no spacing. Works horizontally and vertically.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
func linked(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("linked", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.app-notification` style class.
|
||||
///
|
||||
/// Gives the box osd appearance with rounded bottom corners; historically combined with Gtk.Overlay and Gtk.Revealer for in-app notifications.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
@available(*, deprecated, message: "Deprecated by libadwaita. Use Adw.ToastOverlay instead.")
|
||||
func appNotification(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("app-notification", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.app-notification` style class.
|
||||
///
|
||||
/// Gives the box osd appearance with rounded bottom corners; historically combined with Gtk.Overlay and Gtk.Revealer for in-app notifications.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
@available(*, deprecated, message: "Deprecated by libadwaita. Use Adw.ToastOverlay instead.")
|
||||
func appNotification(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("app-notification", enabled)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -29,3 +29,153 @@ public extension Button {
|
|||
self = self.onClicked(onClick)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Style classes
|
||||
|
||||
import Gtk
|
||||
|
||||
extension WidgetView where Target: Gtk.Button {
|
||||
/// Applies the `.suggested-action` style class.
|
||||
///
|
||||
/// Accent colors; denotes the important/affirmative action. Combines with ``circular`` or ``pill``. Keeps its raised appearance inside a toolbar, and ``linked`` styling does not work correctly with it.
|
||||
///
|
||||
/// - 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. Combines with ``circular`` or ``pill``. Keeps its raised appearance inside a toolbar, and ``linked`` styling does not work correctly with it.
|
||||
///
|
||||
/// - 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``, ``circular`` or ``pill``. 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``, ``circular`` or ``pill``. 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. Buttons inside toolbars and similar widgets are flat by default. Combines with ``circular`` or ``pill``. Equivalent to `hasFrame(false)` on `Gtk.Button` / `Gtk.MenuButton`.
|
||||
///
|
||||
/// - 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. Buttons inside toolbars and similar widgets are flat by default. Combines with ``circular`` or ``pill``. Equivalent to `hasFrame(false)` on `Gtk.Button` / `Gtk.MenuButton`.
|
||||
///
|
||||
/// - 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, where `hasFrame(true)` cannot force a raised look. Combines with ``circular`` or ``pill``.
|
||||
///
|
||||
/// - 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, where `hasFrame(true)` cannot force a raised look. Combines with ``circular`` or ``pill``.
|
||||
///
|
||||
/// - 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 `.circular` style class.
|
||||
///
|
||||
/// Round button, for icons or 1-2 character labels. Combines with ``suggestedAction``, ``destructiveAction``, ``flat``, ``raised``, ``opaque``, or ``osd``.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func circular(_ enabled: Bool = true) -> Self {
|
||||
styleClass("circular", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.circular` style class.
|
||||
///
|
||||
/// Round button, for icons or 1-2 character labels. Combines with ``suggestedAction``, ``destructiveAction``, ``flat``, ``raised``, ``opaque``, or ``osd``.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func circular(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("circular", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.pill` style class.
|
||||
///
|
||||
/// Pill-shaped button for important standalone actions, e.g. inside an `Adw.StatusPage`. Combines with the same set as ``circular``.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func pill(_ enabled: Bool = true) -> Self {
|
||||
styleClass("pill", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.pill` style class.
|
||||
///
|
||||
/// Pill-shaped button for important standalone actions, e.g. inside an `Adw.StatusPage`. Combines with the same set as ``circular``.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func pill(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("pill", 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)
|
||||
}
|
||||
|
||||
}
|
||||
44
Sources/Portico/Extensions/ButtonRow+Extras.swift
Normal file
44
Sources/Portico/Extensions/ButtonRow+Extras.swift
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import Adw
|
||||
|
||||
extension WidgetView where Target: Adw.ButtonRow {
|
||||
/// Applies the `.suggested-action` style class.
|
||||
///
|
||||
/// Accent colors; denotes the important/affirmative action.
|
||||
///
|
||||
/// - 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.
|
||||
///
|
||||
/// - 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.
|
||||
///
|
||||
/// - 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.
|
||||
///
|
||||
/// - 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)
|
||||
}
|
||||
|
||||
}
|
||||
24
Sources/Portico/Extensions/CheckButton+Extras.swift
Normal file
24
Sources/Portico/Extensions/CheckButton+Extras.swift
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import Gtk
|
||||
|
||||
extension WidgetView where Target: Gtk.CheckButton {
|
||||
/// Applies the `.selection-mode` style class.
|
||||
///
|
||||
/// Larger, round check button, for selecting items from a list or grid.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func selectionMode(_ enabled: Bool = true) -> Self {
|
||||
styleClass("selection-mode", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.selection-mode` style class.
|
||||
///
|
||||
/// Larger, round check button, for selecting items from a list or grid.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func selectionMode(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("selection-mode", enabled)
|
||||
}
|
||||
|
||||
}
|
||||
24
Sources/Portico/Extensions/ExpanderRow+Extras.swift
Normal file
24
Sources/Portico/Extensions/ExpanderRow+Extras.swift
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import Adw
|
||||
|
||||
extension WidgetView where Target: Adw.ExpanderRow {
|
||||
/// Applies the `.property` style class.
|
||||
///
|
||||
/// De-emphasizes the row title and emphasizes the subtitle, for read-only properties; typically paired with a selectable subtitle. Since libadwaita 1.4.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func property(_ enabled: Bool = true) -> Self {
|
||||
styleClass("property", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.property` style class.
|
||||
///
|
||||
/// De-emphasizes the row title and emphasizes the subtitle, for read-only properties; typically paired with a selectable subtitle. Since libadwaita 1.4.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func property(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("property", enabled)
|
||||
}
|
||||
|
||||
}
|
||||
24
Sources/Portico/Extensions/FlowBox+Extras.swift
Normal file
24
Sources/Portico/Extensions/FlowBox+Extras.swift
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import Gtk
|
||||
|
||||
extension WidgetView where Target: Gtk.FlowBox {
|
||||
/// Applies the `.navigation-sidebar` style class.
|
||||
///
|
||||
/// Sidebar look: rounded padded items, neutral (not accent) selection color, no default list background.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func navigationSidebar(_ enabled: Bool = true) -> Self {
|
||||
styleClass("navigation-sidebar", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.navigation-sidebar` style class.
|
||||
///
|
||||
/// Sidebar look: rounded padded items, neutral (not accent) selection color, no default list background.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func navigationSidebar(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("navigation-sidebar", enabled)
|
||||
}
|
||||
|
||||
}
|
||||
24
Sources/Portico/Extensions/GridView+Extras.swift
Normal file
24
Sources/Portico/Extensions/GridView+Extras.swift
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import Gtk
|
||||
|
||||
extension WidgetView where Target: Gtk.GridView {
|
||||
/// Applies the `.navigation-sidebar` style class.
|
||||
///
|
||||
/// Sidebar look: rounded padded items, neutral (not accent) selection color, no default list background.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func navigationSidebar(_ enabled: Bool = true) -> Self {
|
||||
styleClass("navigation-sidebar", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.navigation-sidebar` style class.
|
||||
///
|
||||
/// Sidebar look: rounded padded items, neutral (not accent) selection color, no default list background.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func navigationSidebar(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("navigation-sidebar", enabled)
|
||||
}
|
||||
|
||||
}
|
||||
50
Sources/Portico/Extensions/HeaderBar+Extras.swift
Normal file
50
Sources/Portico/Extensions/HeaderBar+Extras.swift
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import Adw
|
||||
import Gtk
|
||||
|
||||
extension WidgetView where Target: Adw.HeaderBar {
|
||||
/// Applies the `.flat` style class.
|
||||
///
|
||||
/// Flat appearance for the header bar.
|
||||
///
|
||||
/// - 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.4. Use Adw.ToolbarView instead.")
|
||||
public func flat(_ enabled: Bool = true) -> Self {
|
||||
styleClass("flat", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.flat` style class.
|
||||
///
|
||||
/// Flat appearance for the header bar.
|
||||
///
|
||||
/// - 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.4. Use Adw.ToolbarView instead.")
|
||||
public func flat(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("flat", enabled)
|
||||
}
|
||||
}
|
||||
|
||||
extension WidgetView where Target: Gtk.HeaderBar {
|
||||
/// Applies the `.flat` style class.
|
||||
///
|
||||
/// Flat appearance for the header bar.
|
||||
///
|
||||
/// - 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.4. Use Adw.ToolbarView instead.")
|
||||
public func flat(_ enabled: Bool = true) -> Self {
|
||||
styleClass("flat", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.flat` style class.
|
||||
///
|
||||
/// Flat appearance for the header bar.
|
||||
///
|
||||
/// - 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.4. Use Adw.ToolbarView instead.")
|
||||
public func flat(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("flat", enabled)
|
||||
}
|
||||
}
|
||||
44
Sources/Portico/Extensions/Image+Extras.swift
Normal file
44
Sources/Portico/Extensions/Image+Extras.swift
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import Gtk
|
||||
|
||||
extension WidgetView where Target: Gtk.Image {
|
||||
/// Applies the `.icon-dropshadow` style class.
|
||||
///
|
||||
/// Shadow that keeps GNOME app icons legible on light backgrounds; use for icons larger than 32x32.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func iconDropshadow(_ enabled: Bool = true) -> Self {
|
||||
styleClass("icon-dropshadow", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.icon-dropshadow` style class.
|
||||
///
|
||||
/// Shadow that keeps GNOME app icons legible on light backgrounds; use for icons larger than 32x32.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func iconDropshadow(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("icon-dropshadow", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.lowres-icon` style class.
|
||||
///
|
||||
/// Shadow that keeps GNOME app icons legible; use for icons 32x32 and smaller.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func lowresIcon(_ enabled: Bool = true) -> Self {
|
||||
styleClass("lowres-icon", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.lowres-icon` style class.
|
||||
///
|
||||
/// Shadow that keeps GNOME app icons legible; use for icons 32x32 and smaller.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func lowresIcon(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("lowres-icon", enabled)
|
||||
}
|
||||
|
||||
}
|
||||
44
Sources/Portico/Extensions/InlineViewSwitcher+Extras.swift
Normal file
44
Sources/Portico/Extensions/InlineViewSwitcher+Extras.swift
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import Adw
|
||||
|
||||
extension WidgetView where Target: Adw.InlineViewSwitcher {
|
||||
/// Applies the `.flat` style class.
|
||||
///
|
||||
/// Makes the group look like a series of flat buttons. Combines with ``round``.
|
||||
///
|
||||
/// - 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.
|
||||
///
|
||||
/// Makes the group look like a series of flat buttons. Combines with ``round``.
|
||||
///
|
||||
/// - 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 `.round` style class.
|
||||
///
|
||||
/// Rounds the group and the toggles inside it. Combines with ``flat``.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func round(_ enabled: Bool = true) -> Self {
|
||||
styleClass("round", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.round` style class.
|
||||
///
|
||||
/// Rounds the group and the toggles inside it. Combines with ``flat``.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func round(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("round", enabled)
|
||||
}
|
||||
|
||||
}
|
||||
86
Sources/Portico/Extensions/ListBox+Extras.swift
Normal file
86
Sources/Portico/Extensions/ListBox+Extras.swift
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
import Gtk
|
||||
|
||||
extension WidgetView where Target: Gtk.ListBox {
|
||||
/// Applies the `.boxed-list` style class.
|
||||
///
|
||||
/// Boxed-list appearance; the list box should have `selectionMode(.none)`.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func boxedList(_ enabled: Bool = true) -> Self {
|
||||
styleClass("boxed-list", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.boxed-list` style class.
|
||||
///
|
||||
/// Boxed-list appearance; the list box should have `selectionMode(.none)`.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func boxedList(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("boxed-list", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.boxed-list-separate` style class.
|
||||
///
|
||||
/// Like ``boxedList`` but each row is a separate card instead of one card with separators; also expects `selectionMode(.none)`.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func boxedListSeparate(_ enabled: Bool = true) -> Self {
|
||||
styleClass("boxed-list-separate", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.boxed-list-separate` style class.
|
||||
///
|
||||
/// Like ``boxedList`` but each row is a separate card instead of one card with separators; also expects `selectionMode(.none)`.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func boxedListSeparate(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("boxed-list-separate", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.navigation-sidebar` style class.
|
||||
///
|
||||
/// Sidebar look: rounded padded items, neutral (not accent) selection color, no default list background. Available on `Gtk.ListBox`, `Gtk.ListView`, `Gtk.FlowBox` and `Gtk.GridView`.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func navigationSidebar(_ enabled: Bool = true) -> Self {
|
||||
styleClass("navigation-sidebar", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.navigation-sidebar` style class.
|
||||
///
|
||||
/// Sidebar look: rounded padded items, neutral (not accent) selection color, no default list background. Available on `Gtk.ListBox`, `Gtk.ListView`, `Gtk.FlowBox` and `Gtk.GridView`.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func navigationSidebar(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("navigation-sidebar", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.content` style class.
|
||||
///
|
||||
/// Deprecated version of ``boxedList``.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
@available(*, deprecated, message: "Deprecated by libadwaita. Use boxedList() instead.")
|
||||
public func content(_ enabled: Bool = true) -> Self {
|
||||
styleClass("content", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.content` style class.
|
||||
///
|
||||
/// Deprecated version of ``boxedList``.
|
||||
///
|
||||
/// - 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 by libadwaita. Use boxedList() instead.")
|
||||
public func content(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("content", enabled)
|
||||
}
|
||||
|
||||
}
|
||||
24
Sources/Portico/Extensions/ListView+Extras.swift
Normal file
24
Sources/Portico/Extensions/ListView+Extras.swift
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import Gtk
|
||||
|
||||
extension WidgetView where Target: Gtk.ListView {
|
||||
/// Applies the `.navigation-sidebar` style class.
|
||||
///
|
||||
/// Sidebar look: rounded padded items, neutral (not accent) selection color, no default list background.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func navigationSidebar(_ enabled: Bool = true) -> Self {
|
||||
styleClass("navigation-sidebar", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.navigation-sidebar` style class.
|
||||
///
|
||||
/// Sidebar look: rounded padded items, neutral (not accent) selection color, no default list background.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func navigationSidebar(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("navigation-sidebar", enabled)
|
||||
}
|
||||
|
||||
}
|
||||
126
Sources/Portico/Extensions/MenuButton+Extras.swift
Normal file
126
Sources/Portico/Extensions/MenuButton+Extras.swift
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
import Gtk
|
||||
|
||||
extension WidgetView where Target: Gtk.MenuButton {
|
||||
/// Applies the `.suggested-action` style class.
|
||||
///
|
||||
/// Accent colors; denotes the important/affirmative action. Combines with ``circular`` or ``pill``. 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. Combines with ``circular`` or ``pill``. 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``, ``circular`` or ``pill``. 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``, ``circular`` or ``pill``. 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. Menu buttons inside toolbars are flat by default. Combines with ``circular``. Equivalent to `hasFrame(false)` on `Gtk.MenuButton`.
|
||||
///
|
||||
/// - 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. Menu buttons inside toolbars are flat by default. Combines with ``circular``. Equivalent to `hasFrame(false)` on `Gtk.MenuButton`.
|
||||
///
|
||||
/// - 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. Combines with ``circular``.
|
||||
///
|
||||
/// - 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. Combines with ``circular``.
|
||||
///
|
||||
/// - 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 `.circular` style class.
|
||||
///
|
||||
/// Round menu button, for icons. Combines with ``suggestedAction``, ``destructiveAction``, ``flat``, ``raised``, ``opaque``, or ``osd``.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func circular(_ enabled: Bool = true) -> Self {
|
||||
styleClass("circular", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.circular` style class.
|
||||
///
|
||||
/// Round menu button, for icons. Combines with ``suggestedAction``, ``destructiveAction``, ``flat``, ``raised``, ``opaque``, or ``osd``.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func circular(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("circular", 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)
|
||||
}
|
||||
|
||||
}
|
||||
24
Sources/Portico/Extensions/Popover+Extras.swift
Normal file
24
Sources/Portico/Extensions/Popover+Extras.swift
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import Gtk
|
||||
|
||||
extension WidgetView where Target: Gtk.Popover {
|
||||
/// Applies the `.menu` style class.
|
||||
///
|
||||
/// Menu-like appearance for a popover containing a `Gtk.ListBox` or `Gtk.ListView`.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func menu(_ enabled: Bool = true) -> Self {
|
||||
styleClass("menu", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.menu` style class.
|
||||
///
|
||||
/// Menu-like appearance for a popover containing a `Gtk.ListBox` or `Gtk.ListView`.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func menu(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("menu", enabled)
|
||||
}
|
||||
|
||||
}
|
||||
84
Sources/Portico/Extensions/ScrolledWindow+Extras.swift
Normal file
84
Sources/Portico/Extensions/ScrolledWindow+Extras.swift
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
import Gtk
|
||||
|
||||
extension WidgetView where Target: Gtk.ScrolledWindow {
|
||||
/// Applies the `.undershoot-top` style class.
|
||||
///
|
||||
/// Shadow undershoot indicator on the top edge. Since libadwaita 1.4. Most applications should use `Adw.ToolbarView`, which manages undershoots automatically.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func undershootTop(_ enabled: Bool = true) -> Self {
|
||||
styleClass("undershoot-top", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.undershoot-top` style class.
|
||||
///
|
||||
/// Shadow undershoot indicator on the top edge. Since libadwaita 1.4. Most applications should use `Adw.ToolbarView`, which manages undershoots automatically.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func undershootTop(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("undershoot-top", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.undershoot-bottom` style class.
|
||||
///
|
||||
/// Shadow undershoot indicator on the bottom edge. Since libadwaita 1.4.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func undershootBottom(_ enabled: Bool = true) -> Self {
|
||||
styleClass("undershoot-bottom", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.undershoot-bottom` style class.
|
||||
///
|
||||
/// Shadow undershoot indicator on the bottom edge. Since libadwaita 1.4.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func undershootBottom(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("undershoot-bottom", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.undershoot-start` style class.
|
||||
///
|
||||
/// Shadow undershoot indicator on the start edge (follows text direction). Since libadwaita 1.4.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func undershootStart(_ enabled: Bool = true) -> Self {
|
||||
styleClass("undershoot-start", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.undershoot-start` style class.
|
||||
///
|
||||
/// Shadow undershoot indicator on the start edge (follows text direction). Since libadwaita 1.4.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func undershootStart(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("undershoot-start", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.undershoot-end` style class.
|
||||
///
|
||||
/// Shadow undershoot indicator on the end edge (follows text direction). Since libadwaita 1.4.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func undershootEnd(_ enabled: Bool = true) -> Self {
|
||||
styleClass("undershoot-end", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.undershoot-end` style class.
|
||||
///
|
||||
/// Shadow undershoot indicator on the end edge (follows text direction). Since libadwaita 1.4.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func undershootEnd(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("undershoot-end", enabled)
|
||||
}
|
||||
|
||||
}
|
||||
24
Sources/Portico/Extensions/SearchBar+Extras.swift
Normal file
24
Sources/Portico/Extensions/SearchBar+Extras.swift
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import Gtk
|
||||
|
||||
extension WidgetView where Target: Gtk.SearchBar {
|
||||
/// Applies the `.inline` style class.
|
||||
///
|
||||
/// Swaps the header-bar-attached look for a neutral background so the widget can be used in other contexts.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func inline(_ enabled: Bool = true) -> Self {
|
||||
styleClass("inline", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.inline` style class.
|
||||
///
|
||||
/// Swaps the header-bar-attached look for a neutral background so the widget can be used in other contexts.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func inline(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("inline", enabled)
|
||||
}
|
||||
|
||||
}
|
||||
24
Sources/Portico/Extensions/Separator+Extras.swift
Normal file
24
Sources/Portico/Extensions/Separator+Extras.swift
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import Gtk
|
||||
|
||||
extension WidgetView where Target: Gtk.Separator {
|
||||
/// Applies the `.spacer` style class.
|
||||
///
|
||||
/// Makes the separator invisible so it acts as whitespace; useful in toolbars to separate groups of widgets.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func spacer(_ enabled: Bool = true) -> Self {
|
||||
styleClass("spacer", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.spacer` style class.
|
||||
///
|
||||
/// Makes the separator invisible so it acts as whitespace; useful in toolbars to separate groups of widgets.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func spacer(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("spacer", enabled)
|
||||
}
|
||||
|
||||
}
|
||||
106
Sources/Portico/Extensions/SplitButton+Extras.swift
Normal file
106
Sources/Portico/Extensions/SplitButton+Extras.swift
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
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)
|
||||
}
|
||||
|
||||
}
|
||||
24
Sources/Portico/Extensions/StatusPage+Extras.swift
Normal file
24
Sources/Portico/Extensions/StatusPage+Extras.swift
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import Adw
|
||||
|
||||
extension WidgetView where Target: Adw.StatusPage {
|
||||
/// Applies the `.compact` style class.
|
||||
///
|
||||
/// Makes the status page take less space; used in sidebars and popovers.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func compact(_ enabled: Bool = true) -> Self {
|
||||
styleClass("compact", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.compact` style class.
|
||||
///
|
||||
/// Makes the status page take less space; used in sidebars and popovers.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func compact(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("compact", enabled)
|
||||
}
|
||||
|
||||
}
|
||||
49
Sources/Portico/Extensions/StyleClass.swift
Normal file
49
Sources/Portico/Extensions/StyleClass.swift
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
import Gtk
|
||||
|
||||
extension WidgetView {
|
||||
/// Adds `name` to the mounted widget when `enabled` is true; a false value
|
||||
/// appends no configuration step at all.
|
||||
func styleClass(_ name: String, _ enabled: Bool) -> Self {
|
||||
guard enabled else { return self }
|
||||
return appending { w, _ in w.addCssClass(cssClass: name) }
|
||||
}
|
||||
|
||||
/// Adds `name` at mount when the binding is true, then adds/removes it on the
|
||||
/// live widget on every change. The subscription is registered with the mount
|
||||
/// context's registry, so unmount cancels it.
|
||||
func styleClass(_ name: String, _ enabled: Binding<Bool>) -> Self {
|
||||
appending { w, ctx in
|
||||
if enabled.untrackedValue { w.addCssClass(cssClass: name) }
|
||||
ctx.registry.add(enabled.subscribe { [w] on in
|
||||
if on { w.addCssClass(cssClass: name) } else { w.removeCssClass(cssClass: name) }
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension View {
|
||||
/// `AnyView`-returning counterpart for views that are not ``WidgetView``
|
||||
/// (`HStack`, `VStack`, `AnyView`, raw `Gtk.Widget`).
|
||||
func styleClass(_ name: String, _ enabled: Bool) -> AnyView {
|
||||
guard enabled else { return AnyView(self) }
|
||||
return AnyView(makeWidget: { ctx in
|
||||
let w = AnyView(self).makeWidget(ctx)
|
||||
w.addCssClass(cssClass: name)
|
||||
return w
|
||||
})
|
||||
}
|
||||
|
||||
/// `AnyView`-returning counterpart for views that are not ``WidgetView``
|
||||
/// (`HStack`, `VStack`, `AnyView`, raw `Gtk.Widget`). The subscription is
|
||||
/// registered with the mount context's registry, so unmount cancels it.
|
||||
func styleClass(_ name: String, _ enabled: Binding<Bool>) -> AnyView {
|
||||
AnyView(makeWidget: { ctx in
|
||||
let w = AnyView(self).makeWidget(ctx)
|
||||
if enabled.untrackedValue { w.addCssClass(cssClass: name) }
|
||||
ctx.registry.add(enabled.subscribe { [w] on in
|
||||
if on { w.addCssClass(cssClass: name) } else { w.removeCssClass(cssClass: name) }
|
||||
})
|
||||
return w
|
||||
})
|
||||
}
|
||||
}
|
||||
24
Sources/Portico/Extensions/TabBar+Extras.swift
Normal file
24
Sources/Portico/Extensions/TabBar+Extras.swift
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import Adw
|
||||
|
||||
extension WidgetView where Target: Adw.TabBar {
|
||||
/// Applies the `.inline` style class.
|
||||
///
|
||||
/// Swaps the header-bar-attached look for a neutral background so the widget can be used in other contexts.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func inline(_ enabled: Bool = true) -> Self {
|
||||
styleClass("inline", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.inline` style class.
|
||||
///
|
||||
/// Swaps the header-bar-attached look for a neutral background so the widget can be used in other contexts.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func inline(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("inline", enabled)
|
||||
}
|
||||
|
||||
}
|
||||
24
Sources/Portico/Extensions/TextView+Extras.swift
Normal file
24
Sources/Portico/Extensions/TextView+Extras.swift
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import Gtk
|
||||
|
||||
extension WidgetView where Target: Gtk.TextView {
|
||||
/// Applies the `.inline` style class.
|
||||
///
|
||||
/// Lets the view sit inside a card while following its styles. Cannot be used with `GtkSourceView`.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func inline(_ enabled: Bool = true) -> Self {
|
||||
styleClass("inline", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.inline` style class.
|
||||
///
|
||||
/// Lets the view sit inside a card while following its styles. Cannot be used with `GtkSourceView`.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func inline(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("inline", enabled)
|
||||
}
|
||||
|
||||
}
|
||||
44
Sources/Portico/Extensions/ToggleGroup+Extras.swift
Normal file
44
Sources/Portico/Extensions/ToggleGroup+Extras.swift
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import Adw
|
||||
|
||||
extension WidgetView where Target: Adw.ToggleGroup {
|
||||
/// Applies the `.flat` style class.
|
||||
///
|
||||
/// Makes the group look like a series of flat buttons. Combines with ``round``.
|
||||
///
|
||||
/// - 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.
|
||||
///
|
||||
/// Makes the group look like a series of flat buttons. Combines with ``round``.
|
||||
///
|
||||
/// - 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 `.round` style class.
|
||||
///
|
||||
/// Rounds the group and the toggles inside it. Combines with ``flat``.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func round(_ enabled: Bool = true) -> Self {
|
||||
styleClass("round", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.round` style class.
|
||||
///
|
||||
/// Rounds the group and the toggles inside it. Combines with ``flat``.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func round(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("round", enabled)
|
||||
}
|
||||
|
||||
}
|
||||
511
Sources/Portico/Extensions/View+StyleClasses.swift
Normal file
511
Sources/Portico/Extensions/View+StyleClasses.swift
Normal file
|
|
@ -0,0 +1,511 @@
|
|||
import Gtk
|
||||
|
||||
extension View {
|
||||
|
||||
/// Applies the `.dimmed` style class.
|
||||
///
|
||||
/// Partially transparent. The opacity is tracked by the `--dim-opacity` CSS variable and differs under high contrast. Since libadwaita 1.7.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func dimmed(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("dimmed", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.dimmed` style class.
|
||||
///
|
||||
/// Partially transparent. The opacity is tracked by the `--dim-opacity` CSS variable and differs under high contrast. Since libadwaita 1.7.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func dimmed(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("dimmed", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.title-1` style class.
|
||||
///
|
||||
/// Largest of four title levels indicating hierarchy; suits big views with plenty of whitespace.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func title1(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("title-1", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.title-1` style class.
|
||||
///
|
||||
/// Largest of four title levels indicating hierarchy; suits big views with plenty of whitespace.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func title1(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("title-1", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.title-2` style class.
|
||||
///
|
||||
/// Second of four title levels indicating hierarchy.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func title2(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("title-2", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.title-2` style class.
|
||||
///
|
||||
/// Second of four title levels indicating hierarchy.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func title2(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("title-2", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.title-3` style class.
|
||||
///
|
||||
/// Third of four title levels indicating hierarchy.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func title3(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("title-3", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.title-3` style class.
|
||||
///
|
||||
/// Third of four title levels indicating hierarchy.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func title3(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("title-3", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.title-4` style class.
|
||||
///
|
||||
/// Fourth and smallest of four title levels indicating hierarchy.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func title4(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("title-4", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.title-4` style class.
|
||||
///
|
||||
/// Fourth and smallest of four title levels indicating hierarchy.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func title4(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("title-4", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.heading` style class.
|
||||
///
|
||||
/// Standard UI heading at the default text size, e.g. for window titles or boxed-list labels.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func heading(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("heading", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.heading` style class.
|
||||
///
|
||||
/// Standard UI heading at the default text size, e.g. for window titles or boxed-list labels.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func heading(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("heading", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.document` style class.
|
||||
///
|
||||
/// Document font: larger size and line height for the app's main content. Since libadwaita 1.8. Use ``body`` for other long text.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func document(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("document", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.document` style class.
|
||||
///
|
||||
/// Document font: larger size and line height for the app's main content. Since libadwaita 1.8. Use ``body`` for other long text.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func document(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("document", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.body` style class.
|
||||
///
|
||||
/// Increased line height for UI text such as descriptions or dialog bodies. Avoid for non-wrapping text; use ``document`` for main content.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func body(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("body", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.body` style class.
|
||||
///
|
||||
/// Increased line height for UI text such as descriptions or dialog bodies. Avoid for non-wrapping text; use ``document`` for main content.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func body(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("body", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.caption-heading` style class.
|
||||
///
|
||||
/// Smaller text that differentiates sub-text accompanying body text.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func captionHeading(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("caption-heading", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.caption-heading` style class.
|
||||
///
|
||||
/// Smaller text that differentiates sub-text accompanying body text.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func captionHeading(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("caption-heading", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.caption` style class.
|
||||
///
|
||||
/// Smaller text for captions and supplementary labels.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func caption(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("caption", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.caption` style class.
|
||||
///
|
||||
/// Smaller text for captions and supplementary labels.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func caption(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("caption", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.monospace` style class.
|
||||
///
|
||||
/// Monospace font, for code, logs, or shell output. On `Adw.EntryRow` only the editable part becomes monospace - apply it to the surrounding `Gtk.ListBox` to cover the whole row. Named `monospaceStyle` because `Gtk.TextView` already has a `monospace(_:)` property modifier.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func monospaceStyle(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("monospace", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.monospace` style class.
|
||||
///
|
||||
/// Monospace font, for code, logs, or shell output. On `Adw.EntryRow` only the editable part becomes monospace - apply it to the surrounding `Gtk.ListBox` to cover the whole row. Named `monospaceStyle` because `Gtk.TextView` already has a `monospace(_:)` property modifier.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func monospaceStyle(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("monospace", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.numeric` style class.
|
||||
///
|
||||
/// Tabular figures, equivalent to Pango "tnum=1"; use for vertically aligned numbers, clocks, and progress. Named `numericStyle` because `Gtk.SpinButton` / `Adw.SpinRow` already has a `numeric(_:)` property modifier.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func numericStyle(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("numeric", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.numeric` style class.
|
||||
///
|
||||
/// Tabular figures, equivalent to Pango "tnum=1"; use for vertically aligned numbers, clocks, and progress. Named `numericStyle` because `Gtk.SpinButton` / `Adw.SpinRow` already has a `numeric(_:)` property modifier.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func numericStyle(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("numeric", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.accent` style class.
|
||||
///
|
||||
/// Recolors the widget with the accent color.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func accent(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("accent", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.accent` style class.
|
||||
///
|
||||
/// Recolors the widget with the accent color.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func accent(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("accent", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.success` style class.
|
||||
///
|
||||
/// Success color. Also usable on `Gtk.Entry` to signal input validation state, where it additionally changes the accent color.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func success(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("success", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.success` style class.
|
||||
///
|
||||
/// Success color. Also usable on `Gtk.Entry` to signal input validation state, where it additionally changes the accent color.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func success(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("success", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.warning` style class.
|
||||
///
|
||||
/// Warning color. Also usable on `Gtk.Entry` to signal input validation state, where it additionally changes the accent color.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func warning(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("warning", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.warning` style class.
|
||||
///
|
||||
/// Warning color. Also usable on `Gtk.Entry` to signal input validation state, where it additionally changes the accent color.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func warning(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("warning", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.error` style class.
|
||||
///
|
||||
/// Error color. Also usable on `Gtk.Entry` to signal input validation state, where it additionally changes the accent color.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func error(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("error", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.error` style class.
|
||||
///
|
||||
/// Error color. Also usable on `Gtk.Entry` to signal input validation state, where it additionally changes the accent color.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func error(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("error", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.card` style class.
|
||||
///
|
||||
/// Gives any widget a boxed-list-like card appearance. Combined with ``activatableStyle`` it gains hover and active states; a `Gtk.Button` gets those states automatically without ``activatableStyle``.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func card(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("card", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.card` style class.
|
||||
///
|
||||
/// Gives any widget a boxed-list-like card appearance. Combined with ``activatableStyle`` it gains hover and active states; a `Gtk.Button` gets those states automatically without ``activatableStyle``.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func card(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("card", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.activatable` style class.
|
||||
///
|
||||
/// Only meaningful together with ``card``; adds hover and active states to the card. Named `activatableStyle` because `Gtk.ListBoxRow` already has an `activatable(_:)` property modifier.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func activatableStyle(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("activatable", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.activatable` style class.
|
||||
///
|
||||
/// Only meaningful together with ``card``; adds hover and active states to the card. Named `activatableStyle` because `Gtk.ListBoxRow` already has an `activatable(_:)` property modifier.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func activatableStyle(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("activatable", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.osd` style class.
|
||||
///
|
||||
/// Dark, partially transparent background with a white accent. On `Gtk.Button` it produces large standalone overlay buttons (combinable with ``circular`` / ``pill``). Combine with ``toolbar`` on a `Gtk.Box` for a floating toolbar. On `Gtk.ProgressBar` it makes the bar thinner and removes the trough.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func osd(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("osd", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.osd` style class.
|
||||
///
|
||||
/// Dark, partially transparent background with a white accent. On `Gtk.Button` it produces large standalone overlay buttons (combinable with ``circular`` / ``pill``). Combine with ``toolbar`` on a `Gtk.Box` for a floating toolbar. On `Gtk.ProgressBar` it makes the bar thinner and removes the trough.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func osd(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("osd", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.background` style class.
|
||||
///
|
||||
/// Default window background and foreground colors; useful when a widget needs an opaque background.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func background(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("background", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.background` style class.
|
||||
///
|
||||
/// Default window background and foreground colors; useful when a widget needs an opaque background.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func background(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("background", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.view` style class.
|
||||
///
|
||||
/// Default view background and foreground colors.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func view(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("view", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.view` style class.
|
||||
///
|
||||
/// Default view background and foreground colors.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func view(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("view", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.frame` style class.
|
||||
///
|
||||
/// Default 1px border.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func frame(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("frame", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.frame` style class.
|
||||
///
|
||||
/// Default 1px border.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
public func frame(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("frame", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.sidebar` style class.
|
||||
///
|
||||
/// Border at the end of the widget plus background removal from a contained list.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
@available(*, deprecated, message: "Deprecated by libadwaita. Use navigationSidebar() on the list widget plus a Separator for the border.")
|
||||
public func sidebar(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("sidebar", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.sidebar` style class.
|
||||
///
|
||||
/// Border at the end of the widget plus background removal from a contained list.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
@available(*, deprecated, message: "Deprecated by libadwaita. Use navigationSidebar() on the list widget plus a Separator for the border.")
|
||||
public func sidebar(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("sidebar", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.large-title` style class.
|
||||
///
|
||||
/// Large thin display heading.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
@available(*, deprecated, message: "Deprecated since libadwaita 1.2. Use title1() instead.")
|
||||
public func largeTitle(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("large-title", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.large-title` style class.
|
||||
///
|
||||
/// Large thin display heading.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
@available(*, deprecated, message: "Deprecated since libadwaita 1.2. Use title1() instead.")
|
||||
public func largeTitle(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("large-title", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.dim-label` style class.
|
||||
///
|
||||
/// Equivalent to ``dimmed``.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
@available(*, deprecated, message: "Deprecated since libadwaita 1.7. Use dimmed() instead.")
|
||||
public func dimLabel(_ enabled: Bool = true) -> AnyView {
|
||||
styleClass("dim-label", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.dim-label` style class.
|
||||
///
|
||||
/// Equivalent to ``dimmed``.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A type-erased view that carries the class. Further widget-specific modifiers are not available after this call.
|
||||
@available(*, deprecated, message: "Deprecated since libadwaita 1.7. Use dimmed() instead.")
|
||||
public func dimLabel(_ enabled: Binding<Bool>) -> AnyView {
|
||||
styleClass("dim-label", enabled)
|
||||
}
|
||||
|
||||
}
|
||||
511
Sources/Portico/Extensions/WidgetView+StyleClasses.swift
Normal file
511
Sources/Portico/Extensions/WidgetView+StyleClasses.swift
Normal file
|
|
@ -0,0 +1,511 @@
|
|||
import Gtk
|
||||
|
||||
extension WidgetView {
|
||||
|
||||
/// Applies the `.dimmed` style class.
|
||||
///
|
||||
/// Partially transparent. The opacity is tracked by the `--dim-opacity` CSS variable and differs under high contrast. Since libadwaita 1.7.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func dimmed(_ enabled: Bool = true) -> Self {
|
||||
styleClass("dimmed", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.dimmed` style class.
|
||||
///
|
||||
/// Partially transparent. The opacity is tracked by the `--dim-opacity` CSS variable and differs under high contrast. Since libadwaita 1.7.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func dimmed(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("dimmed", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.title-1` style class.
|
||||
///
|
||||
/// Largest of four title levels indicating hierarchy; suits big views with plenty of whitespace.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func title1(_ enabled: Bool = true) -> Self {
|
||||
styleClass("title-1", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.title-1` style class.
|
||||
///
|
||||
/// Largest of four title levels indicating hierarchy; suits big views with plenty of whitespace.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func title1(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("title-1", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.title-2` style class.
|
||||
///
|
||||
/// Second of four title levels indicating hierarchy.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func title2(_ enabled: Bool = true) -> Self {
|
||||
styleClass("title-2", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.title-2` style class.
|
||||
///
|
||||
/// Second of four title levels indicating hierarchy.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func title2(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("title-2", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.title-3` style class.
|
||||
///
|
||||
/// Third of four title levels indicating hierarchy.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func title3(_ enabled: Bool = true) -> Self {
|
||||
styleClass("title-3", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.title-3` style class.
|
||||
///
|
||||
/// Third of four title levels indicating hierarchy.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func title3(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("title-3", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.title-4` style class.
|
||||
///
|
||||
/// Fourth and smallest of four title levels indicating hierarchy.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func title4(_ enabled: Bool = true) -> Self {
|
||||
styleClass("title-4", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.title-4` style class.
|
||||
///
|
||||
/// Fourth and smallest of four title levels indicating hierarchy.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func title4(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("title-4", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.heading` style class.
|
||||
///
|
||||
/// Standard UI heading at the default text size, e.g. for window titles or boxed-list labels.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func heading(_ enabled: Bool = true) -> Self {
|
||||
styleClass("heading", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.heading` style class.
|
||||
///
|
||||
/// Standard UI heading at the default text size, e.g. for window titles or boxed-list labels.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func heading(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("heading", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.document` style class.
|
||||
///
|
||||
/// Document font: larger size and line height for the app's main content. Since libadwaita 1.8. Use ``body`` for other long text.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func document(_ enabled: Bool = true) -> Self {
|
||||
styleClass("document", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.document` style class.
|
||||
///
|
||||
/// Document font: larger size and line height for the app's main content. Since libadwaita 1.8. Use ``body`` for other long text.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func document(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("document", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.body` style class.
|
||||
///
|
||||
/// Increased line height for UI text such as descriptions or dialog bodies. Avoid for non-wrapping text; use ``document`` for main content.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func body(_ enabled: Bool = true) -> Self {
|
||||
styleClass("body", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.body` style class.
|
||||
///
|
||||
/// Increased line height for UI text such as descriptions or dialog bodies. Avoid for non-wrapping text; use ``document`` for main content.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func body(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("body", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.caption-heading` style class.
|
||||
///
|
||||
/// Smaller text that differentiates sub-text accompanying body text.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func captionHeading(_ enabled: Bool = true) -> Self {
|
||||
styleClass("caption-heading", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.caption-heading` style class.
|
||||
///
|
||||
/// Smaller text that differentiates sub-text accompanying body text.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func captionHeading(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("caption-heading", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.caption` style class.
|
||||
///
|
||||
/// Smaller text for captions and supplementary labels.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func caption(_ enabled: Bool = true) -> Self {
|
||||
styleClass("caption", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.caption` style class.
|
||||
///
|
||||
/// Smaller text for captions and supplementary labels.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func caption(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("caption", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.monospace` style class.
|
||||
///
|
||||
/// Monospace font, for code, logs, or shell output. On `Adw.EntryRow` only the editable part becomes monospace - apply it to the surrounding `Gtk.ListBox` to cover the whole row. Named `monospaceStyle` because `Gtk.TextView` already has a `monospace(_:)` property modifier.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func monospaceStyle(_ enabled: Bool = true) -> Self {
|
||||
styleClass("monospace", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.monospace` style class.
|
||||
///
|
||||
/// Monospace font, for code, logs, or shell output. On `Adw.EntryRow` only the editable part becomes monospace - apply it to the surrounding `Gtk.ListBox` to cover the whole row. Named `monospaceStyle` because `Gtk.TextView` already has a `monospace(_:)` property modifier.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func monospaceStyle(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("monospace", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.numeric` style class.
|
||||
///
|
||||
/// Tabular figures, equivalent to Pango "tnum=1"; use for vertically aligned numbers, clocks, and progress. Named `numericStyle` because `Gtk.SpinButton` / `Adw.SpinRow` already has a `numeric(_:)` property modifier.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func numericStyle(_ enabled: Bool = true) -> Self {
|
||||
styleClass("numeric", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.numeric` style class.
|
||||
///
|
||||
/// Tabular figures, equivalent to Pango "tnum=1"; use for vertically aligned numbers, clocks, and progress. Named `numericStyle` because `Gtk.SpinButton` / `Adw.SpinRow` already has a `numeric(_:)` property modifier.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func numericStyle(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("numeric", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.accent` style class.
|
||||
///
|
||||
/// Recolors the widget with the accent color.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func accent(_ enabled: Bool = true) -> Self {
|
||||
styleClass("accent", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.accent` style class.
|
||||
///
|
||||
/// Recolors the widget with the accent color.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func accent(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("accent", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.success` style class.
|
||||
///
|
||||
/// Success color. Also usable on `Gtk.Entry` to signal input validation state, where it additionally changes the accent color.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func success(_ enabled: Bool = true) -> Self {
|
||||
styleClass("success", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.success` style class.
|
||||
///
|
||||
/// Success color. Also usable on `Gtk.Entry` to signal input validation state, where it additionally changes the accent color.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func success(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("success", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.warning` style class.
|
||||
///
|
||||
/// Warning color. Also usable on `Gtk.Entry` to signal input validation state, where it additionally changes the accent color.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func warning(_ enabled: Bool = true) -> Self {
|
||||
styleClass("warning", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.warning` style class.
|
||||
///
|
||||
/// Warning color. Also usable on `Gtk.Entry` to signal input validation state, where it additionally changes the accent color.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func warning(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("warning", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.error` style class.
|
||||
///
|
||||
/// Error color. Also usable on `Gtk.Entry` to signal input validation state, where it additionally changes the accent color.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func error(_ enabled: Bool = true) -> Self {
|
||||
styleClass("error", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.error` style class.
|
||||
///
|
||||
/// Error color. Also usable on `Gtk.Entry` to signal input validation state, where it additionally changes the accent color.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func error(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("error", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.card` style class.
|
||||
///
|
||||
/// Gives any widget a boxed-list-like card appearance. Combined with ``activatableStyle`` it gains hover and active states; a `Gtk.Button` gets those states automatically without ``activatableStyle``.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func card(_ enabled: Bool = true) -> Self {
|
||||
styleClass("card", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.card` style class.
|
||||
///
|
||||
/// Gives any widget a boxed-list-like card appearance. Combined with ``activatableStyle`` it gains hover and active states; a `Gtk.Button` gets those states automatically without ``activatableStyle``.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func card(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("card", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.activatable` style class.
|
||||
///
|
||||
/// Only meaningful together with ``card``; adds hover and active states to the card. Named `activatableStyle` because `Gtk.ListBoxRow` already has an `activatable(_:)` property modifier.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func activatableStyle(_ enabled: Bool = true) -> Self {
|
||||
styleClass("activatable", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.activatable` style class.
|
||||
///
|
||||
/// Only meaningful together with ``card``; adds hover and active states to the card. Named `activatableStyle` because `Gtk.ListBoxRow` already has an `activatable(_:)` property modifier.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func activatableStyle(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("activatable", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.osd` style class.
|
||||
///
|
||||
/// Dark, partially transparent background with a white accent. On `Gtk.Button` it produces large standalone overlay buttons (combinable with ``circular`` / ``pill``). Combine with ``toolbar`` on a `Gtk.Box` for a floating toolbar. On `Gtk.ProgressBar` it makes the bar thinner and removes the trough.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func osd(_ enabled: Bool = true) -> Self {
|
||||
styleClass("osd", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.osd` style class.
|
||||
///
|
||||
/// Dark, partially transparent background with a white accent. On `Gtk.Button` it produces large standalone overlay buttons (combinable with ``circular`` / ``pill``). Combine with ``toolbar`` on a `Gtk.Box` for a floating toolbar. On `Gtk.ProgressBar` it makes the bar thinner and removes the trough.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func osd(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("osd", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.background` style class.
|
||||
///
|
||||
/// Default window background and foreground colors; useful when a widget needs an opaque background.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func background(_ enabled: Bool = true) -> Self {
|
||||
styleClass("background", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.background` style class.
|
||||
///
|
||||
/// Default window background and foreground colors; useful when a widget needs an opaque background.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func background(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("background", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.view` style class.
|
||||
///
|
||||
/// Default view background and foreground colors.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func view(_ enabled: Bool = true) -> Self {
|
||||
styleClass("view", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.view` style class.
|
||||
///
|
||||
/// Default view background and foreground colors.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func view(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("view", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.frame` style class.
|
||||
///
|
||||
/// Default 1px border.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func frame(_ enabled: Bool = true) -> Self {
|
||||
styleClass("frame", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.frame` style class.
|
||||
///
|
||||
/// Default 1px border.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func frame(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("frame", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.sidebar` style class.
|
||||
///
|
||||
/// Border at the end of the widget plus background removal from a contained list.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
@available(*, deprecated, message: "Deprecated by libadwaita. Use navigationSidebar() on the list widget plus a Separator for the border.")
|
||||
public func sidebar(_ enabled: Bool = true) -> Self {
|
||||
styleClass("sidebar", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.sidebar` style class.
|
||||
///
|
||||
/// Border at the end of the widget plus background removal from a contained list.
|
||||
///
|
||||
/// - 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 by libadwaita. Use navigationSidebar() on the list widget plus a Separator for the border.")
|
||||
public func sidebar(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("sidebar", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.large-title` style class.
|
||||
///
|
||||
/// Large thin display heading.
|
||||
///
|
||||
/// - 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.2. Use title1() instead.")
|
||||
public func largeTitle(_ enabled: Bool = true) -> Self {
|
||||
styleClass("large-title", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.large-title` style class.
|
||||
///
|
||||
/// Large thin display heading.
|
||||
///
|
||||
/// - 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.2. Use title1() instead.")
|
||||
public func largeTitle(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("large-title", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.dim-label` style class.
|
||||
///
|
||||
/// Equivalent to ``dimmed``.
|
||||
///
|
||||
/// - 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.7. Use dimmed() instead.")
|
||||
public func dimLabel(_ enabled: Bool = true) -> Self {
|
||||
styleClass("dim-label", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.dim-label` style class.
|
||||
///
|
||||
/// Equivalent to ``dimmed``.
|
||||
///
|
||||
/// - 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.7. Use dimmed() instead.")
|
||||
public func dimLabel(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("dim-label", enabled)
|
||||
}
|
||||
|
||||
}
|
||||
24
Sources/Portico/Extensions/Window+Extras.swift
Normal file
24
Sources/Portico/Extensions/Window+Extras.swift
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import Gtk
|
||||
|
||||
extension WidgetView where Target: Gtk.Window {
|
||||
/// Applies the `.devel` style class.
|
||||
///
|
||||
/// Gives any Adw.HeaderBar or Gtk.HeaderBar inside the window a striped appearance; conventionally marks nightly or unstable builds.
|
||||
///
|
||||
/// - Parameter enabled: Whether the style class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func devel(_ enabled: Bool = true) -> Self {
|
||||
styleClass("devel", enabled)
|
||||
}
|
||||
|
||||
/// Applies the `.devel` style class.
|
||||
///
|
||||
/// Gives any Adw.HeaderBar or Gtk.HeaderBar inside the window a striped appearance; conventionally marks nightly or unstable builds.
|
||||
///
|
||||
/// - Parameter enabled: A binding that controls whether the class is applied.
|
||||
/// - Returns: A copy of this view with the modifier applied.
|
||||
public func devel(_ enabled: Binding<Bool>) -> Self {
|
||||
styleClass("devel", enabled)
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue