From 4937c36b3b4db1f73925433e7a5855d5dc2423b3 Mon Sep 17 00:00:00 2001 From: david-swift Date: Sat, 27 Jan 2024 08:07:05 +0100 Subject: [PATCH] Improve updating performance And update docs reflecting the changes in the latest commits --- Documentation/Reference/README.md | 86 +- .../Reference/classes/GTUIAboutWindow.md | 30 + Documentation/Reference/classes/GTUIApp.md | 25 + .../classes/GTUIApplicationWindow.md | 29 + .../Reference/classes/GTUIFileDialog.md | 77 + Documentation/Reference/classes/GTUIWindow.md | 69 + .../Reference/classes/State.Storage.md | 4 + .../classes/ViewStorage.SignalData.md | 37 + .../Reference/classes/ViewStorage.md | 55 +- Documentation/Reference/enums/Alignment.md | 35 + Documentation/Reference/enums/Edge.md | 22 + .../Reference/enums/Icon.DefaultIcon.md | 1431 +++++++++++++++++ Documentation/Reference/enums/Icon.md | 21 + Documentation/Reference/enums/Transition.md | 25 + .../Reference/extensions/ActionRow.md | 9 + Documentation/Reference/extensions/Array.md | 7 +- Documentation/Reference/extensions/Banner.md | 19 + Documentation/Reference/extensions/Bool.md | 8 + Documentation/Reference/extensions/Button.md | 39 + .../Reference/extensions/Carousel.md | 10 + Documentation/Reference/extensions/Clamp.md | 9 + .../Reference/extensions/ComboRow.md | 17 + .../Reference/extensions/EntryRow.md | 26 + .../Reference/extensions/FormSection.md | 17 + .../Reference/extensions/HeaderBar.md | 35 + Documentation/Reference/extensions/Int.md | 12 + Documentation/Reference/extensions/List.md | 25 + Documentation/Reference/extensions/Menu.md | 23 + .../Reference/extensions/OpaquePointer.md | 9 + .../Reference/extensions/OverlaySplitView.md | 18 + .../Reference/extensions/PasswordEntryRow.md | 20 + .../Reference/extensions/ProgressBar.md | 11 + .../Reference/extensions/ScrollView.md | 9 + Documentation/Reference/extensions/Set.md | 39 + Documentation/Reference/extensions/SpinRow.md | 34 + Documentation/Reference/extensions/State.md | 3 +- .../Reference/extensions/StatusPage.md | 13 + Documentation/Reference/extensions/String.md | 31 + .../Reference/extensions/SwitchRow.md | 11 + Documentation/Reference/extensions/Text.md | 9 + .../Reference/extensions/ToastOverlay.md | 19 + Documentation/Reference/extensions/Toggle.md | 24 + Documentation/Reference/extensions/UInt.md | 8 + .../extensions/UnsafeMutablePointer.md | 14 + .../extensions/UnsafeMutableRawPointer.md | 9 + Documentation/Reference/extensions/VStack.md | 11 + Documentation/Reference/extensions/View.md | 46 +- .../Reference/extensions/WindowSceneGroup.md | 3 +- ...ledialog_on_open_cb(ptr_file_userData_).md | 7 + ...ledialog_on_save_cb(ptr_file_userData_).md | 7 + Documentation/Reference/protocols/Widget.md | 3 +- .../Reference/protocols/WindowScene.md | 3 +- .../Reference/structs/AboutWindow.md | 14 +- Documentation/Reference/structs/ActionRow.md | 233 ++- .../Reference/structs/AppearObserver.md | 3 +- Documentation/Reference/structs/Avatar.md | 106 ++ Documentation/Reference/structs/Banner.md | 128 +- Documentation/Reference/structs/Bin.md | 57 + Documentation/Reference/structs/Box.md | 118 ++ Documentation/Reference/structs/Button.md | 179 ++- .../Reference/structs/ButtonContent.md | 127 ++ Documentation/Reference/structs/Carousel.md | 147 +- Documentation/Reference/structs/CenterBox.md | 136 ++ .../Reference/structs/CheckButton.md | 187 +++ Documentation/Reference/structs/Clamp.md | 108 +- Documentation/Reference/structs/ComboRow.md | 284 +++- .../Reference/structs/ContentModifier.md | 3 +- Documentation/Reference/structs/EntryRow.md | 214 ++- .../Reference/structs/ExpanderRow.md | 217 +++ Documentation/Reference/structs/FileDialog.md | 8 +- Documentation/Reference/structs/Form.md | 17 +- Documentation/Reference/structs/HStack.md | 17 +- Documentation/Reference/structs/HeaderBar.md | 287 +++- .../Reference/structs/InspectorWrapper.md | 3 +- Documentation/Reference/structs/Label.md | 416 +++++ Documentation/Reference/structs/LevelBar.md | 197 +++ Documentation/Reference/structs/LinkButton.md | 176 ++ Documentation/Reference/structs/ListBox.md | 223 +++ Documentation/Reference/structs/Menu.md | 214 ++- Documentation/Reference/structs/MenuButton.md | 4 + .../Reference/structs/ModifierStopper.md | 3 +- .../Reference/structs/NavigationSplitView.md | 3 +- Documentation/Reference/structs/Overlay.md | 108 +- .../Reference/structs/OverlaySplitView.md | 286 +++- .../Reference/structs/PasswordEntryRow.md | 178 ++ .../Reference/structs/PreferencesGroup.md | 112 ++ .../Reference/structs/PreferencesPage.md | 104 ++ .../Reference/structs/PreferencesRow.md | 99 ++ .../Reference/structs/ProgressBar.md | 146 +- .../Reference/structs/ScrolledWindow.md | 310 ++++ Documentation/Reference/structs/SpinRow.md | 306 +++- Documentation/Reference/structs/Spinner.md | 63 + .../Reference/structs/SplitButton.md | 204 +++ Documentation/Reference/structs/State.md | 20 +- .../Reference/structs/StateWrapper.md | 3 +- Documentation/Reference/structs/StatusPage.md | 97 +- Documentation/Reference/structs/SwitchRow.md | 222 ++- .../Reference/structs/ToastOverlay.md | 71 +- .../Reference/structs/ToggleButton.md | 221 +++ .../Reference/structs/ToolbarView.md | 246 ++- Documentation/Reference/structs/ViewStack.md | 3 +- .../Reference/structs/ViewSwitcher.md | 3 +- Documentation/Reference/structs/Window.md | 9 +- .../Reference/structs/WindowTitle.md | 76 + .../Reference/typealiases/FormSection.md | 5 + Documentation/Reference/typealiases/List.md | 5 + .../Reference/typealiases/ScrollView.md | 5 + Documentation/Reference/typealiases/Text.md | 5 + Documentation/Reference/typealiases/Toggle.md | 5 + Documentation/Reference/typealiases/VStack.md | 5 + Sources/Adwaita/Model/Data Flow/State.swift | 21 +- Sources/Adwaita/Model/Extensions/Array.swift | 7 +- .../Model/User Interface/App/App.swift | 4 +- .../Model/User Interface/App/GTUIApp.swift | 2 +- .../Model/User Interface/View/View.swift | 8 +- .../Model/User Interface/View/Widget.swift | 3 +- .../User Interface/Window/WindowScene.swift | 3 +- .../Window/WindowSceneGroup.swift | 5 +- .../Adwaita/View/Generated/ActionRow.swift | 39 +- Sources/Adwaita/View/Generated/Avatar.swift | 19 +- Sources/Adwaita/View/Generated/Banner.swift | 17 +- Sources/Adwaita/View/Generated/Bin.swift | 9 +- Sources/Adwaita/View/Generated/Box.swift | 27 +- Sources/Adwaita/View/Generated/Button.swift | 19 +- .../View/Generated/ButtonContent.swift | 15 +- Sources/Adwaita/View/Generated/Carousel.swift | 21 +- .../Adwaita/View/Generated/CenterBox.swift | 15 +- .../Adwaita/View/Generated/CheckButton.swift | 17 +- Sources/Adwaita/View/Generated/Clamp.swift | 13 +- Sources/Adwaita/View/Generated/ComboRow.swift | 33 +- Sources/Adwaita/View/Generated/EntryRow.swift | 33 +- .../Adwaita/View/Generated/ExpanderRow.swift | 47 +- .../Adwaita/View/Generated/HeaderBar.swift | 31 +- Sources/Adwaita/View/Generated/Label.swift | 33 +- Sources/Adwaita/View/Generated/LevelBar.swift | 15 +- .../Adwaita/View/Generated/LinkButton.swift | 25 +- Sources/Adwaita/View/Generated/ListBox.swift | 13 +- Sources/Adwaita/View/Generated/Menu.swift | 25 +- Sources/Adwaita/View/Generated/Overlay.swift | 15 +- .../View/Generated/OverlaySplitView.swift | 27 +- .../View/Generated/PasswordEntryRow.swift | 21 +- .../View/Generated/PreferencesGroup.swift | 19 +- .../View/Generated/PreferencesPage.swift | 23 +- .../View/Generated/PreferencesRow.swift | 15 +- .../Adwaita/View/Generated/ProgressBar.swift | 17 +- .../View/Generated/ScrolledWindow.swift | 27 +- Sources/Adwaita/View/Generated/SpinRow.swift | 43 +- Sources/Adwaita/View/Generated/Spinner.swift | 9 +- .../Adwaita/View/Generated/SplitButton.swift | 19 +- .../Adwaita/View/Generated/StatusPage.swift | 15 +- .../Adwaita/View/Generated/SwitchRow.swift | 29 +- .../Adwaita/View/Generated/ToastOverlay.swift | 9 +- .../Adwaita/View/Generated/ToggleButton.swift | 21 +- .../Adwaita/View/Generated/ToolbarView.swift | 29 +- .../Adwaita/View/Generated/WindowTitle.swift | 15 +- .../View/Modifiers/AppearObserver.swift | 5 +- .../View/Modifiers/ContentModifier.swift | 5 +- .../View/Modifiers/InspectorWrapper.swift | 5 +- .../View/Modifiers/ModifierStopper.swift | 5 +- .../Adwaita/View/NavigationSplitView.swift | 11 +- Sources/Adwaita/View/StateWrapper.swift | 12 +- Sources/Adwaita/View/ViewStack.swift | 7 +- Sources/Adwaita/View/ViewSwitcher.swift | 3 +- Sources/Adwaita/Window/AboutWindow.swift | 3 +- Sources/Adwaita/Window/FileDialog.swift | 2 +- Sources/Adwaita/Window/Window.swift | 9 +- Sources/Generation/GIR/Class+.swift | 8 +- Sources/Generation/GIR/Class.swift | 5 +- Sources/Generation/GIR/Property.swift | 13 +- Tests/Demo.swift | 1 - user-manual/Information/Widgets.md | 15 - 171 files changed, 9273 insertions(+), 1017 deletions(-) create mode 100644 Documentation/Reference/classes/GTUIAboutWindow.md create mode 100644 Documentation/Reference/classes/GTUIApplicationWindow.md create mode 100644 Documentation/Reference/classes/GTUIFileDialog.md create mode 100644 Documentation/Reference/classes/GTUIWindow.md create mode 100644 Documentation/Reference/classes/ViewStorage.SignalData.md create mode 100644 Documentation/Reference/enums/Alignment.md create mode 100644 Documentation/Reference/enums/Edge.md create mode 100644 Documentation/Reference/enums/Icon.DefaultIcon.md create mode 100644 Documentation/Reference/enums/Icon.md create mode 100644 Documentation/Reference/enums/Transition.md create mode 100644 Documentation/Reference/extensions/ActionRow.md create mode 100644 Documentation/Reference/extensions/Banner.md create mode 100644 Documentation/Reference/extensions/Bool.md create mode 100644 Documentation/Reference/extensions/Button.md create mode 100644 Documentation/Reference/extensions/Carousel.md create mode 100644 Documentation/Reference/extensions/Clamp.md create mode 100644 Documentation/Reference/extensions/ComboRow.md create mode 100644 Documentation/Reference/extensions/EntryRow.md create mode 100644 Documentation/Reference/extensions/FormSection.md create mode 100644 Documentation/Reference/extensions/HeaderBar.md create mode 100644 Documentation/Reference/extensions/Int.md create mode 100644 Documentation/Reference/extensions/List.md create mode 100644 Documentation/Reference/extensions/Menu.md create mode 100644 Documentation/Reference/extensions/OpaquePointer.md create mode 100644 Documentation/Reference/extensions/OverlaySplitView.md create mode 100644 Documentation/Reference/extensions/PasswordEntryRow.md create mode 100644 Documentation/Reference/extensions/ProgressBar.md create mode 100644 Documentation/Reference/extensions/ScrollView.md create mode 100644 Documentation/Reference/extensions/Set.md create mode 100644 Documentation/Reference/extensions/SpinRow.md create mode 100644 Documentation/Reference/extensions/StatusPage.md create mode 100644 Documentation/Reference/extensions/SwitchRow.md create mode 100644 Documentation/Reference/extensions/Text.md create mode 100644 Documentation/Reference/extensions/ToastOverlay.md create mode 100644 Documentation/Reference/extensions/Toggle.md create mode 100644 Documentation/Reference/extensions/UInt.md create mode 100644 Documentation/Reference/extensions/UnsafeMutablePointer.md create mode 100644 Documentation/Reference/extensions/UnsafeMutableRawPointer.md create mode 100644 Documentation/Reference/extensions/VStack.md create mode 100644 Documentation/Reference/methods/filedialog_on_open_cb(ptr_file_userData_).md create mode 100644 Documentation/Reference/methods/filedialog_on_save_cb(ptr_file_userData_).md create mode 100644 Documentation/Reference/structs/Avatar.md create mode 100644 Documentation/Reference/structs/Bin.md create mode 100644 Documentation/Reference/structs/Box.md create mode 100644 Documentation/Reference/structs/ButtonContent.md create mode 100644 Documentation/Reference/structs/CenterBox.md create mode 100644 Documentation/Reference/structs/CheckButton.md create mode 100644 Documentation/Reference/structs/ExpanderRow.md create mode 100644 Documentation/Reference/structs/Label.md create mode 100644 Documentation/Reference/structs/LevelBar.md create mode 100644 Documentation/Reference/structs/LinkButton.md create mode 100644 Documentation/Reference/structs/ListBox.md create mode 100644 Documentation/Reference/structs/PasswordEntryRow.md create mode 100644 Documentation/Reference/structs/PreferencesGroup.md create mode 100644 Documentation/Reference/structs/PreferencesPage.md create mode 100644 Documentation/Reference/structs/PreferencesRow.md create mode 100644 Documentation/Reference/structs/ScrolledWindow.md create mode 100644 Documentation/Reference/structs/Spinner.md create mode 100644 Documentation/Reference/structs/SplitButton.md create mode 100644 Documentation/Reference/structs/ToggleButton.md create mode 100644 Documentation/Reference/structs/WindowTitle.md create mode 100644 Documentation/Reference/typealiases/FormSection.md create mode 100644 Documentation/Reference/typealiases/List.md create mode 100644 Documentation/Reference/typealiases/ScrollView.md create mode 100644 Documentation/Reference/typealiases/Text.md create mode 100644 Documentation/Reference/typealiases/Toggle.md create mode 100644 Documentation/Reference/typealiases/VStack.md diff --git a/Documentation/Reference/README.md b/Documentation/Reference/README.md index 5de46ae..21f4cfd 100644 --- a/Documentation/Reference/README.md +++ b/Documentation/Reference/README.md @@ -18,22 +18,30 @@ - [AboutWindow](structs/AboutWindow.md) - [ActionRow](structs/ActionRow.md) - [AppearObserver](structs/AppearObserver.md) +- [Avatar](structs/Avatar.md) - [Banner](structs/Banner.md) +- [Bin](structs/Bin.md) - [Binding](structs/Binding.md) +- [Box](structs/Box.md) - [Button](structs/Button.md) +- [ButtonContent](structs/ButtonContent.md) - [Carousel](structs/Carousel.md) +- [CenterBox](structs/CenterBox.md) +- [CheckButton](structs/CheckButton.md) - [Clamp](structs/Clamp.md) - [ComboRow](structs/ComboRow.md) -- [Container](structs/Container.md) - [ContentModifier](structs/ContentModifier.md) - [EntryRow](structs/EntryRow.md) +- [ExpanderRow](structs/ExpanderRow.md) - [FileDialog](structs/FileDialog.md) - [Form](structs/Form.md) -- [FormSection](structs/FormSection.md) - [HStack](structs/HStack.md) - [HeaderBar](structs/HeaderBar.md) - [InspectorWrapper](structs/InspectorWrapper.md) -- [List](structs/List.md) +- [Label](structs/Label.md) +- [LevelBar](structs/LevelBar.md) +- [LinkButton](structs/LinkButton.md) +- [ListBox](structs/ListBox.md) - [Menu](structs/Menu.md) - [MenuButton](structs/MenuButton.md) - [MenuSection](structs/MenuSection.md) @@ -41,50 +49,91 @@ - [NavigationSplitView](structs/NavigationSplitView.md) - [Overlay](structs/Overlay.md) - [OverlaySplitView](structs/OverlaySplitView.md) +- [PasswordEntryRow](structs/PasswordEntryRow.md) +- [PreferencesGroup](structs/PreferencesGroup.md) +- [PreferencesPage](structs/PreferencesPage.md) +- [PreferencesRow](structs/PreferencesRow.md) - [ProgressBar](structs/ProgressBar.md) -- [ScrollView](structs/ScrollView.md) +- [ScrolledWindow](structs/ScrolledWindow.md) - [Signal](structs/Signal.md) - [SpinRow](structs/SpinRow.md) +- [Spinner](structs/Spinner.md) +- [SplitButton](structs/SplitButton.md) - [State](structs/State.md) - [StateWrapper](structs/StateWrapper.md) - [StatusPage](structs/StatusPage.md) - [Submenu](structs/Submenu.md) - [SwitchRow](structs/SwitchRow.md) -- [Text](structs/Text.md) - [ToastOverlay](structs/ToastOverlay.md) -- [Toggle](structs/Toggle.md) +- [ToggleButton](structs/ToggleButton.md) - [ToolbarView](structs/ToolbarView.md) -- [VStack](structs/VStack.md) - [ViewStack](structs/ViewStack.md) - [ViewSwitcher](structs/ViewSwitcher.md) - [Window](structs/Window.md) +- [WindowTitle](structs/WindowTitle.md) ## Classes +- [GTUIAboutWindow](classes/GTUIAboutWindow.md) - [GTUIApp](classes/GTUIApp.md) +- [GTUIApplicationWindow](classes/GTUIApplicationWindow.md) +- [GTUIFileDialog](classes/GTUIFileDialog.md) +- [GTUIWindow](classes/GTUIWindow.md) - [State.Content](classes/State.Content.md) - [State.Storage](classes/State.Storage.md) - [ViewStorage](classes/ViewStorage.md) +- [ViewStorage.SignalData](classes/ViewStorage.SignalData.md) - [WindowStorage](classes/WindowStorage.md) ## Enums +- [Alignment](enums/Alignment.md) - [ArrayBuilder](enums/ArrayBuilder.md) - [ArrayBuilder.Component](enums/ArrayBuilder.Component.md) +- [Edge](enums/Edge.md) +- [Icon](enums/Icon.md) +- [Icon.DefaultIcon](enums/Icon.DefaultIcon.md) +- [Transition](enums/Transition.md) - [ViewBuilder](enums/ViewBuilder.md) - [ViewBuilder.Component](enums/ViewBuilder.Component.md) ## Extensions +- [ActionRow](extensions/ActionRow.md) - [App](extensions/App.md) - [Array](extensions/Array.md) -- [GTUIWindow](extensions/GTUIWindow.md) -- [Libadwaita.FileDialog](extensions/Libadwaita.FileDialog.md) +- [Banner](extensions/Banner.md) +- [Bool](extensions/Bool.md) +- [Button](extensions/Button.md) +- [Carousel](extensions/Carousel.md) +- [Clamp](extensions/Clamp.md) +- [ComboRow](extensions/ComboRow.md) +- [EntryRow](extensions/EntryRow.md) +- [FormSection](extensions/FormSection.md) +- [HeaderBar](extensions/HeaderBar.md) +- [Int](extensions/Int.md) +- [List](extensions/List.md) +- [Menu](extensions/Menu.md) - [MenuItem](extensions/MenuItem.md) - [MenuItemGroup](extensions/MenuItemGroup.md) -- [NativeWidgetPeer](extensions/NativeWidgetPeer.md) +- [OpaquePointer](extensions/OpaquePointer.md) +- [OverlaySplitView](extensions/OverlaySplitView.md) +- [PasswordEntryRow](extensions/PasswordEntryRow.md) +- [ProgressBar](extensions/ProgressBar.md) +- [ScrollView](extensions/ScrollView.md) +- [Set](extensions/Set.md) +- [SpinRow](extensions/SpinRow.md) - [State](extensions/State.md) +- [StatusPage](extensions/StatusPage.md) - [String](extensions/String.md) +- [SwitchRow](extensions/SwitchRow.md) +- [Text](extensions/Text.md) +- [ToastOverlay](extensions/ToastOverlay.md) +- [Toggle](extensions/Toggle.md) +- [UInt](extensions/UInt.md) +- [UnsafeMutablePointer](extensions/UnsafeMutablePointer.md) +- [UnsafeMutableRawPointer](extensions/UnsafeMutableRawPointer.md) +- [VStack](extensions/VStack.md) - [View](extensions/View.md) - [Widget](extensions/Widget.md) - [WindowScene](extensions/WindowScene.md) @@ -92,16 +141,21 @@ ## Typealiases -- [Alignment](typealiases/Alignment.md) - [Body](typealiases/Body.md) -- [Edge](typealiases/Edge.md) -- [GTUIApplicationWindow](typealiases/GTUIApplicationWindow.md) -- [GTUIWindow](typealiases/GTUIWindow.md) -- [Icon](typealiases/Icon.md) +- [FormSection](typealiases/FormSection.md) +- [List](typealiases/List.md) - [MenuBuilder](typealiases/MenuBuilder.md) - [MenuContent](typealiases/MenuContent.md) - [Scene](typealiases/Scene.md) - [SceneBuilder](typealiases/SceneBuilder.md) -- [Transition](typealiases/Transition.md) +- [ScrollView](typealiases/ScrollView.md) +- [Text](typealiases/Text.md) +- [Toggle](typealiases/Toggle.md) +- [VStack](typealiases/VStack.md) + +## Methods + +- [filedialog_on_open_cb(ptr_file_userData_)](methods/filedialog_on_open_cb(ptr_file_userData_).md) +- [filedialog_on_save_cb(ptr_file_userData_)](methods/filedialog_on_save_cb(ptr_file_userData_).md) This file was generated by [SourceDocs](https://github.com/eneko/SourceDocs) \ No newline at end of file diff --git a/Documentation/Reference/classes/GTUIAboutWindow.md b/Documentation/Reference/classes/GTUIAboutWindow.md new file mode 100644 index 0000000..3ddf50b --- /dev/null +++ b/Documentation/Reference/classes/GTUIAboutWindow.md @@ -0,0 +1,30 @@ +**CLASS** + +# `GTUIAboutWindow` + +A GTUI about window. + +## Methods +### `init(filePath:)` + +Initialize an about window using the AppStream metadata. +- Parameter filePath: The path. + +### `generalData(title:icon:developer:version:)` + +Set the general data. +- Parameters: + - title: The app name. + - icon: The app icon. + - developer: The app's developer. + - version: The app's version. + +### `website(url:)` + +Set the website. +- Parameter url: The website. + +### `issues(url:)` + +Set the URL for issues. +- Parameter issues: The issues website. diff --git a/Documentation/Reference/classes/GTUIApp.md b/Documentation/Reference/classes/GTUIApp.md index a88b8e5..e3f0d97 100644 --- a/Documentation/Reference/classes/GTUIApp.md +++ b/Documentation/Reference/classes/GTUIApp.md @@ -13,6 +13,14 @@ The handlers which are called when a state changes. The app's id for the file name for storing the data. +### `pointer` + +The pointer to the application. + +### `fields` + +Fields for additional information. + ### `body` The app's content. @@ -37,6 +45,19 @@ Initialize the GTUI application. The entry point of the application. +### `run()` + +Run the application. + +### `addKeyboardShortcut(_:id:window:handler:)` + +Add a keyboard shortcut to the application. +- Parameters: + - shortcut: The keyboard shortcut. + - id: The action's id. + - window: Optionally an application window. + - handler: The action's handler. + ### `showWindow(_:)` Focus the window with a certain id. Create the window if it doesn't already exist. @@ -53,3 +74,7 @@ Add a new window with the content of the window with a certain id. ### `setParentWindows()` Set the parents of every window having a parent window. + +### `quit()` + +Terminate the application. diff --git a/Documentation/Reference/classes/GTUIApplicationWindow.md b/Documentation/Reference/classes/GTUIApplicationWindow.md new file mode 100644 index 0000000..04c3e96 --- /dev/null +++ b/Documentation/Reference/classes/GTUIApplicationWindow.md @@ -0,0 +1,29 @@ +**CLASS** + +# `GTUIApplicationWindow` + +A GTUI application window. + +## Properties +### `app` + +The window's parent app. + +## Methods +### `init(app:)` + +Initialize the application window. +- Parameter app: The application. + +### `addKeyboardShortcut(_:id:handler:)` + +Add a keyboard shortcut. +- Parameters: + - shortcut: The keyboard shortcut. + - id: The action's id. + - handler: The action's handler. + +### `setChild(_:)` + +Set the window's child. +- Parameter child: The child. diff --git a/Documentation/Reference/classes/GTUIFileDialog.md b/Documentation/Reference/classes/GTUIFileDialog.md new file mode 100644 index 0000000..988a882 --- /dev/null +++ b/Documentation/Reference/classes/GTUIFileDialog.md @@ -0,0 +1,77 @@ +**CLASS** + +# `GTUIFileDialog` + +A GTUI file dialog window. + +## Properties +### `pointer` + +The file dialog's pointer. + +### `fields` + +Fields for additional data. + +### `selfAddr` + +A link to the file dialog. + +### `parent` + +The parent window. + +### `isImporter` + +Whether the file dialog is an importer. + +### `folder` + +The selected folder in the file dialog. + +### `onResult` + +A closure triggered on selecting a file in the dialog. + +### `onCancel` + +A closure triggered when the dialog is canceled. + +## Methods +### `init()` + +Initialize the window. + +### `setParentWindow(_:)` + +Set the window's parent window. +- Parameter parent: The parent window. + +### `setInitialName(_:)` + +Set the initial name. +- Parameter name: The parent window. + +### `setExtensions(_:)` + +Set the allowed file extensions. +- Parameters: + - extensions: The file extensions. + +### `show()` + +Display the file dialog. + +### `onOpen(_:)` + +Run this when a file gets opened. +- Parameter path: The file path. + +### `onSave(_:)` + +Run this when a file gets saved. +- Parameter path: The file path. + +### `onClose()` + +Run this when the user cancels the action. diff --git a/Documentation/Reference/classes/GTUIWindow.md b/Documentation/Reference/classes/GTUIWindow.md new file mode 100644 index 0000000..963e1ea --- /dev/null +++ b/Documentation/Reference/classes/GTUIWindow.md @@ -0,0 +1,69 @@ +**CLASS** + +# `GTUIWindow` + +A GTUI window. + +## Properties +### `pointer` + +The window's pointer. + +### `fields` + +Fields for additional information. + +## Methods +### `init()` + +Initialize the window. + +### `init(fields:)` + +Initialize the window, but not the pointer. +- Parameter fields: The fields. + +### `setDefaultSize(width:height:)` + +Set the default window size. +- Parameters: + - width: The width. + - height: The height. + +### `setResizability(_:)` + +Set the resizability. +- Parameter resizable: Whether the window is resizable. + +### `setDeletability(_:)` + +Set the deletability. +- Parameter deletable: Whether the window is deletable. + +### `setTitle(_:)` + +Set the window title. +- Parameter title: The window's title. + +### `setChild(_:)` + +Set the window's child. +- Parameter child: The child. + +### `show()` + +Present the window. + +### `observeHide(observer:)` + +Observe when the window is being closed. +- Parameter observer: The signal closure. + +### `close()` + +Close the window. + +### `setParentWindow(_:)` + +Set the window's parent window. +- Parameter parent: The parent window. diff --git a/Documentation/Reference/classes/State.Storage.md b/Documentation/Reference/classes/State.Storage.md index c284024..fa2c671 100644 --- a/Documentation/Reference/classes/State.Storage.md +++ b/Documentation/Reference/classes/State.Storage.md @@ -17,6 +17,10 @@ The storage key. The folder path. +### `update` + +Whether to update the affected views. + ## Methods ### `init(value:)` diff --git a/Documentation/Reference/classes/ViewStorage.SignalData.md b/Documentation/Reference/classes/ViewStorage.SignalData.md new file mode 100644 index 0000000..288ab25 --- /dev/null +++ b/Documentation/Reference/classes/ViewStorage.SignalData.md @@ -0,0 +1,37 @@ +**CLASS** + +# `ViewStorage.SignalData` + +Data to pass to signal handlers. + +## Properties +### `closure` + +The closure. + +### `handler` + +The closure as a C handler. + +### `threeParamsHandler` + +The closure as a C handler with three parameters. + +### `fourParamsHandler` + +The closure as a C handler with four parameters. + +### `fiveParamsHandler` + +The closure as a C handler with five parameters. + +## Methods +### `init(closure:)` + +Initialize the signal data. +- Parameter closure: The signal's closure. + +### `init(closure:)` + +Initialize the signal data. +- Parameter closure: The signal's closure. diff --git a/Documentation/Reference/classes/ViewStorage.md b/Documentation/Reference/classes/ViewStorage.md index 3e0cdea..4a9ecf9 100644 --- a/Documentation/Reference/classes/ViewStorage.md +++ b/Documentation/Reference/classes/ViewStorage.md @@ -5,9 +5,9 @@ Store a rendered view in a view storage. ## Properties -### `view` +### `pointer` -The GTUI widget. +The pointer. ### `content` @@ -17,11 +17,60 @@ The view's content. The view's state (used in `StateWrapper`). +### `handlers` + +The signal handlers. + +### `fields` + +Other properties. + ## Methods ### `init(_:content:state:)` Initialize a view storage. - Parameters: - - view: The GTUI widget. + - pointer: The pointer to the Gtk widget. - content: The view's content. - state: The view's state. + +### `notify(name:id:connectFlags:handler:)` + +Connect a handler to the observer of a property. +- Parameters: + - name: The property's name. + - id: The handlers id to separate form others connecting to the signal. + - connectFlags: The GConnectFlags. + - handler: The signal's handler. + +### `connectSignal(name:id:connectFlags:argCount:handler:)` + +Connect a handler to a signal. +- Parameters: + - name: The signal's name. + - id: The handlers id to separate form others connecting to the signal. + - connectFlags: The GConnectFlags. + - argCount: The number of additional arguments (without the first and the last one). + - handler: The signal's handler. + +### `connectSignal(name:id:connectFlags:argCount:handler:)` + +Connect a handler to a signal. +- Parameters: + - name: The signal's name. + - id: The handlers id to separate form others connecting to the signal. + - connectFlags: The GConnectFlags. + - argCount: The number of additional arguments (without the first and the last one). + - handler: The signal's handler. + +### `modify(_:)` + +Modify the view. +- Parameter modify: The modification function. + +### `modify(_:_:)` + +Convert the pointer to a pointer of a certain type and modify the view. +- Parameters: + - type: The pointer's type. + - modify: The modification function. diff --git a/Documentation/Reference/enums/Alignment.md b/Documentation/Reference/enums/Alignment.md new file mode 100644 index 0000000..ce7a695 --- /dev/null +++ b/Documentation/Reference/enums/Alignment.md @@ -0,0 +1,35 @@ +**ENUM** + +# `Alignment` + +The alignment for a widget. + +## Cases +### `fill` + +The widget will fill the available space. + +### `start` + +The widget will start at the beginning of the available space. + +### `end` + +The widget will end at the end of the available space. + +### `center` + +The widget will be centered in the available space. + +### `baselineFill` + +The widget will be baseline aligned in the available space. + +### `baselineCenter` + +The widget will be baseline aligned at the start of the available space. + +## Properties +### `cAlign` + +Get the GtkAlign alignment. diff --git a/Documentation/Reference/enums/Edge.md b/Documentation/Reference/enums/Edge.md new file mode 100644 index 0000000..88355b6 --- /dev/null +++ b/Documentation/Reference/enums/Edge.md @@ -0,0 +1,22 @@ +**ENUM** + +# `Edge` + +The edges for a widget. + +## Cases +### `leading` + +The leading (start) edge. + +### `trailing` + +The trailing (end) edge. + +### `top` + +The top edge. + +### `bottom` + +The bottom edge. diff --git a/Documentation/Reference/enums/Icon.DefaultIcon.md b/Documentation/Reference/enums/Icon.DefaultIcon.md new file mode 100644 index 0000000..aab9784 --- /dev/null +++ b/Documentation/Reference/enums/Icon.DefaultIcon.md @@ -0,0 +1,1431 @@ +**ENUM** + +# `Icon.DefaultIcon` + +A preinstalled icon. + +## Cases +### `acAdapter` + +### `accessoriesCalculator` + +### `accessoriesCharacterMap` + +### `accessoriesDictionary` + +### `accessoriesTextEditor` + +### `actionUnavailable` + +### `addressBookNew` + +### `airplaneMode` + +### `alarm` + +### `appRemove` + +### `appletsScreenshooter` + +### `applicationCertificate` + +### `applicationExitRtl` + +### `applicationExit` + +### `applicationRss_plus_xml` + +### `applicationXAddon` + +### `applicationXAppliance` + +### `applicationXExecutable` + +### `applicationXFirmware` + +### `applicationXSharedlib` + +### `applicationsEngineering` + +### `applicationsGames` + +### `applicationsGraphics` + +### `applicationsMultimedia` + +### `applicationsScience` + +### `applicationsSystem` + +### `applicationsUtilities` + +### `appointmentMissed` + +### `appointmentNew` + +### `appointmentSoon` + +### `audioCard` + +### `audioHeadphones` + +### `audioHeadset` + +### `audioInputMicrophone` + +### `audioSpeakersRtl` + +### `audioSpeakers` + +### `audioVolumeHighRtl` + +### `audioVolumeHigh` + +### `audioVolumeLowRtl` + +### `audioVolumeLow` + +### `audioVolumeMediumRtl` + +### `audioVolumeMedium` + +### `audioVolumeMutedRtl` + +### `audioVolumeMuted` + +### `audioVolumeOveramplifiedRtl` + +### `audioVolumeOveramplified` + +### `audioXGeneric` + +### `authFace` + +### `authFingerprint` + +### `authSimLocked` + +### `authSimMissing` + +### `authSim` + +### `authSmartcard` + +### `avatarDefault` + +### `batteryAction` + +### `batteryCautionCharging` + +### `batteryCaution` + +### `batteryEmptyCharging` + +### `batteryEmpty` + +### `batteryFullCharged` + +### `batteryFullCharging` + +### `batteryFull` + +### `batteryGoodCharging` + +### `batteryGood` + +### `batteryLevel_0Charging` + +### `batteryLevel_0` + +### `batteryLevel_10Charging` + +### `batteryLevel_10` + +### `batteryLevel_100Charged` + +### `batteryLevel_100` + +### `batteryLevel_20Charging` + +### `batteryLevel_20` + +### `batteryLevel_30Charging` + +### `batteryLevel_30` + +### `batteryLevel_40Charging` + +### `batteryLevel_40` + +### `batteryLevel_50Charging` + +### `batteryLevel_50` + +### `batteryLevel_60Charging` + +### `batteryLevel_60` + +### `batteryLevel_70Charging` + +### `batteryLevel_70` + +### `batteryLevel_80Charging` + +### `batteryLevel_80` + +### `batteryLevel_90Charging` + +### `batteryLevel_90` + +### `batteryLowCharging` + +### `batteryLow` + +### `batteryMissing` + +### `battery` + +### `bluetoothAcquiring` + +### `bluetoothActive` + +### `bluetoothDisabled` + +### `bluetoothDisconnected` + +### `bluetoothHardwareDisabled` + +### `bluetooth` + +### `bookmarkNew` + +### `callIncoming` + +### `callMissed` + +### `callOutgoing` + +### `callStart` + +### `callStop` + +### `cameraDisabled` + +### `cameraHardwareDisabled` + +### `cameraPhoto` + +### `cameraSwitch` + +### `cameraVideo` + +### `cameraWeb` + +### `capsLock` + +### `changesAllow` + +### `changesPrevent` + +### `channelInsecure` + +### `channelSecure` + +### `chatMessageNew` + +### `checkboxChecked` + +### `checkboxMixed` + +### `checkbox` + +### `colorSelect` + +### `colorimeterColorhug` + +### `completionSnippet` + +### `completionWord` + +### `computerAppleIpad` + +### `computerFail` + +### `computer` + +### `contactNew` + +### `contentLoading` + +### `daytimeSunrise` + +### `daytimeSunset` + +### `dialogError` + +### `dialogInformation` + +### `dialogPassword` + +### `dialogQuestion` + +### `dialogWarning` + +### `displayBrightness` + +### `displayProjector` + +### `documentEdit` + +### `documentNew` + +### `documentOpenRecent` + +### `documentOpen` + +### `documentPageSetup` + +### `documentPrintPreview` + +### `documentPrint` + +### `documentProperties` + +### `documentRevertRtl` + +### `documentRevert` + +### `documentSaveAs` + +### `documentSave` + +### `documentSend` + +### `driveHarddiskIeee1394` + +### `driveHarddiskSolidstate` + +### `driveHarddisk` + +### `driveHarddiskSystem` + +### `driveHarddiskUsb` + +### `driveMultidisk` + +### `driveOptical` + +### `driveRemovableMedia` + +### `editClearAll` + +### `editClearRtl` + +### `editClear` + +### `editCopy` + +### `editCut` + +### `editDelete` + +### `editFindReplace` + +### `editFind` + +### `editPaste` + +### `editRedo` + +### `editSelectAll` + +### `editSelect` + +### `editUndo` + +### `emblemDefault` + +### `emblemDocuments` + +### `emblemFavorite` + +### `emblemImportant` + +### `emblemMusic` + +### `emblemOk` + +### `emblemPhotos` + +### `emblemShared` + +### `emblemSynchronizing` + +### `emblemSystem` + +### `emblemVideos` + +### `emojiActivities` + +### `emojiBody` + +### `emojiFlags` + +### `emojiFood` + +### `emojiNature` + +### `emojiObjects` + +### `emojiPeople` + +### `emojiRecent` + +### `emojiSymbols` + +### `emojiTravel` + +### `emoteLove` + +### `errorCorrect` + +### `faceAngel` + +### `faceAngry` + +### `faceConfused` + +### `faceCool` + +### `faceCrying` + +### `faceDevilish` + +### `faceEmbarrassed` + +### `faceGlasses` + +### `faceKiss` + +### `faceLaugh` + +### `faceMonkey` + +### `facePlain` + +### `faceRaspberry` + +### `faceSad` + +### `faceShutmouth` + +### `faceSick` + +### `faceSmileBig` + +### `faceSmile` + +### `faceSmirk` + +### `faceSurprise` + +### `faceTired` + +### `faceUncertain` + +### `faceWink` + +### `faceWorried` + +### `faceYawn` + +### `findLocation` + +### `focusLegacySystray` + +### `focusTopBar` + +### `focusWindows` + +### `folderDocuments` + +### `folderDownload` + +### `folderDragAccept` + +### `folderMusic` + +### `folderNew` + +### `folderOpen` + +### `folderPictures` + +### `folderPublicshare` + +### `folderRemote` + +### `folderSavedSearch` + +### `folder` + +### `folderTemplates` + +### `folderVideos` + +### `folderVisiting` + +### `fontSelect` + +### `fontXGeneric` + +### `formatIndentLessRtl` + +### `formatIndentLess` + +### `formatIndentMoreRtl` + +### `formatIndentMore` + +### `formatJustifyCenter` + +### `formatJustifyFill` + +### `formatJustifyLeft` + +### `formatJustifyRight` + +### `formatTextBold` + +### `formatTextDirectionLtr` + +### `formatTextDirectionRtl` + +### `formatTextDirection` + +### `formatTextItalic` + +### `formatTextPlaintext` + +### `formatTextRich` + +### `formatTextStrikethrough` + +### `formatTextUnderline` + +### `functionLinear` + +### `gestureSwipeLeft` + +### `gestureSwipeRight` + +### `gnomeDisksStateStandby` + +### `gnomePowerManager` + +### `goBottom` + +### `goDown` + +### `goFirst` + +### `goHome` + +### `goJumpRtl` + +### `goJump` + +### `goLast` + +### `goNext` + +### `goPrevious` + +### `goTop` + +### `goUp` + +### `goaAccountExchange` + +### `goaAccountGoogle` + +### `goaAccountLastfm` + +### `goaAccountMsn` + +### `goaAccountOwncloud` + +### `goaAccount` + +### `goaPanel` + +### `gtk3Demo` + +### `gtk3WidgetFactory` + +### `helpAbout` + +### `helpBrowser` + +### `helpContents` + +### `helpFaq` + +### `imageLoading` + +### `imageMissing` + +### `imageXGeneric` + +### `info` + +### `inodeDirectory` + +### `inputDialpad` + +### `inputGaming` + +### `inputKeyboard` + +### `inputMouse` + +### `inputTablet` + +### `inputTouchpad` + +### `insertImage` + +### `insertLink` + +### `insertObject` + +### `insertText` + +### `keyboardBrightness` + +### `langClass` + +### `langDefine` + +### `langEnum` + +### `langEnumValue` + +### `langFunction` + +### `langInclude` + +### `langMethod` + +### `langNamespace` + +### `langStructField` + +### `langStruct` + +### `langTypedef` + +### `langUnion` + +### `langVariable` + +### `libreofficeBase` + +### `libreofficeCalc` + +### `libreofficeDraw` + +### `libreofficeImpress` + +### `libreofficeMain` + +### `libreofficeMath` + +### `libreofficeWriter` + +### `listAdd` + +### `listDragHandle` + +### `listRemoveAll` + +### `listRemove` + +### `locationServicesActive` + +### `locationServicesDisabled` + +### `mailAttachment` + +### `mailForward` + +### `mailMarkImportant` + +### `mailMarkJunk` + +### `mailMarkNotjunk` + +### `mailMessageNew` + +### `mailRead` + +### `mailRepliedRtl` + +### `mailReplied` + +### `mailReplyAllRtl` + +### `mailReplyAll` + +### `mailReplySender` + +### `mailSendReceive` + +### `mailSend` + +### `mailUnread` + +### `markLocation` + +### `mediaEject` + +### `mediaFlash` + +### `mediaFloppy` + +### `mediaOpticalBd` + +### `mediaOpticalCdAudio` + +### `mediaOpticalCd` + +### `mediaOpticalDvd` + +### `mediaOptical` + +### `mediaPlaybackPause` + +### `mediaPlaybackStart` + +### `mediaPlaybackStop` + +### `mediaPlaylistConsecutive` + +### `mediaPlaylistRepeatSong` + +### `mediaPlaylistRepeat` + +### `mediaPlaylistShuffle` + +### `mediaRecord` + +### `mediaRemovable` + +### `mediaSeekBackward` + +### `mediaSeekForward` + +### `mediaSkipBackward` + +### `mediaSkipForward` + +### `mediaTape` + +### `mediaViewSubtitles` + +### `mediaZip` + +### `microphoneDisabled` + +### `microphoneHardwareDisabled` + +### `microphoneSensitivityHigh` + +### `microphoneSensitivityLow` + +### `microphoneSensitivityMedium` + +### `microphoneSensitivityMuted` + +### `modem` + +### `multimediaPlayerAppleIpodTouch` + +### `multimediaPlayer` + +### `multimediaVolumeControl` + +### `networkCellular_2g` + +### `networkCellular_3g` + +### `networkCellular_4g` + +### `networkCellular_5g` + +### `networkCellularAcquiringRtl` + +### `networkCellularAcquiring` + +### `networkCellularConnected` + +### `networkCellularDisabledRtl` + +### `networkCellularDisabled` + +### `networkCellularEdge` + +### `networkCellularGprs` + +### `networkCellularHardwareDisabledRtl` + +### `networkCellularHardwareDisabled` + +### `networkCellularHspa` + +### `networkCellularNoRouteRtl` + +### `networkCellularNoRoute` + +### `networkCellularOfflineRtl` + +### `networkCellularOffline` + +### `networkCellularSignalExcellentRtl` + +### `networkCellularSignalExcellent` + +### `networkCellularSignalGoodRtl` + +### `networkCellularSignalGood` + +### `networkCellularSignalNoneRtl` + +### `networkCellularSignalNone` + +### `networkCellularSignalOkRtl` + +### `networkCellularSignalOk` + +### `networkCellularSignalWeakRtl` + +### `networkCellularSignalWeak` + +### `networkCellular` + +### `networkError` + +### `networkIdle` + +### `networkNoRoute` + +### `networkOffline` + +### `networkReceive` + +### `networkServer` + +### `networkTransmitReceive` + +### `networkTransmit` + +### `networkVpnAcquiring` + +### `networkVpnDisabled` + +### `networkVpnDisconnected` + +### `networkVpnNoRoute` + +### `networkVpn` + +### `networkWiredAcquiring` + +### `networkWiredDisconnected` + +### `networkWiredNoRoute` + +### `networkWired` + +### `networkWirelessAcquiring` + +### `networkWirelessConnected` + +### `networkWirelessDisabled` + +### `networkWirelessEncrypted` + +### `networkWirelessHardwareDisabled` + +### `networkWirelessHotspot` + +### `networkWirelessNoRoute` + +### `networkWirelessOffline` + +### `networkWirelessSignalExcellent` + +### `networkWirelessSignalGood` + +### `networkWirelessSignalNone` + +### `networkWirelessSignalOk` + +### `networkWirelessSignalWeak` + +### `networkWireless` + +### `networkWorkgroup` + +### `nightLightDisabled` + +### `nightLight` + +### `nmDeviceWiredSecure` + +### `nmDeviceWired` + +### `nmDeviceWwan` + +### `nonStarred` + +### `notificationsDisabled` + +### `objectFlipHorizontal` + +### `objectFlipVertical` + +### `objectRotateLeft` + +### `objectRotateRight` + +### `objectSelect` + +### `openMenu` + +### `orca` + +### `fedoraprojectAnacondaInstaller` + +### `freedesktopMalcontentControl` + +### `gnomeAdwaita1Demo` + +### `gnomeBoxes` + +### `gnomeBuilder` + +### `gnomeCalculator` + +### `gnomeCharacters` + +### `gnomeCheese` + +### `gnomeConsole` + +### `gnomeDiskUtility` + +### `gnomeEpiphany` + +### `gnomeEvince` + +### `gnomeLogs` + +### `gnomeMaps` + +### `gnomeNautilus` + +### `gnomePhotos` + +### `gnomeRhythmbox3` + +### `gnomeSettingsAbout` + +### `gnomeSettingsAccessibility` + +### `gnomeSettingsAppearance` + +### `gnomeSettingsApplications` + +### `gnomeSettingsBluetooth` + +### `gnomeSettingsCamera` + +### `gnomeSettingsColor` + +### `gnomeSettingsDefaultApps` + +### `gnomeSettingsDiagnostics` + +### `gnomeSettingsDisplay` + +### `gnomeSettingsFileHistory` + +### `gnomeSettingsKeyboard` + +### `gnomeSettingsLocation` + +### `gnomeSettingsMicrophone` + +### `gnomeSettingsMobileNetwork` + +### `gnomeSettingsMouse` + +### `gnomeSettingsMultitasking` + +### `gnomeSettingsNetwork` + +### `gnomeSettingsNotifications` + +### `gnomeSettingsOnlineAccounts` + +### `gnomeSettingsPower` + +### `gnomeSettingsPinters` + +### `gnomeSettingsRegion` + +### `gnomeSettingsRemovableMedia` + +### `gnomeSettingsSearch` + +### `gnomeSettingsSharing` + +### `gnomeSettingsSound` + +### `gnomeSettings` + +### `gnomeSettingsSystemLockScreen` + +### `gnomeSettingsThunderbolt` + +### `gnomeSettingsTime` + +### `gnomeSettingsUsers` + +### `gnomeSettingsWacom` + +### `gnomeShellExtensions` + +### `gnomeSoftware` + +### `gnomeSystemMonitor` + +### `gnomeTextEditor` + +### `gnomeTotem` + +### `gnomeWeather` + +### `gnomeYelp` + +### `gnomeBaobab` + +### `gnomeClocks` + +### `gnomeDesignIconLibrary` + +### `gnomeEog` + +### `gnomeFontViewer` + +### `gnomeTweaks` + +### `gtkDemo4` + +### `gtkIconBrowser4` + +### `gtkPrintEditor4` + +### `gtkWidgetFactory4` + +### `gtkGtk4NodeEditor` + +### `orientationLandscapeInverse` + +### `orientationLandscape` + +### `orientationPortraitInverse` + +### `orientationPortraitLeft` + +### `orientationPortraitRight` + +### `orientationProtrait` + +### `packageXGeneric` + +### `panDown` + +### `panEnd` + +### `panStart` + +### `panUp` + +### `panelBottom` + +### `panelCenter` + +### `panelLeft` + +### `panelModified` + +### `panelRight` + +### `panelTop` + +### `pda` + +### `phoneAppleIphone` + +### `phoneOld` + +### `phone` + +### `powerProfileBalancedRtl` + +### `powerProfileBalanced` + +### `powerProfilePerformanceRtl` + +### `powerProfilePerformance` + +### `powerProfilePowerSaverRtl` + +### `powerProfilePowerSaver` + +### `preferencesColor` + +### `preferencesDesktopAccessibility` + +### `preferencesDesktopAppearance` + +### `preferencesDesktopApps` + +### `preferencesDesktopDisplay` + +### `preferencesDesktopFont` + +### `preferencesDesktopKeyboardShortcuts` + +### `preferencesDesktopKeyboard` + +### `preferencesDesktopLocale` + +### `preferencesDesktopMultitasking` + +### `preferencesDesktopRemoteDesktop` + +### `preferencesDesktopScreensaver` + +### `preferencesDesktopWallpaper` + +### `preferencesOther` + +### `preferencesSystemDetails` + +### `preferencesSystemDevices` + +### `preferencesSystemNetworkProxy` + +### `preferencesSystemNetwork` + +### `preferencesSystemNotifications` + +### `preferencesSystemParentalControls` + +### `preferencesSystemPrivacy` + +### `preferencesSystemSearch` + +### `preferencesSystemSharing` + +### `preferencesSystem` + +### `preferencesSystemTime` + +### `printerError` + +### `printerNetwork` + +### `printerPrinting` + +### `printer` + +### `printerWarning` + +### `processStop` + +### `processWorking` + +### `radioChecked` + +### `radioMixed` + +### `radio` + +### `rotationAllowed` + +### `rotationLocked` + +### `scanner` + +### `screenShared` + +### `securityHigh` + +### `securityLow` + +### `securityMediumRtl` + +### `securityMedium` + +### `selectionEnd` + +### `selectionMode` + +### `selectionStart` + +### `semiStarredRtl` + +### `semiStarred` + +### `sendTo` + +### `sidebarShowRight` + +### `sidebarShow` + +### `softwareUpdateAvailable` + +### `softwareUpdateUrgent` + +### `speedometer` + +### `starNew` + +### `starred` + +### `startHere` + +### `switchOff` + +### `switchOn` + +### `systemFileManager` + +### `systemHelp` + +### `systemLockScreen` + +### `systemLogOutRtl` + +### `systemLogOut` + +### `systemReboot` + +### `systemRun` + +### `systemSearch` + +### `systemShutdown` + +### `systemSoftwareInstall` + +### `systemSwitchUserRtl` + +### `systemSwitchUser` + +### `systemUsers` + +### `tabNew` + +### `tablet` + +### `taskDue` + +### `taskPastDue` + +### `temperature` + +### `textEditor` + +### `textXGeneric` + +### `thunderboltAcquiring` + +### `thunderbolt` + +### `toolsCheckSpelling` + +### `totemTv` + +### `touchDisabled` + +### `touchpadDisabled` + +### `tv` + +### `uninterruptiblePowerSupply` + +### `userAvailable` + +### `userAway` + +### `userBookmarks` + +### `userBusy` + +### `userDesktop` + +### `userHome` + +### `userIdle` + +### `userInfo` + +### `userInvisible` + +### `userNotTracked` + +### `userOffline` + +### `userStatusPending` + +### `userTrashFull` + +### `userTrash` + +### `utilitiesTerminal` + +### `valueDecrease` + +### `valueIncrease` + +### `videoDisplay` + +### `videoJoineDisplays` + +### `videoSingleDisplay` + +### `videoXGeneric` + +### `viewAppGrid` + +### `viewConceal` + +### `viewContinuous` + +### `viewDual` + +### `viewFullscreen` + +### `viewGrid` + +### `viewListBulletRtl` + +### `viewListBullet` + +### `viewListOrderedRtl` + +### `viewListOrdered` + +### `viewListRtl` + +### `viewList` + +### `viewMirror` + +### `viewMoreHorizontal` + +### `viewMore` + +### `viewPagedRtl` + +### `viewPaged` + +### `viewPin` + +### `viewRefresh` + +### `viewRestore` + +### `viewReveal` + +### `viewSortAscendingRtl` + +### `viewSortAscending` + +### `viewSortDescendingRtl` + +### `viewSortDescending` + +### `viewWrappedRtl` + +### `viewWrapped` + +### `weatherClearNight` + +### `weatherClear` + +### `weatherFewCloudsNight` + +### `weatherFewClouds` + +### `weatherFog` + +### `weatherHourly` + +### `weatherOvercast` + +### `weatherSevereAlert` + +### `weatherShowersScattered` + +### `weatherShowers` + +### `weatherSnow` + +### `weatherStorm` + +### `weatherTornado` + +### `weatherWindy` + +### `webBrowser` + +### `windowClose` + +### `windowMaximize` + +### `windowMinimize` + +### `windowNew` + +### `windowRestore` + +### `xOfficeAddressBook` + +### `xOfficeCalendar` + +### `xOfficeDocument` + +### `xOfficeDrawing` + +### `xOfficePresentation` + +### `xOfficeSpreadsheet` + +### `zoomFitBest` + +### `zoomIn` + +### `zoomOriginal` + +### `zoomOut` + +## Properties +### `string` + +A string representation of the icon. diff --git a/Documentation/Reference/enums/Icon.md b/Documentation/Reference/enums/Icon.md new file mode 100644 index 0000000..df04215 --- /dev/null +++ b/Documentation/Reference/enums/Icon.md @@ -0,0 +1,21 @@ +**ENUM** + +# `Icon` + +An icon. + +## Cases +### `default(icon:)` + +A preinstalled icon. +- Parameter icon: The default icon. + +### `custom(name:)` + +A custom icon. +- Parameter name: The icon's name. + +## Properties +### `string` + +A string representation of the icon. diff --git a/Documentation/Reference/enums/Transition.md b/Documentation/Reference/enums/Transition.md new file mode 100644 index 0000000..add6138 --- /dev/null +++ b/Documentation/Reference/enums/Transition.md @@ -0,0 +1,25 @@ +**ENUM** + +# `Transition` + +A transition for a stack. + +## Cases +### `none` + +### `crossfade` + +### `slideRight` + +### `coverUp` + +### `uncoverUp` + +### `coverUpDown` + +### `rotateLeft` + +## Properties +### `cTransition` + +Get the GtkStackTransitionType transition. diff --git a/Documentation/Reference/extensions/ActionRow.md b/Documentation/Reference/extensions/ActionRow.md new file mode 100644 index 0000000..fa48f5c --- /dev/null +++ b/Documentation/Reference/extensions/ActionRow.md @@ -0,0 +1,9 @@ +**EXTENSION** + +# `ActionRow` + +## Methods +### `init(_:)` + +Initialize an action row. +- Parameter title: The row's title. diff --git a/Documentation/Reference/extensions/Array.md b/Documentation/Reference/extensions/Array.md index 5454d45..dade731 100644 --- a/Documentation/Reference/extensions/Array.md +++ b/Documentation/Reference/extensions/Array.md @@ -7,6 +7,10 @@ The array's view body is the array itself. +### `cArray` + +Get the C version of the array. + ## Methods ### `widget(modifiers:)` @@ -14,12 +18,13 @@ Get a widget from a collection of views. - Parameter modifiers: Modify views before being updated. - Returns: A widget. -### `update(_:modifiers:)` +### `update(_:modifiers:updateProperties:)` Update a collection of views with a collection of view storages. - Parameters: - storage: The collection of view storages. - modifiers: Modify views before being updated. + - updateProperties: Whether to update properties. ### `windows()` diff --git a/Documentation/Reference/extensions/Banner.md b/Documentation/Reference/extensions/Banner.md new file mode 100644 index 0000000..c61a38e --- /dev/null +++ b/Documentation/Reference/extensions/Banner.md @@ -0,0 +1,19 @@ +**EXTENSION** + +# `Banner` + +## Methods +### `init(_:visible:)` + +Initialize a text widget. +- Parameters: + - title: The content. + - visible: Whether the banner is visible. + +### `button(_:handler:)` + +Configure the banner's button. +- Parameters: + - label: The button's title. + - handler: The button's handler. +- Returns: The banner. diff --git a/Documentation/Reference/extensions/Bool.md b/Documentation/Reference/extensions/Bool.md new file mode 100644 index 0000000..ca11f79 --- /dev/null +++ b/Documentation/Reference/extensions/Bool.md @@ -0,0 +1,8 @@ +**EXTENSION** + +# `Bool` + +## Properties +### `cBool` + +Get the gboolean for C. diff --git a/Documentation/Reference/extensions/Button.md b/Documentation/Reference/extensions/Button.md new file mode 100644 index 0000000..0fc4593 --- /dev/null +++ b/Documentation/Reference/extensions/Button.md @@ -0,0 +1,39 @@ +**EXTENSION** + +# `Button` + +## Methods +### `init(_:icon:handler:)` + +Initialize a button. +- Parameters: + - label: The button's label. + - icon: The button's icon. + - handler: The button's action handler. + +### `init(_:handler:)` + +Initialize a button. +- Parameters: + - label: The buttons label. + - handler: The button's action handler. + +### `keyboardShortcut(_:window:)` + +Create a keyboard shortcut for an application window from a button. + +Note that the keyboard shortcut is available after the view has been visible for the first time. +- Parameters: + - shortcut: The keyboard shortcut. + - window: The application window. +- Returns: The button. + +### `keyboardShortcut(_:app:)` + +Create a keyboard shortcut for an application from a button. + +Note that the keyboard shortcut is available after the view has been visible for the first time. +- Parameters: + - shortcut: The keyboard shortcut. + - window: The application. +- Returns: The button. diff --git a/Documentation/Reference/extensions/Carousel.md b/Documentation/Reference/extensions/Carousel.md new file mode 100644 index 0000000..1a01464 --- /dev/null +++ b/Documentation/Reference/extensions/Carousel.md @@ -0,0 +1,10 @@ +**EXTENSION** + +# `Carousel` + +## Methods +### `longSwipes(_:)` + +Set whether long swipes are allowed or not. +- Parameter longSwipes: Whether long swipes are allowed. +- Returns: The carousel. diff --git a/Documentation/Reference/extensions/Clamp.md b/Documentation/Reference/extensions/Clamp.md new file mode 100644 index 0000000..0e72b06 --- /dev/null +++ b/Documentation/Reference/extensions/Clamp.md @@ -0,0 +1,9 @@ +**EXTENSION** + +# `Clamp` + +## Methods +### `init(vertical:)` + +Initialize either a horizontal or vertical clamp. +- Parameter vertical: Whether it is a vertical clamp. diff --git a/Documentation/Reference/extensions/ComboRow.md b/Documentation/Reference/extensions/ComboRow.md new file mode 100644 index 0000000..a825ccb --- /dev/null +++ b/Documentation/Reference/extensions/ComboRow.md @@ -0,0 +1,17 @@ +**EXTENSION** + +# `ComboRow` + +## Properties +### `values` + +### `stringList` + +## Methods +### `init(_:selection:values:)` + +Initialize a combo row. +- Parameters: + - title: The row's title. + - selection: The selected value. + - values: The available values. diff --git a/Documentation/Reference/extensions/EntryRow.md b/Documentation/Reference/extensions/EntryRow.md new file mode 100644 index 0000000..7316d98 --- /dev/null +++ b/Documentation/Reference/extensions/EntryRow.md @@ -0,0 +1,26 @@ +**EXTENSION** + +# `EntryRow` + +## Properties +### `textField` + +## Methods +### `init(_:text:)` + +Initialize an entry row. +- Parameters: + - title: The row's title. + - text: The text. + +### `onSubmit(_:)` + +Set the entry row's subtitle. +- Parameter subtitle: The subtitle. +- Returns: The entry row. + +### `secure(text:)` + +Let the user securely enter private text. +- Parameter: The text. +- Returns: The entry row. diff --git a/Documentation/Reference/extensions/FormSection.md b/Documentation/Reference/extensions/FormSection.md new file mode 100644 index 0000000..5d5482f --- /dev/null +++ b/Documentation/Reference/extensions/FormSection.md @@ -0,0 +1,17 @@ +**EXTENSION** + +# `FormSection` + +## Methods +### `init(_:content:)` + +Initialize a form section. +- Parameters: + - title: The title. + - content: The content, usually one or more forms. + +### `suffix(_:)` + +Set the form section's suffix view. +- Parameter suffix: The suffix. +- Returns: The form section. diff --git a/Documentation/Reference/extensions/HeaderBar.md b/Documentation/Reference/extensions/HeaderBar.md new file mode 100644 index 0000000..e91ec2b --- /dev/null +++ b/Documentation/Reference/extensions/HeaderBar.md @@ -0,0 +1,35 @@ +**EXTENSION** + +# `HeaderBar` + +## Methods +### `init(titleButtons:start:end:)` + +Initialize a header bar. +- Parameters: + - titleButtons: Whether the title buttons (e.g. close button) are visible. + - start: The start content. + - end: The end content. + +### `empty()` + +Initialize an empty header bar. +- Returns: The header bar. + +### `start(start:)` + +Initialize a header bar with only views at the start. +- Parameter start: The views. +- Returns: The header bar. + +### `end(end:)` + +Initialize a header bar with only views at the end. +- Parameter start: The views. +- Returns: The header bar. + +### `headerBarTitle(view:)` + +Set the title widget for the header bar. +- Parameter view: The widget in the header bar. +- Returns: The header bar. diff --git a/Documentation/Reference/extensions/Int.md b/Documentation/Reference/extensions/Int.md new file mode 100644 index 0000000..1d6a3a6 --- /dev/null +++ b/Documentation/Reference/extensions/Int.md @@ -0,0 +1,12 @@ +**EXTENSION** + +# `Int` + +## Properties +### `id` + +Get the integer itself as the identifier. + +### `cInt` + +The C integer. diff --git a/Documentation/Reference/extensions/List.md b/Documentation/Reference/extensions/List.md new file mode 100644 index 0000000..4edd999 --- /dev/null +++ b/Documentation/Reference/extensions/List.md @@ -0,0 +1,25 @@ +**EXTENSION** + +# `List` + +## Properties +### `selectionField` + +The ID for the field storing the selection value. + +### `elementsField` + +The ID for the field storing the elements. + +## Methods +### `init(_:selection:content:)` + +Initialize `List`. +- Parameters: + - elements: The elements. + - selection: The identifier of the selected element. Selection disabled if `nil`. + - content: The view for an element. + +### `sidebarStyle()` + +Add the "navigation-sidebar" style class. diff --git a/Documentation/Reference/extensions/Menu.md b/Documentation/Reference/extensions/Menu.md new file mode 100644 index 0000000..4e5e891 --- /dev/null +++ b/Documentation/Reference/extensions/Menu.md @@ -0,0 +1,23 @@ +**EXTENSION** + +# `Menu` + +## Methods +### `init(_:icon:app:window:content:)` + +Initialize a menu button. +- Parameters: + - label: The button's label. + - icon: The button's icon. + - app: The application. + - window: The application window. + - content: The menu's content. + +### `init(_:app:window:content:)` + +Initialize a menu button. +- Parameters: + - label: The buttons label. + - app: The application. + - window: The application window. + - content: The menu's content. diff --git a/Documentation/Reference/extensions/OpaquePointer.md b/Documentation/Reference/extensions/OpaquePointer.md new file mode 100644 index 0000000..f7ddc2a --- /dev/null +++ b/Documentation/Reference/extensions/OpaquePointer.md @@ -0,0 +1,9 @@ +**EXTENSION** + +# `OpaquePointer` + +## Methods +### `cast()` + +Convert an opaque pointer into an unsafe mutable pointer with a defined type. +- Returns: The unsafe mutable pointer. diff --git a/Documentation/Reference/extensions/OverlaySplitView.md b/Documentation/Reference/extensions/OverlaySplitView.md new file mode 100644 index 0000000..a2505ef --- /dev/null +++ b/Documentation/Reference/extensions/OverlaySplitView.md @@ -0,0 +1,18 @@ +**EXTENSION** + +# `OverlaySplitView` + +## Methods +### `init(visible:sidebar:content:)` + +Initialize an overlay split view. +- Parameters: + - visible: Whether the sidebar is visible. + - sidebar: The sidebar content. + - content: The main content. + +### `trailingSidebar(_:)` + +The position of the sidebar. +- Parameter trailing: Whether the sidebar is at the trailing position. +- Returns: The navigation split view. diff --git a/Documentation/Reference/extensions/PasswordEntryRow.md b/Documentation/Reference/extensions/PasswordEntryRow.md new file mode 100644 index 0000000..ca01011 --- /dev/null +++ b/Documentation/Reference/extensions/PasswordEntryRow.md @@ -0,0 +1,20 @@ +**EXTENSION** + +# `PasswordEntryRow` + +## Properties +### `textField` + +## Methods +### `init(_:text:)` + +Initialize an entry row. +- Parameters: + - title: The row's title. + - text: The text. + +### `onSubmit(_:)` + +Set the entry row's subtitle. +- Parameter subtitle: The subtitle. +- Returns: The entry row. diff --git a/Documentation/Reference/extensions/ProgressBar.md b/Documentation/Reference/extensions/ProgressBar.md new file mode 100644 index 0000000..595af9b --- /dev/null +++ b/Documentation/Reference/extensions/ProgressBar.md @@ -0,0 +1,11 @@ +**EXTENSION** + +# `ProgressBar` + +## Methods +### `init(value:total:)` + +Initialize a progress bar widget. +- Parameters: + - value: The value. + - total: The maximum value. diff --git a/Documentation/Reference/extensions/ScrollView.md b/Documentation/Reference/extensions/ScrollView.md new file mode 100644 index 0000000..9430d07 --- /dev/null +++ b/Documentation/Reference/extensions/ScrollView.md @@ -0,0 +1,9 @@ +**EXTENSION** + +# `ScrollView` + +## Methods +### `init(content:)` + +Initialize a `ScrollView`. +- Parameter content: The view content. diff --git a/Documentation/Reference/extensions/Set.md b/Documentation/Reference/extensions/Set.md new file mode 100644 index 0000000..508679c --- /dev/null +++ b/Documentation/Reference/extensions/Set.md @@ -0,0 +1,39 @@ +**EXTENSION** + +# `Set` + +## Properties +### `all` + +Horizontal and vertical edges. + +### `vertical` + +Top and bottom edges. + +### `horizontal` + +Leading and trailing edges. + +### `top` + +Top edge. + +### `bottom` + +Bottom edge. + +### `leading` + +Leading edge. + +### `trailing` + +Trailing edge. + +## Methods +### `add(_:)` + +Add a collection of edges to a collection of edges. +- Parameter edges: The collection of edges. +- Returns: Both collections combined. diff --git a/Documentation/Reference/extensions/SpinRow.md b/Documentation/Reference/extensions/SpinRow.md new file mode 100644 index 0000000..993a60b --- /dev/null +++ b/Documentation/Reference/extensions/SpinRow.md @@ -0,0 +1,34 @@ +**EXTENSION** + +# `SpinRow` + +## Methods +### `init(_:value:min:max:)` + +Initialize a spin row. +- Parameters: + - title: The row's title. + - value: The selected value. + - min: The minimum value. + - max: The maximum value. + +### `init(_:value:min:max:)` + +Initialize a spin row. +- Parameters: + - title: The row's title. + - value: The selected value. + - min: The minimum value. + - max: The maximum value. + +### `step(_:)` + +Set the difference a single click on the increase/decrease buttons makes. +- Parameter step: The increase/decrease step. +- Returns: The spin row. + +### `step(_:)` + +Set the difference a single click on the increase/decrease buttons makes. +- Parameter step: The increase/decrease step. +- Returns: The spin row. diff --git a/Documentation/Reference/extensions/State.md b/Documentation/Reference/extensions/State.md index 5e237e9..77b5bb3 100644 --- a/Documentation/Reference/extensions/State.md +++ b/Documentation/Reference/extensions/State.md @@ -3,13 +3,14 @@ # `State` ## Methods -### `init(wrappedValue:_:folder:)` +### `init(wrappedValue:_:folder:forceUpdates:)` Initialize a property representing a state in the view. - Parameters: - wrappedValue: The wrapped value. - key: The unique storage key of the property. - folder: The path to the folder containing the JSON file. + - forceUpdates: Whether to force update all available views when the property gets modified. The folder path will be appended to the XDG data home directory. diff --git a/Documentation/Reference/extensions/StatusPage.md b/Documentation/Reference/extensions/StatusPage.md new file mode 100644 index 0000000..e128793 --- /dev/null +++ b/Documentation/Reference/extensions/StatusPage.md @@ -0,0 +1,13 @@ +**EXTENSION** + +# `StatusPage` + +## Methods +### `init(_:icon:description:content:)` + +Initialize a status page widget. +- Parameters: + - title: The title. + - icon: The icon. + - description: Additional details. + - content: Additional content. diff --git a/Documentation/Reference/extensions/String.md b/Documentation/Reference/extensions/String.md index 2705ad9..d219da1 100644 --- a/Documentation/Reference/extensions/String.md +++ b/Documentation/Reference/extensions/String.md @@ -14,3 +14,34 @@ A label for the transition data in a GTUI widget's fields. ### `navigationLabel` A label for the navigation label in a GTUI widget's fields. + +## Methods +### `ctrl()` + +Add the Ctrl key to a shortcut. +- Returns: The shortcut. + +### `shift()` + +Add the Shift key to a shortcut. +- Returns: The shortcut. + +### `alt()` + +Add the Alt key to a shortcut. +- Returns: The shortcut. + +### `meta()` + +Add the Meta key to a shortcut. +- Returns: The shortcut. + +### `super()` + +Add the Super key to a shortcut. +- Returns: The shortcut. + +### `hyper()` + +Add the Hyper key to a shortcut. +- Returns: The shortcut. diff --git a/Documentation/Reference/extensions/SwitchRow.md b/Documentation/Reference/extensions/SwitchRow.md new file mode 100644 index 0000000..25f977c --- /dev/null +++ b/Documentation/Reference/extensions/SwitchRow.md @@ -0,0 +1,11 @@ +**EXTENSION** + +# `SwitchRow` + +## Methods +### `init(_:isOn:)` + +Initialize a switch row. +- Parameters: + - title: The row's title. + - isOn: Whether the switch is on. diff --git a/Documentation/Reference/extensions/Text.md b/Documentation/Reference/extensions/Text.md new file mode 100644 index 0000000..125688b --- /dev/null +++ b/Documentation/Reference/extensions/Text.md @@ -0,0 +1,9 @@ +**EXTENSION** + +# `Text` + +## Methods +### `init(_:)` + +Initialize a text widget. +- Parameter text: The content. diff --git a/Documentation/Reference/extensions/ToastOverlay.md b/Documentation/Reference/extensions/ToastOverlay.md new file mode 100644 index 0000000..a3027bc --- /dev/null +++ b/Documentation/Reference/extensions/ToastOverlay.md @@ -0,0 +1,19 @@ +**EXTENSION** + +# `ToastOverlay` + +## Methods +### `init(_:signal:)` + +Initialize a toast overlay. +- Parameters: + - title: The toast's title. + - signal: The signal for adding a toast. + +### `action(button:handler:)` + +Add an action button to the toast. +- Parameters: + - button: The button's label. + - handler: The handler. +- Returns: The toast overlay. diff --git a/Documentation/Reference/extensions/Toggle.md b/Documentation/Reference/extensions/Toggle.md new file mode 100644 index 0000000..2c5ec13 --- /dev/null +++ b/Documentation/Reference/extensions/Toggle.md @@ -0,0 +1,24 @@ +**EXTENSION** + +# `Toggle` + +## Methods +### `init(_:icon:isOn:)` + +Initialize a toggle button. +- Parameters: + - label: The button's label. + - icon: The button's icon. + - isOn: Whether the toggle is on. + +### `init(_:isOn:)` + +Initialize a toggle button. +- Parameters: + - label: The buttons label. + - isOn: Whether the toggle is on. + +### `checkButton()` + +Use the check button style. +- Returns: The toggle. diff --git a/Documentation/Reference/extensions/UInt.md b/Documentation/Reference/extensions/UInt.md new file mode 100644 index 0000000..b30342c --- /dev/null +++ b/Documentation/Reference/extensions/UInt.md @@ -0,0 +1,8 @@ +**EXTENSION** + +# `UInt` + +## Properties +### `cInt` + +Convert an unsigned integer into the C form. diff --git a/Documentation/Reference/extensions/UnsafeMutablePointer.md b/Documentation/Reference/extensions/UnsafeMutablePointer.md new file mode 100644 index 0000000..543b4ac --- /dev/null +++ b/Documentation/Reference/extensions/UnsafeMutablePointer.md @@ -0,0 +1,14 @@ +**EXTENSION** + +# `UnsafeMutablePointer` + +## Methods +### `opaque()` + +Convert into an opaque pointer. +- Returns: The opaque pointer. + +### `cast()` + +Convert into an unsafe mutable pointer of another type. +- Returns: The unsafe mutable pointer. diff --git a/Documentation/Reference/extensions/UnsafeMutableRawPointer.md b/Documentation/Reference/extensions/UnsafeMutableRawPointer.md new file mode 100644 index 0000000..c8b9bc6 --- /dev/null +++ b/Documentation/Reference/extensions/UnsafeMutableRawPointer.md @@ -0,0 +1,9 @@ +**EXTENSION** + +# `UnsafeMutableRawPointer` + +## Methods +### `cast()` + +Convert into an unsafe mutable pointer of a certain type. +- Returns: The unsafe mutable pointer. diff --git a/Documentation/Reference/extensions/VStack.md b/Documentation/Reference/extensions/VStack.md new file mode 100644 index 0000000..2f2e334 --- /dev/null +++ b/Documentation/Reference/extensions/VStack.md @@ -0,0 +1,11 @@ +**EXTENSION** + +# `VStack` + +## Methods +### `init(content:)` + +Initialize a `VStack`. +- Parameter content: The view content. + +### `init(horizontal:content:)` diff --git a/Documentation/Reference/extensions/View.md b/Documentation/Reference/extensions/View.md index 07160a8..7d47a3b 100644 --- a/Documentation/Reference/extensions/View.md +++ b/Documentation/Reference/extensions/View.md @@ -9,12 +9,15 @@ Wrap the view into a widget. - Parameter modifiers: Modify views before being updated. - Returns: The widget. -### `updateStorage(_:modifiers:)` +### `updateStorage(_:modifiers:updateProperties:)` Update a storage to a view. - Parameters: - storage: The storage. - modifiers: Modify views before being updated. + - updateProperties: Whether to update properties. + +### `getState()` ### `storage(modifiers:)` @@ -44,8 +47,20 @@ Run a function when the widget gets clicked. ### `frame(maxSize:)` -Set the view's maximal size. -- Parameter maxSize: The maximal size. +Set the view's maximum width. +- Parameter maxSize: The maximum width. +- Returns: A view. + +### `frame(maxWidth:)` + +Set the view's maximum width. +- Parameter maxWidth: The maximum width. +- Returns: A view. + +### `frame(maxHeight:)` + +Set the view's maximum height. +- Parameter maxHeight: The maximum height. - Returns: A view. ### `modifyContent(_:modify:)` @@ -137,13 +152,6 @@ Make the view insensitive (useful e.g. in overlays). Remove all of the content modifiers for the wrapped views. - Returns: A view. -### `overlay(_:)` - -Add an overlay view. -- Parameters: - - overlay: The overlay view. -- Returns: A view. - ### `toast(_:signal:)` Present a toast when the signal gets activated. @@ -162,6 +170,16 @@ Present a toast with a button when the signal gets activated. - handler: The handler for the button. - Returns: A view. +### `verticalCenter()` + +Wrap the view in a vertical stack and center vertically. +- Returns: The view. + +### `horizontalCenter()` + +Wrap the view in a horizontal stack and center horizontally. +- Returns: The view. + ### `topToolbar(visible:_:)` Add a top toolbar to the view. @@ -178,7 +196,9 @@ Add a bottom toolbar to the view. - visible: Whether the toolbar is visible. - Returns: A view. -### `verticalCenter()` +### `overlay(_:)` -Wrap the view in a vertical stack and center vertically. -- Returns: The view. +Add an overlay view. +- Parameters: + - overlay: The overlay view. +- Returns: A view. diff --git a/Documentation/Reference/extensions/WindowSceneGroup.md b/Documentation/Reference/extensions/WindowSceneGroup.md index 11d2098..24907c6 100644 --- a/Documentation/Reference/extensions/WindowSceneGroup.md +++ b/Documentation/Reference/extensions/WindowSceneGroup.md @@ -8,9 +8,10 @@ Get the windows described by the group. - Returns: The windows. -### `update(_:app:)` +### `update(_:app:force:)` Update the windows described by the group. - Parameters: - storage: The window's storage. - app: The application. + - force: Whether to force update all the views. diff --git a/Documentation/Reference/methods/filedialog_on_open_cb(ptr_file_userData_).md b/Documentation/Reference/methods/filedialog_on_open_cb(ptr_file_userData_).md new file mode 100644 index 0000000..d660bc8 --- /dev/null +++ b/Documentation/Reference/methods/filedialog_on_open_cb(ptr_file_userData_).md @@ -0,0 +1,7 @@ +### `filedialog_on_open_cb(ptr:file:userData:)` + +Run when a file should be opened. +- Parameters: + - ptr: The pointer. + - file: The path to the file. + - userData: The file dialog data. diff --git a/Documentation/Reference/methods/filedialog_on_save_cb(ptr_file_userData_).md b/Documentation/Reference/methods/filedialog_on_save_cb(ptr_file_userData_).md new file mode 100644 index 0000000..dfc0b3a --- /dev/null +++ b/Documentation/Reference/methods/filedialog_on_save_cb(ptr_file_userData_).md @@ -0,0 +1,7 @@ +### `filedialog_on_save_cb(ptr:file:userData:)` + +Run when a file should be saved. +- Parameters: + - ptr: The pointer. + - file: The path to the file. + - userData: The file dialog data. diff --git a/Documentation/Reference/protocols/Widget.md b/Documentation/Reference/protocols/Widget.md index 7182129..6497a04 100644 --- a/Documentation/Reference/protocols/Widget.md +++ b/Documentation/Reference/protocols/Widget.md @@ -10,9 +10,10 @@ A widget is a view that know about its GTUI widget. The view storage. - Parameter modifiers: Modify views before being updated. -### `update(_:modifiers:)` +### `update(_:modifiers:updateProperties:)` Update the stored content. - Parameters: - storage: The storage to update. - modifiers: Modify views before being updated + - updateProperties: Whether to update the view's properties. diff --git a/Documentation/Reference/protocols/WindowScene.md b/Documentation/Reference/protocols/WindowScene.md index a9ab1e9..259a400 100644 --- a/Documentation/Reference/protocols/WindowScene.md +++ b/Documentation/Reference/protocols/WindowScene.md @@ -28,9 +28,10 @@ Get the storage for the window. - Parameter app: The application. - Returns: The storage. -### `update(_:app:)` +### `update(_:app:force:)` Update a window storage's content. - Parameters: - storage: The storage to update. - app: The application. + - force: Whether to force update all the views. diff --git a/Documentation/Reference/structs/AboutWindow.md b/Documentation/Reference/structs/AboutWindow.md index bd5d39f..bf353dc 100644 --- a/Documentation/Reference/structs/AboutWindow.md +++ b/Documentation/Reference/structs/AboutWindow.md @@ -41,6 +41,10 @@ The app icon. The app's website. +### `path` + +The path to the app data file. + ## Methods ### `init(id:appName:developer:version:)` @@ -51,6 +55,13 @@ Create a window type with a certain identifier and content. - developer: The developer's name. - version: The app version. +### `init(id:path:)` + +Create a window type with a certain identifier and content. +- Parameters: + - id: The identifier. + - path: The path to the app data file. + ### `icon(_:)` Set the app icon. @@ -75,12 +86,13 @@ Get the window. - Parameter app: The application. - Returns: The window. -### `update(_:app:)` +### `update(_:app:force:)` Update a window. - Parameters: - storage: The storage to update. - app: The application. + - force: Whether to force update all the views. ### `updateData(window:)` diff --git a/Documentation/Reference/structs/ActionRow.md b/Documentation/Reference/structs/ActionRow.md index 7aa3fc9..c2a3873 100644 --- a/Documentation/Reference/structs/ActionRow.md +++ b/Documentation/Reference/structs/ActionRow.md @@ -2,71 +2,232 @@ # `ActionRow` -A form content row showing a title and optionally a subtitle and widgets. +A [class@Gtk.ListBoxRow] used to present actions. + +action-row + +The `AdwActionRow` widget can have a title, a subtitle and an icon. The row +can receive additional widgets at its end, or prefix widgets at its start. + +It is convenient to present a preference and its related actions. + +`AdwActionRow` is unactivatable by default, giving it an activatable widget +will automatically make it activatable, but unsetting it won't change the +row's activatability. + +## AdwActionRow as GtkBuildable + +The `AdwActionRow` implementation of the [iface@Gtk.Buildable] interface +supports adding a child at its end by specifying “suffix” or omitting the +“type” attribute of a element. + +It also supports adding a child as a prefix widget by specifying “prefix” as +the “type” attribute of a element. + +## CSS nodes + +`AdwActionRow` has a main CSS node with name `row`. + +It contains the subnode `box.header` for its main horizontal box, and +`box.title` for the vertical box containing the title and subtitle labels. + +It contains subnodes `label.title` and `label.subtitle` representing +respectively the title label and subtitle label. ## Properties -### `title` +### `updateFunctions` -The title. +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `activatableWidget` + +The widget to activate when the row is activated. + +The row can be activated either by clicking on it, calling +[method@ActionRow.activate], or via mnemonics in the title. +See the [property@PreferencesRow:use-underline] property to enable +mnemonics. + +The target widget will be activated by emitting the +[signal@Gtk.Widget::mnemonic-activate] signal on it. + +### `iconName` + +The icon name for this row. ### `subtitle` -The subtitle. +The subtitle for this row. -### `prefix` +The subtitle is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. -The prefix. +### `subtitleLines` + +The number of lines at the end of which the subtitle label will be +ellipsized. + +If the value is 0, the number of lines won't be limited. + +### `subtitleSelectable` + +Whether the user can copy the subtitle from the label. + +See also [property@Gtk.Label:selectable]. + +### `titleLines` + +The number of lines at the end of which the title label will be ellipsized. + +If the value is 0, the number of lines won't be limited. + +### `title` + +The title of the preference represented by this row. + +The title is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. + +### `titleSelectable` + +Whether the user can copy the title from the label. + +See also [property@Gtk.Label:selectable]. + +### `useMarkup` + +Whether to use Pango markup for the title label. + +Subclasses may also use it for other labels, such as subtitle. + +See also [func@Pango.parse_markup]. + +### `useUnderline` + +Whether an embedded underline in the title indicates a mnemonic. + +### `activated` + +This signal is emitted after the row has been activated. ### `suffix` -The suffix. +The body for the widget "suffix". -### `prefixID` +### `prefix` -The identifier for the prefix content. +The body for the widget "prefix". -### `suffixID` +### `app` -The identifier for the suffix content. +The application. + +### `window` + +The window. ## Methods -### `init(_:)` +### `init()` -Initialize an action row. -- Parameter title: The row's title. - -### `update(_:modifiers:)` - -Update a view storage. -- Parameters: - - storage: The view storage. - - modifiers: Modify views before being updated. +Initialize `ActionRow`. ### `container(modifiers:)` -Get a view storage. -- Parameter modifiers: Modify views before being updated. +Get the widget's view storage. +- Parameter modifiers: The view modifiers. - Returns: The view storage. -### `update(row:)` +### `update(_:modifiers:updateProperties:)` -Update the action row. -- Parameter row: The action row. +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `activatableWidget(_:)` + +The widget to activate when the row is activated. + +The row can be activated either by clicking on it, calling +[method@ActionRow.activate], or via mnemonics in the title. +See the [property@PreferencesRow:use-underline] property to enable +mnemonics. + +The target widget will be activated by emitting the +[signal@Gtk.Widget::mnemonic-activate] signal on it. + +### `iconName(_:)` + +The icon name for this row. ### `subtitle(_:)` -Set the action row's subtitle. -- Parameter subtitle: The subtitle. -- Returns: The action row. +The subtitle for this row. -### `prefix(_:)` +The subtitle is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. -Set the action row's prefix view. -- Parameter prefix: The prefix. -- Returns: The action row. +### `subtitleLines(_:)` + +The number of lines at the end of which the subtitle label will be +ellipsized. + +If the value is 0, the number of lines won't be limited. + +### `subtitleSelectable(_:)` + +Whether the user can copy the subtitle from the label. + +See also [property@Gtk.Label:selectable]. + +### `titleLines(_:)` + +The number of lines at the end of which the title label will be ellipsized. + +If the value is 0, the number of lines won't be limited. + +### `title(_:)` + +The title of the preference represented by this row. + +The title is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. + +### `titleSelectable(_:)` + +Whether the user can copy the title from the label. + +See also [property@Gtk.Label:selectable]. + +### `useMarkup(_:)` + +Whether to use Pango markup for the title label. + +Subclasses may also use it for other labels, such as subtitle. + +See also [func@Pango.parse_markup]. + +### `useUnderline(_:)` + +Whether an embedded underline in the title indicates a mnemonic. + +### `activated(_:)` + +This signal is emitted after the row has been activated. ### `suffix(_:)` -Set the action row's suffix view. -- Parameter suffix: The suffix. -- Returns: The action row. +Set the body for "suffix". +- Parameter body: The body. +- Returns: The widget. + +### `prefix(_:)` + +Set the body for "prefix". +- Parameter body: The body. +- Returns: The widget. diff --git a/Documentation/Reference/structs/AppearObserver.md b/Documentation/Reference/structs/AppearObserver.md index 5c9b85f..993c195 100644 --- a/Documentation/Reference/structs/AppearObserver.md +++ b/Documentation/Reference/structs/AppearObserver.md @@ -20,9 +20,10 @@ Get the content's container. - Parameter modifiers: Modify views before being updated. - Returns: The content's container. -### `update(_:modifiers:)` +### `update(_:modifiers:updateProperties:)` Update the content. - Parameters: - storage: The content's storage. - modifiers: Modify views before being updated. + - updateProperties: Whether to update properties. diff --git a/Documentation/Reference/structs/Avatar.md b/Documentation/Reference/structs/Avatar.md new file mode 100644 index 0000000..0e00d9b --- /dev/null +++ b/Documentation/Reference/structs/Avatar.md @@ -0,0 +1,106 @@ +**STRUCT** + +# `Avatar` + +A widget displaying an image, with a generated fallback. + +avatar + +`AdwAvatar` is a widget that shows a round avatar. + +`AdwAvatar` generates an avatar with the initials of the +[property@Avatar:text] on top of a colored background. + +The color is picked based on the hash of the [property@Avatar:text]. + +If [property@Avatar:show-initials] is set to `FALSE`, +[property@Avatar:icon-name] or `avatar-default-symbolic` is shown instead of +the initials. + +Use [property@Avatar:custom-image] to set a custom image. + +## CSS nodes + +`AdwAvatar` has a single CSS node with name `avatar`. + +## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `iconName` + +The name of an icon to use as a fallback. + +If no name is set, `avatar-default-symbolic` will be used. + +### `showInitials` + +Whether initials are used instead of an icon on the fallback avatar. + +See [property@Avatar:icon-name] for how to change the fallback icon. + +### `size` + +The size of the avatar. + +### `text` + +Sets the text used to generate the fallback initials and color. + +It's only used to generate the color if [property@Avatar:show-initials] is +`FALSE`. + +### `app` + +The application. + +### `window` + +The window. + +## Methods +### `init(showInitials:size:)` + +Initialize `Avatar`. + +### `container(modifiers:)` + +Get the widget's view storage. +- Parameter modifiers: The view modifiers. +- Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `iconName(_:)` + +The name of an icon to use as a fallback. + +If no name is set, `avatar-default-symbolic` will be used. + +### `showInitials(_:)` + +Whether initials are used instead of an icon on the fallback avatar. + +See [property@Avatar:icon-name] for how to change the fallback icon. + +### `size(_:)` + +The size of the avatar. + +### `text(_:)` + +Sets the text used to generate the fallback initials and color. + +It's only used to generate the color if [property@Avatar:show-initials] is +`FALSE`. diff --git a/Documentation/Reference/structs/Banner.md b/Documentation/Reference/structs/Banner.md index 147d332..12a7fcf 100644 --- a/Documentation/Reference/structs/Banner.md +++ b/Documentation/Reference/structs/Banner.md @@ -2,54 +2,120 @@ # `Banner` -A banner widget. +A bar with contextual information. + +banner + +Banners are hidden by default, use [property@Banner:revealed] to show them. + +Banners have a title, set with [property@Banner:title]. Titles can be marked +up with Pango markup, use [property@Banner:use-markup] to enable it. + +The title will be shown centered or left-aligned depending on available +space. + +Banners can optionally have a button with text on it, set through +[property@Banner:button-label]. The button can be used with a `GAction`, +or with the [signal@Banner::button-clicked] signal. + +## CSS nodes + +`AdwBanner` has a main CSS node with the name `banner`. ## Properties -### `title` +### `updateFunctions` -The content. +Additional update functions for type extensions. -### `visible` +### `appearFunctions` -Whether the banner is visible. +Additional appear functions for type extensions. ### `buttonLabel` -The button's label. +The label to show on the button. -### `handler` +If set to `""` or `NULL`, the button won't be shown. -The button's handler. +The button can be used with a `GAction`, or with the +[signal@Banner::button-clicked] signal. + +### `revealed` + +Whether the banner is currently revealed. + +### `title` + +The title for this banner. + +See also: [property@Banner:use-markup]. + +### `useMarkup` + +Whether to use Pango markup for the banner title. + +See also [func@Pango.parse_markup]. + +### `buttonClicked` + +This signal is emitted after the action button has been clicked. + +It can be used as an alternative to setting an action. + +### `app` + +The application. + +### `window` + +The window. ## Methods -### `init(_:visible:)` +### `init(title:)` -Initialize a text widget. -- Parameters: - - title: The content. - - visible: Whether the banner is visible. - -### `update(_:modifiers:)` - -Update the view storage of the text widget. -- Parameters: - - storage: The view storage. - - modifiers: Modify views before being updated. +Initialize `Banner`. ### `container(modifiers:)` -Get the container of the text widget. +Get the widget's view storage. +- Parameter modifiers: The view modifiers. - Returns: The view storage. -### `update(banner:)` +### `update(_:modifiers:updateProperties:)` -Update the banner. -- Parameter banner: The banner. - -### `button(_:handler:)` - -Configure the banner's button. +Update the widget's view storage. - Parameters: - - label: The button's title. - - handler: The button's handler. -- Returns: The banner. + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `buttonLabel(_:)` + +The label to show on the button. + +If set to `""` or `NULL`, the button won't be shown. + +The button can be used with a `GAction`, or with the +[signal@Banner::button-clicked] signal. + +### `revealed(_:)` + +Whether the banner is currently revealed. + +### `title(_:)` + +The title for this banner. + +See also: [property@Banner:use-markup]. + +### `useMarkup(_:)` + +Whether to use Pango markup for the banner title. + +See also [func@Pango.parse_markup]. + +### `buttonClicked(_:)` + +This signal is emitted after the action button has been clicked. + +It can be used as an alternative to setting an action. diff --git a/Documentation/Reference/structs/Bin.md b/Documentation/Reference/structs/Bin.md new file mode 100644 index 0000000..400fff3 --- /dev/null +++ b/Documentation/Reference/structs/Bin.md @@ -0,0 +1,57 @@ +**STRUCT** + +# `Bin` + +A widget with one child. + +bin + +The `AdwBin` widget has only one child, set with the [property@Bin:child] +property. + +It is useful for deriving subclasses, since it provides common code needed +for handling a single child widget. + +## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `child` + +The child widget of the `AdwBin`. + +### `app` + +The application. + +### `window` + +The window. + +## Methods +### `init()` + +Initialize `Bin`. + +### `container(modifiers:)` + +Get the widget's view storage. +- Parameter modifiers: The view modifiers. +- Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `child(_:)` + +The child widget of the `AdwBin`. diff --git a/Documentation/Reference/structs/Box.md b/Documentation/Reference/structs/Box.md new file mode 100644 index 0000000..fc0cc32 --- /dev/null +++ b/Documentation/Reference/structs/Box.md @@ -0,0 +1,118 @@ +**STRUCT** + +# `Box` + +The `GtkBox` widget arranges child widgets into a single row or column. + +![An example GtkBox](box.png) + +Whether it is a row or column depends on the value of its +[property@Gtk.Orientable:orientation] property. Within the other +dimension, all children are allocated the same size. Of course, the +[property@Gtk.Widget:halign] and [property@Gtk.Widget:valign] properties +can be used on the children to influence their allocation. + +Use repeated calls to [method@Gtk.Box.append] to pack widgets into a +`GtkBox` from start to end. Use [method@Gtk.Box.remove] to remove widgets +from the `GtkBox`. [method@Gtk.Box.insert_child_after] can be used to add +a child at a particular position. + +Use [method@Gtk.Box.set_homogeneous] to specify whether or not all children +of the `GtkBox` are forced to get the same amount of space. + +Use [method@Gtk.Box.set_spacing] to determine how much space will be minimally +placed between all children in the `GtkBox`. Note that spacing is added +*between* the children. + +Use [method@Gtk.Box.reorder_child_after] to move a child to a different +place in the box. + +# CSS nodes + +`GtkBox` uses a single CSS node with name box. + +# Accessibility + +Until GTK 4.10, `GtkBox` used the `GTK_ACCESSIBLE_ROLE_GROUP` role. + +Starting from GTK 4.12, `GtkBox` uses the `GTK_ACCESSIBLE_ROLE_GENERIC` role. + +## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `baselineChild` + +The child that determines the baseline, in vertical orientation. + +### `homogeneous` + +Whether the children should all be the same size. + +### `spacing` + +The amount of space between children. + +### `append` + +The body for the widget "append". + +### `prepend` + +The body for the widget "prepend". + +### `app` + +The application. + +### `window` + +The window. + +## Methods +### `init(spacing:)` + +Initialize `Box`. + +### `container(modifiers:)` + +Get the widget's view storage. +- Parameter modifiers: The view modifiers. +- Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `baselineChild(_:)` + +The child that determines the baseline, in vertical orientation. + +### `homogeneous(_:)` + +Whether the children should all be the same size. + +### `spacing(_:)` + +The amount of space between children. + +### `append(_:)` + +Set the body for "append". +- Parameter body: The body. +- Returns: The widget. + +### `prepend(_:)` + +Set the body for "prepend". +- Parameter body: The body. +- Returns: The widget. diff --git a/Documentation/Reference/structs/Button.md b/Documentation/Reference/structs/Button.md index 6c4dd03..a154bad 100644 --- a/Documentation/Reference/structs/Button.md +++ b/Documentation/Reference/structs/Button.md @@ -2,66 +2,159 @@ # `Button` -A button widget. +The `GtkButton` widget is generally used to trigger a callback function that is +called when the button is pressed. + +![An example GtkButton](button.png) + +The `GtkButton` widget can hold any valid child widget. That is, it can hold +almost any other standard `GtkWidget`. The most commonly used child is the +`GtkLabel`. + +# CSS nodes + +`GtkButton` has a single CSS node with name button. The node will get the +style classes .image-button or .text-button, if the content is just an +image or label, respectively. It may also receive the .flat style class. +When activating a button via the keyboard, the button will temporarily +gain the .keyboard-activating style class. + +Other style classes that are commonly used with `GtkButton` include +.suggested-action and .destructive-action. In special cases, buttons +can be made round by adding the .circular style class. + +Button-like widgets like [class@Gtk.ToggleButton], [class@Gtk.MenuButton], +[class@Gtk.VolumeButton], [class@Gtk.LockButton], [class@Gtk.ColorButton] +or [class@Gtk.FontButton] use style classes such as .toggle, .popup, .scale, +.lock, .color on the button node to differentiate themselves from a plain +`GtkButton`. + +# Accessibility + +`GtkButton` uses the %GTK_ACCESSIBLE_ROLE_BUTTON role. ## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `canShrink` + +Whether the size of the button can be made smaller than the natural +size of its contents. + +For text buttons, setting this property will allow ellipsizing the label. + +If the contents of a button are an icon or a custom widget, setting this +property has no effect. + +### `child` + +The child widget. + +### `hasFrame` + +Whether the button has a frame. + +### `iconName` + +The name of the icon used to automatically populate the button. + ### `label` -The button's label. +Text of the label inside the button, if the button contains a label widget. -### `icon` +### `useUnderline` -The button's icon. +If set, an underline in the text indicates that the following character is +to be used as mnemonic. -### `handler` +### `activate` -The button's action handler. +Emitted to animate press then release. + +This is an action signal. Applications should never connect +to this signal, but use the [signal@Gtk.Button::clicked] signal. + +The default bindings for this signal are all forms of the + and Enter keys. + +### `clicked` + +Emitted when the button has been activated (pressed and released). + +### `app` + +The application. + +### `window` + +The window. ## Methods -### `init(_:icon:handler:)` +### `init()` -Initialize a button. -- Parameters: - - label: The button's label. - - icon: The button's icon. - - handler: The button's action handler. - -### `init(_:handler:)` - -Initialize a button. -- Parameters: - - label: The buttons label. - - handler: The button's action handler. - -### `update(_:modifiers:)` - -Update a button's view storage. -- Parameters: - - storage: The view storage. - - modifiers: Modify views before being updated. +Initialize `Button`. ### `container(modifiers:)` -Get a button's view storage. -- Parameter modifiers: Modify views before being updated. -- Returns: The button's view storage. +Get the widget's view storage. +- Parameter modifiers: The view modifiers. +- Returns: The view storage. -### `keyboardShortcut(_:window:)` +### `update(_:modifiers:updateProperties:)` -Create a keyboard shortcut for an application window from a button. - -Note that the keyboard shortcut is available after the view has been visible for the first time. +Update the widget's view storage. - Parameters: - - shortcut: The keyboard shortcut. - - window: The application window. -- Returns: The button. + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. -### `keyboardShortcut(_:app:)` +### `canShrink(_:)` -Create a keyboard shortcut for an application from a button. +Whether the size of the button can be made smaller than the natural +size of its contents. -Note that the keyboard shortcut is available after the view has been visible for the first time. -- Parameters: - - shortcut: The keyboard shortcut. - - window: The application. -- Returns: The button. +For text buttons, setting this property will allow ellipsizing the label. + +If the contents of a button are an icon or a custom widget, setting this +property has no effect. + +### `child(_:)` + +The child widget. + +### `hasFrame(_:)` + +Whether the button has a frame. + +### `iconName(_:)` + +The name of the icon used to automatically populate the button. + +### `label(_:)` + +Text of the label inside the button, if the button contains a label widget. + +### `useUnderline(_:)` + +If set, an underline in the text indicates that the following character is +to be used as mnemonic. + +### `activate(_:)` + +Emitted to animate press then release. + +This is an action signal. Applications should never connect +to this signal, but use the [signal@Gtk.Button::clicked] signal. + +The default bindings for this signal are all forms of the + and Enter keys. + +### `clicked(_:)` + +Emitted when the button has been activated (pressed and released). diff --git a/Documentation/Reference/structs/ButtonContent.md b/Documentation/Reference/structs/ButtonContent.md new file mode 100644 index 0000000..baaee89 --- /dev/null +++ b/Documentation/Reference/structs/ButtonContent.md @@ -0,0 +1,127 @@ +**STRUCT** + +# `ButtonContent` + +A helper widget for creating buttons. + +button-content + +`AdwButtonContent` is a box-like widget with an icon and a label. + +It's intended to be used as a direct child of [class@Gtk.Button], +[class@Gtk.MenuButton] or [class@SplitButton], when they need to have both an +icon and a label, as follows: + +```xml +document-open-symbolic_OpenTrue +``` + +`AdwButtonContent` handles style classes and connecting the mnemonic to the +button automatically. + +## CSS nodes + +``` +buttoncontent +├── image +╰── label +``` + +`AdwButtonContent`'s CSS node is called `buttoncontent`. It contains the +subnodes `image` and `label`. + +When inside a `GtkButton` or `AdwSplitButton`, the button will receive the +`.image-text-button` style class. When inside a `GtkMenuButton`, the +internal `GtkButton` will receive it instead. + +## Accessibility + +`AdwButtonContent` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role. + +## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `canShrink` + +Whether the button can be smaller than the natural size of its contents. + +If set to `TRUE`, the label will ellipsize. + +See [property@Gtk.Button:can-shrink]. + +### `iconName` + +The name of the displayed icon. + +If empty, the icon is not shown. + +### `label` + +The displayed label. + +### `useUnderline` + +Whether an underline in the text indicates a mnemonic. + +The mnemonic can be used to activate the parent button. + +See [property@ButtonContent:label]. + +### `app` + +The application. + +### `window` + +The window. + +## Methods +### `init()` + +Initialize `ButtonContent`. + +### `container(modifiers:)` + +Get the widget's view storage. +- Parameter modifiers: The view modifiers. +- Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `canShrink(_:)` + +Whether the button can be smaller than the natural size of its contents. + +If set to `TRUE`, the label will ellipsize. + +See [property@Gtk.Button:can-shrink]. + +### `iconName(_:)` + +The name of the displayed icon. + +If empty, the icon is not shown. + +### `label(_:)` + +The displayed label. + +### `useUnderline(_:)` + +Whether an underline in the text indicates a mnemonic. + +The mnemonic can be used to activate the parent button. + +See [property@ButtonContent:label]. diff --git a/Documentation/Reference/structs/Carousel.md b/Documentation/Reference/structs/Carousel.md index 70672b5..7705511 100644 --- a/Documentation/Reference/structs/Carousel.md +++ b/Documentation/Reference/structs/Carousel.md @@ -2,35 +2,154 @@ # `Carousel` -A carousel view. +A paginated scrolling widget. + +carousel + +The `AdwCarousel` widget can be used to display a set of pages with +swipe-based navigation between them. + +[class@CarouselIndicatorDots] and [class@CarouselIndicatorLines] can be used +to provide page indicators for `AdwCarousel`. + +## CSS nodes + +`AdwCarousel` has a single CSS node with name `carousel`. ## Properties -### `elements` +### `updateFunctions` -The elements. +Additional update functions for type extensions. -### `content` +### `appearFunctions` -The content. +Additional appear functions for type extensions. ### `allowLongSwipes` -Whether long swipes are allowed. +Whether to allow swiping for more than one page at a time. -### `view` +If the value is `FALSE`, each swipe can only move to the adjacent pages. -The view. +### `allowMouseDrag` + +Sets whether the `AdwCarousel` can be dragged with mouse pointer. + +If the value is `FALSE`, dragging is only available on touch. + +### `allowScrollWheel` + +Whether the widget will respond to scroll wheel events. + +If the value is `FALSE`, wheel events will be ignored. + +### `interactive` + +Whether the carousel can be navigated. + +This can be used to temporarily disable the carousel to only allow +navigating it in a certain state. + +### `nPages` + +The number of pages in a `AdwCarousel`. + +### `revealDuration` + +Page reveal duration, in milliseconds. + +Reveal duration is used when animating adding or removing pages. + +### `spacing` + +Spacing between pages in pixels. + +### `pageChanged` + +This signal is emitted after a page has been changed. + +It can be used to implement "infinite scrolling" by amending the pages +after every scroll. Note that an empty carousel is indicated by +`(int)index == -1`. + +### `elements` + +The dynamic widget elements. + +### `content` + +The dynamic widget content. + +### `app` + +The application. + +### `window` + +The window. ## Methods ### `init(_:content:)` Initialize `Carousel`. + +### `container(modifiers:)` + +Get the widget's view storage. +- Parameter modifiers: The view modifiers. +- Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. - Parameters: - - elements: The elements. - - content: The view for an element. + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. -### `longSwipes(_:)` +### `allowLongSwipes(_:)` -Set whether long swipes are allowed or not. -- Parameter longSwipes: Whether long swipes are allowed. -- Returns: The carousel. +Whether to allow swiping for more than one page at a time. + +If the value is `FALSE`, each swipe can only move to the adjacent pages. + +### `allowMouseDrag(_:)` + +Sets whether the `AdwCarousel` can be dragged with mouse pointer. + +If the value is `FALSE`, dragging is only available on touch. + +### `allowScrollWheel(_:)` + +Whether the widget will respond to scroll wheel events. + +If the value is `FALSE`, wheel events will be ignored. + +### `interactive(_:)` + +Whether the carousel can be navigated. + +This can be used to temporarily disable the carousel to only allow +navigating it in a certain state. + +### `nPages(_:)` + +The number of pages in a `AdwCarousel`. + +### `revealDuration(_:)` + +Page reveal duration, in milliseconds. + +Reveal duration is used when animating adding or removing pages. + +### `spacing(_:)` + +Spacing between pages in pixels. + +### `pageChanged(_:)` + +This signal is emitted after a page has been changed. + +It can be used to implement "infinite scrolling" by amending the pages +after every scroll. Note that an empty carousel is indicated by +`(int)index == -1`. diff --git a/Documentation/Reference/structs/CenterBox.md b/Documentation/Reference/structs/CenterBox.md new file mode 100644 index 0000000..a595c5b --- /dev/null +++ b/Documentation/Reference/structs/CenterBox.md @@ -0,0 +1,136 @@ +**STRUCT** + +# `CenterBox` + +`GtkCenterBox` arranges three children in a row, keeping the middle child +centered as well as possible. + +![An example GtkCenterBox](centerbox.png) + +To add children to `GtkCenterBox`, use [method@Gtk.CenterBox.set_start_widget], +[method@Gtk.CenterBox.set_center_widget] and +[method@Gtk.CenterBox.set_end_widget]. + +The sizing and positioning of children can be influenced with the +align and expand properties of the children. + +# GtkCenterBox as GtkBuildable + +The `GtkCenterBox` implementation of the `GtkBuildable` interface +supports placing children in the 3 positions by specifying “start”, “center” +or “end” as the “type” attribute of a `` element. + +# CSS nodes + +`GtkCenterBox` uses a single CSS node with the name “box”, + +The first child of the `GtkCenterBox` will be allocated depending on the +text direction, i.e. in left-to-right layouts it will be allocated on the +left and in right-to-left layouts on the right. + +In vertical orientation, the nodes of the children are arranged from top to +bottom. + +# Accessibility + +Until GTK 4.10, `GtkCenterBox` used the `GTK_ACCESSIBLE_ROLE_GROUP` role. + +Starting from GTK 4.12, `GtkCenterBox` uses the `GTK_ACCESSIBLE_ROLE_GENERIC` role. + +## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `centerWidget` + +The widget that is placed at the center position. + +### `endWidget` + +The widget that is placed at the end position. + +In vertical orientation, the end position is at the bottom. +In horizontal orientation, the end position is at the trailing +edge wrt. to the text direction. + +### `shrinkCenterLast` + +Whether to shrink the center widget after other children. + +By default, when there's no space to give all three children their +natural widths, the start and end widgets start shrinking and the +center child keeps natural width until they reach minimum width. + +If set to `FALSE`, start and end widgets keep natural width and the +center widget starts shrinking instead. + +### `startWidget` + +The widget that is placed at the start position. + +In vertical orientation, the start position is at the top. +In horizontal orientation, the start position is at the leading +edge wrt. to the text direction. + +### `app` + +The application. + +### `window` + +The window. + +## Methods +### `init()` + +Initialize `CenterBox`. + +### `container(modifiers:)` + +Get the widget's view storage. +- Parameter modifiers: The view modifiers. +- Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `centerWidget(_:)` + +The widget that is placed at the center position. + +### `endWidget(_:)` + +The widget that is placed at the end position. + +In vertical orientation, the end position is at the bottom. +In horizontal orientation, the end position is at the trailing +edge wrt. to the text direction. + +### `shrinkCenterLast(_:)` + +Whether to shrink the center widget after other children. + +By default, when there's no space to give all three children their +natural widths, the start and end widgets start shrinking and the +center child keeps natural width until they reach minimum width. + +If set to `FALSE`, start and end widgets keep natural width and the +center widget starts shrinking instead. + +### `startWidget(_:)` + +The widget that is placed at the start position. + +In vertical orientation, the start position is at the top. +In horizontal orientation, the start position is at the leading +edge wrt. to the text direction. diff --git a/Documentation/Reference/structs/CheckButton.md b/Documentation/Reference/structs/CheckButton.md new file mode 100644 index 0000000..849fa5f --- /dev/null +++ b/Documentation/Reference/structs/CheckButton.md @@ -0,0 +1,187 @@ +**STRUCT** + +# `CheckButton` + +A `GtkCheckButton` places a label next to an indicator. + +![Example GtkCheckButtons](check-button.png) + +A `GtkCheckButton` is created by calling either [ctor@Gtk.CheckButton.new] +or [ctor@Gtk.CheckButton.new_with_label]. + +The state of a `GtkCheckButton` can be set specifically using +[method@Gtk.CheckButton.set_active], and retrieved using +[method@Gtk.CheckButton.get_active]. + +# Inconsistent state + +In addition to "on" and "off", check buttons can be an +"in between" state that is neither on nor off. This can be used +e.g. when the user has selected a range of elements (such as some +text or spreadsheet cells) that are affected by a check button, +and the current values in that range are inconsistent. + +To set a `GtkCheckButton` to inconsistent state, use +[method@Gtk.CheckButton.set_inconsistent]. + +# Grouping + +Check buttons can be grouped together, to form mutually exclusive +groups - only one of the buttons can be toggled at a time, and toggling +another one will switch the currently toggled one off. + +Grouped check buttons use a different indicator, and are commonly referred +to as *radio buttons*. + +![Example GtkCheckButtons](radio-button.png) + +To add a `GtkCheckButton` to a group, use [method@Gtk.CheckButton.set_group]. + +When the code must keep track of the state of a group of radio buttons, it +is recommended to keep track of such state through a stateful +`GAction` with a target for each button. Using the `toggled` signals to keep +track of the group changes and state is discouraged. + +# CSS nodes + +``` +checkbutton[.text-button] +├── check +╰── [label] +``` + +A `GtkCheckButton` has a main node with name checkbutton. If the +[property@Gtk.CheckButton:label] or [property@Gtk.CheckButton:child] +properties are set, it contains a child widget. The indicator node +is named check when no group is set, and radio if the checkbutton +is grouped together with other checkbuttons. + +# Accessibility + +`GtkCheckButton` uses the %GTK_ACCESSIBLE_ROLE_CHECKBOX role. + +## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `active` + +If the check button is active. + +Setting `active` to %TRUE will add the `:checked:` state to both +the check button and the indicator CSS node. + +### `child` + +The child widget. + +### `inconsistent` + +If the check button is in an “in between” state. + +The inconsistent state only affects visual appearance, +not the semantics of the button. + +### `label` + +Text of the label inside the check button, if it contains a label widget. + +### `useUnderline` + +If set, an underline in the text indicates that the following +character is to be used as mnemonic. + +### `activate` + +Emitted to when the check button is activated. + +The `::activate` signal on `GtkCheckButton` is an action signal and +emitting it causes the button to animate press then release. + +Applications should never connect to this signal, but use the +[signal@Gtk.CheckButton::toggled] signal. + +The default bindings for this signal are all forms of the + and Enter keys. + +### `toggled` + +Emitted when the buttons's [property@Gtk.CheckButton:active] +property changes. + +### `app` + +The application. + +### `window` + +The window. + +## Methods +### `init()` + +Initialize `CheckButton`. + +### `container(modifiers:)` + +Get the widget's view storage. +- Parameter modifiers: The view modifiers. +- Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `active(_:)` + +If the check button is active. + +Setting `active` to %TRUE will add the `:checked:` state to both +the check button and the indicator CSS node. + +### `child(_:)` + +The child widget. + +### `inconsistent(_:)` + +If the check button is in an “in between” state. + +The inconsistent state only affects visual appearance, +not the semantics of the button. + +### `label(_:)` + +Text of the label inside the check button, if it contains a label widget. + +### `useUnderline(_:)` + +If set, an underline in the text indicates that the following +character is to be used as mnemonic. + +### `activate(_:)` + +Emitted to when the check button is activated. + +The `::activate` signal on `GtkCheckButton` is an action signal and +emitting it causes the button to animate press then release. + +Applications should never connect to this signal, but use the +[signal@Gtk.CheckButton::toggled] signal. + +The default bindings for this signal are all forms of the + and Enter keys. + +### `toggled(_:)` + +Emitted when the buttons's [property@Gtk.CheckButton:active] +property changes. diff --git a/Documentation/Reference/structs/Clamp.md b/Documentation/Reference/structs/Clamp.md index f74c4fa..a5a44f0 100644 --- a/Documentation/Reference/structs/Clamp.md +++ b/Documentation/Reference/structs/Clamp.md @@ -2,27 +2,111 @@ # `Clamp` -A horizontal AdwClamp equivalent. +A widget constraining its child to a given size. + +clamp-wideclamp-narrow + +The `AdwClamp` widget constrains the size of the widget it contains to a +given maximum size. It will constrain the width if it is horizontal, or the +height if it is vertical. The expansion of the child from its minimum to its +maximum size is eased out for a smooth transition. + +If the child requires more than the requested maximum size, it will be +allocated the minimum size it can fit in instead. + +`AdwClamp` can scale with the text scale factor, use the +[property@ClampLayout:unit] property to enable that behavior. + +## CSS nodes + +`AdwClamp` has a single CSS node with name `clamp`. ## Properties -### `content` +### `updateFunctions` -The content. +Additional update functions for type extensions. -### `maxSize` +### `appearFunctions` -The maximum size. +Additional appear functions for type extensions. + +### `child` + +The child widget of the `AdwClamp`. + +### `maximumSize` + +The maximum size allocated to the child. + +It is the width if the clamp is horizontal, or the height if it is vertical. + +### `tighteningThreshold` + +The size above which the child is clamped. + +Starting from this size, the clamp will tighten its grip on the child, +slowly allocating less and less of the available size up to the maximum +allocated size. Below that threshold and below the maximum size, the child +will be allocated all the available size. + +If the threshold is greater than the maximum size to allocate to the child, +the child will be allocated all the size up to the maximum. +If the threshold is lower than the minimum size to allocate to the child, +that size will be used as the tightening threshold. + +Effectively, tightening the grip on the child before it reaches its maximum +size makes transitions to and from the maximum size smoother when resizing. + +### `app` + +The application. + +### `window` + +The window. ## Methods -### `update(_:modifiers:)` +### `init()` -Update a view storage. -- Parameters: - - storage: The view storage. - - modifiers: Modify views before being updated. +Initialize `Clamp`. ### `container(modifiers:)` -Get a view storage. -- Parameter modifiers: Modify views before being updated. +Get the widget's view storage. +- Parameter modifiers: The view modifiers. - Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `child(_:)` + +The child widget of the `AdwClamp`. + +### `maximumSize(_:)` + +The maximum size allocated to the child. + +It is the width if the clamp is horizontal, or the height if it is vertical. + +### `tighteningThreshold(_:)` + +The size above which the child is clamped. + +Starting from this size, the clamp will tighten its grip on the child, +slowly allocating less and less of the available size up to the maximum +allocated size. Below that threshold and below the maximum size, the child +will be allocated all the available size. + +If the threshold is greater than the maximum size to allocate to the child, +the child will be allocated all the size up to the maximum. +If the threshold is lower than the minimum size to allocate to the child, +that size will be used as the tightening threshold. + +Effectively, tightening the grip on the child before it reaches its maximum +size makes transitions to and from the maximum size smoother when resizing. diff --git a/Documentation/Reference/structs/ComboRow.md b/Documentation/Reference/structs/ComboRow.md index 13c357b..f3c92a9 100644 --- a/Documentation/Reference/structs/ComboRow.md +++ b/Documentation/Reference/structs/ComboRow.md @@ -2,86 +2,278 @@ # `ComboRow` -A row for selecting an element out of a list of elements. +A [class@Gtk.ListBoxRow] used to choose from a list of items. + +combo-row + +The `AdwComboRow` widget allows the user to choose from a list of valid +choices. The row displays the selected choice. When activated, the row +displays a popover which allows the user to make a new choice. + +Example of an `AdwComboRow` UI definition: +```xml +Combo RowFooBarBaz +``` + +The [property@ComboRow:selected] and [property@ComboRow:selected-item] +properties can be used to keep track of the selected item and react to their +changes. + +`AdwComboRow` mirrors [class@Gtk.DropDown], see that widget for details. + +`AdwComboRow` is [property@Gtk.ListBoxRow:activatable] if a model is set. + +## CSS nodes + +`AdwComboRow` has a main CSS node with name `row` and the `.combo` style +class. + +Its popover has the node named `popover` with the `.menu` style class, it +contains a [class@Gtk.ScrolledWindow], which in turn contains a +[class@Gtk.ListView], both are accessible via their regular nodes. + +## Accessibility + +`AdwComboRow` uses the `GTK_ACCESSIBLE_ROLE_COMBO_BOX` role. ## Properties -### `title` +### `updateFunctions` -The title. +Additional update functions for type extensions. -### `selection` +### `appearFunctions` -The selected element. +Additional appear functions for type extensions. -### `content` +### `enableSearch` -The content. +Whether to show a search entry in the popup. + +If set to `TRUE`, a search entry will be shown in the popup that +allows to search for items in the list. + +Search requires [property@ComboRow:expression] to be set. + +### `selected` + +The position of the selected item. + +If no item is selected, the property has the value +[const@Gtk.INVALID_LIST_POSITION] + +### `useSubtitle` + +Whether to use the current value as the subtitle. + +If you use a custom list item factory, you will need to give the row a +name conversion expression with [property@ComboRow:expression]. + +If set to `TRUE`, you should not access [property@ActionRow:subtitle]. + +The subtitle is interpreted as Pango markup if +[property@PreferencesRow:use-markup] is set to `TRUE`. + +### `activatableWidget` + +The widget to activate when the row is activated. + +The row can be activated either by clicking on it, calling +[method@ActionRow.activate], or via mnemonics in the title. +See the [property@PreferencesRow:use-underline] property to enable +mnemonics. + +The target widget will be activated by emitting the +[signal@Gtk.Widget::mnemonic-activate] signal on it. + +### `iconName` + +The icon name for this row. ### `subtitle` -The subtitle. +The subtitle for this row. -### `prefix` +The subtitle is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. -The prefix. +### `subtitleLines` + +The number of lines at the end of which the subtitle label will be +ellipsized. + +If the value is 0, the number of lines won't be limited. + +### `subtitleSelectable` + +Whether the user can copy the subtitle from the label. + +See also [property@Gtk.Label:selectable]. + +### `titleLines` + +The number of lines at the end of which the title label will be ellipsized. + +If the value is 0, the number of lines won't be limited. + +### `title` + +The title of the preference represented by this row. + +The title is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. + +### `titleSelectable` + +Whether the user can copy the title from the label. + +See also [property@Gtk.Label:selectable]. + +### `useMarkup` + +Whether to use Pango markup for the title label. + +Subclasses may also use it for other labels, such as subtitle. + +See also [func@Pango.parse_markup]. + +### `useUnderline` + +Whether an embedded underline in the title indicates a mnemonic. + +### `activated` + +This signal is emitted after the row has been activated. ### `suffix` -The suffix. +The body for the widget "suffix". -### `prefixID` +### `prefix` -The identifier for the prefix content. +The body for the widget "prefix". -### `suffixID` +### `app` -The identifier for the suffix content. +The application. -### `elementsID` +### `window` -The identifier for the elements. +The window. ## Methods -### `init(_:selection:values:)` +### `init()` -Initialize a combo row. -- Parameters: - - title: The row's title. - - selection: The selected value. - - values: The available values. - -### `update(_:modifiers:)` - -Update a view storage. -- Parameters: - - storage: The view storage. - - modifiers: Modify views before being updated. +Initialize `ComboRow`. ### `container(modifiers:)` -Get a view storage. -- Parameter modifiers: Modify views before being updated. +Get the widget's view storage. +- Parameter modifiers: The view modifiers. - Returns: The view storage. -### `update(row:)` +### `update(_:modifiers:updateProperties:)` -Update the combo row. -- Parameter row: The combo row. +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `enableSearch(_:)` + +Whether to show a search entry in the popup. + +If set to `TRUE`, a search entry will be shown in the popup that +allows to search for items in the list. + +Search requires [property@ComboRow:expression] to be set. + +### `selected(_:)` + +The position of the selected item. + +If no item is selected, the property has the value +[const@Gtk.INVALID_LIST_POSITION] + +### `useSubtitle(_:)` + +Whether to use the current value as the subtitle. + +If you use a custom list item factory, you will need to give the row a +name conversion expression with [property@ComboRow:expression]. + +If set to `TRUE`, you should not access [property@ActionRow:subtitle]. + +The subtitle is interpreted as Pango markup if +[property@PreferencesRow:use-markup] is set to `TRUE`. + +### `activatableWidget(_:)` + +The widget to activate when the row is activated. + +The row can be activated either by clicking on it, calling +[method@ActionRow.activate], or via mnemonics in the title. +See the [property@PreferencesRow:use-underline] property to enable +mnemonics. + +The target widget will be activated by emitting the +[signal@Gtk.Widget::mnemonic-activate] signal on it. + +### `iconName(_:)` + +The icon name for this row. ### `subtitle(_:)` -Set the combo row's subtitle. -- Parameter subtitle: The subtitle. -- Returns: The combo row. +The subtitle for this row. -### `prefix(_:)` +The subtitle is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. -Set the combo row's prefix view. -- Parameter prefix: The prefix. -- Returns: The combo row. +### `subtitleLines(_:)` -### `suffix(_:)` +The number of lines at the end of which the subtitle label will be +ellipsized. -Set the combo row's suffix view. -- Parameter suffix: The suffix. -- Returns: The combo row. +If the value is 0, the number of lines won't be limited. + +### `subtitleSelectable(_:)` + +Whether the user can copy the subtitle from the label. + +See also [property@Gtk.Label:selectable]. + +### `titleLines(_:)` + +The number of lines at the end of which the title label will be ellipsized. + +If the value is 0, the number of lines won't be limited. + +### `title(_:)` + +The title of the preference represented by this row. + +The title is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. + +### `titleSelectable(_:)` + +Whether the user can copy the title from the label. + +See also [property@Gtk.Label:selectable]. + +### `useMarkup(_:)` + +Whether to use Pango markup for the title label. + +Subclasses may also use it for other labels, such as subtitle. + +See also [func@Pango.parse_markup]. + +### `useUnderline(_:)` + +Whether an embedded underline in the title indicates a mnemonic. + +### `activated(_:)` + +This signal is emitted after the row has been activated. diff --git a/Documentation/Reference/structs/ContentModifier.md b/Documentation/Reference/structs/ContentModifier.md index 2a0e703..0332511 100644 --- a/Documentation/Reference/structs/ContentModifier.md +++ b/Documentation/Reference/structs/ContentModifier.md @@ -20,12 +20,13 @@ Get the content's container. - Parameter modifiers: Modify views before being updated. - Returns: The content's container. -### `update(_:modifiers:)` +### `update(_:modifiers:updateProperties:)` Update the content. - Parameters: - storage: The content's storage. - modifiers: Modify views before being updated. + - updateProperties: Whether to update properties. ### `modifyView(_:)` diff --git a/Documentation/Reference/structs/EntryRow.md b/Documentation/Reference/structs/EntryRow.md index 8f03f37..0352511 100644 --- a/Documentation/Reference/structs/EntryRow.md +++ b/Documentation/Reference/structs/EntryRow.md @@ -2,86 +2,204 @@ # `EntryRow` -A form content row accepting text input. +A [class@Gtk.ListBoxRow] with an embedded text entry. + +entry-row + +`AdwEntryRow` has a title that doubles as placeholder text. It shows an icon +indicating that it's editable and can receive additional widgets before or +after the editable part. + +If [property@EntryRow:show-apply-button] is set to `TRUE`, `AdwEntryRow` can +show an apply button when editing its contents. This can be useful if +changing its contents can result in an expensive operation, such as network +activity. + +`AdwEntryRow` provides only minimal API and should be used with the +[iface@Gtk.Editable] API. + +See also [class@PasswordEntryRow]. + +## AdwEntryRow as GtkBuildable + +The `AdwEntryRow` implementation of the [iface@Gtk.Buildable] interface +supports adding a child at its end by specifying “suffix” or omitting the +“type” attribute of a element. + +It also supports adding a child as a prefix widget by specifying “prefix” as +the “type” attribute of a element. + +## CSS nodes + +`AdwEntryRow` has a single CSS node with name `row` and the `.entry` style +class. ## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `activatesDefault` + +Whether activating the embedded entry can activate the default widget. + +### `enableEmojiCompletion` + +Whether to suggest emoji replacements on the entry row. + +Emoji replacement is done with :-delimited names, like `:heart:`. + +### `showApplyButton` + +Whether to show the apply button. + +When set to `TRUE`, typing text in the entry will reveal an apply button. +Clicking it or pressing the Enter key will hide the button and +emit the [signal@EntryRow::apply] signal. + +This is useful if changing the entry contents can trigger an expensive +operation, e.g. network activity, to avoid triggering it after typing every +character. + ### `title` -The title. +The title of the preference represented by this row. -### `text` +The title is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. -The text. +### `titleSelectable` -### `prefix` +Whether the user can copy the title from the label. -The prefix. +See also [property@Gtk.Label:selectable]. + +### `useMarkup` + +Whether to use Pango markup for the title label. + +Subclasses may also use it for other labels, such as subtitle. + +See also [func@Pango.parse_markup]. + +### `useUnderline` + +Whether an embedded underline in the title indicates a mnemonic. + +### `apply` + +Emitted when the apply button is pressed. + +See [property@EntryRow:show-apply-button]. + +### `entryActivated` + +Emitted when the embedded entry is activated. ### `suffix` -The suffix. +The body for the widget "suffix". -### `onSubmit` +### `prefix` -The handler that gets executed when the user submits the content. +The body for the widget "prefix". -### `password` +### `app` -Whether the password entry row should be used. +The application. -### `prefixID` +### `window` -The identifier for the prefix content. - -### `suffixID` - -The identifier for the suffix content. +The window. ## Methods -### `init(_:text:)` +### `init()` -Initialize an entry row. -- Parameters: - - title: The row's title. - - text: The text. - -### `update(_:modifiers:)` - -Update a view storage. -- Parameters: - - storage: The view storage. - - modifiers: Modify views before being updated. +Initialize `EntryRow`. ### `container(modifiers:)` -Get a view storage. -- Parameter modifiers: Modify views before being updated. +Get the widget's view storage. +- Parameter modifiers: The view modifiers. - Returns: The view storage. -### `update(row:)` +### `update(_:modifiers:updateProperties:)` -Update the entry row. -- Parameter row: The entry row. +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. -### `onSubmit(_:)` +### `activatesDefault(_:)` -Set the entry row's subtitle. -- Parameter subtitle: The subtitle. -- Returns: The entry row. +Whether activating the embedded entry can activate the default widget. -### `prefix(_:)` +### `enableEmojiCompletion(_:)` -Set the entry row's prefix view. -- Parameter prefix: The prefix. -- Returns: The entry row. +Whether to suggest emoji replacements on the entry row. + +Emoji replacement is done with :-delimited names, like `:heart:`. + +### `showApplyButton(_:)` + +Whether to show the apply button. + +When set to `TRUE`, typing text in the entry will reveal an apply button. +Clicking it or pressing the Enter key will hide the button and +emit the [signal@EntryRow::apply] signal. + +This is useful if changing the entry contents can trigger an expensive +operation, e.g. network activity, to avoid triggering it after typing every +character. + +### `title(_:)` + +The title of the preference represented by this row. + +The title is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. + +### `titleSelectable(_:)` + +Whether the user can copy the title from the label. + +See also [property@Gtk.Label:selectable]. + +### `useMarkup(_:)` + +Whether to use Pango markup for the title label. + +Subclasses may also use it for other labels, such as subtitle. + +See also [func@Pango.parse_markup]. + +### `useUnderline(_:)` + +Whether an embedded underline in the title indicates a mnemonic. + +### `apply(_:)` + +Emitted when the apply button is pressed. + +See [property@EntryRow:show-apply-button]. + +### `entryActivated(_:)` + +Emitted when the embedded entry is activated. ### `suffix(_:)` -Set the entry row's suffix view. -- Parameter suffix: The suffix. -- Returns: The entry row. +Set the body for "suffix". +- Parameter body: The body. +- Returns: The widget. -### `secure()` +### `prefix(_:)` -Let the user securely enter private text. -- Returns: The entry row. +Set the body for "prefix". +- Parameter body: The body. +- Returns: The widget. diff --git a/Documentation/Reference/structs/ExpanderRow.md b/Documentation/Reference/structs/ExpanderRow.md new file mode 100644 index 0000000..c998c40 --- /dev/null +++ b/Documentation/Reference/structs/ExpanderRow.md @@ -0,0 +1,217 @@ +**STRUCT** + +# `ExpanderRow` + +A [class@Gtk.ListBoxRow] used to reveal widgets. + +expander-row + +The `AdwExpanderRow` widget allows the user to reveal or hide widgets below +it. It also allows the user to enable the expansion of the row, allowing to +disable all that the row contains. + +## AdwExpanderRow as GtkBuildable + +The `AdwExpanderRow` implementation of the [iface@Gtk.Buildable] interface +supports adding a child as an suffix widget by specifying “suffix” as the +“type” attribute of a element. + +It also supports adding it as a prefix widget by specifying “prefix” as the +“type” attribute of a element. + +## CSS nodes + +`AdwExpanderRow` has a main CSS node with name `row` and the `.expander` +style class. It has the `.empty` style class when it contains no children. + +It contains the subnodes `row.header` for its main embedded row, +`list.nested` for the list it can expand, and `image.expander-row-arrow` for +its arrow. + +## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `enableExpansion` + +Whether expansion is enabled. + +### `expanded` + +Whether the row is expanded. + +### `iconName` + +The icon name for this row. + +### `showEnableSwitch` + +Whether the switch enabling the expansion is visible. + +### `subtitle` + +The subtitle for this row. + +The subtitle is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. + +### `subtitleLines` + +The number of lines at the end of which the subtitle label will be +ellipsized. + +If the value is 0, the number of lines won't be limited. + +### `titleLines` + +The number of lines at the end of which the title label will be ellipsized. + +If the value is 0, the number of lines won't be limited. + +### `title` + +The title of the preference represented by this row. + +The title is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. + +### `titleSelectable` + +Whether the user can copy the title from the label. + +See also [property@Gtk.Label:selectable]. + +### `useMarkup` + +Whether to use Pango markup for the title label. + +Subclasses may also use it for other labels, such as subtitle. + +See also [func@Pango.parse_markup]. + +### `useUnderline` + +Whether an embedded underline in the title indicates a mnemonic. + +### `rows` + +The body for the widget "rows". + +### `suffix` + +The body for the widget "suffix". + +### `prefix` + +The body for the widget "prefix". + +### `app` + +The application. + +### `window` + +The window. + +## Methods +### `init()` + +Initialize `ExpanderRow`. + +### `container(modifiers:)` + +Get the widget's view storage. +- Parameter modifiers: The view modifiers. +- Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `enableExpansion(_:)` + +Whether expansion is enabled. + +### `expanded(_:)` + +Whether the row is expanded. + +### `iconName(_:)` + +The icon name for this row. + +### `showEnableSwitch(_:)` + +Whether the switch enabling the expansion is visible. + +### `subtitle(_:)` + +The subtitle for this row. + +The subtitle is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. + +### `subtitleLines(_:)` + +The number of lines at the end of which the subtitle label will be +ellipsized. + +If the value is 0, the number of lines won't be limited. + +### `titleLines(_:)` + +The number of lines at the end of which the title label will be ellipsized. + +If the value is 0, the number of lines won't be limited. + +### `title(_:)` + +The title of the preference represented by this row. + +The title is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. + +### `titleSelectable(_:)` + +Whether the user can copy the title from the label. + +See also [property@Gtk.Label:selectable]. + +### `useMarkup(_:)` + +Whether to use Pango markup for the title label. + +Subclasses may also use it for other labels, such as subtitle. + +See also [func@Pango.parse_markup]. + +### `useUnderline(_:)` + +Whether an embedded underline in the title indicates a mnemonic. + +### `rows(_:)` + +Set the body for "rows". +- Parameter body: The body. +- Returns: The widget. + +### `suffix(_:)` + +Set the body for "suffix". +- Parameter body: The body. +- Returns: The widget. + +### `prefix(_:)` + +Set the body for "prefix". +- Parameter body: The body. +- Returns: The widget. diff --git a/Documentation/Reference/structs/FileDialog.md b/Documentation/Reference/structs/FileDialog.md index 97bc9b8..410a8e0 100644 --- a/Documentation/Reference/structs/FileDialog.md +++ b/Documentation/Reference/structs/FileDialog.md @@ -37,10 +37,6 @@ The initial file name for the file exporter. The accepted extensions for the file importer. -### `folders` - -Whether folders are accepted in the file importer. - ### `result` The closure to run when the import or export is successful. @@ -50,7 +46,7 @@ The closure to run when the import or export is successful. The closure to run when the import or export is not successful. ## Methods -### `init(importer:initialFolder:extensions:folders:onOpen:onClose:)` +### `init(importer:initialFolder:extensions:onOpen:onClose:)` Create an importer file dialog window. - Parameters: @@ -77,7 +73,7 @@ Get the storage for the window. - Parameter app: The application. - Returns: The storage. -### `update(_:app:)` +### `update(_:app:force:)` Update a window. - Parameters: diff --git a/Documentation/Reference/structs/Form.md b/Documentation/Reference/structs/Form.md index 02b0bd7..21a1bf4 100644 --- a/Documentation/Reference/structs/Form.md +++ b/Documentation/Reference/structs/Form.md @@ -9,21 +9,12 @@ A list with no dynamic content styled as a boxed list. The content. +### `view` + +The view's body. + ## Methods ### `init(content:)` Initialize a `Form`. - Parameter content: The view content, usually different kind of rows. - -### `update(_:modifiers:)` - -Update a view storage. -- Parameters: - - storage: The view storage. - - modifiers: Modify views before being updated. - -### `container(modifiers:)` - -Get a view storage. -- Parameter modifiers: Modify views before being updated. -- Returns: The view storage. diff --git a/Documentation/Reference/structs/HStack.md b/Documentation/Reference/structs/HStack.md index 1045eb8..42e828c 100644 --- a/Documentation/Reference/structs/HStack.md +++ b/Documentation/Reference/structs/HStack.md @@ -9,21 +9,12 @@ A horizontal GtkBox equivalent. The content. +### `view` + +The view's body. + ## Methods ### `init(content:)` Initialize a `HStack`. - Parameter content: The view content. - -### `update(_:modifiers:)` - -Update a view storage. -- Parameters: - - storage: The view storage. - - modifiers: Modify views before being updated. - -### `container(modifiers:)` - -Get a view storage. -- Parameter modifiers: Modify views before being updated. -- Returns: The view storage. diff --git a/Documentation/Reference/structs/HeaderBar.md b/Documentation/Reference/structs/HeaderBar.md index fcd55fc..b37abfe 100644 --- a/Documentation/Reference/structs/HeaderBar.md +++ b/Documentation/Reference/structs/HeaderBar.md @@ -2,78 +2,255 @@ # `HeaderBar` -A header bar widget. +A title bar widget. + +header-bar + +`AdwHeaderBar` is similar to [class@Gtk.HeaderBar], but provides additional +features compared to it. Refer to `GtkHeaderBar` for details. It is typically +used as a top bar within [class@ToolbarView]. + +## Navigation View Integration + +When placed inside an [class@NavigationPage], `AdwHeaderBar` will display the +page title instead of window title. + +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 +page. The button also has a context menu, allowing to pop multiple pages at +once, potentially across multiple navigation views. In rare scenarios, set +[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). + +## Split View Integration + +When placed inside `AdwNavigationSplitView` or `AdwOverlaySplitView`, +`AdwHeaderBar` will automatically hide the title buttons other than at the +edges of the window. + +## Centering Policy + +[property@HeaderBar:centering-policy] allows to enforce strict centering of +the title widget. This can be useful for entries inside [class@Clamp]. + +## Title Buttons + +Unlike `GtkHeaderBar`, `AdwHeaderBar` allows to toggle title button +visibility for each side individually, using the +[property@HeaderBar:show-start-title-buttons] and +[property@HeaderBar:show-end-title-buttons] properties. + +## CSS nodes + +``` +headerbar +╰── windowhandle +╰── box +├── widget +│ ╰── box.start +│ ├── windowcontrols.start +│ ├── widget +│ │ ╰── [button.back] +│ ╰── [other children] +├── widget +│ ╰── [Title Widget] +╰── widget +╰── box.end +├── [other children] +╰── windowcontrols.end +``` + +`AdwHeaderBar`'s CSS node is called `headerbar`. It contains a `windowhandle` +subnode, which contains a `box` subnode, which contains three `widget` +subnodes at the start, center and end of the header bar. The start and end +subnotes contain a `box` subnode with the `.start` and `.end` style classes +respectively, and the center node contains a node that represents the title. + +Each of the boxes contains a `windowcontrols` subnode, see +[class@Gtk.WindowControls] for details, as well as other children. + +When [property@HeaderBar:show-back-button] is `TRUE`, the start box also +contains a node with the name `widget` that contains a node with the name +`button` and `.back` style class. + +## Accessibility + +`AdwHeaderBar` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role. ## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `decorationLayout` + +The decoration layout for buttons. + +If this property is not set, the +[property@Gtk.Settings:gtk-decoration-layout] setting is used. + +The format of the string is button names, separated by commas. A colon +separates the buttons that should appear at the start from those at the +end. Recognized button names are minimize, maximize, close and icon (the +window icon). + +For example, “icon:minimize,maximize,close” specifies an icon at the start, +and minimize, maximize and close buttons at the end. + +### `showBackButton` + +Whether the header bar can show the back button. + +The back button will never be shown unless the header bar is placed inside an +[class@NavigationView]. Usually, there is no reason to set this to `FALSE`. + +### `showEndTitleButtons` + +Whether to show title buttons at the end of the header bar. + +See [property@HeaderBar:show-start-title-buttons] for the other side. + +Which buttons are actually shown and where is determined by the +[property@HeaderBar:decoration-layout] property, and by the state of the +window (e.g. a close button will not be shown if the window can't be +closed). + +### `showStartTitleButtons` + +Whether to show title buttons at the start of the header bar. + +See [property@HeaderBar:show-end-title-buttons] for the other side. + +Which buttons are actually shown and where is determined by the +[property@HeaderBar:decoration-layout] property, and by the state of the +window (e.g. a close button will not be shown if the window can't be +closed). + +### `showTitle` + +Whether the title widget should be shown. + +### `titleWidget` + +The title widget to display. + +When set to `NULL`, the header bar will display the title of the window it +is contained in. + +To use a different title, use [class@WindowTitle]: + +```xml +Title +``` + ### `start` -The start content of the header bar. +The body for the widget "start". ### `end` -The end content of the header bar. +The body for the widget "end". -### `titleButtons` +### `app` -Whether the title buttons are visible. +The application. -### `headerBarTitle` +### `window` -The view acting as the title of the header bar. - -### `startID` - -The start content's id. - -### `endID` - -The end content's id. - -### `titleID` - -The title's id. +The window. ## Methods -### `init(titleButtons:start:end:)` +### `init()` -Initialize a header bar. -- Parameters: - - titleButtons: Whether the title buttons (e.g. close button) are visible. - - start: The start content. - - end: The end content. - -### `empty()` - -Initialize an empty header bar. -- Returns: The header bar. - -### `start(start:)` - -Initialize a header bar with only views at the start. -- Parameter start: The views. -- Returns: The header bar. - -### `end(end:)` - -Initialize a header bar with only views at the end. -- Parameter start: The views. -- Returns: The header bar. - -### `update(_:modifiers:)` - -Update a header bar's view storage. -- Parameters: - - storage: The view storage. - - modifiers: Modify views before being updated. +Initialize `HeaderBar`. ### `container(modifiers:)` -Get the container for a header bar. -- Parameter modifiers: Modify views before being updated. +Get the widget's view storage. +- Parameter modifiers: The view modifiers. - Returns: The view storage. -### `headerBarTitle(view:)` +### `update(_:modifiers:updateProperties:)` -Set the title widget for the header bar. -- Parameter view: The widget in the header bar. -- Returns: The header bar. +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `decorationLayout(_:)` + +The decoration layout for buttons. + +If this property is not set, the +[property@Gtk.Settings:gtk-decoration-layout] setting is used. + +The format of the string is button names, separated by commas. A colon +separates the buttons that should appear at the start from those at the +end. Recognized button names are minimize, maximize, close and icon (the +window icon). + +For example, “icon:minimize,maximize,close” specifies an icon at the start, +and minimize, maximize and close buttons at the end. + +### `showBackButton(_:)` + +Whether the header bar can show the back button. + +The back button will never be shown unless the header bar is placed inside an +[class@NavigationView]. Usually, there is no reason to set this to `FALSE`. + +### `showEndTitleButtons(_:)` + +Whether to show title buttons at the end of the header bar. + +See [property@HeaderBar:show-start-title-buttons] for the other side. + +Which buttons are actually shown and where is determined by the +[property@HeaderBar:decoration-layout] property, and by the state of the +window (e.g. a close button will not be shown if the window can't be +closed). + +### `showStartTitleButtons(_:)` + +Whether to show title buttons at the start of the header bar. + +See [property@HeaderBar:show-end-title-buttons] for the other side. + +Which buttons are actually shown and where is determined by the +[property@HeaderBar:decoration-layout] property, and by the state of the +window (e.g. a close button will not be shown if the window can't be +closed). + +### `showTitle(_:)` + +Whether the title widget should be shown. + +### `titleWidget(_:)` + +The title widget to display. + +When set to `NULL`, the header bar will display the title of the window it +is contained in. + +To use a different title, use [class@WindowTitle]: + +```xml +Title +``` + +### `start(_:)` + +Set the body for "start". +- Parameter body: The body. +- Returns: The widget. + +### `end(_:)` + +Set the body for "end". +- Parameter body: The body. +- Returns: The widget. diff --git a/Documentation/Reference/structs/InspectorWrapper.md b/Documentation/Reference/structs/InspectorWrapper.md index 0bdb525..0d41c6c 100644 --- a/Documentation/Reference/structs/InspectorWrapper.md +++ b/Documentation/Reference/structs/InspectorWrapper.md @@ -20,9 +20,10 @@ Get the content's container. - Parameter modifiers: Modify views before being updated. - Returns: The content's container. -### `update(_:modifiers:)` +### `update(_:modifiers:updateProperties:)` Update the content. - Parameters: - storage: The content's storage. - modifiers: Modify views before being updated. + - updateProperties: Whether to update properties. diff --git a/Documentation/Reference/structs/Label.md b/Documentation/Reference/structs/Label.md new file mode 100644 index 0000000..4eb89eb --- /dev/null +++ b/Documentation/Reference/structs/Label.md @@ -0,0 +1,416 @@ +**STRUCT** + +# `Label` + +The `GtkLabel` widget displays a small amount of text. + +As the name implies, most labels are used to label another widget +such as a [class@Button]. + +![An example GtkLabel](label.png) + +# CSS nodes + +``` +label +├── [selection] +├── [link] +┊ +╰── [link] +``` + +`GtkLabel` has a single CSS node with the name label. A wide variety +of style classes may be applied to labels, such as .title, .subtitle, +.dim-label, etc. In the `GtkShortcutsWindow`, labels are used with the +.keycap style class. + +If the label has a selection, it gets a subnode with name selection. + +If the label has links, there is one subnode per link. These subnodes +carry the link or visited state depending on whether they have been +visited. In this case, label node also gets a .link style class. + +# GtkLabel as GtkBuildable + +The GtkLabel implementation of the GtkBuildable interface supports a +custom `` element, which supports any number of `` +elements. The element has attributes named “name“, “value“, +“start“ and “end“ and allows you to specify [struct@Pango.Attribute] +values for this label. + +An example of a UI definition fragment specifying Pango attributes: +```xml + +``` + +The start and end attributes specify the range of characters to which the +Pango attribute applies. If start and end are not specified, the attribute is +applied to the whole text. Note that specifying ranges does not make much +sense with translatable attributes. Use markup embedded in the translatable +content instead. + +# Accessibility + +`GtkLabel` uses the %GTK_ACCESSIBLE_ROLE_LABEL role. + +# Mnemonics + +Labels may contain “mnemonics”. Mnemonics are underlined characters in the +label, used for keyboard navigation. Mnemonics are created by providing a +string with an underscore before the mnemonic character, such as `"_File"`, +to the functions [ctor@Gtk.Label.new_with_mnemonic] or +[method@Gtk.Label.set_text_with_mnemonic]. + +Mnemonics automatically activate any activatable widget the label is +inside, such as a [class@Gtk.Button]; if the label is not inside the +mnemonic’s target widget, you have to tell the label about the target +using [class@Gtk.Label.set_mnemonic_widget]. Here’s a simple example where +the label is inside a button: + +```c +// Pressing Alt+H will activate this button +GtkWidget *button = gtk_button_new (); +GtkWidget *label = gtk_label_new_with_mnemonic ("_Hello"); +gtk_button_set_child (GTK_BUTTON (button), label); +``` + +There’s a convenience function to create buttons with a mnemonic label +already inside: + +```c +// Pressing Alt+H will activate this button +GtkWidget *button = gtk_button_new_with_mnemonic ("_Hello"); +``` + +To create a mnemonic for a widget alongside the label, such as a +[class@Gtk.Entry], you have to point the label at the entry with +[method@Gtk.Label.set_mnemonic_widget]: + +```c +// Pressing Alt+H will focus the entry +GtkWidget *entry = gtk_entry_new (); +GtkWidget *label = gtk_label_new_with_mnemonic ("_Hello"); +gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry); +``` + +# Markup (styled text) + +To make it easy to format text in a label (changing colors, +fonts, etc.), label text can be provided in a simple +markup format: + +Here’s how to create a label with a small font: +```c +GtkWidget *label = gtk_label_new (NULL); +gtk_label_set_markup (GTK_LABEL (label), "Small text"); +``` + +(See the Pango manual for complete documentation] of available +tags, [func@Pango.parse_markup]) + +The markup passed to [method@Gtk.Label.set_markup] must be valid; for example, +literal `<`, `>` and `&` characters must be escaped as `<`, `>`, and `&`. +If you pass text obtained from the user, file, or a network to +[method@Gtk.Label.set_markup], you’ll want to escape it with +[func@GLib.markup_escape_text] or [func@GLib.markup_printf_escaped]. + +Markup strings are just a convenient way to set the [struct@Pango.AttrList] +on a label; [method@Gtk.Label.set_attributes] may be a simpler way to set +attributes in some cases. Be careful though; [struct@Pango.AttrList] tends +to cause internationalization problems, unless you’re applying attributes +to the entire string (i.e. unless you set the range of each attribute +to [0, %G_MAXINT)). The reason is that specifying the start_index and +end_index for a [struct@Pango.Attribute] requires knowledge of the exact +string being displayed, so translations will cause problems. + +# Selectable labels + +Labels can be made selectable with [method@Gtk.Label.set_selectable]. +Selectable labels allow the user to copy the label contents to +the clipboard. Only labels that contain useful-to-copy information +— such as error messages — should be made selectable. + +# Text layout + +A label can contain any number of paragraphs, but will have +performance problems if it contains more than a small number. +Paragraphs are separated by newlines or other paragraph separators +understood by Pango. + +Labels can automatically wrap text if you call [method@Gtk.Label.set_wrap]. + +[method@Gtk.Label.set_justify] sets how the lines in a label align +with one another. If you want to set how the label as a whole aligns +in its available space, see the [property@Gtk.Widget:halign] and +[property@Gtk.Widget:valign] properties. + +The [property@Gtk.Label:width-chars] and [property@Gtk.Label:max-width-chars] +properties can be used to control the size allocation of ellipsized or +wrapped labels. For ellipsizing labels, if either is specified (and less +than the actual text size), it is used as the minimum width, and the actual +text size is used as the natural width of the label. For wrapping labels, +width-chars is used as the minimum width, if specified, and max-width-chars +is used as the natural width. Even if max-width-chars specified, wrapping +labels will be rewrapped to use all of the available width. + +# Links + +GTK supports markup for clickable hyperlinks in addition to regular Pango +markup. The markup for links is borrowed from HTML, using the `` with +“href“, “title“ and “class“ attributes. GTK renders links similar to the +way they appear in web browsers, with colored, underlined text. The “title“ +attribute is displayed as a tooltip on the link. The “class“ attribute is +used as style class on the CSS node for the link. + +An example looks like this: + +```c +const char *text = +"Go to the " +"" +"GTK website for more..."; +GtkWidget *label = gtk_label_new (NULL); +gtk_label_set_markup (GTK_LABEL (label), text); +``` + +It is possible to implement custom handling for links and their tooltips +with the [signal@Gtk.Label::activate-link] signal and the +[method@Gtk.Label.get_current_uri] function. + +## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `label` + +The contents of the label. + +If the string contains Pango markup (see [func@Pango.parse_markup]), +you will have to set the [property@Gtk.Label:use-markup] property to +%TRUE in order for the label to display the markup attributes. See also +[method@Gtk.Label.set_markup] for a convenience function that sets both +this property and the [property@Gtk.Label:use-markup] property at the +same time. + +If the string contains underlines acting as mnemonics, you will have to +set the [property@Gtk.Label:use-underline] property to %TRUE in order +for the label to display them. + +### `lines` + +The number of lines to which an ellipsized, wrapping label +should be limited. + +This property has no effect if the label is not wrapping or ellipsized. +Set this property to -1 if you don't want to limit the number of lines. + +### `maxWidthChars` + +The desired maximum width of the label, in characters. + +If this property is set to -1, the width will be calculated automatically. + +See the section on [text layout](class.Label.html#text-layout) for details of how +[property@Gtk.Label:width-chars] and [property@Gtk.Label:max-width-chars] +determine the width of ellipsized and wrapped labels. + +### `mnemonicKeyval` + +The mnemonic accelerator key for the label. + +### `mnemonicWidget` + +The widget to be activated when the labels mnemonic key is pressed. + +### `selectable` + +Whether the label text can be selected with the mouse. + +### `singleLineMode` + +Whether the label is in single line mode. + +In single line mode, the height of the label does not depend on the +actual text, it is always set to ascent + descent of the font. This +can be an advantage in situations where resizing the label because +of text changes would be distracting, e.g. in a statusbar. + +### `useMarkup` + +%TRUE if the text of the label includes Pango markup. + +See [func@Pango.parse_markup]. + +### `useUnderline` + +%TRUE if the text of the label indicates a mnemonic with an _ +before the mnemonic character. + +### `widthChars` + +The desired width of the label, in characters. + +If this property is set to -1, the width will be calculated automatically. + +See the section on [text layout](class.Label.html#text-layout) for details of how +[property@Gtk.Label:width-chars] and [property@Gtk.Label:max-width-chars] +determine the width of ellipsized and wrapped labels. + +### `wrap` + +%TRUE if the label text will wrap if it gets too wide. + +### `xalign` + +The horizontal alignment of the label text inside its size allocation. + +Compare this to [property@Gtk.Widget:halign], which determines how the +labels size allocation is positioned in the space available for the label. + +### `yalign` + +The vertical alignment of the label text inside its size allocation. + +Compare this to [property@Gtk.Widget:valign], which determines how the +labels size allocation is positioned in the space available for the label. + +### `copyClipboard` + +Gets emitted to copy the selection to the clipboard. + +The ::copy-clipboard signal is a [keybinding signal](class.SignalAction.html). + +The default binding for this signal is Ctrl+c. + +### `app` + +The application. + +### `window` + +The window. + +## Methods +### `init(label:)` + +Initialize `Label`. + +### `container(modifiers:)` + +Get the widget's view storage. +- Parameter modifiers: The view modifiers. +- Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `label(_:)` + +The contents of the label. + +If the string contains Pango markup (see [func@Pango.parse_markup]), +you will have to set the [property@Gtk.Label:use-markup] property to +%TRUE in order for the label to display the markup attributes. See also +[method@Gtk.Label.set_markup] for a convenience function that sets both +this property and the [property@Gtk.Label:use-markup] property at the +same time. + +If the string contains underlines acting as mnemonics, you will have to +set the [property@Gtk.Label:use-underline] property to %TRUE in order +for the label to display them. + +### `lines(_:)` + +The number of lines to which an ellipsized, wrapping label +should be limited. + +This property has no effect if the label is not wrapping or ellipsized. +Set this property to -1 if you don't want to limit the number of lines. + +### `maxWidthChars(_:)` + +The desired maximum width of the label, in characters. + +If this property is set to -1, the width will be calculated automatically. + +See the section on [text layout](class.Label.html#text-layout) for details of how +[property@Gtk.Label:width-chars] and [property@Gtk.Label:max-width-chars] +determine the width of ellipsized and wrapped labels. + +### `mnemonicKeyval(_:)` + +The mnemonic accelerator key for the label. + +### `mnemonicWidget(_:)` + +The widget to be activated when the labels mnemonic key is pressed. + +### `selectable(_:)` + +Whether the label text can be selected with the mouse. + +### `singleLineMode(_:)` + +Whether the label is in single line mode. + +In single line mode, the height of the label does not depend on the +actual text, it is always set to ascent + descent of the font. This +can be an advantage in situations where resizing the label because +of text changes would be distracting, e.g. in a statusbar. + +### `useMarkup(_:)` + +%TRUE if the text of the label includes Pango markup. + +See [func@Pango.parse_markup]. + +### `useUnderline(_:)` + +%TRUE if the text of the label indicates a mnemonic with an _ +before the mnemonic character. + +### `widthChars(_:)` + +The desired width of the label, in characters. + +If this property is set to -1, the width will be calculated automatically. + +See the section on [text layout](class.Label.html#text-layout) for details of how +[property@Gtk.Label:width-chars] and [property@Gtk.Label:max-width-chars] +determine the width of ellipsized and wrapped labels. + +### `wrap(_:)` + +%TRUE if the label text will wrap if it gets too wide. + +### `xalign(_:)` + +The horizontal alignment of the label text inside its size allocation. + +Compare this to [property@Gtk.Widget:halign], which determines how the +labels size allocation is positioned in the space available for the label. + +### `yalign(_:)` + +The vertical alignment of the label text inside its size allocation. + +Compare this to [property@Gtk.Widget:valign], which determines how the +labels size allocation is positioned in the space available for the label. + +### `copyClipboard(_:)` + +Gets emitted to copy the selection to the clipboard. + +The ::copy-clipboard signal is a [keybinding signal](class.SignalAction.html). + +The default binding for this signal is Ctrl+c. diff --git a/Documentation/Reference/structs/LevelBar.md b/Documentation/Reference/structs/LevelBar.md new file mode 100644 index 0000000..bfe901a --- /dev/null +++ b/Documentation/Reference/structs/LevelBar.md @@ -0,0 +1,197 @@ +**STRUCT** + +# `LevelBar` + +`GtkLevelBar` is a widget that can be used as a level indicator. + +Typical use cases are displaying the strength of a password, or +showing the charge level of a battery. + +![An example GtkLevelBar](levelbar.png) + +Use [method@Gtk.LevelBar.set_value] to set the current value, and +[method@Gtk.LevelBar.add_offset_value] to set the value offsets at which +the bar will be considered in a different state. GTK will add a few +offsets by default on the level bar: %GTK_LEVEL_BAR_OFFSET_LOW, +%GTK_LEVEL_BAR_OFFSET_HIGH and %GTK_LEVEL_BAR_OFFSET_FULL, with +values 0.25, 0.75 and 1.0 respectively. + +Note that it is your responsibility to update preexisting offsets +when changing the minimum or maximum value. GTK will simply clamp +them to the new range. + +## Adding a custom offset on the bar + +```c +static GtkWidget * +create_level_bar (void) +{ +GtkWidget *widget; +GtkLevelBar *bar; + +widget = gtk_level_bar_new (); +bar = GTK_LEVEL_BAR (widget); + +// This changes the value of the default low offset + +gtk_level_bar_add_offset_value (bar, +GTK_LEVEL_BAR_OFFSET_LOW, +0.10); + +// This adds a new offset to the bar; the application will +// be able to change its color CSS like this: +// +// levelbar block.my-offset { +// background-color: magenta; +// border-style: solid; +// border-color: black; +// border-width: 1px; +// } + +gtk_level_bar_add_offset_value (bar, "my-offset", 0.60); + +return widget; +} +``` + +The default interval of values is between zero and one, but it’s possible +to modify the interval using [method@Gtk.LevelBar.set_min_value] and +[method@Gtk.LevelBar.set_max_value]. The value will be always drawn in +proportion to the admissible interval, i.e. a value of 15 with a specified +interval between 10 and 20 is equivalent to a value of 0.5 with an interval +between 0 and 1. When %GTK_LEVEL_BAR_MODE_DISCRETE is used, the bar level +is rendered as a finite number of separated blocks instead of a single one. +The number of blocks that will be rendered is equal to the number of units +specified by the admissible interval. + +For instance, to build a bar rendered with five blocks, it’s sufficient to +set the minimum value to 0 and the maximum value to 5 after changing the +indicator mode to discrete. + +# GtkLevelBar as GtkBuildable + +The `GtkLevelBar` implementation of the `GtkBuildable` interface supports a +custom `` element, which can contain any number of `` elements, +each of which must have "name" and "value" attributes. + +# CSS nodes + +``` +levelbar[.discrete] +╰── trough +├── block.filled.level-name +┊ +├── block.empty +┊ +``` + +`GtkLevelBar` has a main CSS node with name levelbar and one of the style +classes .discrete or .continuous and a subnode with name trough. Below the +trough node are a number of nodes with name block and style class .filled +or .empty. In continuous mode, there is exactly one node of each, in discrete +mode, the number of filled and unfilled nodes corresponds to blocks that are +drawn. The block.filled nodes also get a style class .level-name corresponding +to the level for the current value. + +In horizontal orientation, the nodes are always arranged from left to right, +regardless of text direction. + +# Accessibility + +`GtkLevelBar` uses the %GTK_ACCESSIBLE_ROLE_METER role. + +## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `inverted` + +Whether the `GtkLeveBar` is inverted. + +Level bars normally grow from top to bottom or left to right. +Inverted level bars grow in the opposite direction. + +### `maxValue` + +Determines the maximum value of the interval that can be displayed by the bar. + +### `minValue` + +Determines the minimum value of the interval that can be displayed by the bar. + +### `value` + +Determines the currently filled value of the level bar. + +### `offsetChanged` + +Emitted when an offset specified on the bar changes value. + +This typically is the result of a [method@Gtk.LevelBar.add_offset_value] +call. + +The signal supports detailed connections; you can connect to the +detailed signal "changed::x" in order to only receive callbacks when +the value of offset "x" changes. + +### `app` + +The application. + +### `window` + +The window. + +## Methods +### `init()` + +Initialize `LevelBar`. + +### `container(modifiers:)` + +Get the widget's view storage. +- Parameter modifiers: The view modifiers. +- Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `inverted(_:)` + +Whether the `GtkLeveBar` is inverted. + +Level bars normally grow from top to bottom or left to right. +Inverted level bars grow in the opposite direction. + +### `maxValue(_:)` + +Determines the maximum value of the interval that can be displayed by the bar. + +### `minValue(_:)` + +Determines the minimum value of the interval that can be displayed by the bar. + +### `value(_:)` + +Determines the currently filled value of the level bar. + +### `offsetChanged(_:)` + +Emitted when an offset specified on the bar changes value. + +This typically is the result of a [method@Gtk.LevelBar.add_offset_value] +call. + +The signal supports detailed connections; you can connect to the +detailed signal "changed::x" in order to only receive callbacks when +the value of offset "x" changes. diff --git a/Documentation/Reference/structs/LinkButton.md b/Documentation/Reference/structs/LinkButton.md new file mode 100644 index 0000000..8ebc83f --- /dev/null +++ b/Documentation/Reference/structs/LinkButton.md @@ -0,0 +1,176 @@ +**STRUCT** + +# `LinkButton` + +A `GtkLinkButton` is a button with a hyperlink. + +![An example GtkLinkButton](link-button.png) + +It is useful to show quick links to resources. + +A link button is created by calling either [ctor@Gtk.LinkButton.new] or +[ctor@Gtk.LinkButton.new_with_label]. If using the former, the URI you +pass to the constructor is used as a label for the widget. + +The URI bound to a `GtkLinkButton` can be set specifically using +[method@Gtk.LinkButton.set_uri]. + +By default, `GtkLinkButton` calls [method@Gtk.FileLauncher.launch] when the button +is clicked. This behaviour can be overridden by connecting to the +[signal@Gtk.LinkButton::activate-link] signal and returning %TRUE from +the signal handler. + +# CSS nodes + +`GtkLinkButton` has a single CSS node with name button. To differentiate +it from a plain `GtkButton`, it gets the .link style class. + +# Accessibility + +`GtkLinkButton` uses the %GTK_ACCESSIBLE_ROLE_LINK role. + +## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `uri` + +The URI bound to this button. + +### `visited` + +The 'visited' state of this button. + +A visited link is drawn in a different color. + +### `canShrink` + +Whether the size of the button can be made smaller than the natural +size of its contents. + +For text buttons, setting this property will allow ellipsizing the label. + +If the contents of a button are an icon or a custom widget, setting this +property has no effect. + +### `child` + +The child widget. + +### `hasFrame` + +Whether the button has a frame. + +### `iconName` + +The name of the icon used to automatically populate the button. + +### `label` + +Text of the label inside the button, if the button contains a label widget. + +### `useUnderline` + +If set, an underline in the text indicates that the following character is +to be used as mnemonic. + +### `activate` + +Emitted to animate press then release. + +This is an action signal. Applications should never connect +to this signal, but use the [signal@Gtk.Button::clicked] signal. + +The default bindings for this signal are all forms of the + and Enter keys. + +### `clicked` + +Emitted when the button has been activated (pressed and released). + +### `app` + +The application. + +### `window` + +The window. + +## Methods +### `init(uri:)` + +Initialize `LinkButton`. + +### `container(modifiers:)` + +Get the widget's view storage. +- Parameter modifiers: The view modifiers. +- Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `uri(_:)` + +The URI bound to this button. + +### `visited(_:)` + +The 'visited' state of this button. + +A visited link is drawn in a different color. + +### `canShrink(_:)` + +Whether the size of the button can be made smaller than the natural +size of its contents. + +For text buttons, setting this property will allow ellipsizing the label. + +If the contents of a button are an icon or a custom widget, setting this +property has no effect. + +### `child(_:)` + +The child widget. + +### `hasFrame(_:)` + +Whether the button has a frame. + +### `iconName(_:)` + +The name of the icon used to automatically populate the button. + +### `label(_:)` + +Text of the label inside the button, if the button contains a label widget. + +### `useUnderline(_:)` + +If set, an underline in the text indicates that the following character is +to be used as mnemonic. + +### `activate(_:)` + +Emitted to animate press then release. + +This is an action signal. Applications should never connect +to this signal, but use the [signal@Gtk.Button::clicked] signal. + +The default bindings for this signal are all forms of the + and Enter keys. + +### `clicked(_:)` + +Emitted when the button has been activated (pressed and released). diff --git a/Documentation/Reference/structs/ListBox.md b/Documentation/Reference/structs/ListBox.md new file mode 100644 index 0000000..9ecdf6c --- /dev/null +++ b/Documentation/Reference/structs/ListBox.md @@ -0,0 +1,223 @@ +**STRUCT** + +# `ListBox` + +`GtkListBox` is a vertical list. + +A `GtkListBox` only contains `GtkListBoxRow` children. These rows can +by dynamically sorted and filtered, and headers can be added dynamically +depending on the row content. It also allows keyboard and mouse navigation +and selection like a typical list. + +Using `GtkListBox` is often an alternative to `GtkTreeView`, especially +when the list contents has a more complicated layout than what is allowed +by a `GtkCellRenderer`, or when the contents is interactive (i.e. has a +button in it). + +Although a `GtkListBox` must have only `GtkListBoxRow` children, you can +add any kind of widget to it via [method@Gtk.ListBox.prepend], +[method@Gtk.ListBox.append] and [method@Gtk.ListBox.insert] and a +`GtkListBoxRow` widget will automatically be inserted between the list +and the widget. + +`GtkListBoxRows` can be marked as activatable or selectable. If a row is +activatable, [signal@Gtk.ListBox::row-activated] will be emitted for it when +the user tries to activate it. If it is selectable, the row will be marked +as selected when the user tries to select it. + +# GtkListBox as GtkBuildable + +The `GtkListBox` implementation of the `GtkBuildable` interface supports +setting a child as the placeholder by specifying “placeholder” as the “type” +attribute of a `` element. See [method@Gtk.ListBox.set_placeholder] +for info. + +# CSS nodes + +|[ +list[.separators][.rich-list][.navigation-sidebar][.boxed-list] +╰── row[.activatable] +]| + +`GtkListBox` uses a single CSS node named list. It may carry the .separators +style class, when the [property@Gtk.ListBox:show-separators] property is set. +Each `GtkListBoxRow` uses a single CSS node named row. The row nodes get the +.activatable style class added when appropriate. + +It may also carry the .boxed-list style class. In this case, the list will be +automatically surrounded by a frame and have separators. + +The main list node may also carry style classes to select +the style of [list presentation](section-list-widget.html#list-styles): +.rich-list, .navigation-sidebar or .data-table. + +# Accessibility + +`GtkListBox` uses the %GTK_ACCESSIBLE_ROLE_LIST role and `GtkListBoxRow` uses +the %GTK_ACCESSIBLE_ROLE_LIST_ITEM role. + +## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `acceptUnpairedRelease` + +Whether to accept unpaired release events. + +### `activateOnSingleClick` + +Determines whether children can be activated with a single +click, or require a double-click. + +### `showSeparators` + +Whether to show separators between rows. + +### `activateCursorRow` + +activateCursorRow + +### `moveCursor` + +moveCursor + +### `rowActivated` + +Emitted when a row has been activated by the user. + +### `rowSelected` + +Emitted when a new row is selected, or (with a %NULL @row) +when the selection is cleared. + +When the @box is using %GTK_SELECTION_MULTIPLE, this signal will not +give you the full picture of selection changes, and you should use +the [signal@Gtk.ListBox::selected-rows-changed] signal instead. + +### `selectAll` + +Emitted to select all children of the box, if the selection +mode permits it. + +This is a [keybinding signal](class.SignalAction.html). + +The default binding for this signal is Ctrl-a. + +### `selectedRowsChanged` + +Emitted when the set of selected rows changes. + +### `toggleCursorRow` + +toggleCursorRow + +### `unselectAll` + +Emitted to unselect all children of the box, if the selection +mode permits it. + +This is a [keybinding signal](class.SignalAction.html). + +The default binding for this signal is +Ctrl-Shift-a. + +### `elements` + +The dynamic widget elements. + +### `content` + +The dynamic widget content. + +### `app` + +The application. + +### `window` + +The window. + +## Methods +### `init(_:content:)` + +Initialize `ListBox`. + +### `container(modifiers:)` + +Get the widget's view storage. +- Parameter modifiers: The view modifiers. +- Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `acceptUnpairedRelease(_:)` + +Whether to accept unpaired release events. + +### `activateOnSingleClick(_:)` + +Determines whether children can be activated with a single +click, or require a double-click. + +### `showSeparators(_:)` + +Whether to show separators between rows. + +### `activateCursorRow(_:)` + +activateCursorRow + +### `moveCursor(_:)` + +moveCursor + +### `rowActivated(_:)` + +Emitted when a row has been activated by the user. + +### `rowSelected(_:)` + +Emitted when a new row is selected, or (with a %NULL @row) +when the selection is cleared. + +When the @box is using %GTK_SELECTION_MULTIPLE, this signal will not +give you the full picture of selection changes, and you should use +the [signal@Gtk.ListBox::selected-rows-changed] signal instead. + +### `selectAll(_:)` + +Emitted to select all children of the box, if the selection +mode permits it. + +This is a [keybinding signal](class.SignalAction.html). + +The default binding for this signal is Ctrl-a. + +### `selectedRowsChanged(_:)` + +Emitted when the set of selected rows changes. + +### `toggleCursorRow(_:)` + +toggleCursorRow + +### `unselectAll(_:)` + +Emitted to unselect all children of the box, if the selection +mode permits it. + +This is a [keybinding signal](class.SignalAction.html). + +The default binding for this signal is +Ctrl-Shift-a. diff --git a/Documentation/Reference/structs/Menu.md b/Documentation/Reference/structs/Menu.md index 4ae44ee..d6bb8f3 100644 --- a/Documentation/Reference/structs/Menu.md +++ b/Documentation/Reference/structs/Menu.md @@ -2,20 +2,129 @@ # `Menu` -A menu button widget. +The `GtkMenuButton` widget is used to display a popup when clicked. + +![An example GtkMenuButton](menu-button.png) + +This popup can be provided either as a `GtkPopover` or as an abstract +`GMenuModel`. + +The `GtkMenuButton` widget can show either an icon (set with the +[property@Gtk.MenuButton:icon-name] property) or a label (set with the +[property@Gtk.MenuButton:label] property). If neither is explicitly set, +a [class@Gtk.Image] is automatically created, using an arrow image oriented +according to [property@Gtk.MenuButton:direction] or the generic +“open-menu-symbolic” icon if the direction is not set. + +The positioning of the popup is determined by the +[property@Gtk.MenuButton:direction] property of the menu button. + +For menus, the [property@Gtk.Widget:halign] and [property@Gtk.Widget:valign] +properties of the menu are also taken into account. For example, when the +direction is %GTK_ARROW_DOWN and the horizontal alignment is %GTK_ALIGN_START, +the menu will be positioned below the button, with the starting edge +(depending on the text direction) of the menu aligned with the starting +edge of the button. If there is not enough space below the button, the +menu is popped up above the button instead. If the alignment would move +part of the menu offscreen, it is “pushed in”. + +| | start | center | end | +| - | --- | --- | --- | +| **down** | ![](down-start.png) | ![](down-center.png) | ![](down-end.png) | +| **up** | ![](up-start.png) | ![](up-center.png) | ![](up-end.png) | +| **left** | ![](left-start.png) | ![](left-center.png) | ![](left-end.png) | +| **right** | ![](right-start.png) | ![](right-center.png) | ![](right-end.png) | + +# CSS nodes + +``` +menubutton +╰── button.toggle +╰── ╰── [arrow] +``` + +`GtkMenuButton` has a single CSS node with name `menubutton` +which contains a `button` node with a `.toggle` style class. + +If the button contains an icon, it will have the `.image-button` style class, +if it contains text, it will have `.text-button` style class. If an arrow is +visible in addition to an icon, text or a custom child, it will also have +`.arrow-button` style class. + +Inside the toggle button content, there is an `arrow` node for +the indicator, which will carry one of the `.none`, `.up`, `.down`, +`.left` or `.right` style classes to indicate the direction that +the menu will appear in. The CSS is expected to provide a suitable +image for each of these cases using the `-gtk-icon-source` property. + +Optionally, the `menubutton` node can carry the `.circular` style class +to request a round appearance. + +# Accessibility + +`GtkMenuButton` uses the %GTK_ACCESSIBLE_ROLE_BUTTON role. ## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `active` + +Whether the menu button is active. + +### `alwaysShowArrow` + +Whether to show a dropdown arrow even when using an icon or a custom child. + +### `canShrink` + +Whether the size of the button can be made smaller than the natural +size of its contents. + +### `child` + +The child widget. + +### `hasFrame` + +Whether the button has a frame. + +### `iconName` + +The name of the icon used to automatically populate the button. + ### `label` -The button's label. +The label for the button. -### `icon` +### `menuModel` -The button's icon. +The `GMenuModel` from which the popup will be created. -### `content` +See [method@Gtk.MenuButton.set_menu_model] for the interaction +with the [property@Gtk.MenuButton:popover] property. -The menu's content. +### `primary` + +Whether the menu button acts as a primary menu. + +Primary menus can be opened using the F10 key + +### `useUnderline` + +If set an underscore in the text indicates a mnemonic. + +### `activate` + +Emitted to when the menu button is activated. + +The `::activate` signal on `GtkMenuButton` is an action signal and +emitting it causes the button to pop up its menu. ### `app` @@ -26,34 +135,73 @@ The application. The window. ## Methods -### `init(_:icon:app:window:content:)` +### `init()` -Initialize a menu button. -- Parameters: - - label: The button's label. - - icon: The button's icon. - - app: The application. - - window: The application window. - - content: The menu's content. - -### `init(_:app:window:content:)` - -Initialize a menu button. -- Parameters: - - label: The buttons label. - - app: The application. - - window: The application window. - - content: The menu's content. - -### `update(_:modifiers:)` - -Update a button's view storage. -- Parameters: - - storage: The view storage. - - modifiers: Modify views before being updated. +Initialize `Menu`. ### `container(modifiers:)` -Get a button's view storage. -- Parameter modifiers: Modify views before being updated. -- Returns: The button's view storage. +Get the widget's view storage. +- Parameter modifiers: The view modifiers. +- Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `active(_:)` + +Whether the menu button is active. + +### `alwaysShowArrow(_:)` + +Whether to show a dropdown arrow even when using an icon or a custom child. + +### `canShrink(_:)` + +Whether the size of the button can be made smaller than the natural +size of its contents. + +### `child(_:)` + +The child widget. + +### `hasFrame(_:)` + +Whether the button has a frame. + +### `iconName(_:)` + +The name of the icon used to automatically populate the button. + +### `label(_:)` + +The label for the button. + +### `menuModel(app:window:_:)` + +The `GMenuModel` from which the popup will be created. + +See [method@Gtk.MenuButton.set_menu_model] for the interaction +with the [property@Gtk.MenuButton:popover] property. + +### `primary(_:)` + +Whether the menu button acts as a primary menu. + +Primary menus can be opened using the F10 key + +### `useUnderline(_:)` + +If set an underscore in the text indicates a mnemonic. + +### `activate(_:)` + +Emitted to when the menu button is activated. + +The `::activate` signal on `GtkMenuButton` is an action signal and +emitting it causes the button to pop up its menu. diff --git a/Documentation/Reference/structs/MenuButton.md b/Documentation/Reference/structs/MenuButton.md index 7cbe9db..8129038 100644 --- a/Documentation/Reference/structs/MenuButton.md +++ b/Documentation/Reference/structs/MenuButton.md @@ -21,6 +21,10 @@ The keyboard shortcut. Whether to prefer adding the action to the application window. +### `filteredLabel` + +The action label. + ## Methods ### `init(_:window:handler:)` diff --git a/Documentation/Reference/structs/ModifierStopper.md b/Documentation/Reference/structs/ModifierStopper.md index d286f66..54e81be 100644 --- a/Documentation/Reference/structs/ModifierStopper.md +++ b/Documentation/Reference/structs/ModifierStopper.md @@ -16,9 +16,10 @@ Get the content's container. - Parameter modifiers: Modify views before being updated. - Returns: The content's container. -### `update(_:modifiers:)` +### `update(_:modifiers:updateProperties:)` Update the content. - Parameters: - storage: The content's storage. - modifiers: Modify views before being updated. + - updateProperties: Whether to update properties. diff --git a/Documentation/Reference/structs/NavigationSplitView.md b/Documentation/Reference/structs/NavigationSplitView.md index 53996e5..f1bb728 100644 --- a/Documentation/Reference/structs/NavigationSplitView.md +++ b/Documentation/Reference/structs/NavigationSplitView.md @@ -35,9 +35,10 @@ Get the container of the navigation split view widget. - Parameter modifiers: Modify views before being updated. - Returns: The view storage. -### `update(_:modifiers:)` +### `update(_:modifiers:updateProperties:)` Update the view storage of the navigation split view widget. - Parameters: - storage: The view storage. - modifiers: Modify views before being updated. + - updateProperties: Whether to update properties. diff --git a/Documentation/Reference/structs/Overlay.md b/Documentation/Reference/structs/Overlay.md index b412008..7f0dbde 100644 --- a/Documentation/Reference/structs/Overlay.md +++ b/Documentation/Reference/structs/Overlay.md @@ -2,31 +2,123 @@ # `Overlay` -A wrapper around a view for adding other views on top. +`GtkOverlay` is a container which contains a single main child, on top +of which it can place “overlay” widgets. + +![An example GtkOverlay](overlay.png) + +The position of each overlay widget is determined by its +[property@Gtk.Widget:halign] and [property@Gtk.Widget:valign] +properties. E.g. a widget with both alignments set to %GTK_ALIGN_START +will be placed at the top left corner of the `GtkOverlay` container, +whereas an overlay with halign set to %GTK_ALIGN_CENTER and valign set +to %GTK_ALIGN_END will be placed a the bottom edge of the `GtkOverlay`, +horizontally centered. The position can be adjusted by setting the margin +properties of the child to non-zero values. + +More complicated placement of overlays is possible by connecting +to the [signal@Gtk.Overlay::get-child-position] signal. + +An overlay’s minimum and natural sizes are those of its main child. +The sizes of overlay children are not considered when measuring these +preferred sizes. + +# GtkOverlay as GtkBuildable + +The `GtkOverlay` implementation of the `GtkBuildable` interface +supports placing a child as an overlay by specifying “overlay” as +the “type” attribute of a `` element. + +# CSS nodes + +`GtkOverlay` has a single CSS node with the name “overlay”. Overlay children +whose alignments cause them to be positioned at an edge get the style classes +“.left”, “.right”, “.top”, and/or “.bottom” according to their position. ## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + ### `child` -The child view. +The main child widget. + +### `getChildPosition` + +Emitted to determine the position and size of any overlay +child widgets. + +A handler for this signal should fill @allocation with +the desired position and size for @widget, relative to +the 'main' child of @overlay. + +The default handler for this signal uses the @widget's +halign and valign properties to determine the position +and gives the widget its natural size (except that an +alignment of %GTK_ALIGN_FILL will cause the overlay to +be full-width/height). If the main child is a +`GtkScrolledWindow`, the overlays are placed relative +to its contents. ### `overlay` -The overlay view. +The body for the widget "overlay". -### `overlayID` +### `app` -The identifier for the overlay content. +The application. + +### `window` + +The window. ## Methods +### `init()` + +Initialize `Overlay`. + ### `container(modifiers:)` -Get the overlay's view storage. +Get the widget's view storage. - Parameter modifiers: The view modifiers. - Returns: The view storage. -### `update(_:modifiers:)` +### `update(_:modifiers:updateProperties:)` -Update the overlay's view storage. +Update the widget's view storage. - Parameters: - storage: The view storage. - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `child(_:)` + +The main child widget. + +### `getChildPosition(_:)` + +Emitted to determine the position and size of any overlay +child widgets. + +A handler for this signal should fill @allocation with +the desired position and size for @widget, relative to +the 'main' child of @overlay. + +The default handler for this signal uses the @widget's +halign and valign properties to determine the position +and gives the widget its natural size (except that an +alignment of %GTK_ALIGN_FILL will cause the overlay to +be full-width/height). If the main child is a +`GtkScrolledWindow`, the overlays are placed relative +to its contents. + +### `overlay(_:)` + +Set the body for "overlay". +- Parameter body: The body. +- Returns: The widget. diff --git a/Documentation/Reference/structs/OverlaySplitView.md b/Documentation/Reference/structs/OverlaySplitView.md index 2208670..677feef 100644 --- a/Documentation/Reference/structs/OverlaySplitView.md +++ b/Documentation/Reference/structs/OverlaySplitView.md @@ -2,62 +2,284 @@ # `OverlaySplitView` -An overlay split view widget. +A widget presenting sidebar and content side by side or as an overlay. + +overlay-split-viewoverlay-split-view-collapsed + +`AdwOverlaySplitView` has two children: sidebar and content, and displays +them side by side. + +When [property@OverlaySplitView:collapsed] is set to `TRUE`, the sidebar is +instead shown as an overlay above the content widget. + +The sidebar can be hidden or shown using the +[property@OverlaySplitView:show-sidebar] property. + +Sidebar can be displayed before or after the content, this can be controlled +with the [property@OverlaySplitView:sidebar-position] property. + +Collapsing the split view automatically hides the sidebar widget, and +uncollapsing it shows the sidebar. If this behavior is not desired, the +[property@OverlaySplitView:pin-sidebar] property can be used to override it. + +`AdwOverlaySplitView` supports an edge swipe gesture for showing the sidebar, +and a swipe from the sidebar for hiding it. Gestures are only supported on +touchscreen, but not touchpad. Gestures can be controlled with the +[property@OverlaySplitView:enable-show-gesture] and +[property@OverlaySplitView:enable-hide-gesture] properties. + +See also [class@NavigationSplitView]. + +`AdwOverlaySplitView` is typically used together with an [class@Breakpoint] +setting the `collapsed` property to `TRUE` on small widths, as follows: + +```xml +360200800800max-width: 400spTrue +``` + +`AdwOverlaySplitView` is often used for implementing the +[utility pane](https://developer.gnome.org/hig/patterns/containers/utility-panes.html) +pattern. + +## Sizing + +When not collapsed, `AdwOverlaySplitView` changes the sidebar width +depending on its own width. + +If possible, it tries to allocate a fraction of the total width, controlled +with the [property@OverlaySplitView:sidebar-width-fraction] property. + +The sidebar also has minimum and maximum sizes, controlled with the +[property@OverlaySplitView:min-sidebar-width] and +[property@OverlaySplitView:max-sidebar-width] properties. + +The minimum and maximum sizes are using the length unit specified with the +[property@OverlaySplitView:sidebar-width-unit]. + +By default, sidebar is using 25% of the total width, with 180sp as the +minimum size and 280sp as the maximum size. + +When collapsed, the preferred width fraction is ignored and the sidebar uses +[property@OverlaySplitView:max-sidebar-width] when possible. + +## Header Bar Integration + +When used inside `AdwOverlaySplitView`, [class@HeaderBar] will automatically +hide the window buttons in the middle. + +## `AdwOverlaySplitView` as `GtkBuildable` + +The `AdwOverlaySplitView` implementation of the [iface@Gtk.Buildable] +interface supports setting the sidebar widget by specifying “sidebar” as the +“type” attribute of a `` element, Specifying “content” child type or +omitting it results in setting the content widget. + +## CSS nodes + +`AdwOverlaySplitView` has a single CSS node with the name +`overlay-split-view`. + +It contains two nodes with the name `widget`, containing the sidebar and +content children. + +When not collapsed, they have the `.sidebar-view` and `.content-view` style +classes respectively. + +``` +overlay-split-view +├── widget.sidebar-pane +│ ╰── [sidebar child] +╰── widget.content-pane +╰── [content child] +``` + +When collapsed, the one containing the sidebar child has the `.background` +style class and the other one has no style classes. + +``` +overlay-split-view +├── widget.background +│ ╰── [sidebar child] +╰── widget +╰── [content child] +``` + +## Accessibility + +`AdwOverlaySplitView` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role. ## Properties -### `sidebar` +### `updateFunctions` -The sidebar's content. +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `collapsed` + +Whether the split view is collapsed. + +When collapsed, the sidebar widget is presented as an overlay above the +content widget, otherwise they are displayed side by side. ### `content` -The split view's main content. +The content widget. -### `trailing` +### `enableHideGesture` -Whether the sidebar is at the trailing position. +Whether the sidebar can be closed with a swipe gesture. -### `visible` +Only touchscreen swipes are supported. -Whether the sidebar is visible. +### `enableShowGesture` -### `sidebarID` +Whether the sidebar can be opened with an edge swipe gesture. -The sidebar content's id. +Only touchscreen swipes are supported. -### `contentID` +### `maxSidebarWidth` -The main content's id. +The maximum sidebar width. + +Maximum width is affected by +[property@OverlaySplitView:sidebar-width-unit]. + +The sidebar widget can still be allocated with larger width if its own +minimum width exceeds it. + +### `minSidebarWidth` + +The minimum sidebar width. + +Minimum width is affected by +[property@OverlaySplitView:sidebar-width-unit]. + +The sidebar widget can still be allocated with larger width if its own +minimum width exceeds it. + +### `pinSidebar` + +Whether the sidebar widget is pinned. + +By default, collapsing @self automatically hides the sidebar widget, and +uncollapsing it shows the sidebar. If set to `TRUE`, sidebar visibility +never changes on its own. + +### `showSidebar` + +Whether the sidebar widget is shown. + +### `sidebar` + +The sidebar widget. + +### `sidebarWidthFraction` + +The preferred sidebar width as a fraction of the total width. + +The preferred width is additionally limited by +[property@OverlaySplitView:min-sidebar-width] and +[property@OverlaySplitView:max-sidebar-width]. + +The sidebar widget can be allocated with larger width if its own minimum +width exceeds the preferred width. + +### `app` + +The application. + +### `window` + +The window. ## Methods -### `init(visible:sidebar:content:)` +### `init()` -Initialize an overlay split view. -- Parameters: - - visible: Whether the sidebar is visible. - - sidebar: The sidebar content. - - content: The main content. - -### `trailingSidebar(_:)` - -The position of the sidebar. -- Parameter trailing: Whether the sidebar is at the trailing position. -- Returns: The navigation split view. +Initialize `OverlaySplitView`. ### `container(modifiers:)` -Get the container of the overlay split view widget. -- Parameter modifiers: Modify views before being updated. +Get the widget's view storage. +- Parameter modifiers: The view modifiers. - Returns: The view storage. -### `update(_:modifiers:)` +### `update(_:modifiers:updateProperties:)` -Update the view storage of the overlay split view widget. +Update the widget's view storage. - Parameters: - storage: The view storage. - - modifiers: Modify views before being updated. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. -### `updatePosition(_:)` +### `collapsed(_:)` -Update the sidebar's position in the split view. -- Parameter splitView: The overlay split view. +Whether the split view is collapsed. + +When collapsed, the sidebar widget is presented as an overlay above the +content widget, otherwise they are displayed side by side. + +### `content(_:)` + +The content widget. + +### `enableHideGesture(_:)` + +Whether the sidebar can be closed with a swipe gesture. + +Only touchscreen swipes are supported. + +### `enableShowGesture(_:)` + +Whether the sidebar can be opened with an edge swipe gesture. + +Only touchscreen swipes are supported. + +### `maxSidebarWidth(_:)` + +The maximum sidebar width. + +Maximum width is affected by +[property@OverlaySplitView:sidebar-width-unit]. + +The sidebar widget can still be allocated with larger width if its own +minimum width exceeds it. + +### `minSidebarWidth(_:)` + +The minimum sidebar width. + +Minimum width is affected by +[property@OverlaySplitView:sidebar-width-unit]. + +The sidebar widget can still be allocated with larger width if its own +minimum width exceeds it. + +### `pinSidebar(_:)` + +Whether the sidebar widget is pinned. + +By default, collapsing @self automatically hides the sidebar widget, and +uncollapsing it shows the sidebar. If set to `TRUE`, sidebar visibility +never changes on its own. + +### `showSidebar(_:)` + +Whether the sidebar widget is shown. + +### `sidebar(_:)` + +The sidebar widget. + +### `sidebarWidthFraction(_:)` + +The preferred sidebar width as a fraction of the total width. + +The preferred width is additionally limited by +[property@OverlaySplitView:min-sidebar-width] and +[property@OverlaySplitView:max-sidebar-width]. + +The sidebar widget can be allocated with larger width if its own minimum +width exceeds the preferred width. diff --git a/Documentation/Reference/structs/PasswordEntryRow.md b/Documentation/Reference/structs/PasswordEntryRow.md new file mode 100644 index 0000000..a86292e --- /dev/null +++ b/Documentation/Reference/structs/PasswordEntryRow.md @@ -0,0 +1,178 @@ +**STRUCT** + +# `PasswordEntryRow` + +A [class@EntryRow] tailored for entering secrets. + +password-entry-row + +It does not show its contents in clear text, does not allow to copy it to the +clipboard, and shows a warning when Caps Lock is engaged. If the underlying +platform allows it, `AdwPasswordEntryRow` will also place the text in a +non-pageable memory area, to avoid it being written out to disk by the +operating system. + +It offer a way to reveal the contents in clear text. + +## CSS Nodes + +`AdwPasswordEntryRow` has a single CSS node with name `row` that carries +`.entry` and `.password` style classes. + +## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `activatesDefault` + +Whether activating the embedded entry can activate the default widget. + +### `enableEmojiCompletion` + +Whether to suggest emoji replacements on the entry row. + +Emoji replacement is done with :-delimited names, like `:heart:`. + +### `showApplyButton` + +Whether to show the apply button. + +When set to `TRUE`, typing text in the entry will reveal an apply button. +Clicking it or pressing the Enter key will hide the button and +emit the [signal@EntryRow::apply] signal. + +This is useful if changing the entry contents can trigger an expensive +operation, e.g. network activity, to avoid triggering it after typing every +character. + +### `title` + +The title of the preference represented by this row. + +The title is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. + +### `titleSelectable` + +Whether the user can copy the title from the label. + +See also [property@Gtk.Label:selectable]. + +### `useMarkup` + +Whether to use Pango markup for the title label. + +Subclasses may also use it for other labels, such as subtitle. + +See also [func@Pango.parse_markup]. + +### `useUnderline` + +Whether an embedded underline in the title indicates a mnemonic. + +### `apply` + +Emitted when the apply button is pressed. + +See [property@EntryRow:show-apply-button]. + +### `entryActivated` + +Emitted when the embedded entry is activated. + +### `suffix` + +The body for the widget "suffix". + +### `prefix` + +The body for the widget "prefix". + +### `app` + +The application. + +### `window` + +The window. + +## Methods +### `init()` + +Initialize `PasswordEntryRow`. + +### `container(modifiers:)` + +Get the widget's view storage. +- Parameter modifiers: The view modifiers. +- Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `activatesDefault(_:)` + +Whether activating the embedded entry can activate the default widget. + +### `enableEmojiCompletion(_:)` + +Whether to suggest emoji replacements on the entry row. + +Emoji replacement is done with :-delimited names, like `:heart:`. + +### `showApplyButton(_:)` + +Whether to show the apply button. + +When set to `TRUE`, typing text in the entry will reveal an apply button. +Clicking it or pressing the Enter key will hide the button and +emit the [signal@EntryRow::apply] signal. + +This is useful if changing the entry contents can trigger an expensive +operation, e.g. network activity, to avoid triggering it after typing every +character. + +### `title(_:)` + +The title of the preference represented by this row. + +The title is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. + +### `titleSelectable(_:)` + +Whether the user can copy the title from the label. + +See also [property@Gtk.Label:selectable]. + +### `useMarkup(_:)` + +Whether to use Pango markup for the title label. + +Subclasses may also use it for other labels, such as subtitle. + +See also [func@Pango.parse_markup]. + +### `useUnderline(_:)` + +Whether an embedded underline in the title indicates a mnemonic. + +### `apply(_:)` + +Emitted when the apply button is pressed. + +See [property@EntryRow:show-apply-button]. + +### `entryActivated(_:)` + +Emitted when the embedded entry is activated. diff --git a/Documentation/Reference/structs/PreferencesGroup.md b/Documentation/Reference/structs/PreferencesGroup.md new file mode 100644 index 0000000..1723559 --- /dev/null +++ b/Documentation/Reference/structs/PreferencesGroup.md @@ -0,0 +1,112 @@ +**STRUCT** + +# `PreferencesGroup` + +A group of preference rows. + +preferences-group + +An `AdwPreferencesGroup` represents a group or tightly related preferences, +which in turn are represented by [class@PreferencesRow]. + +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] +to let the user look for a preference. + +## AdwPreferencesGroup as GtkBuildable + +The `AdwPreferencesGroup` implementation of the [iface@Gtk.Buildable] interface +supports adding [class@PreferencesRow]s to the list by omitting "type". If "type" +is omitted and the widget isn't a [class@PreferencesRow] the child is added to +a box below the list. + +When the "type" attribute of a child is `header-suffix`, the child +is set as the suffix on the end of the title and description. + +## CSS nodes + +`AdwPreferencesGroup` has a single CSS node with name `preferencesgroup`. + +## Accessibility + +`AdwPreferencesGroup` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role. + +## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `description` + +The description for this group of preferences. + +### `headerSuffix` + +The header suffix widget. + +Displayed above the list, next to the title and description. + +Suffixes are commonly used to show a button or a spinner for the whole +group. + +### `title` + +The title for this group of preferences. + +### `child` + +The body for the widget "child". + +### `app` + +The application. + +### `window` + +The window. + +## Methods +### `init()` + +Initialize `PreferencesGroup`. + +### `container(modifiers:)` + +Get the widget's view storage. +- Parameter modifiers: The view modifiers. +- Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `description(_:)` + +The description for this group of preferences. + +### `headerSuffix(_:)` + +The header suffix widget. + +Displayed above the list, next to the title and description. + +Suffixes are commonly used to show a button or a spinner for the whole +group. + +### `title(_:)` + +The title for this group of preferences. + +### `child(_:)` + +Set the body for "child". +- Parameter body: The body. +- Returns: The widget. diff --git a/Documentation/Reference/structs/PreferencesPage.md b/Documentation/Reference/structs/PreferencesPage.md new file mode 100644 index 0000000..3dc4ac4 --- /dev/null +++ b/Documentation/Reference/structs/PreferencesPage.md @@ -0,0 +1,104 @@ +**STRUCT** + +# `PreferencesPage` + +A page from [class@PreferencesWindow]. + +preferences-page + +The `AdwPreferencesPage` widget gathers preferences groups into a single page +of a preferences window. + +## CSS nodes + +`AdwPreferencesPage` has a single CSS node with name `preferencespage`. + +## Accessibility + +`AdwPreferencesPage` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role. + +## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `description` + +The description to be displayed at the top of the page. + +### `iconName` + +The icon name for this page. + +### `name` + +The name of this page. + +### `title` + +The title for this page. + +### `useUnderline` + +Whether an embedded underline in the title indicates a mnemonic. + +### `child` + +The body for the widget "child". + +### `app` + +The application. + +### `window` + +The window. + +## Methods +### `init()` + +Initialize `PreferencesPage`. + +### `container(modifiers:)` + +Get the widget's view storage. +- Parameter modifiers: The view modifiers. +- Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `description(_:)` + +The description to be displayed at the top of the page. + +### `iconName(_:)` + +The icon name for this page. + +### `name(_:)` + +The name of this page. + +### `title(_:)` + +The title for this page. + +### `useUnderline(_:)` + +Whether an embedded underline in the title indicates a mnemonic. + +### `child(_:)` + +Set the body for "child". +- Parameter body: The body. +- Returns: The widget. diff --git a/Documentation/Reference/structs/PreferencesRow.md b/Documentation/Reference/structs/PreferencesRow.md new file mode 100644 index 0000000..575db78 --- /dev/null +++ b/Documentation/Reference/structs/PreferencesRow.md @@ -0,0 +1,99 @@ +**STRUCT** + +# `PreferencesRow` + +A [class@Gtk.ListBoxRow] used to present preferences. + +The `AdwPreferencesRow` widget has a title that [class@PreferencesWindow] +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. + +[class@ActionRow] and its derivatives are convenient to use as preference +rows as they take care of presenting the preference's title while letting you +compose the inputs of the preference around it. + +## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `title` + +The title of the preference represented by this row. + +The title is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. + +### `titleSelectable` + +Whether the user can copy the title from the label. + +See also [property@Gtk.Label:selectable]. + +### `useMarkup` + +Whether to use Pango markup for the title label. + +Subclasses may also use it for other labels, such as subtitle. + +See also [func@Pango.parse_markup]. + +### `useUnderline` + +Whether an embedded underline in the title indicates a mnemonic. + +### `app` + +The application. + +### `window` + +The window. + +## Methods +### `init()` + +Initialize `PreferencesRow`. + +### `container(modifiers:)` + +Get the widget's view storage. +- Parameter modifiers: The view modifiers. +- Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `title(_:)` + +The title of the preference represented by this row. + +The title is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. + +### `titleSelectable(_:)` + +Whether the user can copy the title from the label. + +See also [property@Gtk.Label:selectable]. + +### `useMarkup(_:)` + +Whether to use Pango markup for the title label. + +Subclasses may also use it for other labels, such as subtitle. + +See also [func@Pango.parse_markup]. + +### `useUnderline(_:)` + +Whether an embedded underline in the title indicates a mnemonic. diff --git a/Documentation/Reference/structs/ProgressBar.md b/Documentation/Reference/structs/ProgressBar.md index 442c20e..7136884 100644 --- a/Documentation/Reference/structs/ProgressBar.md +++ b/Documentation/Reference/structs/ProgressBar.md @@ -2,29 +2,143 @@ # `ProgressBar` -A progress bar widget. +`GtkProgressBar` is typically used to display the progress of a long +running operation. + +It provides a visual clue that processing is underway. `GtkProgressBar` +can be used in two different modes: percentage mode and activity mode. + +![An example GtkProgressBar](progressbar.png) + +When an application can determine how much work needs to take place +(e.g. read a fixed number of bytes from a file) and can monitor its +progress, it can use the `GtkProgressBar` in percentage mode and the +user sees a growing bar indicating the percentage of the work that +has been completed. In this mode, the application is required to call +[method@Gtk.ProgressBar.set_fraction] periodically to update the progress bar. + +When an application has no accurate way of knowing the amount of work +to do, it can use the `GtkProgressBar` in activity mode, which shows +activity by a block moving back and forth within the progress area. In +this mode, the application is required to call [method@Gtk.ProgressBar.pulse] +periodically to update the progress bar. + +There is quite a bit of flexibility provided to control the appearance +of the `GtkProgressBar`. Functions are provided to control the orientation +of the bar, optional text can be displayed along with the bar, and the +step size used in activity mode can be set. + +# CSS nodes + +``` +progressbar[.osd] +├── [text] +╰── trough[.empty][.full] +╰── progress[.pulse] +``` + +`GtkProgressBar` has a main CSS node with name progressbar and subnodes with +names text and trough, of which the latter has a subnode named progress. The +text subnode is only present if text is shown. The progress subnode has the +style class .pulse when in activity mode. It gets the style classes .left, +.right, .top or .bottom added when the progress 'touches' the corresponding +end of the GtkProgressBar. The .osd class on the progressbar node is for use +in overlays like the one Epiphany has for page loading progress. + +# Accessibility + +`GtkProgressBar` uses the %GTK_ACCESSIBLE_ROLE_PROGRESS_BAR role. ## Properties -### `value` +### `updateFunctions` -The value. +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `fraction` + +The fraction of total work that has been completed. + +### `inverted` + +Invert the direction in which the progress bar grows. + +### `pulseStep` + +The fraction of total progress to move the bounding block when pulsed. + +### `showText` + +Sets whether the progress bar will show a text in addition +to the bar itself. + +The shown text is either the value of the [property@Gtk.ProgressBar:text] +property or, if that is %NULL, the [property@Gtk.ProgressBar:fraction] +value, as a percentage. + +To make a progress bar that is styled and sized suitably for showing text +(even if the actual text is blank), set [property@Gtk.ProgressBar:show-text] +to %TRUE and [property@Gtk.ProgressBar:text] to the empty string (not %NULL). + +### `text` + +Text to be displayed in the progress bar. + +### `app` + +The application. + +### `window` + +The window. ## Methods -### `init(value:total:)` +### `init()` -Initialize a progress bar widget. -- Parameters: - - value: The value. - - total: The maximum value. - -### `update(_:modifiers:)` - -Update the view storage of the progress bar widget. -- Parameters: - - storage: The view storage. - - modifiers: Modify views before being updated. +Initialize `ProgressBar`. ### `container(modifiers:)` -Get the container of the progress bar widget. +Get the widget's view storage. +- Parameter modifiers: The view modifiers. - Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `fraction(_:)` + +The fraction of total work that has been completed. + +### `inverted(_:)` + +Invert the direction in which the progress bar grows. + +### `pulseStep(_:)` + +The fraction of total progress to move the bounding block when pulsed. + +### `showText(_:)` + +Sets whether the progress bar will show a text in addition +to the bar itself. + +The shown text is either the value of the [property@Gtk.ProgressBar:text] +property or, if that is %NULL, the [property@Gtk.ProgressBar:fraction] +value, as a percentage. + +To make a progress bar that is styled and sized suitably for showing text +(even if the actual text is blank), set [property@Gtk.ProgressBar:show-text] +to %TRUE and [property@Gtk.ProgressBar:text] to the empty string (not %NULL). + +### `text(_:)` + +Text to be displayed in the progress bar. diff --git a/Documentation/Reference/structs/ScrolledWindow.md b/Documentation/Reference/structs/ScrolledWindow.md new file mode 100644 index 0000000..04d3e49 --- /dev/null +++ b/Documentation/Reference/structs/ScrolledWindow.md @@ -0,0 +1,310 @@ +**STRUCT** + +# `ScrolledWindow` + +`GtkScrolledWindow` is a container that makes its child scrollable. + +It does so using either internally added scrollbars or externally +associated adjustments, and optionally draws a frame around the child. + +Widgets with native scrolling support, i.e. those whose classes implement +the [iface@Gtk.Scrollable] interface, are added directly. For other types +of widget, the class [class@Gtk.Viewport] acts as an adaptor, giving +scrollability to other widgets. [method@Gtk.ScrolledWindow.set_child] +intelligently accounts for whether or not the added child is a `GtkScrollable`. +If it isn’t, then it wraps the child in a `GtkViewport`. Therefore, you can +just add any child widget and not worry about the details. + +If [method@Gtk.ScrolledWindow.set_child] has added a `GtkViewport` for you, +it will be automatically removed when you unset the child. +Unless [property@Gtk.ScrolledWindow:hscrollbar-policy] and +[property@Gtk.ScrolledWindow:vscrollbar-policy] are %GTK_POLICY_NEVER or +%GTK_POLICY_EXTERNAL, `GtkScrolledWindow` adds internal `GtkScrollbar` widgets +around its child. The scroll position of the child, and if applicable the +scrollbars, is controlled by the [property@Gtk.ScrolledWindow:hadjustment] +and [property@Gtk.ScrolledWindow:vadjustment] that are associated with the +`GtkScrolledWindow`. See the docs on [class@Gtk.Scrollbar] for the details, +but note that the “step_increment” and “page_increment” fields are only +effective if the policy causes scrollbars to be present. + +If a `GtkScrolledWindow` doesn’t behave quite as you would like, or +doesn’t have exactly the right layout, it’s very possible to set up +your own scrolling with `GtkScrollbar` and for example a `GtkGrid`. + +# Touch support + +`GtkScrolledWindow` has built-in support for touch devices. When a +touchscreen is used, swiping will move the scrolled window, and will +expose 'kinetic' behavior. This can be turned off with the +[property@Gtk.ScrolledWindow:kinetic-scrolling] property if it is undesired. + +`GtkScrolledWindow` also displays visual 'overshoot' indication when +the content is pulled beyond the end, and this situation can be +captured with the [signal@Gtk.ScrolledWindow::edge-overshot] signal. + +If no mouse device is present, the scrollbars will overlaid as +narrow, auto-hiding indicators over the content. If traditional +scrollbars are desired although no mouse is present, this behaviour +can be turned off with the [property@Gtk.ScrolledWindow:overlay-scrolling] +property. + +# CSS nodes + +`GtkScrolledWindow` has a main CSS node with name scrolledwindow. +It gets a .frame style class added when [property@Gtk.ScrolledWindow:has-frame] +is %TRUE. + +It uses subnodes with names overshoot and undershoot to draw the overflow +and underflow indications. These nodes get the .left, .right, .top or .bottom +style class added depending on where the indication is drawn. + +`GtkScrolledWindow` also sets the positional style classes (.left, .right, +.top, .bottom) and style classes related to overlay scrolling +(.overlay-indicator, .dragging, .hovering) on its scrollbars. + +If both scrollbars are visible, the area where they meet is drawn +with a subnode named junction. + +# Accessibility + +Until GTK 4.10, `GtkScrolledWindow` used the `GTK_ACCESSIBLE_ROLE_GROUP` role. + +Starting from GTK 4.12, `GtkScrolledWindow` uses the `GTK_ACCESSIBLE_ROLE_GENERIC` role. + +## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `child` + +The child widget. + +### `hasFrame` + +Whether to draw a frame around the contents. + +### `kineticScrolling` + +Whether kinetic scrolling is enabled or not. + +Kinetic scrolling only applies to devices with source %GDK_SOURCE_TOUCHSCREEN. + +### `maxContentHeight` + +The maximum content height of @scrolled_window. + +### `maxContentWidth` + +The maximum content width of @scrolled_window. + +### `minContentHeight` + +The minimum content height of @scrolled_window. + +### `minContentWidth` + +The minimum content width of @scrolled_window. + +### `overlayScrolling` + +Whether overlay scrolling is enabled or not. + +If it is, the scrollbars are only added as traditional widgets +when a mouse is present. Otherwise, they are overlaid on top of +the content, as narrow indicators. + +Note that overlay scrolling can also be globally disabled, with +the [property@Gtk.Settings:gtk-overlay-scrolling] setting. + +### `propagateNaturalHeight` + +Whether the natural height of the child should be calculated and propagated +through the scrolled window’s requested natural height. + +This is useful in cases where an attempt should be made to allocate exactly +enough space for the natural size of the child. + +### `propagateNaturalWidth` + +Whether the natural width of the child should be calculated and propagated +through the scrolled window’s requested natural width. + +This is useful in cases where an attempt should be made to allocate exactly +enough space for the natural size of the child. + +### `edgeOvershot` + +Emitted whenever user initiated scrolling makes the scrolled +window firmly surpass the limits defined by the adjustment +in that orientation. + +A similar behavior without edge resistance is provided by the +[signal@Gtk.ScrolledWindow::edge-reached] signal. + +Note: The @pos argument is LTR/RTL aware, so callers should be +aware too if intending to provide behavior on horizontal edges. + +### `edgeReached` + +Emitted whenever user-initiated scrolling makes the scrolled +window exactly reach the lower or upper limits defined by the +adjustment in that orientation. + +A similar behavior with edge resistance is provided by the +[signal@Gtk.ScrolledWindow::edge-overshot] signal. + +Note: The @pos argument is LTR/RTL aware, so callers should be +aware too if intending to provide behavior on horizontal edges. + +### `moveFocusOut` + +Emitted when focus is moved away from the scrolled window by a +keybinding. + +This is a [keybinding signal](class.SignalAction.html). + +The default bindings for this signal are +`Ctrl + Tab` to move forward and `Ctrl + Shift + Tab` to +move backward. + +### `scrollChild` + +Emitted when a keybinding that scrolls is pressed. + +This is a [keybinding signal](class.SignalAction.html). + +The horizontal or vertical adjustment is updated which triggers a +signal that the scrolled window’s child may listen to and scroll itself. + +### `app` + +The application. + +### `window` + +The window. + +## Methods +### `init()` + +Initialize `ScrolledWindow`. + +### `container(modifiers:)` + +Get the widget's view storage. +- Parameter modifiers: The view modifiers. +- Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `child(_:)` + +The child widget. + +### `hasFrame(_:)` + +Whether to draw a frame around the contents. + +### `kineticScrolling(_:)` + +Whether kinetic scrolling is enabled or not. + +Kinetic scrolling only applies to devices with source %GDK_SOURCE_TOUCHSCREEN. + +### `maxContentHeight(_:)` + +The maximum content height of @scrolled_window. + +### `maxContentWidth(_:)` + +The maximum content width of @scrolled_window. + +### `minContentHeight(_:)` + +The minimum content height of @scrolled_window. + +### `minContentWidth(_:)` + +The minimum content width of @scrolled_window. + +### `overlayScrolling(_:)` + +Whether overlay scrolling is enabled or not. + +If it is, the scrollbars are only added as traditional widgets +when a mouse is present. Otherwise, they are overlaid on top of +the content, as narrow indicators. + +Note that overlay scrolling can also be globally disabled, with +the [property@Gtk.Settings:gtk-overlay-scrolling] setting. + +### `propagateNaturalHeight(_:)` + +Whether the natural height of the child should be calculated and propagated +through the scrolled window’s requested natural height. + +This is useful in cases where an attempt should be made to allocate exactly +enough space for the natural size of the child. + +### `propagateNaturalWidth(_:)` + +Whether the natural width of the child should be calculated and propagated +through the scrolled window’s requested natural width. + +This is useful in cases where an attempt should be made to allocate exactly +enough space for the natural size of the child. + +### `edgeOvershot(_:)` + +Emitted whenever user initiated scrolling makes the scrolled +window firmly surpass the limits defined by the adjustment +in that orientation. + +A similar behavior without edge resistance is provided by the +[signal@Gtk.ScrolledWindow::edge-reached] signal. + +Note: The @pos argument is LTR/RTL aware, so callers should be +aware too if intending to provide behavior on horizontal edges. + +### `edgeReached(_:)` + +Emitted whenever user-initiated scrolling makes the scrolled +window exactly reach the lower or upper limits defined by the +adjustment in that orientation. + +A similar behavior with edge resistance is provided by the +[signal@Gtk.ScrolledWindow::edge-overshot] signal. + +Note: The @pos argument is LTR/RTL aware, so callers should be +aware too if intending to provide behavior on horizontal edges. + +### `moveFocusOut(_:)` + +Emitted when focus is moved away from the scrolled window by a +keybinding. + +This is a [keybinding signal](class.SignalAction.html). + +The default bindings for this signal are +`Ctrl + Tab` to move forward and `Ctrl + Shift + Tab` to +move backward. + +### `scrollChild(_:)` + +Emitted when a keybinding that scrolls is pressed. + +This is a [keybinding signal](class.SignalAction.html). + +The horizontal or vertical adjustment is updated which triggers a +signal that the scrolled window’s child may listen to and scroll itself. diff --git a/Documentation/Reference/structs/SpinRow.md b/Documentation/Reference/structs/SpinRow.md index 4d74efe..1176ccc 100644 --- a/Documentation/Reference/structs/SpinRow.md +++ b/Documentation/Reference/structs/SpinRow.md @@ -2,101 +2,299 @@ # `SpinRow` -A spin row lets the user select an integer in a certain range. +An [class@ActionRow] with an embedded spin button. + +spin-row + +Example of an `AdwSpinRow` UI definition: + +```xml +Spin Row010050101 +``` + +See [class@Gtk.SpinButton] for details. + +## CSS nodes + +`AdwSpinRow` has the same structure as [class@ActionRow], as well as the +`.spin` style class on the main node. ## Properties -### `title` +### `updateFunctions` -The title. +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `climbRate` + +The acceleration rate when you hold down a button or key. + +### `digits` + +The number of decimal places to display. + +### `numeric` + +Whether non-numeric characters should be ignored. + +### `snapToTicks` + +Whether invalid values are snapped to the nearest step increment. ### `value` -The selected value. +The current value. -### `min` +### `wrap` -The minimum value. +Whether the spin row should wrap upon reaching its limits. -### `max` +### `activatableWidget` -The maximum value. +The widget to activate when the row is activated. -### `step` +The row can be activated either by clicking on it, calling +[method@ActionRow.activate], or via mnemonics in the title. +See the [property@PreferencesRow:use-underline] property to enable +mnemonics. -The increase/decrease step. +The target widget will be activated by emitting the +[signal@Gtk.Widget::mnemonic-activate] signal on it. + +### `iconName` + +The icon name for this row. ### `subtitle` -The subtitle. +The subtitle for this row. -### `prefix` +The subtitle is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. -The prefix. +### `subtitleLines` + +The number of lines at the end of which the subtitle label will be +ellipsized. + +If the value is 0, the number of lines won't be limited. + +### `subtitleSelectable` + +Whether the user can copy the subtitle from the label. + +See also [property@Gtk.Label:selectable]. + +### `titleLines` + +The number of lines at the end of which the title label will be ellipsized. + +If the value is 0, the number of lines won't be limited. + +### `title` + +The title of the preference represented by this row. + +The title is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. + +### `titleSelectable` + +Whether the user can copy the title from the label. + +See also [property@Gtk.Label:selectable]. + +### `useMarkup` + +Whether to use Pango markup for the title label. + +Subclasses may also use it for other labels, such as subtitle. + +See also [func@Pango.parse_markup]. + +### `useUnderline` + +Whether an embedded underline in the title indicates a mnemonic. + +### `input` + +Emitted to convert the user's input into a double value. + +The signal handler is expected to use [method@Gtk.Editable.get_text] to +retrieve the text of the spinbutton and set new_value to the new value. + +The default conversion uses [func@GLib.strtod]. + +See [signal@Gtk.SpinButton::input]. + +### `output` + +Emitted to tweak the formatting of the value for display. + +See [signal@Gtk.SpinButton::output]. + +### `wrapped` + +Emitted right after the spinbutton wraps. + +See [signal@Gtk.SpinButton::wrapped]. + +### `activated` + +This signal is emitted after the row has been activated. ### `suffix` -The suffix. +The body for the widget "suffix". -### `prefixID` +### `prefix` -The identifier for the prefix content. +The body for the widget "prefix". -### `suffixID` +### `app` -The identifier for the suffix content. +The application. -### `configID` +### `window` -The identifier of the configuration field. +The window. ## Methods -### `init(_:value:min:max:)` +### `init(climbRate:digits:)` -Initialize a spin row. -- Parameters: - - title: The row's title. - - value: The selected value. - - min: The minimum value. - - max: The maximum value. - -### `update(_:modifiers:)` - -Update a view storage. -- Parameters: - - storage: The view storage. - - modifiers: Modify views before being updated. +Initialize `SpinRow`. ### `container(modifiers:)` -Get a view storage. -- Parameter modifiers: Modify views before being updated. +Get the widget's view storage. +- Parameter modifiers: The view modifiers. - Returns: The view storage. -### `update(row:)` +### `update(_:modifiers:updateProperties:)` -Update the spin row. -- Parameter row: The spin row. +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `climbRate(_:)` + +The acceleration rate when you hold down a button or key. + +### `digits(_:)` + +The number of decimal places to display. + +### `numeric(_:)` + +Whether non-numeric characters should be ignored. + +### `snapToTicks(_:)` + +Whether invalid values are snapped to the nearest step increment. + +### `value(_:)` + +The current value. + +### `wrap(_:)` + +Whether the spin row should wrap upon reaching its limits. + +### `activatableWidget(_:)` + +The widget to activate when the row is activated. + +The row can be activated either by clicking on it, calling +[method@ActionRow.activate], or via mnemonics in the title. +See the [property@PreferencesRow:use-underline] property to enable +mnemonics. + +The target widget will be activated by emitting the +[signal@Gtk.Widget::mnemonic-activate] signal on it. + +### `iconName(_:)` + +The icon name for this row. ### `subtitle(_:)` -Set the spin row's subtitle. -- Parameter subtitle: The subtitle. -- Returns: The spin row. +The subtitle for this row. -### `prefix(_:)` +The subtitle is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. -Set the spin row's prefix view. -- Parameter prefix: The prefix. -- Returns: The spin row. +### `subtitleLines(_:)` -### `suffix(_:)` +The number of lines at the end of which the subtitle label will be +ellipsized. -Set the spin row's suffix view. -- Parameter suffix: The suffix. -- Returns: The spin row. +If the value is 0, the number of lines won't be limited. -### `step(_:)` +### `subtitleSelectable(_:)` -Set the difference a single click on the increase/decrease buttons makes. -- Parameter step: The increase/decrease step. -- Returns: The spin row. +Whether the user can copy the subtitle from the label. + +See also [property@Gtk.Label:selectable]. + +### `titleLines(_:)` + +The number of lines at the end of which the title label will be ellipsized. + +If the value is 0, the number of lines won't be limited. + +### `title(_:)` + +The title of the preference represented by this row. + +The title is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. + +### `titleSelectable(_:)` + +Whether the user can copy the title from the label. + +See also [property@Gtk.Label:selectable]. + +### `useMarkup(_:)` + +Whether to use Pango markup for the title label. + +Subclasses may also use it for other labels, such as subtitle. + +See also [func@Pango.parse_markup]. + +### `useUnderline(_:)` + +Whether an embedded underline in the title indicates a mnemonic. + +### `input(_:)` + +Emitted to convert the user's input into a double value. + +The signal handler is expected to use [method@Gtk.Editable.get_text] to +retrieve the text of the spinbutton and set new_value to the new value. + +The default conversion uses [func@GLib.strtod]. + +See [signal@Gtk.SpinButton::input]. + +### `output(_:)` + +Emitted to tweak the formatting of the value for display. + +See [signal@Gtk.SpinButton::output]. + +### `wrapped(_:)` + +Emitted right after the spinbutton wraps. + +See [signal@Gtk.SpinButton::wrapped]. + +### `activated(_:)` + +This signal is emitted after the row has been activated. diff --git a/Documentation/Reference/structs/Spinner.md b/Documentation/Reference/structs/Spinner.md new file mode 100644 index 0000000..2d530ca --- /dev/null +++ b/Documentation/Reference/structs/Spinner.md @@ -0,0 +1,63 @@ +**STRUCT** + +# `Spinner` + +A `GtkSpinner` widget displays an icon-size spinning animation. + +It is often used as an alternative to a [class@Gtk.ProgressBar] +for displaying indefinite activity, instead of actual progress. + +![An example GtkSpinner](spinner.png) + +To start the animation, use [method@Gtk.Spinner.start], to stop it +use [method@Gtk.Spinner.stop]. + +# CSS nodes + +`GtkSpinner` has a single CSS node with the name spinner. +When the animation is active, the :checked pseudoclass is +added to this node. + +## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `spinning` + +Whether the spinner is spinning + +### `app` + +The application. + +### `window` + +The window. + +## Methods +### `init()` + +Initialize `Spinner`. + +### `container(modifiers:)` + +Get the widget's view storage. +- Parameter modifiers: The view modifiers. +- Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `spinning(_:)` + +Whether the spinner is spinning diff --git a/Documentation/Reference/structs/SplitButton.md b/Documentation/Reference/structs/SplitButton.md new file mode 100644 index 0000000..09f3451 --- /dev/null +++ b/Documentation/Reference/structs/SplitButton.md @@ -0,0 +1,204 @@ +**STRUCT** + +# `SplitButton` + +A combined button and dropdown widget. + +split-button + +`AdwSplitButton` is typically used to present a set of actions in a menu, +but allow access to one of them with a single click. + +The API is very similar to [class@Gtk.Button] and [class@Gtk.MenuButton], see +their documentation for details. + +## CSS nodes + +``` +splitbutton[.image-button][.text-button] +├── button +│ ╰── ├── separator +╰── menubutton +╰── button.toggle +╰── arrow +``` + +`AdwSplitButton`'s CSS node is called `splitbutton`. It contains the css +nodes: `button`, `separator`, `menubutton`. See [class@Gtk.MenuButton] +documentation for the `menubutton` contents. + +The main CSS node will contain the `.image-button` or `.text-button` style +classes matching the button contents. The nested button nodes will never +contain them. + +## Accessibility + +`AdwSplitButton` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role. + +## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `canShrink` + +Whether the button can be smaller than the natural size of its contents. + +If set to `TRUE`, the label will ellipsize. + +See [property@Gtk.Button:can-shrink] and +[property@Gtk.MenuButton:can-shrink]. + +### `child` + +The child widget. + +Setting the child widget will set [property@SplitButton:label] and +[property@SplitButton:icon-name] to `NULL`. + +### `dropdownTooltip` + +The tooltip of the dropdown button. + +The tooltip can be marked up with the Pango text markup language. + +### `iconName` + +The name of the icon used to automatically populate the button. + +Setting the icon name will set [property@SplitButton:label] and +[property@SplitButton:child] to `NULL`. + +### `label` + +The label for the button. + +Setting the label will set [property@SplitButton:icon-name] and +[property@SplitButton:child] to `NULL`. + +### `menuModel` + +The `GMenuModel` from which the popup will be created. + +If the menu model is `NULL`, the dropdown is disabled. + +A [class@Gtk.Popover] will be created from the menu model with +[ctor@Gtk.PopoverMenu.new_from_model]. Actions will be connected as +documented for this function. + +If [property@SplitButton:popover] is already set, it will be dissociated +from the button, and the property is set to `NULL`. + +### `useUnderline` + +Whether an underline in the text indicates a mnemonic. + +See [property@SplitButton:label]. + +### `activate` + +Emitted to animate press then release. + +This is an action signal. Applications should never connect to this signal, +but use the [signal@SplitButton::clicked] signal. + +### `clicked` + +Emitted when the button has been activated (pressed and released). + +### `app` + +The application. + +### `window` + +The window. + +## Methods +### `init()` + +Initialize `SplitButton`. + +### `container(modifiers:)` + +Get the widget's view storage. +- Parameter modifiers: The view modifiers. +- Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `canShrink(_:)` + +Whether the button can be smaller than the natural size of its contents. + +If set to `TRUE`, the label will ellipsize. + +See [property@Gtk.Button:can-shrink] and +[property@Gtk.MenuButton:can-shrink]. + +### `child(_:)` + +The child widget. + +Setting the child widget will set [property@SplitButton:label] and +[property@SplitButton:icon-name] to `NULL`. + +### `dropdownTooltip(_:)` + +The tooltip of the dropdown button. + +The tooltip can be marked up with the Pango text markup language. + +### `iconName(_:)` + +The name of the icon used to automatically populate the button. + +Setting the icon name will set [property@SplitButton:label] and +[property@SplitButton:child] to `NULL`. + +### `label(_:)` + +The label for the button. + +Setting the label will set [property@SplitButton:icon-name] and +[property@SplitButton:child] to `NULL`. + +### `menuModel(app:window:_:)` + +The `GMenuModel` from which the popup will be created. + +If the menu model is `NULL`, the dropdown is disabled. + +A [class@Gtk.Popover] will be created from the menu model with +[ctor@Gtk.PopoverMenu.new_from_model]. Actions will be connected as +documented for this function. + +If [property@SplitButton:popover] is already set, it will be dissociated +from the button, and the property is set to `NULL`. + +### `useUnderline(_:)` + +Whether an underline in the text indicates a mnemonic. + +See [property@SplitButton:label]. + +### `activate(_:)` + +Emitted to animate press then release. + +This is an action signal. Applications should never connect to this signal, +but use the [signal@SplitButton::clicked] signal. + +### `clicked(_:)` + +Emitted when the button has been activated (pressed and released). diff --git a/Documentation/Reference/structs/State.md b/Documentation/Reference/structs/State.md index 5016c85..2e724e3 100644 --- a/Documentation/Reference/structs/State.md +++ b/Documentation/Reference/structs/State.md @@ -21,6 +21,10 @@ Get and set the value without updating the views. The stored value. +### `forceUpdates` + +Whether to force update the views when the value changes. + ### `writeValue` The function for updating the value in the settings file. @@ -30,15 +34,27 @@ The function for updating the value in the settings file. The value with an erased type. ## Methods -### `init(wrappedValue:)` +### `init(wrappedValue:forceUpdates:)` Initialize a property representing a state in the view. - Parameters: - wrappedValue: The wrapped value. + - forceUpdates: Whether to force update all available views when the property gets modified. -### `updateViews()` +### `updateViews(force:)` Update all of the views. +- Parameter force: Whether to force all views to update. + +### `userDataDir()` + +The directory used for storing user data. +- Returns: The URL. + +### `copy(_:)` + +Copy a text to the clipboard. +- Parameter text: The text. ### `dirPath()` diff --git a/Documentation/Reference/structs/StateWrapper.md b/Documentation/Reference/structs/StateWrapper.md index d225433..49cd9c8 100644 --- a/Documentation/Reference/structs/StateWrapper.md +++ b/Documentation/Reference/structs/StateWrapper.md @@ -26,12 +26,13 @@ Initialize a `StateWrapper`. - content: The view content. - state: The state information. -### `update(_:modifiers:)` +### `update(_:modifiers:updateProperties:)` Update a view storage. - Parameters: - storage: The view storage. - modifiers: Modify views before being updated. + - updateProperties: Whether to update properties. ### `container(modifiers:)` diff --git a/Documentation/Reference/structs/StatusPage.md b/Documentation/Reference/structs/StatusPage.md index 8726045..d2072f2 100644 --- a/Documentation/Reference/structs/StatusPage.md +++ b/Documentation/Reference/structs/StatusPage.md @@ -2,44 +2,93 @@ # `StatusPage` -A status page widget. +A page used for empty/error states and similar use-cases. + +status-page + +The `AdwStatusPage` widget can have an icon, a title, a description and a +custom widget which is displayed below them. + +## CSS nodes + +`AdwStatusPage` has a main CSS node with name `statuspage`. + +`AdwStatusPage` can use the +[`.compact`](style-classes.html#compact-status-page) style class for when it +needs to fit into a small space such a sidebar or a popover. ## Properties -### `title` +### `updateFunctions` -The title. +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `child` + +The child widget. ### `description` -The description. +The description markup to be displayed below the title. -### `icon` +### `iconName` -The icon. +The name of the icon to be used. -### `content` +Changing this will set [property@StatusPage:paintable] to `NULL`. -Additional content. +### `title` + +The title to be displayed below the icon. + +It is not parsed as Pango markup. + +### `app` + +The application. + +### `window` + +The window. ## Methods -### `init(_:icon:description:content:)` +### `init()` -Initialize a status page widget. -- Parameters: - - title: The title. - - icon: The icon. - - description: Additional details. - - content: Additional content. - -### `update(_:modifiers:)` - -Update the view storage of the text widget. -- Parameters: - - storage: The view storage. - - modifiers: Modify views before being updated. +Initialize `StatusPage`. ### `container(modifiers:)` -Get the container of the text widget. -- Parameter modifiers: Modify views before being updated. +Get the widget's view storage. +- Parameter modifiers: The view modifiers. - Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `child(_:)` + +The child widget. + +### `description(_:)` + +The description markup to be displayed below the title. + +### `iconName(_:)` + +The name of the icon to be used. + +Changing this will set [property@StatusPage:paintable] to `NULL`. + +### `title(_:)` + +The title to be displayed below the icon. + +It is not parsed as Pango markup. diff --git a/Documentation/Reference/structs/SwitchRow.md b/Documentation/Reference/structs/SwitchRow.md index f11bdac..40c27a1 100644 --- a/Documentation/Reference/structs/SwitchRow.md +++ b/Documentation/Reference/structs/SwitchRow.md @@ -2,77 +2,217 @@ # `SwitchRow` -A row representing a boolean state. +A [class@Gtk.ListBoxRow] used to represent two states. + +switch-row + +The `AdwSwitchRow` widget contains a [class@Gtk.Switch] that allows the user +to select between two states: "on" or "off". When activated, the row will +invert its active state. + +The user can control the switch by activating the row or by dragging on the +switch handle. + +See [class@Gtk.Switch] for details. + +Example of an `AdwSwitchRow` UI definition: +```xml +Switch Row +``` + +The [property@SwitchRow:active] property should be connected to in order to +monitor changes to the active state. ## Properties -### `title` +### `updateFunctions` -The title. +Additional update functions for type extensions. -### `isOn` +### `appearFunctions` -Whether the switch is activated. +Additional appear functions for type extensions. + +### `active` + +Whether the switch row is in the "on" or "off" position. + +### `activatableWidget` + +The widget to activate when the row is activated. + +The row can be activated either by clicking on it, calling +[method@ActionRow.activate], or via mnemonics in the title. +See the [property@PreferencesRow:use-underline] property to enable +mnemonics. + +The target widget will be activated by emitting the +[signal@Gtk.Widget::mnemonic-activate] signal on it. + +### `iconName` + +The icon name for this row. ### `subtitle` -The subtitle. +The subtitle for this row. -### `prefix` +The subtitle is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. -The prefix. +### `subtitleLines` + +The number of lines at the end of which the subtitle label will be +ellipsized. + +If the value is 0, the number of lines won't be limited. + +### `subtitleSelectable` + +Whether the user can copy the subtitle from the label. + +See also [property@Gtk.Label:selectable]. + +### `titleLines` + +The number of lines at the end of which the title label will be ellipsized. + +If the value is 0, the number of lines won't be limited. + +### `title` + +The title of the preference represented by this row. + +The title is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. + +### `titleSelectable` + +Whether the user can copy the title from the label. + +See also [property@Gtk.Label:selectable]. + +### `useMarkup` + +Whether to use Pango markup for the title label. + +Subclasses may also use it for other labels, such as subtitle. + +See also [func@Pango.parse_markup]. + +### `useUnderline` + +Whether an embedded underline in the title indicates a mnemonic. + +### `activated` + +This signal is emitted after the row has been activated. ### `suffix` -The suffix. +The body for the widget "suffix". -### `prefixID` +### `prefix` -The identifier for the prefix content. +The body for the widget "prefix". -### `suffixID` +### `app` -The identifier for the suffix content. +The application. + +### `window` + +The window. ## Methods -### `init(_:isOn:)` +### `init()` -Initialize a switch row. -- Parameters: - - title: The row's title. - - isOn: Whether the switch is on. - -### `update(_:modifiers:)` - -Update a view storage. -- Parameters: - - storage: The view storage. - - modifiers: Modify views before being updated. +Initialize `SwitchRow`. ### `container(modifiers:)` -Get a view storage. -- Parameter modifiers: Modify views before being updated. +Get the widget's view storage. +- Parameter modifiers: The view modifiers. - Returns: The view storage. -### `update(row:)` +### `update(_:modifiers:updateProperties:)` -Update the switch row. -- Parameter row: The switch row. +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `active(_:)` + +Whether the switch row is in the "on" or "off" position. + +### `activatableWidget(_:)` + +The widget to activate when the row is activated. + +The row can be activated either by clicking on it, calling +[method@ActionRow.activate], or via mnemonics in the title. +See the [property@PreferencesRow:use-underline] property to enable +mnemonics. + +The target widget will be activated by emitting the +[signal@Gtk.Widget::mnemonic-activate] signal on it. + +### `iconName(_:)` + +The icon name for this row. ### `subtitle(_:)` -Set the switch row's subtitle. -- Parameter subtitle: The subtitle. -- Returns: The switch row. +The subtitle for this row. -### `prefix(_:)` +The subtitle is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. -Set the switch row's prefix view. -- Parameter prefix: The prefix. -- Returns: The switch row. +### `subtitleLines(_:)` -### `suffix(_:)` +The number of lines at the end of which the subtitle label will be +ellipsized. -Set the switch row's suffix view. -- Parameter suffix: The suffix. -- Returns: The switch row. +If the value is 0, the number of lines won't be limited. + +### `subtitleSelectable(_:)` + +Whether the user can copy the subtitle from the label. + +See also [property@Gtk.Label:selectable]. + +### `titleLines(_:)` + +The number of lines at the end of which the title label will be ellipsized. + +If the value is 0, the number of lines won't be limited. + +### `title(_:)` + +The title of the preference represented by this row. + +The title is interpreted as Pango markup unless +[property@PreferencesRow:use-markup] is set to `FALSE`. + +### `titleSelectable(_:)` + +Whether the user can copy the title from the label. + +See also [property@Gtk.Label:selectable]. + +### `useMarkup(_:)` + +Whether to use Pango markup for the title label. + +Subclasses may also use it for other labels, such as subtitle. + +See also [func@Pango.parse_markup]. + +### `useUnderline(_:)` + +Whether an embedded underline in the title indicates a mnemonic. + +### `activated(_:)` + +This signal is emitted after the row has been activated. diff --git a/Documentation/Reference/structs/ToastOverlay.md b/Documentation/Reference/structs/ToastOverlay.md index 13161cf..2718809 100644 --- a/Documentation/Reference/structs/ToastOverlay.md +++ b/Documentation/Reference/structs/ToastOverlay.md @@ -2,40 +2,83 @@ # `ToastOverlay` -A wrapper around a view presenting toasts. +A widget showing toasts above its content. + +toast-overlay + +Much like [class@Gtk.Overlay], `AdwToastOverlay` is a container with a single +main child, on top of which it can display a [class@Toast], overlaid. +Toasts can be shown with [method@ToastOverlay.add_toast]. + +See [class@Toast] for details. + +## CSS nodes + +``` +toastoverlay +├── [child] +├── toast +┊ ├── widget +┊ │ ├── [label.heading] +│ ╰── [custom title] +├── [button] +╰── button.circular.flat +``` + +`AdwToastOverlay`'s CSS node is called `toastoverlay`. It contains the child, +as well as zero or more `toast` subnodes. + +Each of the `toast` nodes contains a `widget` subnode, optionally a `button` +subnode, and another `button` subnode with `.circular` and `.flat` style +classes. + +The `widget` subnode contains a `label` subnode with the `.heading` style +class, or a custom widget provided by the application. + +## Accessibility + +`AdwToastOverlay` uses the `GTK_ACCESSIBLE_ROLE_TAB_GROUP` role. ## Properties -### `signal` +### `updateFunctions` -The signal for showing the toast./// Present a toast when the signal gets activated. +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. ### `child` -The child view. +The child widget. -### `title` +### `app` -The title of the toast. +The application. -### `button` +### `window` -Information about the button if available (label and handler). +The window. ## Methods +### `init()` + +Initialize `ToastOverlay`. + ### `container(modifiers:)` -Get the overlay's view storage. +Get the widget's view storage. - Parameter modifiers: The view modifiers. - Returns: The view storage. -### `update(_:modifiers:)` +### `update(_:modifiers:updateProperties:)` -Update the overlay's view storage. +Update the widget's view storage. - Parameters: - storage: The view storage. - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. -### `setVisibility(_:)` +### `child(_:)` -Add a toast if the signal is active. -- Parameter overlay: The toast overlay. +The child widget. diff --git a/Documentation/Reference/structs/ToggleButton.md b/Documentation/Reference/structs/ToggleButton.md new file mode 100644 index 0000000..1f16662 --- /dev/null +++ b/Documentation/Reference/structs/ToggleButton.md @@ -0,0 +1,221 @@ +**STRUCT** + +# `ToggleButton` + +A `GtkToggleButton` is a button which remains “pressed-in” when +clicked. + +Clicking again will cause the toggle button to return to its normal state. + +A toggle button is created by calling either [ctor@Gtk.ToggleButton.new] or +[ctor@Gtk.ToggleButton.new_with_label]. If using the former, it is advisable +to pack a widget, (such as a `GtkLabel` and/or a `GtkImage`), into the toggle +button’s container. (See [class@Gtk.Button] for more information). + +The state of a `GtkToggleButton` can be set specifically using +[method@Gtk.ToggleButton.set_active], and retrieved using +[method@Gtk.ToggleButton.get_active]. + +To simply switch the state of a toggle button, use +[method@Gtk.ToggleButton.toggled]. + +## Grouping + +Toggle buttons can be grouped together, to form mutually exclusive +groups - only one of the buttons can be toggled at a time, and toggling +another one will switch the currently toggled one off. + +To add a `GtkToggleButton` to a group, use [method@Gtk.ToggleButton.set_group]. + +## CSS nodes + +`GtkToggleButton` has a single CSS node with name button. To differentiate +it from a plain `GtkButton`, it gets the `.toggle` style class. + +## Accessibility + +`GtkToggleButton` uses the %GTK_ACCESSIBLE_ROLE_TOGGLE_BUTTON role. + +## Creating two `GtkToggleButton` widgets. + +```c +static void +output_state (GtkToggleButton *source, +gpointer user_data) +{ +g_print ("Toggle button "%s" is active: %s", +gtk_button_get_label (GTK_BUTTON (source)), +gtk_toggle_button_get_active (source) ? "Yes" : "No"); +} + +static void +make_toggles (void) +{ +GtkWidget *window, *toggle1, *toggle2; +GtkWidget *box; +const char *text; + +window = gtk_window_new (); +box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); + +text = "Hi, I’m toggle button one"; +toggle1 = gtk_toggle_button_new_with_label (text); + +g_signal_connect (toggle1, "toggled", +G_CALLBACK (output_state), +NULL); +gtk_box_append (GTK_BOX (box), toggle1); + +text = "Hi, I’m toggle button two"; +toggle2 = gtk_toggle_button_new_with_label (text); +g_signal_connect (toggle2, "toggled", +G_CALLBACK (output_state), +NULL); +gtk_box_append (GTK_BOX (box), toggle2); + +gtk_window_set_child (GTK_WINDOW (window), box); +gtk_window_present (GTK_WINDOW (window)); +} +``` + +## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `active` + +If the toggle button should be pressed in. + +### `canShrink` + +Whether the size of the button can be made smaller than the natural +size of its contents. + +For text buttons, setting this property will allow ellipsizing the label. + +If the contents of a button are an icon or a custom widget, setting this +property has no effect. + +### `child` + +The child widget. + +### `hasFrame` + +Whether the button has a frame. + +### `iconName` + +The name of the icon used to automatically populate the button. + +### `label` + +Text of the label inside the button, if the button contains a label widget. + +### `useUnderline` + +If set, an underline in the text indicates that the following character is +to be used as mnemonic. + +### `toggled` + +Emitted whenever the `GtkToggleButton`'s state is changed. + +### `activate` + +Emitted to animate press then release. + +This is an action signal. Applications should never connect +to this signal, but use the [signal@Gtk.Button::clicked] signal. + +The default bindings for this signal are all forms of the + and Enter keys. + +### `clicked` + +Emitted when the button has been activated (pressed and released). + +### `app` + +The application. + +### `window` + +The window. + +## Methods +### `init()` + +Initialize `ToggleButton`. + +### `container(modifiers:)` + +Get the widget's view storage. +- Parameter modifiers: The view modifiers. +- Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `active(_:)` + +If the toggle button should be pressed in. + +### `canShrink(_:)` + +Whether the size of the button can be made smaller than the natural +size of its contents. + +For text buttons, setting this property will allow ellipsizing the label. + +If the contents of a button are an icon or a custom widget, setting this +property has no effect. + +### `child(_:)` + +The child widget. + +### `hasFrame(_:)` + +Whether the button has a frame. + +### `iconName(_:)` + +The name of the icon used to automatically populate the button. + +### `label(_:)` + +Text of the label inside the button, if the button contains a label widget. + +### `useUnderline(_:)` + +If set, an underline in the text indicates that the following character is +to be used as mnemonic. + +### `toggled(_:)` + +Emitted whenever the `GtkToggleButton`'s state is changed. + +### `activate(_:)` + +Emitted to animate press then release. + +This is an action signal. Applications should never connect +to this signal, but use the [signal@Gtk.Button::clicked] signal. + +The default bindings for this signal are all forms of the + and Enter keys. + +### `clicked(_:)` + +Emitted when the button has been activated (pressed and released). diff --git a/Documentation/Reference/structs/ToolbarView.md b/Documentation/Reference/structs/ToolbarView.md index ab6c37d..c06dae5 100644 --- a/Documentation/Reference/structs/ToolbarView.md +++ b/Documentation/Reference/structs/ToolbarView.md @@ -2,39 +2,257 @@ # `ToolbarView` -A toolbar view widget. +A widget containing a page, as well as top and/or bottom bars. + +toolbar-view + +`AdwToolbarView` has a single content widget and one or multiple top and +bottom bars, shown at the top and bottom sides respectively. + +Example of an `AdwToolbarView` UI definition: +```xml + +``` + +The following kinds of top and bottom bars are supported: + +- [class@HeaderBar] +- [class@TabBar] +- [class@ViewSwitcherBar] +- [class@Gtk.ActionBar] +- [class@Gtk.HeaderBar] +- [class@Gtk.PopoverMenuBar] +- [class@Gtk.SearchBar] +- Any [class@Gtk.Box] or a similar widget with the +[`.toolbar`](style-classes.html#toolbars) style class + +By default, top and bottom bars are flat and scrolling content has a subtle +undershoot shadow, same as when using the +[`.undershoot-top`](style-classes.html#undershot-indicators) and +[`.undershoot-bottom`](style-classes.html#undershot-indicators) style +classes. This works well in most cases, e.g. with [class@StatusPage] or +[class@PreferencesPage], where the background at the top and bottom parts of +the page is uniform. Additionally, windows with sidebars should always use +this style. + +[property@ToolbarView:top-bar-style] and +[property@ToolbarView:bottom-bar-style] properties can be used add an opaque +background and a persistent shadow to top and bottom bars, this can be useful +for content such as [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html), +where some elements are adjacent to the top/bottom bars, or [class@TabView], +where each page can have a different background. + +toolbar-view-flat-1toolbar-view-flat-2toolbar-view-raised + +`AdwToolbarView` ensures the top and bottom bars have consistent backdrop +styles and vertical spacing. For comparison: + +toolbar-view-spacingtoolbar-view-spacing-box + +Any top and bottom bars can also be dragged to move the window, equivalent +to putting them into a [class@Gtk.WindowHandle]. + +Content is typically place between top and bottom bars, but can also extend +behind them. This is controlled with the +[property@ToolbarView:extend-content-to-top-edge] and +[property@ToolbarView:extend-content-to-bottom-edge] properties. + +Top and bottom bars can be hidden and revealed with an animation using the +[property@ToolbarView:reveal-top-bars] and +[property@ToolbarView:reveal-bottom-bars] properties. + +## `AdwToolbarView` as `GtkBuildable` + +The `AdwToolbarView` implementation of the [iface@Gtk.Buildable] interface +supports adding a top bar by specifying “top” as the “type” attribute of a +`` element, or adding a bottom bar by specifying “bottom”. + +## Accessibility + +`AdwToolbarView` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role. ## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `bottomBarHeight` + +The current bottom bar height. + +Bottom bar height does change depending on +[property@ToolbarView:reveal-bottom-bars], including during the transition. + +See [property@ToolbarView:top-bar-height]. + ### `content` -The sidebar's content. +The content widget. -### `toolbar` +### `extendContentToBottomEdge` -The toolbars. +Whether the content widget can extend behind bottom bars. + +This can be used in combination with +[property@ToolbarView:reveal-bottom-bars] to show and hide toolbars in +fullscreen. + +See [property@ToolbarView:extend-content-to-top-edge]. + +### `extendContentToTopEdge` + +Whether the content widget can extend behind top bars. + +This can be used in combination with [property@ToolbarView:reveal-top-bars] +to show and hide toolbars in fullscreen. + +See [property@ToolbarView:extend-content-to-bottom-edge]. + +### `revealBottomBars` + +Whether bottom bars are visible. + +The transition will be animated. + +This can be used in combination with +[property@ToolbarView:extend-content-to-bottom-edge] to show and hide +toolbars in fullscreen. + +See [property@ToolbarView:reveal-top-bars]. + +### `revealTopBars` + +Whether top bars are revealed. + +The transition will be animated. + +This can be used in combination with +[property@ToolbarView:extend-content-to-top-edge] to show and hide toolbars +in fullscreen. + +See [property@ToolbarView:reveal-bottom-bars]. + +### `topBarHeight` + +The current top bar height. + +Top bar height does change depending [property@ToolbarView:reveal-top-bars], +including during the transition. + +See [property@ToolbarView:bottom-bar-height]. ### `bottom` -Whether the toolbars are bottom toolbars. +The body for the widget "bottom". -### `visible` +### `top` -Whether the toolbar is visible. +The body for the widget "top". -### `toolbarID` +### `app` -The identifier of the toolbar content. +The application. + +### `window` + +The window. ## Methods +### `init()` + +Initialize `ToolbarView`. + ### `container(modifiers:)` -Get the container of the toolbar view widget. -- Parameter modifiers: Modify views before being updated. +Get the widget's view storage. +- Parameter modifiers: The view modifiers. - Returns: The view storage. -### `update(_:modifiers:)` +### `update(_:modifiers:updateProperties:)` -Update the view storage of the toolbar view widget. +Update the widget's view storage. - Parameters: - storage: The view storage. - - modifiers: Modify views before being updated. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `bottomBarHeight(_:)` + +The current bottom bar height. + +Bottom bar height does change depending on +[property@ToolbarView:reveal-bottom-bars], including during the transition. + +See [property@ToolbarView:top-bar-height]. + +### `content(_:)` + +The content widget. + +### `extendContentToBottomEdge(_:)` + +Whether the content widget can extend behind bottom bars. + +This can be used in combination with +[property@ToolbarView:reveal-bottom-bars] to show and hide toolbars in +fullscreen. + +See [property@ToolbarView:extend-content-to-top-edge]. + +### `extendContentToTopEdge(_:)` + +Whether the content widget can extend behind top bars. + +This can be used in combination with [property@ToolbarView:reveal-top-bars] +to show and hide toolbars in fullscreen. + +See [property@ToolbarView:extend-content-to-bottom-edge]. + +### `revealBottomBars(_:)` + +Whether bottom bars are visible. + +The transition will be animated. + +This can be used in combination with +[property@ToolbarView:extend-content-to-bottom-edge] to show and hide +toolbars in fullscreen. + +See [property@ToolbarView:reveal-top-bars]. + +### `revealTopBars(_:)` + +Whether top bars are revealed. + +The transition will be animated. + +This can be used in combination with +[property@ToolbarView:extend-content-to-top-edge] to show and hide toolbars +in fullscreen. + +See [property@ToolbarView:reveal-bottom-bars]. + +### `topBarHeight(_:)` + +The current top bar height. + +Top bar height does change depending [property@ToolbarView:reveal-top-bars], +including during the transition. + +See [property@ToolbarView:bottom-bar-height]. + +### `bottom(_:)` + +Set the body for "bottom". +- Parameter body: The body. +- Returns: The widget. + +### `top(_:)` + +Set the body for "top". +- Parameter body: The body. +- Returns: The widget. diff --git a/Documentation/Reference/structs/ViewStack.md b/Documentation/Reference/structs/ViewStack.md index 788a197..48f0249 100644 --- a/Documentation/Reference/structs/ViewStack.md +++ b/Documentation/Reference/structs/ViewStack.md @@ -34,9 +34,10 @@ Get a stack's view storage. - Parameter modifiers: Modify views before being updated. - Returns: The stack's view storage. -### `update(_:modifiers:)` +### `update(_:modifiers:updateProperties:)` Update a stack's view storage. - Parameters: - storage: The view storage. - modifiers: Modify views before being updated. + - updateProperties: Whether to update properties. diff --git a/Documentation/Reference/structs/ViewSwitcher.md b/Documentation/Reference/structs/ViewSwitcher.md index 795d0f6..ca7a5e0 100644 --- a/Documentation/Reference/structs/ViewSwitcher.md +++ b/Documentation/Reference/structs/ViewSwitcher.md @@ -27,12 +27,13 @@ Get a view switcher's view storage. - Parameter modifiers: Modify views before being updated. - Returns: The view storage. -### `update(_:modifiers:)` +### `update(_:modifiers:updateProperties:)` Update a view switcher's view storage. - Parameters: - storage: The view storage. - modifiers: Modify views before being updated. + - updateProperties: Whether to update properties. ### `updateSwitcher(switcher:)` diff --git a/Documentation/Reference/structs/Window.md b/Documentation/Reference/structs/Window.md index 5054be3..e54b48d 100644 --- a/Documentation/Reference/structs/Window.md +++ b/Documentation/Reference/structs/Window.md @@ -78,10 +78,13 @@ Get the storage of the content view. - Parameter window: The window. - Returns: The storage of the content of the window. -### `update(_:app:)` +### `update(_:app:force:)` Update a window storage's content. -- Parameter storage: The storage to update. +- Parameters: + - storage: The storage to update. + - app: The GTUI app. + - force: Whether to force update all the views. ### `setProperties(window:)` @@ -94,7 +97,7 @@ Add windows that overlay the last instance of this window if presented. - Parameter windows: The windows. - Returns: The new windows and this window. -### `fileImporter(_:initialFolder:extensions:folders:onOpen:onClose:)` +### `fileImporter(_:initialFolder:extensions:onOpen:onClose:)` Add an importer file dialog to the window. - Parameters: diff --git a/Documentation/Reference/structs/WindowTitle.md b/Documentation/Reference/structs/WindowTitle.md new file mode 100644 index 0000000..8cf0acb --- /dev/null +++ b/Documentation/Reference/structs/WindowTitle.md @@ -0,0 +1,76 @@ +**STRUCT** + +# `WindowTitle` + +A helper widget for setting a window's title and subtitle. + +window-title + +`AdwWindowTitle` shows a title and subtitle. It's intended to be used as the +title child of [class@Gtk.HeaderBar] or [class@HeaderBar]. + +## CSS nodes + +`AdwWindowTitle` has a single CSS node with name `windowtitle`. + +## Properties +### `updateFunctions` + +Additional update functions for type extensions. + +### `appearFunctions` + +Additional appear functions for type extensions. + +### `subtitle` + +The subtitle to display. + +The subtitle should give the user additional details. + +### `title` + +The title to display. + +The title typically identifies the current view or content item, and +generally does not use the application name. + +### `app` + +The application. + +### `window` + +The window. + +## Methods +### `init(subtitle:title:)` + +Initialize `WindowTitle`. + +### `container(modifiers:)` + +Get the widget's view storage. +- Parameter modifiers: The view modifiers. +- Returns: The view storage. + +### `update(_:modifiers:updateProperties:)` + +Update the widget's view storage. +- Parameters: + - storage: The view storage. + - modifiers: The view modifiers. + - updateProperties: Whether to update the view's properties. + +### `subtitle(_:)` + +The subtitle to display. + +The subtitle should give the user additional details. + +### `title(_:)` + +The title to display. + +The title typically identifies the current view or content item, and +generally does not use the application name. diff --git a/Documentation/Reference/typealiases/FormSection.md b/Documentation/Reference/typealiases/FormSection.md new file mode 100644 index 0000000..63b6502 --- /dev/null +++ b/Documentation/Reference/typealiases/FormSection.md @@ -0,0 +1,5 @@ +**TYPEALIAS** + +# `FormSection` + +A section usually groups forms. \ No newline at end of file diff --git a/Documentation/Reference/typealiases/List.md b/Documentation/Reference/typealiases/List.md new file mode 100644 index 0000000..ab08b25 --- /dev/null +++ b/Documentation/Reference/typealiases/List.md @@ -0,0 +1,5 @@ +**TYPEALIAS** + +# `List` + +A list box widget. \ No newline at end of file diff --git a/Documentation/Reference/typealiases/ScrollView.md b/Documentation/Reference/typealiases/ScrollView.md new file mode 100644 index 0000000..ea4e3d0 --- /dev/null +++ b/Documentation/Reference/typealiases/ScrollView.md @@ -0,0 +1,5 @@ +**TYPEALIAS** + +# `ScrollView` + +A GtkScrolledWindow equivalent. \ No newline at end of file diff --git a/Documentation/Reference/typealiases/Text.md b/Documentation/Reference/typealiases/Text.md new file mode 100644 index 0000000..ba2f5b1 --- /dev/null +++ b/Documentation/Reference/typealiases/Text.md @@ -0,0 +1,5 @@ +**TYPEALIAS** + +# `Text` + +A text widget. \ No newline at end of file diff --git a/Documentation/Reference/typealiases/Toggle.md b/Documentation/Reference/typealiases/Toggle.md new file mode 100644 index 0000000..c88b14a --- /dev/null +++ b/Documentation/Reference/typealiases/Toggle.md @@ -0,0 +1,5 @@ +**TYPEALIAS** + +# `Toggle` + +A toggle button widget. \ No newline at end of file diff --git a/Documentation/Reference/typealiases/VStack.md b/Documentation/Reference/typealiases/VStack.md new file mode 100644 index 0000000..027f145 --- /dev/null +++ b/Documentation/Reference/typealiases/VStack.md @@ -0,0 +1,5 @@ +**TYPEALIAS** + +# `VStack` + +A GtkBox equivalent. \ No newline at end of file diff --git a/Sources/Adwaita/Model/Data Flow/State.swift b/Sources/Adwaita/Model/Data Flow/State.swift index 38a45fb..a3b7f57 100644 --- a/Sources/Adwaita/Model/Data Flow/State.swift +++ b/Sources/Adwaita/Model/Data Flow/State.swift @@ -19,7 +19,8 @@ public struct State: StateProtocol { } nonmutating set { rawValue = newValue - Self.updateViews() + content.storage.update = true + Self.updateViews(force: forceUpdates) } } @@ -48,6 +49,9 @@ public struct State: StateProtocol { /// The stored value. public let content: State.Content + /// Whether to force update the views when the value changes. + public var forceUpdates: Bool + /// The function for updating the value in the settings file. private var writeValue: (() -> Void)? @@ -66,8 +70,10 @@ public struct State: StateProtocol { /// Initialize a property representing a state in the view. /// - Parameters: /// - wrappedValue: The wrapped value. - public init(wrappedValue: Value) { + /// - forceUpdates: Whether to force update all available views when the property gets modified. + public init(wrappedValue: Value, forceUpdates: Bool = false) { content = .init(storage: .init(value: wrappedValue)) + self.forceUpdates = forceUpdates } /// A class storing the state's content. @@ -93,6 +99,8 @@ public struct State: StateProtocol { public var key: String? /// The folder path. public var folder: String? + /// Whether to update the affected views. + public var update = false /// Initialize the storage. /// - Parameters: @@ -104,9 +112,10 @@ public struct State: StateProtocol { } /// Update all of the views. - public static func updateViews() { + /// - Parameter force: Whether to force all views to update. + public static func updateViews(force: Bool = false) { for handler in GTUIApp.updateHandlers { - handler() + handler(force) } } @@ -145,10 +154,12 @@ extension State where Value: Codable { /// - wrappedValue: The wrapped value. /// - key: The unique storage key of the property. /// - folder: The path to the folder containing the JSON file. + /// - forceUpdates: Whether to force update all available views when the property gets modified. /// /// The folder path will be appended to the XDG data home directory. - public init(wrappedValue: Value, _ key: String, folder: String? = nil) { + public init(wrappedValue: Value, _ key: String, folder: String? = nil, forceUpdates: Bool = false) { content = .init(storage: .init(value: wrappedValue)) + self.forceUpdates = forceUpdates content.storage.key = key content.storage.folder = folder checkFile() diff --git a/Sources/Adwaita/Model/Extensions/Array.swift b/Sources/Adwaita/Model/Extensions/Array.swift index 778fba7..a5136b3 100644 --- a/Sources/Adwaita/Model/Extensions/Array.swift +++ b/Sources/Adwaita/Model/Extensions/Array.swift @@ -33,10 +33,13 @@ extension Array: View where Element == View { /// - Parameters: /// - storage: The collection of view storages. /// - modifiers: Modify views before being updated. - public func update(_ storage: [ViewStorage], modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update properties. + public func update(_ storage: [ViewStorage], modifiers: [(View) -> View], updateProperties: Bool) { for (index, element) in enumerated() { if let storage = storage[safe: index] { - element.widget(modifiers: modifiers).updateStorage(storage, modifiers: modifiers) + element + .widget(modifiers: modifiers) + .updateStorage(storage, modifiers: modifiers, updateProperties: updateProperties) } } } diff --git a/Sources/Adwaita/Model/User Interface/App/App.swift b/Sources/Adwaita/Model/User Interface/App/App.swift index 74dab3b..754114c 100644 --- a/Sources/Adwaita/Model/User Interface/App/App.swift +++ b/Sources/Adwaita/Model/User Interface/App/App.swift @@ -43,13 +43,13 @@ extension App { public static func main() { var appInstance = self.init() appInstance.app = GTUIApp(appInstance.id) { appInstance } - GTUIApp.updateHandlers.append { + GTUIApp.updateHandlers.append { force in var removeIndices: [Int] = [] for (index, window) in appInstance.app.sceneStorage.enumerated() { if window.destroy { removeIndices.insert(index, at: 0) } else if let scene = appInstance.scene.windows().first(where: { $0.id == window.id }) { - scene.update(window, app: appInstance.app) + scene.update(window, app: appInstance.app, force: force) } } for index in removeIndices { diff --git a/Sources/Adwaita/Model/User Interface/App/GTUIApp.swift b/Sources/Adwaita/Model/User Interface/App/GTUIApp.swift index 1828443..b8c9a19 100644 --- a/Sources/Adwaita/Model/User Interface/App/GTUIApp.swift +++ b/Sources/Adwaita/Model/User Interface/App/GTUIApp.swift @@ -11,7 +11,7 @@ import CAdw public class GTUIApp { /// The handlers which are called when a state changes. - static var updateHandlers: [() -> Void] = [] + static var updateHandlers: [(Bool) -> Void] = [] /// The app's id for the file name for storing the data. static var appID = "temporary" diff --git a/Sources/Adwaita/Model/User Interface/View/View.swift b/Sources/Adwaita/Model/User Interface/View/View.swift index 223aa7a..cf117f4 100644 --- a/Sources/Adwaita/Model/User Interface/View/View.swift +++ b/Sources/Adwaita/Model/User Interface/View/View.swift @@ -43,12 +43,14 @@ extension View { /// - Parameters: /// - storage: The storage. /// - modifiers: Modify views before being updated. - public func updateStorage(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update properties. + public func updateStorage(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { let modified = getModified(modifiers: modifiers) if let widget = modified as? Widget { - widget.update(storage, modifiers: modifiers) + widget.update(storage, modifiers: modifiers, updateProperties: updateProperties) } else { - StateWrapper(content: { view }, state: getState()).update(storage, modifiers: modifiers) + StateWrapper(content: { view }, state: getState()) + .update(storage, modifiers: modifiers, updateProperties: updateProperties) } } diff --git a/Sources/Adwaita/Model/User Interface/View/Widget.swift b/Sources/Adwaita/Model/User Interface/View/Widget.swift index f12a2bb..a631658 100644 --- a/Sources/Adwaita/Model/User Interface/View/Widget.swift +++ b/Sources/Adwaita/Model/User Interface/View/Widget.swift @@ -15,7 +15,8 @@ public protocol Widget: View { /// - Parameters: /// - storage: The storage to update. /// - modifiers: Modify views before being updated - func update(_ storage: ViewStorage, modifiers: [(View) -> View]) + /// - updateProperties: Whether to update the view's properties. + func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) } diff --git a/Sources/Adwaita/Model/User Interface/Window/WindowScene.swift b/Sources/Adwaita/Model/User Interface/Window/WindowScene.swift index fbed105..aa329a1 100644 --- a/Sources/Adwaita/Model/User Interface/Window/WindowScene.swift +++ b/Sources/Adwaita/Model/User Interface/Window/WindowScene.swift @@ -24,7 +24,8 @@ public protocol WindowScene: WindowSceneGroup { /// - Parameters: /// - storage: The storage to update. /// - app: The application. - func update(_ storage: WindowStorage, app: GTUIApp) + /// - force: Whether to force update all the views. + func update(_ storage: WindowStorage, app: GTUIApp, force: Bool) } diff --git a/Sources/Adwaita/Model/User Interface/Window/WindowSceneGroup.swift b/Sources/Adwaita/Model/User Interface/Window/WindowSceneGroup.swift index 19ebae1..209af7d 100644 --- a/Sources/Adwaita/Model/User Interface/Window/WindowSceneGroup.swift +++ b/Sources/Adwaita/Model/User Interface/Window/WindowSceneGroup.swift @@ -33,10 +33,11 @@ extension WindowSceneGroup { /// - Parameters: /// - storage: The window's storage. /// - app: The application. - func update(_ storage: [WindowStorage], app: GTUIApp) { + /// - force: Whether to force update all the views. + func update(_ storage: [WindowStorage], app: GTUIApp, force: Bool) { for (index, window) in windows().enumerated() { if let storage = storage[safe: index] { - window.update(storage, app: app) + window.update(storage, app: app, force: force) } } } diff --git a/Sources/Adwaita/View/Generated/ActionRow.swift b/Sources/Adwaita/View/Generated/ActionRow.swift index 95c071b..beda785 100644 --- a/Sources/Adwaita/View/Generated/ActionRow.swift +++ b/Sources/Adwaita/View/Generated/ActionRow.swift @@ -2,7 +2,7 @@ // ActionRow.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -113,7 +113,7 @@ public struct ActionRow: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(adw_action_row_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) if let activatableWidgetStorage = activatableWidget?().widget(modifiers: modifiers).storage(modifiers: modifiers) { storage.content["activatableWidget"] = [activatableWidgetStorage] adw_action_row_set_activatable_widget(storage.pointer?.cast(), activatableWidgetStorage.pointer?.cast()) @@ -142,7 +142,8 @@ public struct ActionRow: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { if let activated { storage.connectSignal(name: "activated") { activated() @@ -150,47 +151,55 @@ public struct ActionRow: Widget { } storage.modify { widget in if let widget = storage.content["activatableWidget"]?.first { - activatableWidget?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + activatableWidget?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } - if let iconName { + if let iconName, updateProperties { adw_action_row_set_icon_name(widget?.cast(), iconName) } - if let subtitle { + if let subtitle, updateProperties { adw_action_row_set_subtitle(widget?.cast(), subtitle) } - if let subtitleLines { + if let subtitleLines, updateProperties { adw_action_row_set_subtitle_lines(widget?.cast(), subtitleLines.cInt) } - if let subtitleSelectable { + if let subtitleSelectable, updateProperties { adw_action_row_set_subtitle_selectable(widget?.cast(), subtitleSelectable.cBool) } - if let titleLines { + if let titleLines, updateProperties { adw_action_row_set_title_lines(widget?.cast(), titleLines.cInt) } - if let title { + if let title, updateProperties { adw_preferences_row_set_title(widget?.cast(), title) } - if let titleSelectable { + if let titleSelectable, updateProperties { adw_preferences_row_set_title_selectable(widget?.cast(), titleSelectable.cBool) } - if let useMarkup { + if let useMarkup, updateProperties { adw_preferences_row_set_use_markup(widget?.cast(), useMarkup.cBool) } - if let useUnderline { + if let useUnderline, updateProperties { adw_preferences_row_set_use_underline(widget?.cast(), useUnderline.cBool) } if let suffixStorage = storage.content["suffix"] { for (index, view) in suffix().enumerated() { if let storage = suffixStorage[safe: index] { - view.updateStorage(storage, modifiers: modifiers) + view.updateStorage( + storage, + modifiers: modifiers, + updateProperties: updateProperties + ) } } } if let prefixStorage = storage.content["prefix"] { for (index, view) in prefix().enumerated() { if let storage = prefixStorage[safe: index] { - view.updateStorage(storage, modifiers: modifiers) + view.updateStorage( + storage, + modifiers: modifiers, + updateProperties: updateProperties + ) } } } diff --git a/Sources/Adwaita/View/Generated/Avatar.swift b/Sources/Adwaita/View/Generated/Avatar.swift index 1ae76f6..46f0021 100644 --- a/Sources/Adwaita/View/Generated/Avatar.swift +++ b/Sources/Adwaita/View/Generated/Avatar.swift @@ -2,7 +2,7 @@ // Avatar.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -66,7 +66,7 @@ public struct Avatar: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(adw_avatar_new(size.cInt, text, showInitials.cBool)?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) for function in appearFunctions { @@ -79,14 +79,19 @@ public struct Avatar: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { storage.modify { widget in - if let iconName { + if let iconName, updateProperties { adw_avatar_set_icon_name(widget, iconName) } - adw_avatar_set_show_initials(widget, showInitials.cBool) - adw_avatar_set_size(widget, size.cInt) - if let text { + if updateProperties { + adw_avatar_set_show_initials(widget, showInitials.cBool) + } + if updateProperties { + adw_avatar_set_size(widget, size.cInt) + } + if let text, updateProperties { adw_avatar_set_text(widget, text) } diff --git a/Sources/Adwaita/View/Generated/Banner.swift b/Sources/Adwaita/View/Generated/Banner.swift index 1aa1a33..9bb9e16 100644 --- a/Sources/Adwaita/View/Generated/Banner.swift +++ b/Sources/Adwaita/View/Generated/Banner.swift @@ -2,7 +2,7 @@ // Banner.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -70,7 +70,7 @@ public struct Banner: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(adw_banner_new(title)?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) for function in appearFunctions { @@ -83,21 +83,24 @@ public struct Banner: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { if let buttonClicked { storage.connectSignal(name: "button-clicked") { buttonClicked() } } storage.modify { widget in - if let buttonLabel { + if let buttonLabel, updateProperties { adw_banner_set_button_label(widget, buttonLabel) } - if let revealed { + if let revealed, updateProperties { adw_banner_set_revealed(widget, revealed.cBool) } - adw_banner_set_title(widget, title) - if let useMarkup { + if updateProperties { + adw_banner_set_title(widget, title) + } + if let useMarkup, updateProperties { adw_banner_set_use_markup(widget, useMarkup.cBool) } diff --git a/Sources/Adwaita/View/Generated/Bin.swift b/Sources/Adwaita/View/Generated/Bin.swift index 0555bdf..6015718 100644 --- a/Sources/Adwaita/View/Generated/Bin.swift +++ b/Sources/Adwaita/View/Generated/Bin.swift @@ -2,7 +2,7 @@ // Bin.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -40,7 +40,7 @@ public struct Bin: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(adw_bin_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) if let childStorage = child?().widget(modifiers: modifiers).storage(modifiers: modifiers) { storage.content["child"] = [childStorage] adw_bin_set_child(storage.pointer?.cast(), childStorage.pointer?.cast()) @@ -57,10 +57,11 @@ public struct Bin: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { storage.modify { widget in if let widget = storage.content["child"]?.first { - child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } diff --git a/Sources/Adwaita/View/Generated/Box.swift b/Sources/Adwaita/View/Generated/Box.swift index 5bc77a5..2ab1c63 100644 --- a/Sources/Adwaita/View/Generated/Box.swift +++ b/Sources/Adwaita/View/Generated/Box.swift @@ -2,7 +2,7 @@ // Box.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -74,7 +74,7 @@ public struct Box: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(gtk_box_new(GTK_ORIENTATION_VERTICAL, spacing.cInt)?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) var appendStorage: [ViewStorage] = [] for view in append() { @@ -99,27 +99,38 @@ public struct Box: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { storage.modify { widget in - if let baselineChild { + if let baselineChild, updateProperties { gtk_box_set_baseline_child(widget?.cast(), baselineChild.cInt) } - if let homogeneous { + if let homogeneous, updateProperties { gtk_box_set_homogeneous(widget?.cast(), homogeneous.cBool) } - gtk_box_set_spacing(widget?.cast(), spacing.cInt) + if updateProperties { + gtk_box_set_spacing(widget?.cast(), spacing.cInt) + } if let appendStorage = storage.content["append"] { for (index, view) in append().enumerated() { if let storage = appendStorage[safe: index] { - view.updateStorage(storage, modifiers: modifiers) + view.updateStorage( + storage, + modifiers: modifiers, + updateProperties: updateProperties + ) } } } if let prependStorage = storage.content["prepend"] { for (index, view) in prepend().enumerated() { if let storage = prependStorage[safe: index] { - view.updateStorage(storage, modifiers: modifiers) + view.updateStorage( + storage, + modifiers: modifiers, + updateProperties: updateProperties + ) } } } diff --git a/Sources/Adwaita/View/Generated/Button.swift b/Sources/Adwaita/View/Generated/Button.swift index ec2f0d6..c4ad080 100644 --- a/Sources/Adwaita/View/Generated/Button.swift +++ b/Sources/Adwaita/View/Generated/Button.swift @@ -2,7 +2,7 @@ // Button.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -88,7 +88,7 @@ public struct Button: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(gtk_button_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) if let childStorage = child?().widget(modifiers: modifiers).storage(modifiers: modifiers) { storage.content["child"] = [childStorage] gtk_button_set_child(storage.pointer?.cast(), childStorage.pointer?.cast()) @@ -105,7 +105,8 @@ public struct Button: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { if let activate { storage.connectSignal(name: "activate") { activate() @@ -117,22 +118,22 @@ public struct Button: Widget { } } storage.modify { widget in - if let canShrink { + if let canShrink, updateProperties { gtk_button_set_can_shrink(widget?.cast(), canShrink.cBool) } if let widget = storage.content["child"]?.first { - child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } - if let hasFrame { + if let hasFrame, updateProperties { gtk_button_set_has_frame(widget?.cast(), hasFrame.cBool) } - if let iconName { + if let iconName, updateProperties { gtk_button_set_icon_name(widget?.cast(), iconName) } - if let label, storage.content["child"] == nil { + if let label, storage.content["child"] == nil, updateProperties { gtk_button_set_label(widget?.cast(), label) } - if let useUnderline { + if let useUnderline, updateProperties { gtk_button_set_use_underline(widget?.cast(), useUnderline.cBool) } diff --git a/Sources/Adwaita/View/Generated/ButtonContent.swift b/Sources/Adwaita/View/Generated/ButtonContent.swift index 35b3928..85c29ce 100644 --- a/Sources/Adwaita/View/Generated/ButtonContent.swift +++ b/Sources/Adwaita/View/Generated/ButtonContent.swift @@ -2,7 +2,7 @@ // ButtonContent.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -82,7 +82,7 @@ public struct ButtonContent: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(adw_button_content_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) for function in appearFunctions { @@ -95,18 +95,19 @@ public struct ButtonContent: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { storage.modify { widget in - if let canShrink { + if let canShrink, updateProperties { adw_button_content_set_can_shrink(widget, canShrink.cBool) } - if let iconName { + if let iconName, updateProperties { adw_button_content_set_icon_name(widget, iconName) } - if let label { + if let label, updateProperties { adw_button_content_set_label(widget, label) } - if let useUnderline { + if let useUnderline, updateProperties { adw_button_content_set_use_underline(widget, useUnderline.cBool) } diff --git a/Sources/Adwaita/View/Generated/Carousel.swift b/Sources/Adwaita/View/Generated/Carousel.swift index 978eece..f45f632 100644 --- a/Sources/Adwaita/View/Generated/Carousel.swift +++ b/Sources/Adwaita/View/Generated/Carousel.swift @@ -2,7 +2,7 @@ // Carousel.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -79,7 +79,7 @@ public struct Carousel: Widget where Element: Identifiable { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(adw_carousel_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) for function in appearFunctions { @@ -92,29 +92,30 @@ public struct Carousel: Widget where Element: Identifiable { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { if let pageChanged { storage.connectSignal(name: "page-changed") { pageChanged() } } storage.modify { widget in - if let allowLongSwipes { + if let allowLongSwipes, updateProperties { adw_carousel_set_allow_long_swipes(widget, allowLongSwipes.cBool) } - if let allowMouseDrag { + if let allowMouseDrag, updateProperties { adw_carousel_set_allow_mouse_drag(widget, allowMouseDrag.cBool) } - if let allowScrollWheel { + if let allowScrollWheel, updateProperties { adw_carousel_set_allow_scroll_wheel(widget, allowScrollWheel.cBool) } - if let interactive { + if let interactive, updateProperties { adw_carousel_set_interactive(widget, interactive.cBool) } - if let revealDuration { + if let revealDuration, updateProperties { adw_carousel_set_reveal_duration(widget, revealDuration.cInt) } - if let spacing { + if let spacing, updateProperties { adw_carousel_set_spacing(widget, spacing.cInt) } @@ -140,7 +141,7 @@ public struct Carousel: Widget where Element: Identifiable { storage.fields["element"] = elements storage.content[.mainContent] = contentStorage for (index, element) in elements.enumerated() { - content(element).widget(modifiers: modifiers).update(contentStorage[index], modifiers: modifiers) + content(element).widget(modifiers: modifiers).update(contentStorage[index], modifiers: modifiers, updateProperties: updateProperties) } } for function in updateFunctions { diff --git a/Sources/Adwaita/View/Generated/CenterBox.swift b/Sources/Adwaita/View/Generated/CenterBox.swift index 7055e4d..0c64edc 100644 --- a/Sources/Adwaita/View/Generated/CenterBox.swift +++ b/Sources/Adwaita/View/Generated/CenterBox.swift @@ -2,7 +2,7 @@ // CenterBox.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -86,7 +86,7 @@ public struct CenterBox: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(gtk_center_box_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) if let centerWidgetStorage = centerWidget?().widget(modifiers: modifiers).storage(modifiers: modifiers) { storage.content["centerWidget"] = [centerWidgetStorage] gtk_center_box_set_center_widget(storage.pointer, centerWidgetStorage.pointer?.cast()) @@ -111,19 +111,20 @@ public struct CenterBox: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { storage.modify { widget in if let widget = storage.content["centerWidget"]?.first { - centerWidget?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + centerWidget?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } if let widget = storage.content["endWidget"]?.first { - endWidget?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + endWidget?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } - if let shrinkCenterLast { + if let shrinkCenterLast, updateProperties { gtk_center_box_set_shrink_center_last(widget, shrinkCenterLast.cBool) } if let widget = storage.content["startWidget"]?.first { - startWidget?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + startWidget?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } diff --git a/Sources/Adwaita/View/Generated/CheckButton.swift b/Sources/Adwaita/View/Generated/CheckButton.swift index e8198b8..1f343c7 100644 --- a/Sources/Adwaita/View/Generated/CheckButton.swift +++ b/Sources/Adwaita/View/Generated/CheckButton.swift @@ -2,7 +2,7 @@ // CheckButton.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -117,7 +117,7 @@ public struct CheckButton: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(gtk_check_button_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) if let childStorage = child?().widget(modifiers: modifiers).storage(modifiers: modifiers) { storage.content["child"] = [childStorage] gtk_check_button_set_child(storage.pointer?.cast(), childStorage.pointer?.cast()) @@ -137,7 +137,8 @@ public struct CheckButton: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { if let activate { storage.connectSignal(name: "activate") { activate() @@ -149,19 +150,19 @@ public struct CheckButton: Widget { } } storage.modify { widget in - if let active { + if let active, updateProperties { gtk_check_button_set_active(widget?.cast(), active.wrappedValue.cBool) } if let widget = storage.content["child"]?.first { - child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } - if let inconsistent { + if let inconsistent, updateProperties { gtk_check_button_set_inconsistent(widget?.cast(), inconsistent.cBool) } - if let label, storage.content["child"] == nil { + if let label, storage.content["child"] == nil, updateProperties { gtk_check_button_set_label(widget?.cast(), label) } - if let useUnderline { + if let useUnderline, updateProperties { gtk_check_button_set_use_underline(widget?.cast(), useUnderline.cBool) } diff --git a/Sources/Adwaita/View/Generated/Clamp.swift b/Sources/Adwaita/View/Generated/Clamp.swift index ee0a6c2..a035dab 100644 --- a/Sources/Adwaita/View/Generated/Clamp.swift +++ b/Sources/Adwaita/View/Generated/Clamp.swift @@ -2,7 +2,7 @@ // Clamp.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -68,7 +68,7 @@ public struct Clamp: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(adw_clamp_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) if let childStorage = child?().widget(modifiers: modifiers).storage(modifiers: modifiers) { storage.content["child"] = [childStorage] adw_clamp_set_child(storage.pointer, childStorage.pointer?.cast()) @@ -85,15 +85,16 @@ public struct Clamp: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { storage.modify { widget in if let widget = storage.content["child"]?.first { - child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } - if let maximumSize { + if let maximumSize, updateProperties { adw_clamp_set_maximum_size(widget, maximumSize.cInt) } - if let tighteningThreshold { + if let tighteningThreshold, updateProperties { adw_clamp_set_tightening_threshold(widget, tighteningThreshold.cInt) } diff --git a/Sources/Adwaita/View/Generated/ComboRow.swift b/Sources/Adwaita/View/Generated/ComboRow.swift index 9c7804c..c602da8 100644 --- a/Sources/Adwaita/View/Generated/ComboRow.swift +++ b/Sources/Adwaita/View/Generated/ComboRow.swift @@ -2,7 +2,7 @@ // ComboRow.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -137,7 +137,7 @@ public struct ComboRow: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(adw_combo_row_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) if let activatableWidgetStorage = activatableWidget?().widget(modifiers: modifiers).storage(modifiers: modifiers) { storage.content["activatableWidget"] = [activatableWidgetStorage] adw_action_row_set_activatable_widget(storage.pointer?.cast(), activatableWidgetStorage.pointer?.cast()) @@ -169,50 +169,51 @@ public struct ComboRow: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { if let activated { storage.connectSignal(name: "activated") { activated() } } storage.modify { widget in - if let enableSearch { + if let enableSearch, updateProperties { adw_combo_row_set_enable_search(widget?.cast(), enableSearch.cBool) } - if let selected { + if let selected, updateProperties { adw_combo_row_set_selected(widget?.cast(), selected.wrappedValue.cInt) } - if let useSubtitle { + if let useSubtitle, updateProperties { adw_combo_row_set_use_subtitle(widget?.cast(), useSubtitle.cBool) } if let widget = storage.content["activatableWidget"]?.first { - activatableWidget?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + activatableWidget?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } - if let iconName { + if let iconName, updateProperties { adw_action_row_set_icon_name(widget?.cast(), iconName) } - if let subtitle { + if let subtitle, updateProperties { adw_action_row_set_subtitle(widget?.cast(), subtitle) } - if let subtitleLines { + if let subtitleLines, updateProperties { adw_action_row_set_subtitle_lines(widget?.cast(), subtitleLines.cInt) } - if let subtitleSelectable { + if let subtitleSelectable, updateProperties { adw_action_row_set_subtitle_selectable(widget?.cast(), subtitleSelectable.cBool) } - if let titleLines { + if let titleLines, updateProperties { adw_action_row_set_title_lines(widget?.cast(), titleLines.cInt) } - if let title { + if let title, updateProperties { adw_preferences_row_set_title(widget?.cast(), title) } - if let titleSelectable { + if let titleSelectable, updateProperties { adw_preferences_row_set_title_selectable(widget?.cast(), titleSelectable.cBool) } - if let useMarkup { + if let useMarkup, updateProperties { adw_preferences_row_set_use_markup(widget?.cast(), useMarkup.cBool) } - if let useUnderline { + if let useUnderline, updateProperties { adw_preferences_row_set_use_underline(widget?.cast(), useUnderline.cBool) } diff --git a/Sources/Adwaita/View/Generated/EntryRow.swift b/Sources/Adwaita/View/Generated/EntryRow.swift index ef2bf50..6730eaa 100644 --- a/Sources/Adwaita/View/Generated/EntryRow.swift +++ b/Sources/Adwaita/View/Generated/EntryRow.swift @@ -2,7 +2,7 @@ // EntryRow.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -103,7 +103,7 @@ public struct EntryRow: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(adw_entry_row_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) var suffixStorage: [ViewStorage] = [] for view in suffix() { @@ -128,7 +128,8 @@ public struct EntryRow: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { if let apply { storage.connectSignal(name: "apply") { apply() @@ -140,39 +141,47 @@ public struct EntryRow: Widget { } } storage.modify { widget in - if let activatesDefault { + if let activatesDefault, updateProperties { adw_entry_row_set_activates_default(widget?.cast(), activatesDefault.cBool) } - if let enableEmojiCompletion { + if let enableEmojiCompletion, updateProperties { adw_entry_row_set_enable_emoji_completion(widget?.cast(), enableEmojiCompletion.cBool) } - if let showApplyButton { + if let showApplyButton, updateProperties { adw_entry_row_set_show_apply_button(widget?.cast(), showApplyButton.cBool) } - if let title { + if let title, updateProperties { adw_preferences_row_set_title(widget?.cast(), title) } - if let titleSelectable { + if let titleSelectable, updateProperties { adw_preferences_row_set_title_selectable(widget?.cast(), titleSelectable.cBool) } - if let useMarkup { + if let useMarkup, updateProperties { adw_preferences_row_set_use_markup(widget?.cast(), useMarkup.cBool) } - if let useUnderline { + if let useUnderline, updateProperties { adw_preferences_row_set_use_underline(widget?.cast(), useUnderline.cBool) } if let suffixStorage = storage.content["suffix"] { for (index, view) in suffix().enumerated() { if let storage = suffixStorage[safe: index] { - view.updateStorage(storage, modifiers: modifiers) + view.updateStorage( + storage, + modifiers: modifiers, + updateProperties: updateProperties + ) } } } if let prefixStorage = storage.content["prefix"] { for (index, view) in prefix().enumerated() { if let storage = prefixStorage[safe: index] { - view.updateStorage(storage, modifiers: modifiers) + view.updateStorage( + storage, + modifiers: modifiers, + updateProperties: updateProperties + ) } } } diff --git a/Sources/Adwaita/View/Generated/ExpanderRow.swift b/Sources/Adwaita/View/Generated/ExpanderRow.swift index cb2450c..b0b7df1 100644 --- a/Sources/Adwaita/View/Generated/ExpanderRow.swift +++ b/Sources/Adwaita/View/Generated/ExpanderRow.swift @@ -2,7 +2,7 @@ // ExpanderRow.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -99,7 +99,7 @@ public struct ExpanderRow: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(adw_expander_row_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) var rowsStorage: [ViewStorage] = [] for view in rows() { @@ -136,60 +136,73 @@ public struct ExpanderRow: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { storage.modify { widget in - if let enableExpansion { + if let enableExpansion, updateProperties { adw_expander_row_set_enable_expansion(widget?.cast(), enableExpansion.wrappedValue.cBool) } - if let expanded { + if let expanded, updateProperties { adw_expander_row_set_expanded(widget?.cast(), expanded.wrappedValue.cBool) } - if let iconName { + if let iconName, updateProperties { adw_expander_row_set_icon_name(widget?.cast(), iconName) } - if let showEnableSwitch { + if let showEnableSwitch, updateProperties { adw_expander_row_set_show_enable_switch(widget?.cast(), showEnableSwitch.cBool) } - if let subtitle { + if let subtitle, updateProperties { adw_expander_row_set_subtitle(widget?.cast(), subtitle) } - if let subtitleLines { + if let subtitleLines, updateProperties { adw_expander_row_set_subtitle_lines(widget?.cast(), subtitleLines.cInt) } - if let titleLines { + if let titleLines, updateProperties { adw_expander_row_set_title_lines(widget?.cast(), titleLines.cInt) } - if let title { + if let title, updateProperties { adw_preferences_row_set_title(widget?.cast(), title) } - if let titleSelectable { + if let titleSelectable, updateProperties { adw_preferences_row_set_title_selectable(widget?.cast(), titleSelectable.cBool) } - if let useMarkup { + if let useMarkup, updateProperties { adw_preferences_row_set_use_markup(widget?.cast(), useMarkup.cBool) } - if let useUnderline { + if let useUnderline, updateProperties { adw_preferences_row_set_use_underline(widget?.cast(), useUnderline.cBool) } if let rowsStorage = storage.content["rows"] { for (index, view) in rows().enumerated() { if let storage = rowsStorage[safe: index] { - view.updateStorage(storage, modifiers: modifiers) + view.updateStorage( + storage, + modifiers: modifiers, + updateProperties: updateProperties + ) } } } if let suffixStorage = storage.content["suffix"] { for (index, view) in suffix().enumerated() { if let storage = suffixStorage[safe: index] { - view.updateStorage(storage, modifiers: modifiers) + view.updateStorage( + storage, + modifiers: modifiers, + updateProperties: updateProperties + ) } } } if let prefixStorage = storage.content["prefix"] { for (index, view) in prefix().enumerated() { if let storage = prefixStorage[safe: index] { - view.updateStorage(storage, modifiers: modifiers) + view.updateStorage( + storage, + modifiers: modifiers, + updateProperties: updateProperties + ) } } } diff --git a/Sources/Adwaita/View/Generated/HeaderBar.swift b/Sources/Adwaita/View/Generated/HeaderBar.swift index fc9e241..30181a3 100644 --- a/Sources/Adwaita/View/Generated/HeaderBar.swift +++ b/Sources/Adwaita/View/Generated/HeaderBar.swift @@ -2,7 +2,7 @@ // HeaderBar.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -156,7 +156,7 @@ public struct HeaderBar: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(adw_header_bar_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) if let titleWidgetStorage = titleWidget?().widget(modifiers: modifiers).storage(modifiers: modifiers) { storage.content["titleWidget"] = [titleWidgetStorage] adw_header_bar_set_title_widget(storage.pointer, titleWidgetStorage.pointer?.cast()) @@ -185,38 +185,47 @@ public struct HeaderBar: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { storage.modify { widget in - if let decorationLayout { + if let decorationLayout, updateProperties { adw_header_bar_set_decoration_layout(widget, decorationLayout) } - if let showBackButton { + if let showBackButton, updateProperties { adw_header_bar_set_show_back_button(widget, showBackButton.cBool) } - if let showEndTitleButtons { + if let showEndTitleButtons, updateProperties { adw_header_bar_set_show_end_title_buttons(widget, showEndTitleButtons.cBool) } - if let showStartTitleButtons { + if let showStartTitleButtons, updateProperties { adw_header_bar_set_show_start_title_buttons(widget, showStartTitleButtons.cBool) } - if let showTitle { + if let showTitle, updateProperties { adw_header_bar_set_show_title(widget, showTitle.cBool) } if let widget = storage.content["titleWidget"]?.first { - titleWidget?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + titleWidget?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } if let startStorage = storage.content["start"] { for (index, view) in start().enumerated() { if let storage = startStorage[safe: index] { - view.updateStorage(storage, modifiers: modifiers) + view.updateStorage( + storage, + modifiers: modifiers, + updateProperties: updateProperties + ) } } } if let endStorage = storage.content["end"] { for (index, view) in end().enumerated() { if let storage = endStorage[safe: index] { - view.updateStorage(storage, modifiers: modifiers) + view.updateStorage( + storage, + modifiers: modifiers, + updateProperties: updateProperties + ) } } } diff --git a/Sources/Adwaita/View/Generated/Label.swift b/Sources/Adwaita/View/Generated/Label.swift index 3d879a6..2e51c98 100644 --- a/Sources/Adwaita/View/Generated/Label.swift +++ b/Sources/Adwaita/View/Generated/Label.swift @@ -2,7 +2,7 @@ // Label.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -277,7 +277,7 @@ public struct Label: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(gtk_label_new(label)?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) if let mnemonicWidgetStorage = mnemonicWidget?().widget(modifiers: modifiers).storage(modifiers: modifiers) { storage.content["mnemonicWidget"] = [mnemonicWidgetStorage] gtk_label_set_mnemonic_widget(storage.pointer, mnemonicWidgetStorage.pointer?.cast()) @@ -294,45 +294,48 @@ public struct Label: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { if let copyClipboard { storage.connectSignal(name: "copy-clipboard") { copyClipboard() } } storage.modify { widget in - gtk_label_set_label(widget, label) - if let lines { + if updateProperties { + gtk_label_set_label(widget, label) + } + if let lines, updateProperties { gtk_label_set_lines(widget, lines.cInt) } - if let maxWidthChars { + if let maxWidthChars, updateProperties { gtk_label_set_max_width_chars(widget, maxWidthChars.cInt) } if let widget = storage.content["mnemonicWidget"]?.first { - mnemonicWidget?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + mnemonicWidget?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } - if let selectable { + if let selectable, updateProperties { gtk_label_set_selectable(widget, selectable.cBool) } - if let singleLineMode { + if let singleLineMode, updateProperties { gtk_label_set_single_line_mode(widget, singleLineMode.cBool) } - if let useMarkup { + if let useMarkup, updateProperties { gtk_label_set_use_markup(widget, useMarkup.cBool) } - if let useUnderline { + if let useUnderline, updateProperties { gtk_label_set_use_underline(widget, useUnderline.cBool) } - if let widthChars { + if let widthChars, updateProperties { gtk_label_set_width_chars(widget, widthChars.cInt) } - if let wrap { + if let wrap, updateProperties { gtk_label_set_wrap(widget, wrap.cBool) } - if let xalign { + if let xalign, updateProperties { gtk_label_set_xalign(widget, xalign) } - if let yalign { + if let yalign, updateProperties { gtk_label_set_yalign(widget, yalign) } diff --git a/Sources/Adwaita/View/Generated/LevelBar.swift b/Sources/Adwaita/View/Generated/LevelBar.swift index c01513d..77174d7 100644 --- a/Sources/Adwaita/View/Generated/LevelBar.swift +++ b/Sources/Adwaita/View/Generated/LevelBar.swift @@ -2,7 +2,7 @@ // LevelBar.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -146,7 +146,7 @@ public struct LevelBar: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(gtk_level_bar_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) for function in appearFunctions { @@ -159,23 +159,24 @@ public struct LevelBar: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { if let offsetChanged { storage.connectSignal(name: "offset-changed") { offsetChanged() } } storage.modify { widget in - if let inverted { + if let inverted, updateProperties { gtk_level_bar_set_inverted(widget, inverted.cBool) } - if let maxValue { + if let maxValue, updateProperties { gtk_level_bar_set_max_value(widget, maxValue) } - if let minValue { + if let minValue, updateProperties { gtk_level_bar_set_min_value(widget, minValue) } - if let value { + if let value, updateProperties { gtk_level_bar_set_value(widget, value) } diff --git a/Sources/Adwaita/View/Generated/LinkButton.swift b/Sources/Adwaita/View/Generated/LinkButton.swift index 3270ba2..51954e7 100644 --- a/Sources/Adwaita/View/Generated/LinkButton.swift +++ b/Sources/Adwaita/View/Generated/LinkButton.swift @@ -2,7 +2,7 @@ // LinkButton.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -91,7 +91,7 @@ public struct LinkButton: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(gtk_link_button_new(uri)?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) if let childStorage = child?().widget(modifiers: modifiers).storage(modifiers: modifiers) { storage.content["child"] = [childStorage] gtk_button_set_child(storage.pointer?.cast(), childStorage.pointer?.cast()) @@ -108,7 +108,8 @@ public struct LinkButton: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { if let activate { storage.connectSignal(name: "activate") { activate() @@ -120,26 +121,28 @@ public struct LinkButton: Widget { } } storage.modify { widget in - gtk_link_button_set_uri(widget, uri) - if let visited { + if updateProperties { + gtk_link_button_set_uri(widget, uri) + } + if let visited, updateProperties { gtk_link_button_set_visited(widget, visited.cBool) } - if let canShrink { + if let canShrink, updateProperties { gtk_button_set_can_shrink(widget?.cast(), canShrink.cBool) } if let widget = storage.content["child"]?.first { - child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } - if let hasFrame { + if let hasFrame, updateProperties { gtk_button_set_has_frame(widget?.cast(), hasFrame.cBool) } - if let iconName { + if let iconName, updateProperties { gtk_button_set_icon_name(widget?.cast(), iconName) } - if let label, storage.content["child"] == nil { + if let label, storage.content["child"] == nil, updateProperties { gtk_button_set_label(widget?.cast(), label) } - if let useUnderline { + if let useUnderline, updateProperties { gtk_button_set_use_underline(widget?.cast(), useUnderline.cBool) } diff --git a/Sources/Adwaita/View/Generated/ListBox.swift b/Sources/Adwaita/View/Generated/ListBox.swift index ecb6a83..654a81c 100644 --- a/Sources/Adwaita/View/Generated/ListBox.swift +++ b/Sources/Adwaita/View/Generated/ListBox.swift @@ -2,7 +2,7 @@ // ListBox.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -127,7 +127,7 @@ public struct ListBox: Widget where Element: Identifiable { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(gtk_list_box_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) for function in appearFunctions { @@ -140,7 +140,8 @@ public struct ListBox: Widget where Element: Identifiable { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { if let activateCursorRow { storage.connectSignal(name: "activate-cursor-row") { activateCursorRow() @@ -182,10 +183,10 @@ public struct ListBox: Widget where Element: Identifiable { } } storage.modify { widget in - if let activateOnSingleClick { + if let activateOnSingleClick, updateProperties { gtk_list_box_set_activate_on_single_click(widget, activateOnSingleClick.cBool) } - if let showSeparators { + if let showSeparators, updateProperties { gtk_list_box_set_show_separators(widget, showSeparators.cBool) } @@ -211,7 +212,7 @@ public struct ListBox: Widget where Element: Identifiable { storage.fields["element"] = elements storage.content[.mainContent] = contentStorage for (index, element) in elements.enumerated() { - content(element).widget(modifiers: modifiers).update(contentStorage[index], modifiers: modifiers) + content(element).widget(modifiers: modifiers).update(contentStorage[index], modifiers: modifiers, updateProperties: updateProperties) } } for function in updateFunctions { diff --git a/Sources/Adwaita/View/Generated/Menu.swift b/Sources/Adwaita/View/Generated/Menu.swift index 12cc597..6894eb5 100644 --- a/Sources/Adwaita/View/Generated/Menu.swift +++ b/Sources/Adwaita/View/Generated/Menu.swift @@ -2,7 +2,7 @@ // Menu.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -121,7 +121,7 @@ public struct Menu: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(gtk_menu_button_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) if let childStorage = child?().widget(modifiers: modifiers).storage(modifiers: modifiers) { storage.content["child"] = [childStorage] gtk_menu_button_set_child(storage.pointer, childStorage.pointer?.cast()) @@ -148,38 +148,39 @@ public struct Menu: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { if let activate { storage.connectSignal(name: "activate") { activate() } } storage.modify { widget in - if let active { + if let active, updateProperties { gtk_menu_button_set_active(widget, active.wrappedValue.cBool) } - if let alwaysShowArrow { + if let alwaysShowArrow, updateProperties { gtk_menu_button_set_always_show_arrow(widget, alwaysShowArrow.cBool) } - if let canShrink { + if let canShrink, updateProperties { gtk_menu_button_set_can_shrink(widget, canShrink.cBool) } if let widget = storage.content["child"]?.first { - child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } - if let hasFrame { + if let hasFrame, updateProperties { gtk_menu_button_set_has_frame(widget, hasFrame.cBool) } - if let iconName { + if let iconName, updateProperties { gtk_menu_button_set_icon_name(widget, iconName) } - if let label, storage.content["child"] == nil { + if let label, storage.content["child"] == nil, updateProperties { gtk_menu_button_set_label(widget, label) } - if let primary { + if let primary, updateProperties { gtk_menu_button_set_primary(widget, primary.cBool) } - if let useUnderline { + if let useUnderline, updateProperties { gtk_menu_button_set_use_underline(widget, useUnderline.cBool) } diff --git a/Sources/Adwaita/View/Generated/Overlay.swift b/Sources/Adwaita/View/Generated/Overlay.swift index a6ed828..6792e1c 100644 --- a/Sources/Adwaita/View/Generated/Overlay.swift +++ b/Sources/Adwaita/View/Generated/Overlay.swift @@ -2,7 +2,7 @@ // Overlay.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -80,7 +80,7 @@ public struct Overlay: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(gtk_overlay_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) if let childStorage = child?().widget(modifiers: modifiers).storage(modifiers: modifiers) { storage.content["child"] = [childStorage] gtk_overlay_set_child(storage.pointer, childStorage.pointer?.cast()) @@ -103,7 +103,8 @@ public struct Overlay: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { if let getChildPosition { storage.connectSignal(name: "get-child-position") { getChildPosition() @@ -111,13 +112,17 @@ public struct Overlay: Widget { } storage.modify { widget in if let widget = storage.content["child"]?.first { - child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } if let overlayStorage = storage.content["overlay"] { for (index, view) in overlay().enumerated() { if let storage = overlayStorage[safe: index] { - view.updateStorage(storage, modifiers: modifiers) + view.updateStorage( + storage, + modifiers: modifiers, + updateProperties: updateProperties + ) } } } diff --git a/Sources/Adwaita/View/Generated/OverlaySplitView.swift b/Sources/Adwaita/View/Generated/OverlaySplitView.swift index 8ec0a8a..663855f 100644 --- a/Sources/Adwaita/View/Generated/OverlaySplitView.swift +++ b/Sources/Adwaita/View/Generated/OverlaySplitView.swift @@ -2,7 +2,7 @@ // OverlaySplitView.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -184,7 +184,7 @@ public struct OverlaySplitView: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(adw_overlay_split_view_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) if let contentStorage = content?().widget(modifiers: modifiers).storage(modifiers: modifiers) { storage.content["content"] = [contentStorage] adw_overlay_split_view_set_content(storage.pointer, contentStorage.pointer?.cast()) @@ -208,36 +208,37 @@ public struct OverlaySplitView: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { storage.modify { widget in - if let collapsed { + if let collapsed, updateProperties { adw_overlay_split_view_set_collapsed(widget, collapsed.cBool) } if let widget = storage.content["content"]?.first { - content?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + content?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } - if let enableHideGesture { + if let enableHideGesture, updateProperties { adw_overlay_split_view_set_enable_hide_gesture(widget, enableHideGesture.cBool) } - if let enableShowGesture { + if let enableShowGesture, updateProperties { adw_overlay_split_view_set_enable_show_gesture(widget, enableShowGesture.cBool) } - if let maxSidebarWidth { + if let maxSidebarWidth, updateProperties { adw_overlay_split_view_set_max_sidebar_width(widget, maxSidebarWidth) } - if let minSidebarWidth { + if let minSidebarWidth, updateProperties { adw_overlay_split_view_set_min_sidebar_width(widget, minSidebarWidth) } - if let pinSidebar { + if let pinSidebar, updateProperties { adw_overlay_split_view_set_pin_sidebar(widget, pinSidebar.cBool) } - if let showSidebar { + if let showSidebar, updateProperties { adw_overlay_split_view_set_show_sidebar(widget, showSidebar.wrappedValue.cBool) } if let widget = storage.content["sidebar"]?.first { - sidebar?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + sidebar?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } - if let sidebarWidthFraction { + if let sidebarWidthFraction, updateProperties { adw_overlay_split_view_set_sidebar_width_fraction(widget, sidebarWidthFraction) } diff --git a/Sources/Adwaita/View/Generated/PasswordEntryRow.swift b/Sources/Adwaita/View/Generated/PasswordEntryRow.swift index ce96051..28a6868 100644 --- a/Sources/Adwaita/View/Generated/PasswordEntryRow.swift +++ b/Sources/Adwaita/View/Generated/PasswordEntryRow.swift @@ -2,7 +2,7 @@ // PasswordEntryRow.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -88,7 +88,7 @@ public struct PasswordEntryRow: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(adw_password_entry_row_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) var suffixStorage: [ViewStorage] = [] for view in suffix() { @@ -113,7 +113,8 @@ public struct PasswordEntryRow: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { if let apply { storage.connectSignal(name: "apply") { apply() @@ -125,25 +126,25 @@ public struct PasswordEntryRow: Widget { } } storage.modify { widget in - if let activatesDefault { + if let activatesDefault, updateProperties { adw_entry_row_set_activates_default(widget?.cast(), activatesDefault.cBool) } - if let enableEmojiCompletion { + if let enableEmojiCompletion, updateProperties { adw_entry_row_set_enable_emoji_completion(widget?.cast(), enableEmojiCompletion.cBool) } - if let showApplyButton { + if let showApplyButton, updateProperties { adw_entry_row_set_show_apply_button(widget?.cast(), showApplyButton.cBool) } - if let title { + if let title, updateProperties { adw_preferences_row_set_title(widget?.cast(), title) } - if let titleSelectable { + if let titleSelectable, updateProperties { adw_preferences_row_set_title_selectable(widget?.cast(), titleSelectable.cBool) } - if let useMarkup { + if let useMarkup, updateProperties { adw_preferences_row_set_use_markup(widget?.cast(), useMarkup.cBool) } - if let useUnderline { + if let useUnderline, updateProperties { adw_preferences_row_set_use_underline(widget?.cast(), useUnderline.cBool) } diff --git a/Sources/Adwaita/View/Generated/PreferencesGroup.swift b/Sources/Adwaita/View/Generated/PreferencesGroup.swift index 0f50d71..86b4ec7 100644 --- a/Sources/Adwaita/View/Generated/PreferencesGroup.swift +++ b/Sources/Adwaita/View/Generated/PreferencesGroup.swift @@ -2,7 +2,7 @@ // PreferencesGroup.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -70,7 +70,7 @@ public struct PreferencesGroup: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(adw_preferences_group_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) if let headerSuffixStorage = headerSuffix?().widget(modifiers: modifiers).storage(modifiers: modifiers) { storage.content["headerSuffix"] = [headerSuffixStorage] adw_preferences_group_set_header_suffix(storage.pointer?.cast(), headerSuffixStorage.pointer?.cast()) @@ -93,22 +93,27 @@ public struct PreferencesGroup: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { storage.modify { widget in - if let description { + if let description, updateProperties { adw_preferences_group_set_description(widget?.cast(), description) } if let widget = storage.content["headerSuffix"]?.first { - headerSuffix?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + headerSuffix?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } - if let title { + if let title, updateProperties { adw_preferences_group_set_title(widget?.cast(), title) } if let childStorage = storage.content["child"] { for (index, view) in child().enumerated() { if let storage = childStorage[safe: index] { - view.updateStorage(storage, modifiers: modifiers) + view.updateStorage( + storage, + modifiers: modifiers, + updateProperties: updateProperties + ) } } } diff --git a/Sources/Adwaita/View/Generated/PreferencesPage.swift b/Sources/Adwaita/View/Generated/PreferencesPage.swift index aa9a174..b4366fa 100644 --- a/Sources/Adwaita/View/Generated/PreferencesPage.swift +++ b/Sources/Adwaita/View/Generated/PreferencesPage.swift @@ -2,7 +2,7 @@ // PreferencesPage.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -55,7 +55,7 @@ public struct PreferencesPage: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(adw_preferences_page_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) var childStorage: [ViewStorage] = [] for view in child() { @@ -74,28 +74,33 @@ public struct PreferencesPage: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { storage.modify { widget in - if let description { + if let description, updateProperties { adw_preferences_page_set_description(widget?.cast(), description) } - if let iconName { + if let iconName, updateProperties { adw_preferences_page_set_icon_name(widget?.cast(), iconName) } - if let name { + if let name, updateProperties { adw_preferences_page_set_name(widget?.cast(), name) } - if let title { + if let title, updateProperties { adw_preferences_page_set_title(widget?.cast(), title) } - if let useUnderline { + if let useUnderline, updateProperties { adw_preferences_page_set_use_underline(widget?.cast(), useUnderline.cBool) } if let childStorage = storage.content["child"] { for (index, view) in child().enumerated() { if let storage = childStorage[safe: index] { - view.updateStorage(storage, modifiers: modifiers) + view.updateStorage( + storage, + modifiers: modifiers, + updateProperties: updateProperties + ) } } } diff --git a/Sources/Adwaita/View/Generated/PreferencesRow.swift b/Sources/Adwaita/View/Generated/PreferencesRow.swift index 922d954..4579d54 100644 --- a/Sources/Adwaita/View/Generated/PreferencesRow.swift +++ b/Sources/Adwaita/View/Generated/PreferencesRow.swift @@ -2,7 +2,7 @@ // PreferencesRow.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -55,7 +55,7 @@ public struct PreferencesRow: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(adw_preferences_row_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) for function in appearFunctions { @@ -68,18 +68,19 @@ public struct PreferencesRow: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { storage.modify { widget in - if let title { + if let title, updateProperties { adw_preferences_row_set_title(widget?.cast(), title) } - if let titleSelectable { + if let titleSelectable, updateProperties { adw_preferences_row_set_title_selectable(widget?.cast(), titleSelectable.cBool) } - if let useMarkup { + if let useMarkup, updateProperties { adw_preferences_row_set_use_markup(widget?.cast(), useMarkup.cBool) } - if let useUnderline { + if let useUnderline, updateProperties { adw_preferences_row_set_use_underline(widget?.cast(), useUnderline.cBool) } diff --git a/Sources/Adwaita/View/Generated/ProgressBar.swift b/Sources/Adwaita/View/Generated/ProgressBar.swift index 4d86290..9390de4 100644 --- a/Sources/Adwaita/View/Generated/ProgressBar.swift +++ b/Sources/Adwaita/View/Generated/ProgressBar.swift @@ -2,7 +2,7 @@ // ProgressBar.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -94,7 +94,7 @@ public struct ProgressBar: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(gtk_progress_bar_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) for function in appearFunctions { @@ -107,21 +107,22 @@ public struct ProgressBar: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { storage.modify { widget in - if let fraction { + if let fraction, updateProperties { gtk_progress_bar_set_fraction(widget, fraction) } - if let inverted { + if let inverted, updateProperties { gtk_progress_bar_set_inverted(widget, inverted.cBool) } - if let pulseStep { + if let pulseStep, updateProperties { gtk_progress_bar_set_pulse_step(widget, pulseStep) } - if let showText { + if let showText, updateProperties { gtk_progress_bar_set_show_text(widget, showText.cBool) } - if let text { + if let text, updateProperties { gtk_progress_bar_set_text(widget, text) } diff --git a/Sources/Adwaita/View/Generated/ScrolledWindow.swift b/Sources/Adwaita/View/Generated/ScrolledWindow.swift index 31f0079..efd5b43 100644 --- a/Sources/Adwaita/View/Generated/ScrolledWindow.swift +++ b/Sources/Adwaita/View/Generated/ScrolledWindow.swift @@ -2,7 +2,7 @@ // ScrolledWindow.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -170,7 +170,7 @@ public struct ScrolledWindow: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(gtk_scrolled_window_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) if let childStorage = child?().widget(modifiers: modifiers).storage(modifiers: modifiers) { storage.content["child"] = [childStorage] gtk_scrolled_window_set_child(storage.pointer, childStorage.pointer?.cast()) @@ -187,7 +187,8 @@ public struct ScrolledWindow: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { if let edgeOvershot { storage.connectSignal(name: "edge-overshot") { edgeOvershot() @@ -210,33 +211,33 @@ public struct ScrolledWindow: Widget { } storage.modify { widget in if let widget = storage.content["child"]?.first { - child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } - if let hasFrame { + if let hasFrame, updateProperties { gtk_scrolled_window_set_has_frame(widget, hasFrame.cBool) } - if let kineticScrolling { + if let kineticScrolling, updateProperties { gtk_scrolled_window_set_kinetic_scrolling(widget, kineticScrolling.cBool) } - if let maxContentHeight { + if let maxContentHeight, updateProperties { gtk_scrolled_window_set_max_content_height(widget, maxContentHeight.cInt) } - if let maxContentWidth { + if let maxContentWidth, updateProperties { gtk_scrolled_window_set_max_content_width(widget, maxContentWidth.cInt) } - if let minContentHeight { + if let minContentHeight, updateProperties { gtk_scrolled_window_set_min_content_height(widget, minContentHeight.cInt) } - if let minContentWidth { + if let minContentWidth, updateProperties { gtk_scrolled_window_set_min_content_width(widget, minContentWidth.cInt) } - if let overlayScrolling { + if let overlayScrolling, updateProperties { gtk_scrolled_window_set_overlay_scrolling(widget, overlayScrolling.cBool) } - if let propagateNaturalHeight { + if let propagateNaturalHeight, updateProperties { gtk_scrolled_window_set_propagate_natural_height(widget, propagateNaturalHeight.cBool) } - if let propagateNaturalWidth { + if let propagateNaturalWidth, updateProperties { gtk_scrolled_window_set_propagate_natural_width(widget, propagateNaturalWidth.cBool) } diff --git a/Sources/Adwaita/View/Generated/SpinRow.swift b/Sources/Adwaita/View/Generated/SpinRow.swift index f12db34..f8004d1 100644 --- a/Sources/Adwaita/View/Generated/SpinRow.swift +++ b/Sources/Adwaita/View/Generated/SpinRow.swift @@ -2,7 +2,7 @@ // SpinRow.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -129,7 +129,7 @@ public struct SpinRow: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(adw_spin_row_new(nil, climbRate, digits.cInt)?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) if let activatableWidgetStorage = activatableWidget?().widget(modifiers: modifiers).storage(modifiers: modifiers) { storage.content["activatableWidget"] = [activatableWidgetStorage] adw_action_row_set_activatable_widget(storage.pointer?.cast(), activatableWidgetStorage.pointer?.cast()) @@ -161,7 +161,8 @@ public struct SpinRow: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { if let input { storage.connectSignal(name: "input") { input() @@ -183,48 +184,52 @@ public struct SpinRow: Widget { } } storage.modify { widget in - adw_spin_row_set_climb_rate(widget, climbRate) - adw_spin_row_set_digits(widget, digits.cInt) - if let numeric { + if updateProperties { + adw_spin_row_set_climb_rate(widget, climbRate) + } + if updateProperties { + adw_spin_row_set_digits(widget, digits.cInt) + } + if let numeric, updateProperties { adw_spin_row_set_numeric(widget, numeric.cBool) } - if let snapToTicks { + if let snapToTicks, updateProperties { adw_spin_row_set_snap_to_ticks(widget, snapToTicks.cBool) } - if let value { + if let value, updateProperties { adw_spin_row_set_value(widget, value.wrappedValue) } - if let wrap { + if let wrap, updateProperties { adw_spin_row_set_wrap(widget, wrap.cBool) } if let widget = storage.content["activatableWidget"]?.first { - activatableWidget?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + activatableWidget?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } - if let iconName { + if let iconName, updateProperties { adw_action_row_set_icon_name(widget?.cast(), iconName) } - if let subtitle { + if let subtitle, updateProperties { adw_action_row_set_subtitle(widget?.cast(), subtitle) } - if let subtitleLines { + if let subtitleLines, updateProperties { adw_action_row_set_subtitle_lines(widget?.cast(), subtitleLines.cInt) } - if let subtitleSelectable { + if let subtitleSelectable, updateProperties { adw_action_row_set_subtitle_selectable(widget?.cast(), subtitleSelectable.cBool) } - if let titleLines { + if let titleLines, updateProperties { adw_action_row_set_title_lines(widget?.cast(), titleLines.cInt) } - if let title { + if let title, updateProperties { adw_preferences_row_set_title(widget?.cast(), title) } - if let titleSelectable { + if let titleSelectable, updateProperties { adw_preferences_row_set_title_selectable(widget?.cast(), titleSelectable.cBool) } - if let useMarkup { + if let useMarkup, updateProperties { adw_preferences_row_set_use_markup(widget?.cast(), useMarkup.cBool) } - if let useUnderline { + if let useUnderline, updateProperties { adw_preferences_row_set_use_underline(widget?.cast(), useUnderline.cBool) } diff --git a/Sources/Adwaita/View/Generated/Spinner.swift b/Sources/Adwaita/View/Generated/Spinner.swift index 5db7f8c..ff8ece3 100644 --- a/Sources/Adwaita/View/Generated/Spinner.swift +++ b/Sources/Adwaita/View/Generated/Spinner.swift @@ -2,7 +2,7 @@ // Spinner.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -46,7 +46,7 @@ public struct Spinner: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(gtk_spinner_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) for function in appearFunctions { @@ -59,9 +59,10 @@ public struct Spinner: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { storage.modify { widget in - if let spinning { + if let spinning, updateProperties { gtk_spinner_set_spinning(widget, spinning.cBool) } diff --git a/Sources/Adwaita/View/Generated/SplitButton.swift b/Sources/Adwaita/View/Generated/SplitButton.swift index 71228e7..9e29565 100644 --- a/Sources/Adwaita/View/Generated/SplitButton.swift +++ b/Sources/Adwaita/View/Generated/SplitButton.swift @@ -2,7 +2,7 @@ // SplitButton.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -109,7 +109,7 @@ public struct SplitButton: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(adw_split_button_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) if let childStorage = child?().widget(modifiers: modifiers).storage(modifiers: modifiers) { storage.content["child"] = [childStorage] adw_split_button_set_child(storage.pointer, childStorage.pointer?.cast()) @@ -133,7 +133,8 @@ public struct SplitButton: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { if let activate { storage.connectSignal(name: "activate") { activate() @@ -145,22 +146,22 @@ public struct SplitButton: Widget { } } storage.modify { widget in - if let canShrink { + if let canShrink, updateProperties { adw_split_button_set_can_shrink(widget, canShrink.cBool) } if let widget = storage.content["child"]?.first { - child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } - if let dropdownTooltip { + if let dropdownTooltip, updateProperties { adw_split_button_set_dropdown_tooltip(widget, dropdownTooltip) } - if let iconName { + if let iconName, updateProperties { adw_split_button_set_icon_name(widget, iconName) } - if let label, storage.content["child"] == nil { + if let label, storage.content["child"] == nil, updateProperties { adw_split_button_set_label(widget, label) } - if let useUnderline { + if let useUnderline, updateProperties { adw_split_button_set_use_underline(widget, useUnderline.cBool) } diff --git a/Sources/Adwaita/View/Generated/StatusPage.swift b/Sources/Adwaita/View/Generated/StatusPage.swift index 2c15b34..d1c9fbe 100644 --- a/Sources/Adwaita/View/Generated/StatusPage.swift +++ b/Sources/Adwaita/View/Generated/StatusPage.swift @@ -2,7 +2,7 @@ // StatusPage.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -55,7 +55,7 @@ public struct StatusPage: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(adw_status_page_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) if let childStorage = child?().widget(modifiers: modifiers).storage(modifiers: modifiers) { storage.content["child"] = [childStorage] adw_status_page_set_child(storage.pointer, childStorage.pointer?.cast()) @@ -72,18 +72,19 @@ public struct StatusPage: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { storage.modify { widget in if let widget = storage.content["child"]?.first { - child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } - if let description { + if let description, updateProperties { adw_status_page_set_description(widget, description) } - if let iconName { + if let iconName, updateProperties { adw_status_page_set_icon_name(widget, iconName) } - if let title { + if let title, updateProperties { adw_status_page_set_title(widget, title) } diff --git a/Sources/Adwaita/View/Generated/SwitchRow.swift b/Sources/Adwaita/View/Generated/SwitchRow.swift index e5f5a7f..44d6fdc 100644 --- a/Sources/Adwaita/View/Generated/SwitchRow.swift +++ b/Sources/Adwaita/View/Generated/SwitchRow.swift @@ -2,7 +2,7 @@ // SwitchRow.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -104,7 +104,7 @@ public struct SwitchRow: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(adw_switch_row_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) if let activatableWidgetStorage = activatableWidget?().widget(modifiers: modifiers).storage(modifiers: modifiers) { storage.content["activatableWidget"] = [activatableWidgetStorage] adw_action_row_set_activatable_widget(storage.pointer?.cast(), activatableWidgetStorage.pointer?.cast()) @@ -136,44 +136,45 @@ public struct SwitchRow: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { if let activated { storage.connectSignal(name: "activated") { activated() } } storage.modify { widget in - if let active { + if let active, updateProperties { adw_switch_row_set_active(widget, active.wrappedValue.cBool) } if let widget = storage.content["activatableWidget"]?.first { - activatableWidget?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + activatableWidget?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } - if let iconName { + if let iconName, updateProperties { adw_action_row_set_icon_name(widget?.cast(), iconName) } - if let subtitle { + if let subtitle, updateProperties { adw_action_row_set_subtitle(widget?.cast(), subtitle) } - if let subtitleLines { + if let subtitleLines, updateProperties { adw_action_row_set_subtitle_lines(widget?.cast(), subtitleLines.cInt) } - if let subtitleSelectable { + if let subtitleSelectable, updateProperties { adw_action_row_set_subtitle_selectable(widget?.cast(), subtitleSelectable.cBool) } - if let titleLines { + if let titleLines, updateProperties { adw_action_row_set_title_lines(widget?.cast(), titleLines.cInt) } - if let title { + if let title, updateProperties { adw_preferences_row_set_title(widget?.cast(), title) } - if let titleSelectable { + if let titleSelectable, updateProperties { adw_preferences_row_set_title_selectable(widget?.cast(), titleSelectable.cBool) } - if let useMarkup { + if let useMarkup, updateProperties { adw_preferences_row_set_use_markup(widget?.cast(), useMarkup.cBool) } - if let useUnderline { + if let useUnderline, updateProperties { adw_preferences_row_set_use_underline(widget?.cast(), useUnderline.cBool) } diff --git a/Sources/Adwaita/View/Generated/ToastOverlay.swift b/Sources/Adwaita/View/Generated/ToastOverlay.swift index 6605666..1da61e1 100644 --- a/Sources/Adwaita/View/Generated/ToastOverlay.swift +++ b/Sources/Adwaita/View/Generated/ToastOverlay.swift @@ -2,7 +2,7 @@ // ToastOverlay.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -67,7 +67,7 @@ public struct ToastOverlay: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(adw_toast_overlay_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) if let childStorage = child?().widget(modifiers: modifiers).storage(modifiers: modifiers) { storage.content["child"] = [childStorage] adw_toast_overlay_set_child(storage.pointer, childStorage.pointer?.cast()) @@ -84,10 +84,11 @@ public struct ToastOverlay: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { storage.modify { widget in if let widget = storage.content["child"]?.first { - child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } diff --git a/Sources/Adwaita/View/Generated/ToggleButton.swift b/Sources/Adwaita/View/Generated/ToggleButton.swift index 8b9b95f..2747a77 100644 --- a/Sources/Adwaita/View/Generated/ToggleButton.swift +++ b/Sources/Adwaita/View/Generated/ToggleButton.swift @@ -2,7 +2,7 @@ // ToggleButton.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -137,7 +137,7 @@ public struct ToggleButton: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(gtk_toggle_button_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) if let childStorage = child?().widget(modifiers: modifiers).storage(modifiers: modifiers) { storage.content["child"] = [childStorage] gtk_button_set_child(storage.pointer?.cast(), childStorage.pointer?.cast()) @@ -157,7 +157,8 @@ public struct ToggleButton: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { if let toggled { storage.connectSignal(name: "toggled") { toggled() @@ -174,25 +175,25 @@ public struct ToggleButton: Widget { } } storage.modify { widget in - if let active { + if let active, updateProperties { gtk_toggle_button_set_active(widget?.cast(), active.wrappedValue.cBool) } - if let canShrink { + if let canShrink, updateProperties { gtk_button_set_can_shrink(widget?.cast(), canShrink.cBool) } if let widget = storage.content["child"]?.first { - child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + child?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } - if let hasFrame { + if let hasFrame, updateProperties { gtk_button_set_has_frame(widget?.cast(), hasFrame.cBool) } - if let iconName { + if let iconName, updateProperties { gtk_button_set_icon_name(widget?.cast(), iconName) } - if let label, storage.content["child"] == nil { + if let label, storage.content["child"] == nil, updateProperties { gtk_button_set_label(widget?.cast(), label) } - if let useUnderline { + if let useUnderline, updateProperties { gtk_button_set_use_underline(widget?.cast(), useUnderline.cBool) } diff --git a/Sources/Adwaita/View/Generated/ToolbarView.swift b/Sources/Adwaita/View/Generated/ToolbarView.swift index 41cc162..5fd6abd 100644 --- a/Sources/Adwaita/View/Generated/ToolbarView.swift +++ b/Sources/Adwaita/View/Generated/ToolbarView.swift @@ -2,7 +2,7 @@ // ToolbarView.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -152,7 +152,7 @@ public struct ToolbarView: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(adw_toolbar_view_new()?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) if let contentStorage = content?().widget(modifiers: modifiers).storage(modifiers: modifiers) { storage.content["content"] = [contentStorage] adw_toolbar_view_set_content(storage.pointer, contentStorage.pointer?.cast()) @@ -181,35 +181,44 @@ public struct ToolbarView: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { storage.modify { widget in if let widget = storage.content["content"]?.first { - content?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + content?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } - if let extendContentToBottomEdge { + if let extendContentToBottomEdge, updateProperties { adw_toolbar_view_set_extend_content_to_bottom_edge(widget, extendContentToBottomEdge.cBool) } - if let extendContentToTopEdge { + if let extendContentToTopEdge, updateProperties { adw_toolbar_view_set_extend_content_to_top_edge(widget, extendContentToTopEdge.cBool) } - if let revealBottomBars { + if let revealBottomBars, updateProperties { adw_toolbar_view_set_reveal_bottom_bars(widget, revealBottomBars.cBool) } - if let revealTopBars { + if let revealTopBars, updateProperties { adw_toolbar_view_set_reveal_top_bars(widget, revealTopBars.cBool) } if let bottomStorage = storage.content["bottom"] { for (index, view) in bottom().enumerated() { if let storage = bottomStorage[safe: index] { - view.updateStorage(storage, modifiers: modifiers) + view.updateStorage( + storage, + modifiers: modifiers, + updateProperties: updateProperties + ) } } } if let topStorage = storage.content["top"] { for (index, view) in top().enumerated() { if let storage = topStorage[safe: index] { - view.updateStorage(storage, modifiers: modifiers) + view.updateStorage( + storage, + modifiers: modifiers, + updateProperties: updateProperties + ) } } } diff --git a/Sources/Adwaita/View/Generated/WindowTitle.swift b/Sources/Adwaita/View/Generated/WindowTitle.swift index c2833d8..2c084df 100644 --- a/Sources/Adwaita/View/Generated/WindowTitle.swift +++ b/Sources/Adwaita/View/Generated/WindowTitle.swift @@ -2,7 +2,7 @@ // WindowTitle.swift // Adwaita // -// Created by auto-generation on 22.01.24. +// Created by auto-generation on 27.01.24. // import CAdw @@ -50,7 +50,7 @@ public struct WindowTitle: Widget { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(adw_window_title_new(title, subtitle)?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) for function in appearFunctions { @@ -63,10 +63,15 @@ public struct WindowTitle: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { storage.modify { widget in - adw_window_title_set_subtitle(widget, subtitle) - adw_window_title_set_title(widget, title) + if updateProperties { + adw_window_title_set_subtitle(widget, subtitle) + } + if updateProperties { + adw_window_title_set_title(widget, title) + } } diff --git a/Sources/Adwaita/View/Modifiers/AppearObserver.swift b/Sources/Adwaita/View/Modifiers/AppearObserver.swift index a9569e4..3cb4332 100644 --- a/Sources/Adwaita/View/Modifiers/AppearObserver.swift +++ b/Sources/Adwaita/View/Modifiers/AppearObserver.swift @@ -28,8 +28,9 @@ struct AppearObserver: Widget { /// - Parameters: /// - storage: The content's storage. /// - modifiers: Modify views before being updated. - func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { - content.updateStorage(storage, modifiers: modifiers) + /// - updateProperties: Whether to update properties. + func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { + content.updateStorage(storage, modifiers: modifiers, updateProperties: updateProperties) } } diff --git a/Sources/Adwaita/View/Modifiers/ContentModifier.swift b/Sources/Adwaita/View/Modifiers/ContentModifier.swift index 8614ff3..2214ccc 100644 --- a/Sources/Adwaita/View/Modifiers/ContentModifier.swift +++ b/Sources/Adwaita/View/Modifiers/ContentModifier.swift @@ -25,8 +25,9 @@ struct ContentModifier: Widget where Content: View { /// - Parameters: /// - storage: The content's storage. /// - modifiers: Modify views before being updated. - func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { - content.updateStorage(storage, modifiers: modifiers + [modifyView]) + /// - updateProperties: Whether to update properties. + func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { + content.updateStorage(storage, modifiers: modifiers + [modifyView], updateProperties: updateProperties) } /// Apply the modifier to a view. diff --git a/Sources/Adwaita/View/Modifiers/InspectorWrapper.swift b/Sources/Adwaita/View/Modifiers/InspectorWrapper.swift index 41ad057..ab15af6 100644 --- a/Sources/Adwaita/View/Modifiers/InspectorWrapper.swift +++ b/Sources/Adwaita/View/Modifiers/InspectorWrapper.swift @@ -28,8 +28,9 @@ struct InspectorWrapper: Widget { /// - Parameters: /// - storage: The content's storage. /// - modifiers: Modify views before being updated. - func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { - content.updateStorage(storage, modifiers: modifiers) + /// - updateProperties: Whether to update properties. + func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { + content.updateStorage(storage, modifiers: modifiers, updateProperties: updateProperties) modify(storage) } diff --git a/Sources/Adwaita/View/Modifiers/ModifierStopper.swift b/Sources/Adwaita/View/Modifiers/ModifierStopper.swift index c4b8c26..23a24de 100644 --- a/Sources/Adwaita/View/Modifiers/ModifierStopper.swift +++ b/Sources/Adwaita/View/Modifiers/ModifierStopper.swift @@ -23,8 +23,9 @@ struct ModifierStopper: Widget { /// - Parameters: /// - storage: The content's storage. /// - modifiers: Modify views before being updated. - func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { - content.updateStorage(storage, modifiers: []) + /// - updateProperties: Whether to update properties. + func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { + content.updateStorage(storage, modifiers: [], updateProperties: updateProperties) } } diff --git a/Sources/Adwaita/View/NavigationSplitView.swift b/Sources/Adwaita/View/NavigationSplitView.swift index a3f2016..6747f6c 100644 --- a/Sources/Adwaita/View/NavigationSplitView.swift +++ b/Sources/Adwaita/View/NavigationSplitView.swift @@ -55,12 +55,17 @@ public struct NavigationSplitView: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: Modify views before being updated. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { if let storage = storage.content[contentID]?[safe: 0] { - content().widget(modifiers: modifiers).update(storage, modifiers: modifiers) + content() + .widget(modifiers: modifiers) + .update(storage, modifiers: modifiers, updateProperties: updateProperties) } if let storage = storage.content[sidebarID]?[safe: 0] { - sidebar().widget(modifiers: modifiers).update(storage, modifiers: modifiers) + sidebar() + .widget(modifiers: modifiers) + .update(storage, modifiers: modifiers, updateProperties: updateProperties) } } diff --git a/Sources/Adwaita/View/StateWrapper.swift b/Sources/Adwaita/View/StateWrapper.swift index 317d011..81e0000 100644 --- a/Sources/Adwaita/View/StateWrapper.swift +++ b/Sources/Adwaita/View/StateWrapper.swift @@ -32,14 +32,22 @@ public struct StateWrapper: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: Modify views before being updated. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { + var updateProperties = updateProperties for property in state { if let storage = storage.state[property.key]?.content.storage { property.value.content.storage = storage } + if property.value.content.storage.update { + updateProperties = true + property.value.content.storage.update = false + } } if let storage = storage.content[.mainContent]?.first { - content().widget(modifiers: modifiers).update(storage, modifiers: modifiers) + content() + .widget(modifiers: modifiers) + .update(storage, modifiers: modifiers, updateProperties: updateProperties) } } diff --git a/Sources/Adwaita/View/ViewStack.swift b/Sources/Adwaita/View/ViewStack.swift index 2abdebc..56d9cdc 100644 --- a/Sources/Adwaita/View/ViewStack.swift +++ b/Sources/Adwaita/View/ViewStack.swift @@ -45,7 +45,7 @@ public struct ViewStack: Widget { public func container(modifiers: [(View) -> View]) -> ViewStorage { let stack = gtk_stack_new() let storage = ViewStorage(.init(stack)) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) return storage } @@ -53,10 +53,11 @@ public struct ViewStack: Widget { /// - Parameters: /// - storage: The view storage. /// - modifiers: Modify views before being updated. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { let widget = content.widget(modifiers: modifiers) if let view = storage.content[id.description]?.first { - widget.updateStorage(view, modifiers: modifiers) + widget.updateStorage(view, modifiers: modifiers, updateProperties: updateProperties) } else { let view = widget.storage(modifiers: modifiers) gtk_stack_add_named(storage.pointer, view.pointer?.cast(), id.description) diff --git a/Sources/Adwaita/View/ViewSwitcher.swift b/Sources/Adwaita/View/ViewSwitcher.swift index 36711bb..fb4d8c5 100644 --- a/Sources/Adwaita/View/ViewSwitcher.swift +++ b/Sources/Adwaita/View/ViewSwitcher.swift @@ -54,7 +54,8 @@ public struct ViewSwitcher: Widget where Element: ViewSwitcherOption { /// - Parameters: /// - storage: The view storage. /// - modifiers: Modify views before being updated. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { + /// - updateProperties: Whether to update properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) { updateSwitcher(switcher: storage) } diff --git a/Sources/Adwaita/Window/AboutWindow.swift b/Sources/Adwaita/Window/AboutWindow.swift index 8a08e8d..bb8986d 100644 --- a/Sources/Adwaita/Window/AboutWindow.swift +++ b/Sources/Adwaita/Window/AboutWindow.swift @@ -102,7 +102,8 @@ public struct AboutWindow: WindowScene { /// - Parameters: /// - storage: The storage to update. /// - app: The application. - public func update(_ storage: WindowStorage, app: GTUIApp) { + /// - force: Whether to force update all the views. + public func update(_ storage: WindowStorage, app: GTUIApp, force: Bool) { updateAppShortcuts(app: app) storage.destroy = true } diff --git a/Sources/Adwaita/Window/FileDialog.swift b/Sources/Adwaita/Window/FileDialog.swift index 89fad76..3bb4083 100644 --- a/Sources/Adwaita/Window/FileDialog.swift +++ b/Sources/Adwaita/Window/FileDialog.swift @@ -92,7 +92,7 @@ public struct FileDialog: WindowScene { /// - Parameters: /// - storage: The storage to update. /// - app: The application. - public func update(_ storage: WindowStorage, app: GTUIApp) { + public func update(_ storage: WindowStorage, app: GTUIApp, force: Bool) { updateAppShortcuts(app: app) if let window = storage.window as? GTUIFileDialog { update(window: window) diff --git a/Sources/Adwaita/Window/Window.swift b/Sources/Adwaita/Window/Window.swift index 403b584..bce0bc4 100644 --- a/Sources/Adwaita/Window/Window.swift +++ b/Sources/Adwaita/Window/Window.swift @@ -86,12 +86,15 @@ public struct Window: WindowScene { } /// Update a window storage's content. - /// - Parameter storage: The storage to update. - public func update(_ storage: WindowStorage, app: GTUIApp) { + /// - Parameters: + /// - storage: The storage to update. + /// - app: The GTUI app. + /// - force: Whether to force update all the views. + public func update(_ storage: WindowStorage, app: GTUIApp, force: Bool) { if let window = storage.window as? GTUIApplicationWindow { let content = content(window) if let view = storage.view { - content.widget(modifiers: []).updateStorage(view, modifiers: []) + content.widget(modifiers: []).updateStorage(view, modifiers: [], updateProperties: force) } setProperties(window: window) updateShortcuts(window: window) diff --git a/Sources/Generation/GIR/Class+.swift b/Sources/Generation/GIR/Class+.swift index 2da2856..c58503a 100644 --- a/Sources/Generation/GIR/Class+.swift +++ b/Sources/Generation/GIR/Class+.swift @@ -195,7 +195,11 @@ extension Class { if let \(widget.name)Storage = storage.content["\(widget.name)"] { for (index, view) in \(widget.name)().enumerated() { if let storage = \(widget.name)Storage[safe: index] { - view.updateStorage(storage, modifiers: modifiers) + view.updateStorage( + storage, + modifiers: modifiers, + updateProperties: updateProperties + ) } } } @@ -238,7 +242,7 @@ extension Class { storage.fields["element"] = elements storage.content[.mainContent] = contentStorage for (index, element) in elements.enumerated() { - content(element).widget(modifiers: modifiers).update(contentStorage[index], modifiers: modifiers) + content(element).widget(modifiers: modifiers).update(contentStorage[index], modifiers: modifiers, updateProperties: updateProperties) } """ // swiftlint:enable line_length diff --git a/Sources/Generation/GIR/Class.swift b/Sources/Generation/GIR/Class.swift index 3932b16..564991f 100644 --- a/Sources/Generation/GIR/Class.swift +++ b/Sources/Generation/GIR/Class.swift @@ -195,7 +195,7 @@ struct Class: Decodable { /// - Returns: The view storage. public func container(modifiers: [(View) -> View]) -> ViewStorage { let storage = ViewStorage(\(generateInitializer(name: widgetName, config: config, classes: classes, configs: configs))?.opaque()) - update(storage, modifiers: modifiers) + update(storage, modifiers: modifiers, updateProperties: true) \(generateWidgetAssignments(config: config, genConfig: genConfig, classes: classes, configs: configs)) \(generateBindingAssignments(config: config, genConfig: genConfig, classes: classes, configs: configs)) for function in appearFunctions { @@ -208,7 +208,8 @@ struct Class: Decodable { /// - Parameters: /// - storage: The view storage. /// - modifiers: The view modifiers. - public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) {\(generateSignalModifications(config: config, genConfig: genConfig, classes: classes)) + /// - updateProperties: Whether to update the view's properties. + public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) {\(generateSignalModifications(config: config, genConfig: genConfig, classes: classes)) storage.modify { widget in \(generateModifications(config: config, genConfig: genConfig, classes: classes, configs: configs)) \(generateDynamicWidgetUpdate(config: config, genConfig: genConfig)) diff --git a/Sources/Generation/GIR/Property.swift b/Sources/Generation/GIR/Property.swift index 390df9d..c13bd9d 100644 --- a/Sources/Generation/GIR/Property.swift +++ b/Sources/Generation/GIR/Property.swift @@ -108,6 +108,7 @@ struct Property: Decodable { """ } + // swiftlint:disable function_body_length /// Generate the property's modification when being updated. /// - Parameters: /// - config: The widget configuration. @@ -123,7 +124,7 @@ struct Property: Decodable { guard !(type?.isWidget ?? false) else { return """ if let widget = storage.content["\(name)"]?.first { - \(name)?().widget(modifiers: modifiers).update(widget, modifiers: modifiers) + \(name)?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties) } """ @@ -151,26 +152,28 @@ struct Property: Decodable { } if config.bindings.contains { $0.property == self.name } { return """ - if let \(name)\(setConditions) { + if let \(name)\(setConditions), updateProperties { \(setter)(\(widget), \(name).wrappedValue\(propertyString)) } """ } else if config.requiredProperties.contains(self.name) { return """ - \(onlySetConditions)\(onlySetConditionsIndentation)\(setter)(\(widget), \(name)\(propertyString))\(onlySetConditionsEnd) + if updateProperties { + \(onlySetConditions)\(onlySetConditionsIndentation)\(setter)(\(widget), \(name)\(propertyString))\(onlySetConditionsEnd) + } """ } else { return """ - if let \(name)\(setConditions) { + if let \(name)\(setConditions), updateProperties { \(setter)(\(widget), \(name)\(propertyString)) } """ } } - // swiftlint:enable line_length + // swiftlint:enable line_length function_body_length /// Generate the widget assignments. /// - Parameters: diff --git a/Tests/Demo.swift b/Tests/Demo.swift index 8d248d6..39df86c 100644 --- a/Tests/Demo.swift +++ b/Tests/Demo.swift @@ -14,7 +14,6 @@ struct Demo: App { let id = "io.github.AparokshaUI.Demo" var app: GTUIApp! - @State private var toolbar = false var scene: Scene { Window(id: "main") { window in diff --git a/user-manual/Information/Widgets.md b/user-manual/Information/Widgets.md index 5a0a288..e089c67 100644 --- a/user-manual/Information/Widgets.md +++ b/user-manual/Information/Widgets.md @@ -5,32 +5,17 @@ There are many more widgets available using auto-generation. Learn [how to use t | Name | Description | Widget | | -------------------- | ------------------------------------------------------------------- | ---------------------- | -| Button | A widget that triggers a function when being clicked. | GtkButton | | ViewStack | A widget that displays one of its child views based on an id. | GtkStack | -| HeaderBar | A widget for creating custom title bars for windows. | GtkHeaderBar | -| Text | A widget for displaying a small amount of text. | GtkLabel | | VStack | A widget which arranges child widgets into a single column. | GtkBox | | HStack | A widget which arranges child widgets into a single row. | GtkBox | | Toggle | A button with two possible states, on and off. | GtkToggleButton | | List | A widget which arranges child widgets vertically into rows. | GtkListBox | -| Menu | A widget showing a button that toggles the appearance of a menu. | GtkMenuButton | | NavigationSplitView | A widget presenting sidebar and content side by side. | AdwNavigationSplitView | -| OverlaySplitView | A widget presenting sidebar and content side by side. | AdwOverlaySplitView | | ScrollView | A container that makes its child scrollable. | GtkScrolledWindow | -| StatusPage | A page with an icon, title, and optionally description and widget. | AdwStatusPage | -| Container | Supports any widget conforming to `Libadwaita.InsertableContainer`. | Multiple widgets | -| Carousel | A paginated scrolling widget. | AdwCarousel | | ViewSwitcher | A control for switching between different views. | AdwViewSwitcher | -| ProgressBar | A bar showing a progress. | GtkProgressBar | -| Banner | A bar showing contextual information. | AdwBanner | | StateWrapper | A wrapper not affecting the UI which stores state information. | - | | FormSection | A titled section, usually containing one or multiple forms. | AdwPreferencesGroup | | Form | A static boxed list, usually containing one or multiple rows. | GtkListBox | -| ActionRow | The most basic row displaying text and optionally other views. | AdwActionRow | -| ComboRow | A row displaying an array, letting the user choose one element. | AdwComboRow | -| EntryRow | A row for text input. | AdwEntryRow | -| SpinRow | A row for selecting an integer in a range. | AdwSpinRow | -| SwitchRow | A row controlling a simple boolean value. | AdwSwitchRow | ### View Modifiers