Add support for dialogs
This commit is contained in:
parent
2146a4f268
commit
6ee069ebd9
97
Sources/Adwaita/View/Dialogs/Dialog.swift
Normal file
97
Sources/Adwaita/View/Dialogs/Dialog.swift
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
//
|
||||||
|
// Dialog.swift
|
||||||
|
// Adwaita
|
||||||
|
//
|
||||||
|
// Created by david-swift on 20.03.24.
|
||||||
|
//
|
||||||
|
|
||||||
|
import CAdw
|
||||||
|
|
||||||
|
/// The dialog widget.
|
||||||
|
struct Dialog: Widget {
|
||||||
|
|
||||||
|
/// Whether the dialog is visible.
|
||||||
|
@Binding var visible: Bool
|
||||||
|
/// The dialog's title.
|
||||||
|
var title: String?
|
||||||
|
/// The wrapped view.
|
||||||
|
var child: View
|
||||||
|
/// The content of the dialog.
|
||||||
|
var content: Body
|
||||||
|
|
||||||
|
/// The ID for the dialog's storage.
|
||||||
|
let dialogID = "dialog"
|
||||||
|
/// The ID for the content's storage.
|
||||||
|
let contentID = "content"
|
||||||
|
|
||||||
|
/// Get the container of the child.
|
||||||
|
/// - Parameter modifiers: Modify views before being updated.
|
||||||
|
/// - Returns: The view storage.
|
||||||
|
func container(modifiers: [(View) -> View]) -> ViewStorage {
|
||||||
|
let storage = child.storage(modifiers: modifiers)
|
||||||
|
update(storage, modifiers: modifiers, updateProperties: true)
|
||||||
|
return storage
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Update the view storage of the child, dialog, and dialog content.
|
||||||
|
/// - Parameters:
|
||||||
|
/// - storage: The view storage.
|
||||||
|
/// - modifiers: Modify views before being updated.
|
||||||
|
/// - updateProperties: Whether to update properties.
|
||||||
|
func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) {
|
||||||
|
child.widget(modifiers: modifiers).update(storage, modifiers: modifiers, updateProperties: updateProperties)
|
||||||
|
if let storage = storage.content[contentID]?.first as? ViewStorage {
|
||||||
|
content
|
||||||
|
.widget(modifiers: modifiers)
|
||||||
|
.update(storage, modifiers: modifiers, updateProperties: updateProperties)
|
||||||
|
}
|
||||||
|
guard updateProperties else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if visible {
|
||||||
|
if storage.content[dialogID]?.first == nil {
|
||||||
|
createDialog(storage: storage, modifiers: modifiers)
|
||||||
|
adw_dialog_present(storage.content[dialogID]?.first?.pointer?.cast(), storage.pointer?.cast())
|
||||||
|
}
|
||||||
|
adw_dialog_set_title(storage.content[dialogID]?.first?.pointer?.cast(), title ?? "")
|
||||||
|
} else {
|
||||||
|
if storage.content[dialogID]?.first != nil {
|
||||||
|
adw_dialog_close(storage.content[dialogID]?.first?.pointer?.cast())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a new instance of the dialog.
|
||||||
|
/// - Parameters:
|
||||||
|
/// - storage: The wrapped view's storage.
|
||||||
|
/// - modifiers: The view modifiers.
|
||||||
|
func createDialog(storage: ViewStorage, modifiers: [(View) -> View]) {
|
||||||
|
let pointer = adw_dialog_new()
|
||||||
|
let dialog = ViewStorage(pointer?.opaque())
|
||||||
|
storage.content[dialogID] = [dialog]
|
||||||
|
let contentStorage = content.widget(modifiers: modifiers).storage(modifiers: modifiers)
|
||||||
|
adw_dialog_set_child(pointer, contentStorage.pointer?.cast())
|
||||||
|
storage.content[contentID] = [contentStorage]
|
||||||
|
dialog.connectSignal(name: "closed") {
|
||||||
|
storage.content[dialogID] = []
|
||||||
|
storage.content[contentID] = []
|
||||||
|
if visible {
|
||||||
|
visible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension View {
|
||||||
|
|
||||||
|
/// Add a dialog to the parent window.
|
||||||
|
/// - Parameters:
|
||||||
|
/// - visible: Whether the dialog is presented.
|
||||||
|
/// - title: The dialog's title.
|
||||||
|
/// - content: The dialog's content.
|
||||||
|
public func dialog(visible: Binding<Bool>, title: String? = nil, @ViewBuilder content: () -> Body) -> View {
|
||||||
|
Dialog(visible: visible, title: title, child: self, content: content())
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -2,7 +2,7 @@
|
|||||||
// ActionRow.swift
|
// ActionRow.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// Avatar.swift
|
// Avatar.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// Banner.swift
|
// Banner.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// Bin.swift
|
// Bin.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// Box.swift
|
// Box.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// Button.swift
|
// Button.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// ButtonContent.swift
|
// ButtonContent.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
@ -29,12 +29,13 @@ import LevenshteinTransformations
|
|||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// buttoncontent
|
/// buttoncontent
|
||||||
|
/// ╰── box
|
||||||
/// ├── image
|
/// ├── image
|
||||||
/// ╰── label
|
/// ╰── label
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// `AdwButtonContent`'s CSS node is called `buttoncontent`. It contains the
|
/// `AdwButtonContent`'s CSS node is called `buttoncontent`. It contains a `box`
|
||||||
/// subnodes `image` and `label`.
|
/// subnode that serves as a container for the `image` and `label` nodes.
|
||||||
///
|
///
|
||||||
/// When inside a `GtkButton` or `AdwSplitButton`, the button will receive the
|
/// When inside a `GtkButton` or `AdwSplitButton`, the button will receive the
|
||||||
/// `.image-text-button` style class. When inside a `GtkMenuButton`, the
|
/// `.image-text-button` style class. When inside a `GtkMenuButton`, the
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// Carousel.swift
|
// Carousel.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
@ -56,8 +56,10 @@ public struct Carousel<Element>: Widget where Element: Identifiable {
|
|||||||
/// This signal is emitted after a page has been changed.
|
/// This signal is emitted after a page has been changed.
|
||||||
///
|
///
|
||||||
/// It can be used to implement "infinite scrolling" by amending the pages
|
/// It can be used to implement "infinite scrolling" by amending the pages
|
||||||
/// after every scroll. Note that an empty carousel is indicated by
|
/// after every scroll.
|
||||||
/// `(int)index == -1`.
|
///
|
||||||
|
/// ::: note
|
||||||
|
/// An empty carousel is indicated by `(int)index == -1`.
|
||||||
var pageChanged: (() -> Void)?
|
var pageChanged: (() -> Void)?
|
||||||
/// The dynamic widget elements.
|
/// The dynamic widget elements.
|
||||||
var elements: [Element]
|
var elements: [Element]
|
||||||
@ -219,8 +221,10 @@ public struct Carousel<Element>: Widget where Element: Identifiable {
|
|||||||
/// This signal is emitted after a page has been changed.
|
/// This signal is emitted after a page has been changed.
|
||||||
///
|
///
|
||||||
/// It can be used to implement "infinite scrolling" by amending the pages
|
/// It can be used to implement "infinite scrolling" by amending the pages
|
||||||
/// after every scroll. Note that an empty carousel is indicated by
|
/// after every scroll.
|
||||||
/// `(int)index == -1`.
|
///
|
||||||
|
/// ::: note
|
||||||
|
/// An empty carousel is indicated by `(int)index == -1`.
|
||||||
public func pageChanged(_ pageChanged: @escaping () -> Void) -> Self {
|
public func pageChanged(_ pageChanged: @escaping () -> Void) -> Self {
|
||||||
var newSelf = self
|
var newSelf = self
|
||||||
newSelf.pageChanged = pageChanged
|
newSelf.pageChanged = pageChanged
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// CenterBox.swift
|
// CenterBox.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// CheckButton.swift
|
// CheckButton.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// Clamp.swift
|
// Clamp.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// ComboRow.swift
|
// ComboRow.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// EntryRow.swift
|
// EntryRow.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
@ -62,6 +62,8 @@ public struct EntryRow: Widget {
|
|||||||
/// operation, e.g. network activity, to avoid triggering it after typing every
|
/// operation, e.g. network activity, to avoid triggering it after typing every
|
||||||
/// character.
|
/// character.
|
||||||
var showApplyButton: Bool?
|
var showApplyButton: Bool?
|
||||||
|
/// The length of the text in the entry row.
|
||||||
|
var textLength: UInt?
|
||||||
/// The title of the preference represented by this row.
|
/// The title of the preference represented by this row.
|
||||||
///
|
///
|
||||||
/// The title is interpreted as Pango markup unless
|
/// The title is interpreted as Pango markup unless
|
||||||
@ -226,6 +228,14 @@ public struct EntryRow: Widget {
|
|||||||
return newSelf
|
return newSelf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The length of the text in the entry row.
|
||||||
|
public func textLength(_ textLength: UInt?) -> Self {
|
||||||
|
var newSelf = self
|
||||||
|
newSelf.textLength = textLength
|
||||||
|
|
||||||
|
return newSelf
|
||||||
|
}
|
||||||
|
|
||||||
/// The title of the preference represented by this row.
|
/// The title of the preference represented by this row.
|
||||||
///
|
///
|
||||||
/// The title is interpreted as Pango markup unless
|
/// The title is interpreted as Pango markup unless
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// ExpanderRow.swift
|
// ExpanderRow.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// FlowBox.swift
|
// FlowBox.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// HeaderBar.swift
|
// HeaderBar.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
@ -16,6 +16,15 @@ import LevenshteinTransformations
|
|||||||
/// features compared to it. Refer to `GtkHeaderBar` for details. It is typically
|
/// features compared to it. Refer to `GtkHeaderBar` for details. It is typically
|
||||||
/// used as a top bar within [class@ToolbarView].
|
/// used as a top bar within [class@ToolbarView].
|
||||||
///
|
///
|
||||||
|
/// ## Dialog Integration
|
||||||
|
///
|
||||||
|
/// When placed inside an [class@Dialog], `AdwHeaderBar` will display the dialog
|
||||||
|
/// title intead of window title. It will also adjust the decoration layout to
|
||||||
|
/// ensure it always has a close button and nothing else. Set
|
||||||
|
/// [property@HeaderBar:show-start-title-buttons] and
|
||||||
|
/// [property@HeaderBar:show-end-title-buttons] to `FALSE` to remove it if it's
|
||||||
|
/// unwanted.
|
||||||
|
///
|
||||||
/// ## Navigation View Integration
|
/// ## Navigation View Integration
|
||||||
///
|
///
|
||||||
/// When placed inside an [class@NavigationPage], `AdwHeaderBar` will display the
|
/// When placed inside an [class@NavigationPage], `AdwHeaderBar` will display the
|
||||||
@ -24,9 +33,10 @@ import LevenshteinTransformations
|
|||||||
/// When used together with [class@NavigationView] or [class@NavigationSplitView],
|
/// When used together with [class@NavigationView] or [class@NavigationSplitView],
|
||||||
/// it will also display a back button that can be used to go back to the previous
|
/// it will also display a back button that can be used to go back to the previous
|
||||||
/// page. The button also has a context menu, allowing to pop multiple pages at
|
/// page. The button also has a context menu, allowing to pop multiple pages at
|
||||||
/// once, potentially across multiple navigation views. In rare scenarios, set
|
/// once, potentially across multiple navigation views.
|
||||||
/// [property@HeaderBar:show-back-button] to `FALSE` to disable the back button
|
///
|
||||||
/// if it's unwanted (e.g. in an extra header bar on the same page).
|
/// Set [property@HeaderBar:show-back-button] to `FALSE` to disable this behavior
|
||||||
|
/// in rare scenarios where it's unwanted.
|
||||||
///
|
///
|
||||||
/// ## Split View Integration
|
/// ## Split View Integration
|
||||||
///
|
///
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// Label.swift
|
// Label.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
@ -15,7 +15,7 @@ import LevenshteinTransformations
|
|||||||
///
|
///
|
||||||
/// 
|
/// 
|
||||||
///
|
///
|
||||||
/// # CSS nodes
|
/// ## CSS nodes
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// label
|
/// label
|
||||||
@ -36,7 +36,7 @@ import LevenshteinTransformations
|
|||||||
/// carry the link or visited state depending on whether they have been
|
/// carry the link or visited state depending on whether they have been
|
||||||
/// visited. In this case, label node also gets a .link style class.
|
/// visited. In this case, label node also gets a .link style class.
|
||||||
///
|
///
|
||||||
/// # GtkLabel as GtkBuildable
|
/// ## GtkLabel as GtkBuildable
|
||||||
///
|
///
|
||||||
/// The GtkLabel implementation of the GtkBuildable interface supports a
|
/// The GtkLabel implementation of the GtkBuildable interface supports a
|
||||||
/// custom `<attributes>` element, which supports any number of `<attribute>`
|
/// custom `<attributes>` element, which supports any number of `<attribute>`
|
||||||
@ -45,6 +45,7 @@ import LevenshteinTransformations
|
|||||||
/// values for this label.
|
/// values for this label.
|
||||||
///
|
///
|
||||||
/// An example of a UI definition fragment specifying Pango attributes:
|
/// An example of a UI definition fragment specifying Pango attributes:
|
||||||
|
///
|
||||||
/// ```xml
|
/// ```xml
|
||||||
/// <object class="GtkLabel"><attributes><attribute name="weight" value="PANGO_WEIGHT_BOLD"/><attribute name="background" value="red" start="5" end="10"/></attributes></object>
|
/// <object class="GtkLabel"><attributes><attribute name="weight" value="PANGO_WEIGHT_BOLD"/><attribute name="background" value="red" start="5" end="10"/></attributes></object>
|
||||||
/// ```
|
/// ```
|
||||||
@ -55,11 +56,11 @@ import LevenshteinTransformations
|
|||||||
/// sense with translatable attributes. Use markup embedded in the translatable
|
/// sense with translatable attributes. Use markup embedded in the translatable
|
||||||
/// content instead.
|
/// content instead.
|
||||||
///
|
///
|
||||||
/// # Accessibility
|
/// ## Accessibility
|
||||||
///
|
///
|
||||||
/// `GtkLabel` uses the %GTK_ACCESSIBLE_ROLE_LABEL role.
|
/// `GtkLabel` uses the %GTK_ACCESSIBLE_ROLE_LABEL role.
|
||||||
///
|
///
|
||||||
/// # Mnemonics
|
/// ## Mnemonics
|
||||||
///
|
///
|
||||||
/// Labels may contain “mnemonics”. Mnemonics are underlined characters in the
|
/// Labels may contain “mnemonics”. Mnemonics are underlined characters in the
|
||||||
/// label, used for keyboard navigation. Mnemonics are created by providing a
|
/// label, used for keyboard navigation. Mnemonics are created by providing a
|
||||||
@ -100,7 +101,7 @@ import LevenshteinTransformations
|
|||||||
/// gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
|
/// gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// # Markup (styled text)
|
/// ## Markup (styled text)
|
||||||
///
|
///
|
||||||
/// To make it easy to format text in a label (changing colors,
|
/// To make it easy to format text in a label (changing colors,
|
||||||
/// fonts, etc.), label text can be provided in a simple
|
/// fonts, etc.), label text can be provided in a simple
|
||||||
@ -130,14 +131,14 @@ import LevenshteinTransformations
|
|||||||
/// end_index for a [struct@Pango.Attribute] requires knowledge of the exact
|
/// end_index for a [struct@Pango.Attribute] requires knowledge of the exact
|
||||||
/// string being displayed, so translations will cause problems.
|
/// string being displayed, so translations will cause problems.
|
||||||
///
|
///
|
||||||
/// # Selectable labels
|
/// ## Selectable labels
|
||||||
///
|
///
|
||||||
/// Labels can be made selectable with [method@Gtk.Label.set_selectable].
|
/// Labels can be made selectable with [method@Gtk.Label.set_selectable].
|
||||||
/// Selectable labels allow the user to copy the label contents to
|
/// Selectable labels allow the user to copy the label contents to
|
||||||
/// the clipboard. Only labels that contain useful-to-copy information
|
/// the clipboard. Only labels that contain useful-to-copy information—such
|
||||||
/// — such as error messages — should be made selectable.
|
/// as error messages—should be made selectable.
|
||||||
///
|
///
|
||||||
/// # Text layout
|
/// ## Text layout
|
||||||
///
|
///
|
||||||
/// A label can contain any number of paragraphs, but will have
|
/// A label can contain any number of paragraphs, but will have
|
||||||
/// performance problems if it contains more than a small number.
|
/// performance problems if it contains more than a small number.
|
||||||
@ -160,7 +161,7 @@ import LevenshteinTransformations
|
|||||||
/// is used as the natural width. Even if max-width-chars specified, wrapping
|
/// is used as the natural width. Even if max-width-chars specified, wrapping
|
||||||
/// labels will be rewrapped to use all of the available width.
|
/// labels will be rewrapped to use all of the available width.
|
||||||
///
|
///
|
||||||
/// # Links
|
/// ## Links
|
||||||
///
|
///
|
||||||
/// GTK supports markup for clickable hyperlinks in addition to regular Pango
|
/// GTK supports markup for clickable hyperlinks in addition to regular Pango
|
||||||
/// markup. The markup for links is borrowed from HTML, using the `<a>` with
|
/// markup. The markup for links is borrowed from HTML, using the `<a>` with
|
||||||
@ -169,7 +170,7 @@ import LevenshteinTransformations
|
|||||||
/// attribute is displayed as a tooltip on the link. The “class“ attribute is
|
/// attribute is displayed as a tooltip on the link. The “class“ attribute is
|
||||||
/// used as style class on the CSS node for the link.
|
/// used as style class on the CSS node for the link.
|
||||||
///
|
///
|
||||||
/// An example looks like this:
|
/// An example of inline links looks like this:
|
||||||
///
|
///
|
||||||
/// ```c
|
/// ```c
|
||||||
/// const char *text =
|
/// const char *text =
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// LevelBar.swift
|
// LevelBar.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// LinkButton.swift
|
// LinkButton.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// ListBox.swift
|
// ListBox.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// Menu.swift
|
// Menu.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// NavigationView.swift
|
// NavigationView.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
@ -51,7 +51,7 @@ import LevenshteinTransformations
|
|||||||
/// at once, potentially across multiple navigation views.
|
/// at once, potentially across multiple navigation views.
|
||||||
///
|
///
|
||||||
/// Set [property@HeaderBar:show-back-button] to `FALSE` to disable this behavior
|
/// Set [property@HeaderBar:show-back-button] to `FALSE` to disable this behavior
|
||||||
/// if it's unwanted.
|
/// in rare scenarios where it's unwanted.
|
||||||
///
|
///
|
||||||
/// `AdwHeaderBar` will also display the title of the `AdwNavigationPage` it's
|
/// `AdwHeaderBar` will also display the title of the `AdwNavigationPage` it's
|
||||||
/// placed into, so most applications shouldn't need to customize it at all.
|
/// placed into, so most applications shouldn't need to customize it at all.
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// Overlay.swift
|
// Overlay.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// OverlaySplitView.swift
|
// OverlaySplitView.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// PasswordEntryRow.swift
|
// PasswordEntryRow.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
@ -47,6 +47,8 @@ public struct PasswordEntryRow: Widget {
|
|||||||
/// operation, e.g. network activity, to avoid triggering it after typing every
|
/// operation, e.g. network activity, to avoid triggering it after typing every
|
||||||
/// character.
|
/// character.
|
||||||
var showApplyButton: Bool?
|
var showApplyButton: Bool?
|
||||||
|
/// The length of the text in the entry row.
|
||||||
|
var textLength: UInt?
|
||||||
/// The title of the preference represented by this row.
|
/// The title of the preference represented by this row.
|
||||||
///
|
///
|
||||||
/// The title is interpreted as Pango markup unless
|
/// The title is interpreted as Pango markup unless
|
||||||
@ -189,6 +191,14 @@ public struct PasswordEntryRow: Widget {
|
|||||||
return newSelf
|
return newSelf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The length of the text in the entry row.
|
||||||
|
public func textLength(_ textLength: UInt?) -> Self {
|
||||||
|
var newSelf = self
|
||||||
|
newSelf.textLength = textLength
|
||||||
|
|
||||||
|
return newSelf
|
||||||
|
}
|
||||||
|
|
||||||
/// The title of the preference represented by this row.
|
/// The title of the preference represented by this row.
|
||||||
///
|
///
|
||||||
/// The title is interpreted as Pango markup unless
|
/// The title is interpreted as Pango markup unless
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// Popover.swift
|
// Popover.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// PreferencesGroup.swift
|
// PreferencesGroup.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
@ -16,7 +16,7 @@ import LevenshteinTransformations
|
|||||||
/// which in turn are represented by [class@PreferencesRow].
|
/// which in turn are represented by [class@PreferencesRow].
|
||||||
///
|
///
|
||||||
/// To summarize the role of the preferences it gathers, a group can have both a
|
/// To summarize the role of the preferences it gathers, a group can have both a
|
||||||
/// title and a description. The title will be used by [class@PreferencesWindow]
|
/// title and a description. The title will be used by [class@PreferencesDialog]
|
||||||
/// to let the user look for a preference.
|
/// to let the user look for a preference.
|
||||||
///
|
///
|
||||||
/// ## AdwPreferencesGroup as GtkBuildable
|
/// ## AdwPreferencesGroup as GtkBuildable
|
||||||
|
|||||||
@ -2,13 +2,13 @@
|
|||||||
// PreferencesPage.swift
|
// PreferencesPage.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
import LevenshteinTransformations
|
import LevenshteinTransformations
|
||||||
|
|
||||||
/// A page from [class@PreferencesWindow].
|
/// A page from [class@PreferencesDialog].
|
||||||
///
|
///
|
||||||
/// <picture><source srcset="preferences-page-dark.png" media="(prefers-color-scheme: dark)"><img src="preferences-page.png" alt="preferences-page"></picture>
|
/// <picture><source srcset="preferences-page-dark.png" media="(prefers-color-scheme: dark)"><img src="preferences-page.png" alt="preferences-page"></picture>
|
||||||
///
|
///
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// PreferencesRow.swift
|
// PreferencesRow.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
@ -10,7 +10,7 @@ import LevenshteinTransformations
|
|||||||
|
|
||||||
/// A [class@Gtk.ListBoxRow] used to present preferences.
|
/// A [class@Gtk.ListBoxRow] used to present preferences.
|
||||||
///
|
///
|
||||||
/// The `AdwPreferencesRow` widget has a title that [class@PreferencesWindow]
|
/// The `AdwPreferencesRow` widget has a title that [class@PreferencesDialog]
|
||||||
/// will use to let the user look for a preference. It doesn't present the title
|
/// will use to let the user look for a preference. It doesn't present the title
|
||||||
/// in any way and lets you present the preference as you please.
|
/// in any way and lets you present the preference as you please.
|
||||||
///
|
///
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// ProgressBar.swift
|
// ProgressBar.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// ScrolledWindow.swift
|
// ScrolledWindow.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// SearchBar.swift
|
// SearchBar.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// SearchEntry.swift
|
// SearchEntry.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// SpinRow.swift
|
// SpinRow.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// Spinner.swift
|
// Spinner.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// SplitButton.swift
|
// SplitButton.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// StatusPage.swift
|
// StatusPage.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// SwitchRow.swift
|
// SwitchRow.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// ToastOverlay.swift
|
// ToastOverlay.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// ToggleButton.swift
|
// ToggleButton.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// ToolbarView.swift
|
// ToolbarView.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// WindowTitle.swift
|
// WindowTitle.swift
|
||||||
// Adwaita
|
// Adwaita
|
||||||
//
|
//
|
||||||
// Created by auto-generation on 17.02.24.
|
// Created by auto-generation on 20.03.24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
|||||||
@ -254,7 +254,11 @@ struct GenerationConfiguration {
|
|||||||
),
|
),
|
||||||
excludeProperties: ["selection-mode", "orientation"]
|
excludeProperties: ["selection-mode", "orientation"]
|
||||||
),
|
),
|
||||||
.init(class: "SearchEntry", bindings: [.init(property: "text")]),
|
.init(
|
||||||
|
class: "SearchEntry",
|
||||||
|
bindings: [.init(property: "text")],
|
||||||
|
excludeProperties: ["input-hints", "input-purpose"]
|
||||||
|
),
|
||||||
.init(class: "SearchBar")
|
.init(class: "SearchBar")
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@ -24,11 +24,6 @@ struct Demo: App {
|
|||||||
.icon(.default(icon: .applicationXExecutable))
|
.icon(.default(icon: .applicationXExecutable))
|
||||||
.website(.init(string: "https://david-swift.gitbook.io/adwaita"))
|
.website(.init(string: "https://david-swift.gitbook.io/adwaita"))
|
||||||
.issues(.init(string: "https://github.com/AparokshaUI/adwaita-swift/issues"))
|
.issues(.init(string: "https://github.com/AparokshaUI/adwaita-swift/issues"))
|
||||||
Window(id: "overlay", open: 0) { window in
|
|
||||||
OverlayWindowDemo.WindowContent(window: window)
|
|
||||||
}
|
|
||||||
.keyboardShortcut("Escape") { $0.close() }
|
|
||||||
.defaultSize(width: 300, height: 200)
|
|
||||||
}
|
}
|
||||||
HelperWindows()
|
HelperWindows()
|
||||||
}
|
}
|
||||||
|
|||||||
37
Tests/DialogDemo.swift
Normal file
37
Tests/DialogDemo.swift
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
//
|
||||||
|
// DialogDemo.swift
|
||||||
|
// Adwaita
|
||||||
|
//
|
||||||
|
// Created by david-swift on 20.13.24.
|
||||||
|
//
|
||||||
|
|
||||||
|
// swiftlint:disable missing_docs
|
||||||
|
|
||||||
|
import Adwaita
|
||||||
|
|
||||||
|
struct DialogDemo: View {
|
||||||
|
|
||||||
|
@State private var dialog = false
|
||||||
|
let padding = 20
|
||||||
|
|
||||||
|
var view: Body {
|
||||||
|
VStack {
|
||||||
|
Button("Show Dialog") {
|
||||||
|
dialog = true
|
||||||
|
}
|
||||||
|
.style("pill")
|
||||||
|
.frame(maxSize: 100)
|
||||||
|
.padding()
|
||||||
|
}
|
||||||
|
.dialog(visible: $dialog, title: "Counter") {
|
||||||
|
CounterDemo()
|
||||||
|
.padding(padding)
|
||||||
|
.topToolbar {
|
||||||
|
HeaderBar.empty()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// swiftlint:enable missing_docs
|
||||||
@ -1,51 +0,0 @@
|
|||||||
//
|
|
||||||
// OverlayWindowDemo.swift
|
|
||||||
// Adwaita
|
|
||||||
//
|
|
||||||
// Created by david-swift on 09.11.23.
|
|
||||||
//
|
|
||||||
|
|
||||||
// swiftlint:disable missing_docs implicitly_unwrapped_optional
|
|
||||||
|
|
||||||
import Adwaita
|
|
||||||
|
|
||||||
struct OverlayWindowDemo: View {
|
|
||||||
|
|
||||||
var app: GTUIApp!
|
|
||||||
var window: GTUIApplicationWindow
|
|
||||||
|
|
||||||
var view: Body {
|
|
||||||
VStack {
|
|
||||||
Button("Show Window") {
|
|
||||||
app.addWindow("overlay", parent: window)
|
|
||||||
}
|
|
||||||
.style("pill")
|
|
||||||
.frame(maxSize: 100)
|
|
||||||
.padding()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct WindowContent: View {
|
|
||||||
|
|
||||||
var window: GTUIWindow
|
|
||||||
|
|
||||||
var view: Body {
|
|
||||||
VStack {
|
|
||||||
Button("Close Window") {
|
|
||||||
window.close()
|
|
||||||
}
|
|
||||||
.style("pill")
|
|
||||||
.padding()
|
|
||||||
.frame(maxSize: 100)
|
|
||||||
}
|
|
||||||
.valign(.center)
|
|
||||||
.topToolbar {
|
|
||||||
HeaderBar.empty()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// swiftlint:enable missing_docs implicitly_unwrapped_optional
|
|
||||||
@ -17,7 +17,7 @@ enum Page: String, Identifiable, CaseIterable, Codable {
|
|||||||
case toolbar
|
case toolbar
|
||||||
case transition
|
case transition
|
||||||
case dice
|
case dice
|
||||||
case overlayWindow
|
case dialog
|
||||||
case toast
|
case toast
|
||||||
case list
|
case list
|
||||||
case carousel
|
case carousel
|
||||||
@ -33,8 +33,6 @@ enum Page: String, Identifiable, CaseIterable, Codable {
|
|||||||
|
|
||||||
var label: String {
|
var label: String {
|
||||||
switch self {
|
switch self {
|
||||||
case .overlayWindow:
|
|
||||||
return "Overlay Window"
|
|
||||||
case .viewSwitcher:
|
case .viewSwitcher:
|
||||||
return "View Switcher"
|
return "View Switcher"
|
||||||
case .flowBox:
|
case .flowBox:
|
||||||
@ -58,35 +56,35 @@ enum Page: String, Identifiable, CaseIterable, Codable {
|
|||||||
var description: String {
|
var description: String {
|
||||||
switch self {
|
switch self {
|
||||||
case .welcome:
|
case .welcome:
|
||||||
return "This is a collection of examples for the Swift Adwaita package."
|
return "This is a collection of examples for the Swift Adwaita package"
|
||||||
case .counter:
|
case .counter:
|
||||||
return "A simple sample view."
|
return "A simple sample view"
|
||||||
case .windows:
|
case .windows:
|
||||||
return "Showcase window management."
|
return "Showcase window management"
|
||||||
case .toolbar:
|
case .toolbar:
|
||||||
return "Toggle the bottom toolbar."
|
return "Toggle the bottom toolbar"
|
||||||
case .transition:
|
case .transition:
|
||||||
return "A slide transition between two views."
|
return "A slide transition between two views"
|
||||||
case .dice:
|
case .dice:
|
||||||
return "Roll the dice."
|
return "Roll the dice"
|
||||||
case .overlayWindow:
|
case .dialog:
|
||||||
return "A window on top of another window."
|
return "A window on top of another window"
|
||||||
case .toast:
|
case .toast:
|
||||||
return "Show a notification inside of your app."
|
return "Show a notification inside of your app"
|
||||||
case .list:
|
case .list:
|
||||||
return "Organize content in multiple rows."
|
return "Organize content in multiple rows"
|
||||||
case .carousel:
|
case .carousel:
|
||||||
return "Scroll horizontally on a touchpad or touchscreen, or scroll down on your mouse wheel."
|
return "Scroll horizontally on a touchpad or touchscreen, or scroll down on your mouse wheel"
|
||||||
case .viewSwitcher:
|
case .viewSwitcher:
|
||||||
return "Switch the window's view."
|
return "Switch the window's view"
|
||||||
case .form:
|
case .form:
|
||||||
return "Group controls used for data entry."
|
return "Group controls used for data entry"
|
||||||
case .popover:
|
case .popover:
|
||||||
return "Present content in a bubble-like context popup."
|
return "Present content in a bubble-like context popup"
|
||||||
case .flowBox:
|
case .flowBox:
|
||||||
return "Display views in a reflowing grid."
|
return "Display views in a reflowing grid"
|
||||||
case .navigationView:
|
case .navigationView:
|
||||||
return "A page-based navigation container."
|
return "A page-based navigation container"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,8 +104,8 @@ enum Page: String, Identifiable, CaseIterable, Codable {
|
|||||||
TransitionDemo()
|
TransitionDemo()
|
||||||
case .dice:
|
case .dice:
|
||||||
DiceDemo()
|
DiceDemo()
|
||||||
case .overlayWindow:
|
case .dialog:
|
||||||
OverlayWindowDemo(app: app, window: window)
|
DialogDemo()
|
||||||
case .toast:
|
case .toast:
|
||||||
ToastDemo(toast: toast)
|
ToastDemo(toast: toast)
|
||||||
case .list:
|
case .list:
|
||||||
|
|||||||
@ -20,7 +20,7 @@ There are many more widgets available using auto-generation. Learn [how to use t
|
|||||||
|
|
||||||
### View Modifiers
|
### View Modifiers
|
||||||
|
|
||||||
| Syntax | Description |
|
| Syntax | Description |
|
||||||
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
||||||
| `freeze(_:)` | Prevent a view from being updated. |
|
| `freeze(_:)` | Prevent a view from being updated. |
|
||||||
| `inspect(_:)` | Edit the underlying Gtk or Libadwaita widget. |
|
| `inspect(_:)` | Edit the underlying Gtk or Libadwaita widget. |
|
||||||
@ -31,7 +31,7 @@ There are many more widgets available using auto-generation. Learn [how to use t
|
|||||||
| `valign(_:)` | Set the vertical alignment of a view. |
|
| `valign(_:)` | Set the vertical alignment of a view. |
|
||||||
| `frame(minWidth:minHeight:)` | Set the view’s minimum width or height. |
|
| `frame(minWidth:minHeight:)` | Set the view’s minimum width or height. |
|
||||||
| `frame(maxWidth:)` | Set the view’s maximum width. |
|
| `frame(maxWidth:)` | Set the view’s maximum width. |
|
||||||
| `frame(maxHeight:)` | Set the view’s maximum height. |
|
| `frame(maxHeight:)` | Set the view’s maximum height. |
|
||||||
| `transition(_:)` | Assign a transition with the view that is used if it is a direct child of an EitherView. |
|
| `transition(_:)` | Assign a transition with the view that is used if it is a direct child of an EitherView. |
|
||||||
| `onUpdate(_:)` | Run a function every time a view gets updated. |
|
| `onUpdate(_:)` | Run a function every time a view gets updated. |
|
||||||
| `navigationTitle(_:)` | Add a title that is used if the view is a direct child of a NavigationView. |
|
| `navigationTitle(_:)` | Add a title that is used if the view is a direct child of a NavigationView. |
|
||||||
@ -51,6 +51,7 @@ There are many more widgets available using auto-generation. Learn [how to use t
|
|||||||
| `focus(_:)` | Bind a signal that focuses the view. |
|
| `focus(_:)` | Bind a signal that focuses the view. |
|
||||||
| `verticalCenter()` | Wrap a view in a `VStack` and center vertically. |
|
| `verticalCenter()` | Wrap a view in a `VStack` and center vertically. |
|
||||||
| `horizontalCenter()` | Wrap a view in an `HStack` and center horizontally. |
|
| `horizontalCenter()` | Wrap a view in an `HStack` and center horizontally. |
|
||||||
|
| `dialog(visible:title:content:)` | Add a dialog to the window containing the view. |
|
||||||
|
|
||||||
### `Button` Modifiers
|
### `Button` Modifiers
|
||||||
| Syntax | Description |
|
| Syntax | Description |
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user