Include interfaces in auto generation

This commit is contained in:
david-swift 2024-02-14 15:02:25 +01:00
parent 6b5e1c1a25
commit adfea3f581
50 changed files with 1567 additions and 521 deletions

View File

@ -2,7 +2,7 @@
// ActionRow.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw
@ -72,15 +72,15 @@ public struct ActionRow: Widget {
///
/// See also [property@Gtk.Label:selectable].
var subtitleSelectable: Bool?
/// 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.
var titleLines: Int?
/// 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`.
var title: String?
/// 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.
var titleLines: Int?
/// Whether the user can copy the title from the label.
///
/// See also [property@Gtk.Label:selectable].
@ -165,12 +165,12 @@ public struct ActionRow: Widget {
if let subtitleSelectable, updateProperties {
adw_action_row_set_subtitle_selectable(widget?.cast(), subtitleSelectable.cBool)
}
if let titleLines, updateProperties {
adw_action_row_set_title_lines(widget?.cast(), titleLines.cInt)
}
if let title, updateProperties {
adw_preferences_row_set_title(widget?.cast(), title)
}
if let titleLines, updateProperties {
adw_action_row_set_title_lines(widget?.cast(), titleLines.cInt)
}
if let titleSelectable, updateProperties {
adw_preferences_row_set_title_selectable(widget?.cast(), titleSelectable.cBool)
}
@ -266,16 +266,6 @@ public struct ActionRow: Widget {
return newSelf
}
/// 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.
public func titleLines(_ titleLines: Int?) -> Self {
var newSelf = self
newSelf.titleLines = titleLines
return newSelf
}
/// The title of the preference represented by this row.
///
/// The title is interpreted as Pango markup unless
@ -287,6 +277,16 @@ public struct ActionRow: Widget {
return newSelf
}
/// 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.
public func titleLines(_ titleLines: Int?) -> Self {
var newSelf = self
newSelf.titleLines = titleLines
return newSelf
}
/// Whether the user can copy the title from the label.
///
/// See also [property@Gtk.Label:selectable].

View File

@ -2,7 +2,7 @@
// Avatar.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// Banner.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// Bin.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// Box.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw
@ -49,6 +49,10 @@ public struct Box: Widget {
/// Additional appear functions for type extensions.
var appearFunctions: [(ViewStorage) -> Void] = []
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
var accessibleRole: String?
/// The child that determines the baseline, in vertical orientation.
var baselineChild: Int?
/// Whether the children should all be the same size.
@ -141,6 +145,16 @@ public struct Box: Widget {
}
}
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
public func accessibleRole(_ accessibleRole: String?) -> Self {
var newSelf = self
newSelf.accessibleRole = accessibleRole
return newSelf
}
/// The child that determines the baseline, in vertical orientation.
public func baselineChild(_ baselineChild: Int?) -> Self {
var newSelf = self

View File

@ -2,7 +2,7 @@
// Button.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw
@ -45,6 +45,12 @@ public struct Button: Widget {
/// Additional appear functions for type extensions.
var appearFunctions: [(ViewStorage) -> Void] = []
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
var accessibleRole: String?
/// action-name
var actionName: String?
/// Whether the size of the button can be made smaller than the natural
/// size of its contents.
///
@ -118,6 +124,9 @@ public struct Button: Widget {
}
}
storage.modify { widget in
if let actionName, updateProperties {
gtk_actionable_set_action_name(widget, actionName)
}
if let canShrink, updateProperties {
gtk_button_set_can_shrink(widget?.cast(), canShrink.cBool)
}
@ -144,6 +153,24 @@ public struct Button: Widget {
}
}
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
public func accessibleRole(_ accessibleRole: String?) -> Self {
var newSelf = self
newSelf.accessibleRole = accessibleRole
return newSelf
}
/// action-name
public func actionName(_ actionName: String?) -> Self {
var newSelf = self
newSelf.actionName = actionName
return newSelf
}
/// Whether the size of the button can be made smaller than the natural
/// size of its contents.
///

View File

@ -2,7 +2,7 @@
// ButtonContent.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// Carousel.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// CenterBox.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw
@ -49,6 +49,10 @@ public struct CenterBox: Widget {
/// Additional appear functions for type extensions.
var appearFunctions: [(ViewStorage) -> Void] = []
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
var accessibleRole: String?
/// The widget that is placed at the center position.
var centerWidget: (() -> Body)?
/// The widget that is placed at the end position.
@ -134,6 +138,16 @@ public struct CenterBox: Widget {
}
}
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
public func accessibleRole(_ accessibleRole: String?) -> Self {
var newSelf = self
newSelf.accessibleRole = accessibleRole
return newSelf
}
/// The widget that is placed at the center position.
public func centerWidget(@ViewBuilder _ centerWidget: @escaping (() -> Body)) -> Self {
var newSelf = self

View File

@ -2,7 +2,7 @@
// CheckButton.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw
@ -72,6 +72,12 @@ public struct CheckButton: Widget {
/// Additional appear functions for type extensions.
var appearFunctions: [(ViewStorage) -> Void] = []
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
var accessibleRole: String?
/// action-name
var actionName: String?
/// If the check button is active.
///
/// Setting `active` to %TRUE will add the `:checked:` state to both
@ -150,6 +156,9 @@ public struct CheckButton: Widget {
}
}
storage.modify { widget in
if let actionName, updateProperties {
gtk_actionable_set_action_name(widget, actionName)
}
if let active, updateProperties {
gtk_check_button_set_active(widget?.cast(), active.wrappedValue.cBool)
}
@ -173,6 +182,24 @@ public struct CheckButton: Widget {
}
}
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
public func accessibleRole(_ accessibleRole: String?) -> Self {
var newSelf = self
newSelf.accessibleRole = accessibleRole
return newSelf
}
/// action-name
public func actionName(_ actionName: String?) -> Self {
var newSelf = self
newSelf.actionName = actionName
return newSelf
}
/// If the check button is active.
///
/// Setting `active` to %TRUE will add the `:checked:` state to both

View File

@ -2,7 +2,7 @@
// Clamp.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// ComboRow.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw
@ -48,28 +48,6 @@ public struct ComboRow: Widget {
/// Additional appear functions for type extensions.
var appearFunctions: [(ViewStorage) -> Void] = []
/// 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.
var enableSearch: Bool?
/// The position of the selected item.
///
/// If no item is selected, the property has the value
/// [const@Gtk.INVALID_LIST_POSITION]
var selected: Binding<UInt>?
/// 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`.
var useSubtitle: Bool?
/// The widget to activate when the row is activated.
///
/// The row can be activated either by clicking on it, calling
@ -80,8 +58,20 @@ public struct ComboRow: Widget {
/// The target widget will be activated by emitting the
/// [signal@Gtk.Widget::mnemonic-activate] signal on it.
var activatableWidget: (() -> Body)?
/// 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.
var enableSearch: Bool?
/// The icon name for this row.
var iconName: String?
/// The position of the selected item.
///
/// If no item is selected, the property has the value
/// [const@Gtk.INVALID_LIST_POSITION]
var selected: Binding<UInt>?
/// The subtitle for this row.
///
/// The subtitle is interpreted as Pango markup unless
@ -96,15 +86,15 @@ public struct ComboRow: Widget {
///
/// See also [property@Gtk.Label:selectable].
var subtitleSelectable: Bool?
/// 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.
var titleLines: Int?
/// 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`.
var title: String?
/// 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.
var titleLines: Int?
/// Whether the user can copy the title from the label.
///
/// See also [property@Gtk.Label:selectable].
@ -115,6 +105,16 @@ public struct ComboRow: Widget {
///
/// See also [func@Pango.parse_markup].
var useMarkup: Bool?
/// 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`.
var useSubtitle: Bool?
/// Whether an embedded underline in the title indicates a mnemonic.
var useUnderline: Bool?
/// This signal is emitted after the row has been activated.
@ -177,21 +177,18 @@ public struct ComboRow: Widget {
}
}
storage.modify { widget in
if let enableSearch, updateProperties {
adw_combo_row_set_enable_search(widget?.cast(), enableSearch.cBool)
}
if let selected, updateProperties {
adw_combo_row_set_selected(widget?.cast(), selected.wrappedValue.cInt)
}
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, updateProperties: updateProperties)
}
if let enableSearch, updateProperties {
adw_combo_row_set_enable_search(widget?.cast(), enableSearch.cBool)
}
if let iconName, updateProperties {
adw_action_row_set_icon_name(widget?.cast(), iconName)
}
if let selected, updateProperties {
adw_combo_row_set_selected(widget?.cast(), selected.wrappedValue.cInt)
}
if let subtitle, updateProperties {
adw_action_row_set_subtitle(widget?.cast(), subtitle)
}
@ -201,18 +198,21 @@ public struct ComboRow: Widget {
if let subtitleSelectable, updateProperties {
adw_action_row_set_subtitle_selectable(widget?.cast(), subtitleSelectable.cBool)
}
if let titleLines, updateProperties {
adw_action_row_set_title_lines(widget?.cast(), titleLines.cInt)
}
if let title, updateProperties {
adw_preferences_row_set_title(widget?.cast(), title)
}
if let titleLines, updateProperties {
adw_action_row_set_title_lines(widget?.cast(), titleLines.cInt)
}
if let titleSelectable, updateProperties {
adw_preferences_row_set_title_selectable(widget?.cast(), titleSelectable.cBool)
}
if let useMarkup, updateProperties {
adw_preferences_row_set_use_markup(widget?.cast(), useMarkup.cBool)
}
if let useSubtitle, updateProperties {
adw_combo_row_set_use_subtitle(widget?.cast(), useSubtitle.cBool)
}
if let useUnderline, updateProperties {
adw_preferences_row_set_use_underline(widget?.cast(), useUnderline.cBool)
}
@ -224,46 +224,6 @@ public struct ComboRow: Widget {
}
}
/// 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.
public func enableSearch(_ enableSearch: Bool? = true) -> Self {
var newSelf = self
newSelf.enableSearch = enableSearch
return newSelf
}
/// The position of the selected item.
///
/// If no item is selected, the property has the value
/// [const@Gtk.INVALID_LIST_POSITION]
public func selected(_ selected: Binding<UInt>?) -> Self {
var newSelf = self
newSelf.selected = selected
return newSelf
}
/// 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`.
public func useSubtitle(_ useSubtitle: Bool? = true) -> Self {
var newSelf = self
newSelf.useSubtitle = useSubtitle
return newSelf
}
/// The widget to activate when the row is activated.
///
/// The row can be activated either by clicking on it, calling
@ -280,6 +240,19 @@ public struct ComboRow: Widget {
return newSelf
}
/// 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.
public func enableSearch(_ enableSearch: Bool? = true) -> Self {
var newSelf = self
newSelf.enableSearch = enableSearch
return newSelf
}
/// The icon name for this row.
public func iconName(_ iconName: String?) -> Self {
var newSelf = self
@ -288,6 +261,17 @@ public struct ComboRow: Widget {
return newSelf
}
/// The position of the selected item.
///
/// If no item is selected, the property has the value
/// [const@Gtk.INVALID_LIST_POSITION]
public func selected(_ selected: Binding<UInt>?) -> Self {
var newSelf = self
newSelf.selected = selected
return newSelf
}
/// The subtitle for this row.
///
/// The subtitle is interpreted as Pango markup unless
@ -320,16 +304,6 @@ public struct ComboRow: Widget {
return newSelf
}
/// 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.
public func titleLines(_ titleLines: Int?) -> Self {
var newSelf = self
newSelf.titleLines = titleLines
return newSelf
}
/// The title of the preference represented by this row.
///
/// The title is interpreted as Pango markup unless
@ -341,6 +315,16 @@ public struct ComboRow: Widget {
return newSelf
}
/// 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.
public func titleLines(_ titleLines: Int?) -> Self {
var newSelf = self
newSelf.titleLines = titleLines
return newSelf
}
/// Whether the user can copy the title from the label.
///
/// See also [property@Gtk.Label:selectable].
@ -363,6 +347,22 @@ public struct ComboRow: Widget {
return newSelf
}
/// 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`.
public func useSubtitle(_ useSubtitle: Bool? = true) -> Self {
var newSelf = self
newSelf.useSubtitle = useSubtitle
return newSelf
}
/// Whether an embedded underline in the title indicates a mnemonic.
public func useUnderline(_ useUnderline: Bool? = true) -> Self {
var newSelf = self

View File

@ -2,7 +2,7 @@
// EntryRow.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// ExpanderRow.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw
@ -58,15 +58,15 @@ public struct ExpanderRow: Widget {
///
/// If the value is 0, the number of lines won't be limited.
var subtitleLines: Int?
/// 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.
var titleLines: Int?
/// 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`.
var title: String?
/// 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.
var titleLines: Int?
/// Whether the user can copy the title from the label.
///
/// See also [property@Gtk.Label:selectable].
@ -157,12 +157,12 @@ public struct ExpanderRow: Widget {
if let subtitleLines, updateProperties {
adw_expander_row_set_subtitle_lines(widget?.cast(), subtitleLines.cInt)
}
if let titleLines, updateProperties {
adw_expander_row_set_title_lines(widget?.cast(), titleLines.cInt)
}
if let title, updateProperties {
adw_preferences_row_set_title(widget?.cast(), title)
}
if let titleLines, updateProperties {
adw_expander_row_set_title_lines(widget?.cast(), titleLines.cInt)
}
if let titleSelectable, updateProperties {
adw_preferences_row_set_title_selectable(widget?.cast(), titleSelectable.cBool)
}
@ -267,16 +267,6 @@ public struct ExpanderRow: Widget {
return newSelf
}
/// 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.
public func titleLines(_ titleLines: Int?) -> Self {
var newSelf = self
newSelf.titleLines = titleLines
return newSelf
}
/// The title of the preference represented by this row.
///
/// The title is interpreted as Pango markup unless
@ -288,6 +278,16 @@ public struct ExpanderRow: Widget {
return newSelf
}
/// 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.
public func titleLines(_ titleLines: Int?) -> Self {
var newSelf = self
newSelf.titleLines = titleLines
return newSelf
}
/// Whether the user can copy the title from the label.
///
/// See also [property@Gtk.Label:selectable].

View File

@ -2,7 +2,7 @@
// FlowBox.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw
@ -61,6 +61,10 @@ public struct FlowBox<Element>: Widget where Element: Identifiable {
/// accept-unpaired-release
var acceptUnpairedRelease: Bool?
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
var accessibleRole: String?
/// Determines whether children can be activated with a single
/// click, or require a double-click.
var activateOnSingleClick: Bool?
@ -258,6 +262,16 @@ public struct FlowBox<Element>: Widget where Element: Identifiable {
return newSelf
}
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
public func accessibleRole(_ accessibleRole: String?) -> Self {
var newSelf = self
newSelf.accessibleRole = accessibleRole
return newSelf
}
/// Determines whether children can be activated with a single
/// click, or require a double-click.
public func activateOnSingleClick(_ activateOnSingleClick: Bool? = true) -> Self {

View File

@ -2,7 +2,7 @@
// HeaderBar.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// Label.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw
@ -189,6 +189,10 @@ public struct Label: Widget {
/// Additional appear functions for type extensions.
var appearFunctions: [(ViewStorage) -> Void] = []
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
var accessibleRole: String?
/// The contents of the label.
///
/// If the string contains Pango markup (see [func@Pango.parse_markup]),
@ -346,6 +350,16 @@ public struct Label: Widget {
}
}
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
public func accessibleRole(_ accessibleRole: String?) -> Self {
var newSelf = self
newSelf.accessibleRole = accessibleRole
return newSelf
}
/// The contents of the label.
///
/// If the string contains Pango markup (see [func@Pango.parse_markup]),

View File

@ -2,7 +2,7 @@
// LevelBar.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw
@ -112,6 +112,10 @@ public struct LevelBar: Widget {
/// Additional appear functions for type extensions.
var appearFunctions: [(ViewStorage) -> Void] = []
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
var accessibleRole: String?
/// Whether the `GtkLeveBar` is inverted.
///
/// Level bars normally grow from top to bottom or left to right.
@ -187,6 +191,16 @@ public struct LevelBar: Widget {
}
}
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
public func accessibleRole(_ accessibleRole: String?) -> Self {
var newSelf = self
newSelf.accessibleRole = accessibleRole
return newSelf
}
/// Whether the `GtkLeveBar` is inverted.
///
/// Level bars normally grow from top to bottom or left to right.

View File

@ -2,7 +2,7 @@
// LinkButton.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw
@ -41,12 +41,12 @@ public struct LinkButton: Widget {
/// Additional appear functions for type extensions.
var appearFunctions: [(ViewStorage) -> Void] = []
/// The URI bound to this button.
var uri: String
/// The 'visited' state of this button.
/// The accessible role of the given `GtkAccessible` implementation.
///
/// A visited link is drawn in a different color.
var visited: Bool?
/// The accessible role cannot be changed once set.
var accessibleRole: String?
/// action-name
var actionName: String?
/// Whether the size of the button can be made smaller than the natural
/// size of its contents.
///
@ -63,9 +63,15 @@ public struct LinkButton: Widget {
var iconName: String?
/// Text of the label inside the button, if the button contains a label widget.
var label: String?
/// The URI bound to this button.
var uri: String
/// If set, an underline in the text indicates that the following character is
/// to be used as mnemonic.
var useUnderline: Bool?
/// The 'visited' state of this button.
///
/// A visited link is drawn in a different color.
var visited: Bool?
/// Emitted to animate press then release.
///
/// This is an action signal. Applications should never connect
@ -121,11 +127,8 @@ public struct LinkButton: Widget {
}
}
storage.modify { widget in
if updateProperties {
gtk_link_button_set_uri(widget, uri)
}
if let visited, updateProperties {
gtk_link_button_set_visited(widget, visited.cBool)
if let actionName, updateProperties {
gtk_actionable_set_action_name(widget, actionName)
}
if let canShrink, updateProperties {
gtk_button_set_can_shrink(widget?.cast(), canShrink.cBool)
@ -142,9 +145,15 @@ public struct LinkButton: Widget {
if let label, storage.content["child"] == nil, updateProperties {
gtk_button_set_label(widget?.cast(), label)
}
if updateProperties {
gtk_link_button_set_uri(widget, uri)
}
if let useUnderline, updateProperties {
gtk_button_set_use_underline(widget?.cast(), useUnderline.cBool)
}
if let visited, updateProperties {
gtk_link_button_set_visited(widget, visited.cBool)
}
}
@ -153,20 +162,20 @@ public struct LinkButton: Widget {
}
}
/// The URI bound to this button.
public func uri(_ uri: String) -> Self {
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
public func accessibleRole(_ accessibleRole: String?) -> Self {
var newSelf = self
newSelf.uri = uri
newSelf.accessibleRole = accessibleRole
return newSelf
}
/// The 'visited' state of this button.
///
/// A visited link is drawn in a different color.
public func visited(_ visited: Bool? = true) -> Self {
/// action-name
public func actionName(_ actionName: String?) -> Self {
var newSelf = self
newSelf.visited = visited
newSelf.actionName = actionName
return newSelf
}
@ -217,6 +226,14 @@ public struct LinkButton: Widget {
return newSelf
}
/// The URI bound to this button.
public func uri(_ uri: String) -> Self {
var newSelf = self
newSelf.uri = uri
return newSelf
}
/// If set, an underline in the text indicates that the following character is
/// to be used as mnemonic.
public func useUnderline(_ useUnderline: Bool? = true) -> Self {
@ -226,6 +243,16 @@ public struct LinkButton: Widget {
return newSelf
}
/// The 'visited' state of this button.
///
/// A visited link is drawn in a different color.
public func visited(_ visited: Bool? = true) -> Self {
var newSelf = self
newSelf.visited = visited
return newSelf
}
/// Emitted to animate press then release.
///
/// This is an action signal. Applications should never connect

View File

@ -2,7 +2,7 @@
// ListBox.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw
@ -70,6 +70,10 @@ public struct ListBox<Element>: Widget where Element: Identifiable {
/// Whether to accept unpaired release events.
var acceptUnpairedRelease: Bool?
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
var accessibleRole: String?
/// Determines whether children can be activated with a single
/// click, or require a double-click.
var activateOnSingleClick: Bool?
@ -228,6 +232,16 @@ public struct ListBox<Element>: Widget where Element: Identifiable {
return newSelf
}
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
public func accessibleRole(_ accessibleRole: String?) -> Self {
var newSelf = self
newSelf.accessibleRole = accessibleRole
return newSelf
}
/// Determines whether children can be activated with a single
/// click, or require a double-click.
public func activateOnSingleClick(_ activateOnSingleClick: Bool? = true) -> Self {

View File

@ -2,7 +2,7 @@
// Menu.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw
@ -76,6 +76,10 @@ public struct Menu: Widget {
/// Additional appear functions for type extensions.
var appearFunctions: [(ViewStorage) -> Void] = []
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
var accessibleRole: String?
/// Whether the menu button is active.
var active: Binding<Bool>?
/// Whether to show a dropdown arrow even when using an icon or a custom child.
@ -191,6 +195,16 @@ public struct Menu: Widget {
}
}
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
public func accessibleRole(_ accessibleRole: String?) -> Self {
var newSelf = self
newSelf.accessibleRole = accessibleRole
return newSelf
}
/// Whether the menu button is active.
public func active(_ active: Binding<Bool>?) -> Self {
var newSelf = self

View File

@ -2,7 +2,7 @@
// Overlay.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw
@ -47,6 +47,10 @@ public struct Overlay: Widget {
/// Additional appear functions for type extensions.
var appearFunctions: [(ViewStorage) -> Void] = []
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
var accessibleRole: String?
/// The main child widget.
var child: (() -> Body)?
/// Emitted to determine the position and size of any overlay
@ -133,6 +137,16 @@ public struct Overlay: Widget {
}
}
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
public func accessibleRole(_ accessibleRole: String?) -> Self {
var newSelf = self
newSelf.accessibleRole = accessibleRole
return newSelf
}
/// The main child widget.
public func child(@ViewBuilder _ child: @escaping (() -> Body)) -> Self {
var newSelf = self

View File

@ -2,7 +2,7 @@
// OverlaySplitView.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// PasswordEntryRow.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// Popover.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw
@ -75,6 +75,10 @@ public struct Popover: Widget {
/// Additional appear functions for type extensions.
var appearFunctions: [(ViewStorage) -> Void] = []
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
var accessibleRole: String?
/// Whether to dismiss the popover on outside clicks.
var autohide: Bool?
/// Whether the popover pops down after a child popover.
@ -169,6 +173,16 @@ public struct Popover: Widget {
}
}
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
public func accessibleRole(_ accessibleRole: String?) -> Self {
var newSelf = self
newSelf.accessibleRole = accessibleRole
return newSelf
}
/// Whether to dismiss the popover on outside clicks.
public func autohide(_ autohide: Bool? = true) -> Self {
var newSelf = self

View File

@ -2,7 +2,7 @@
// PreferencesGroup.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// PreferencesPage.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// PreferencesRow.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// ProgressBar.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw
@ -61,6 +61,10 @@ public struct ProgressBar: Widget {
/// Additional appear functions for type extensions.
var appearFunctions: [(ViewStorage) -> Void] = []
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
var accessibleRole: String?
/// The fraction of total work that has been completed.
var fraction: Double?
/// Invert the direction in which the progress bar grows.
@ -133,6 +137,16 @@ public struct ProgressBar: Widget {
}
}
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
public func accessibleRole(_ accessibleRole: String?) -> Self {
var newSelf = self
newSelf.accessibleRole = accessibleRole
return newSelf
}
/// The fraction of total work that has been completed.
public func fraction(_ fraction: Double?) -> Self {
var newSelf = self

View File

@ -2,7 +2,7 @@
// ScrolledWindow.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw
@ -83,6 +83,10 @@ public struct ScrolledWindow: Widget {
/// Additional appear functions for type extensions.
var appearFunctions: [(ViewStorage) -> Void] = []
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
var accessibleRole: String?
/// The child widget.
var child: (() -> Body)?
/// Whether to draw a frame around the contents.
@ -248,6 +252,16 @@ public struct ScrolledWindow: Widget {
}
}
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
public func accessibleRole(_ accessibleRole: String?) -> Self {
var newSelf = self
newSelf.accessibleRole = accessibleRole
return newSelf
}
/// The child widget.
public func child(@ViewBuilder _ child: @escaping (() -> Body)) -> Self {
var newSelf = self

View File

@ -0,0 +1,171 @@
//
// SearchBar.swift
// Adwaita
//
// Created by auto-generation on 14.02.24.
//
import CAdw
import LevenshteinTransformations
/// `GtkSearchBar` is a container made to have a search entry.
///
/// ![An example GtkSearchBar](search-bar.png)
///
/// It can also contain additional widgets, such as drop-down menus,
/// or buttons. The search bar would appear when a search is started
/// through typing on the keyboard, or the applications search mode
/// is toggled on.
///
/// For keyboard presses to start a search, the search bar must be told
/// of a widget to capture key events from through
/// [method@Gtk.SearchBar.set_key_capture_widget]. This widget will
/// typically be the top-level window, or a parent container of the
/// search bar. Common shortcuts such as Ctrl+F should be handled as an
/// application action, or through the menu items.
///
/// You will also need to tell the search bar about which entry you
/// are using as your search entry using [method@Gtk.SearchBar.connect_entry].
///
/// ## Creating a search bar
///
/// The following example shows you how to create a more complex search
/// entry.
///
/// [A simple example](https://gitlab.gnome.org/GNOME/gtk/tree/main/examples/search-bar.c)
///
/// # CSS nodes
///
/// ```
/// searchbar
/// revealer
/// box
/// [child]
/// [button.close]
/// ```
///
/// `GtkSearchBar` has a main CSS node with name searchbar. It has a child
/// node with name revealer that contains a node with name box. The box node
/// contains both the CSS node of the child widget as well as an optional button
/// node which gets the .close style class applied.
///
/// # Accessibility
///
/// `GtkSearchBar` uses the %GTK_ACCESSIBLE_ROLE_SEARCH role.
public struct SearchBar: Widget {
/// Additional update functions for type extensions.
var updateFunctions: [(ViewStorage) -> Void] = []
/// Additional appear functions for type extensions.
var appearFunctions: [(ViewStorage) -> Void] = []
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
var accessibleRole: String?
/// The child widget.
var child: (() -> Body)?
/// The key capture widget.
var keyCaptureWidget: (() -> Body)?
/// Whether the search mode is on and the search bar shown.
var searchModeEnabled: Bool?
/// Whether to show the close button in the search bar.
var showCloseButton: Bool?
/// The application.
var app: GTUIApp?
/// The window.
var window: GTUIApplicationWindow?
/// Initialize `SearchBar`.
public init() {
}
/// Get the widget's view storage.
/// - Parameter modifiers: The view modifiers.
/// - Returns: The view storage.
public func container(modifiers: [(View) -> View]) -> ViewStorage {
let storage = ViewStorage(gtk_search_bar_new()?.opaque())
update(storage, modifiers: modifiers, updateProperties: true)
if let childStorage = child?().widget(modifiers: modifiers).storage(modifiers: modifiers) {
storage.content["child"] = [childStorage]
gtk_search_bar_set_child(storage.pointer, childStorage.pointer?.cast())
}
if let keyCaptureWidgetStorage = keyCaptureWidget?().widget(modifiers: modifiers).storage(modifiers: modifiers) {
storage.content["keyCaptureWidget"] = [keyCaptureWidgetStorage]
gtk_search_bar_set_key_capture_widget(storage.pointer, keyCaptureWidgetStorage.pointer?.cast())
}
for function in appearFunctions {
function(storage)
}
return storage
}
/// Update the widget's view storage.
/// - Parameters:
/// - storage: The view storage.
/// - modifiers: The view modifiers.
/// - 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, updateProperties: updateProperties)
}
if let widget = storage.content["keyCaptureWidget"]?.first {
keyCaptureWidget?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties)
}
if let showCloseButton, updateProperties {
gtk_search_bar_set_show_close_button(widget, showCloseButton.cBool)
}
}
for function in updateFunctions {
function(storage)
}
}
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
public func accessibleRole(_ accessibleRole: String?) -> Self {
var newSelf = self
newSelf.accessibleRole = accessibleRole
return newSelf
}
/// The child widget.
public func child(@ViewBuilder _ child: @escaping (() -> Body)) -> Self {
var newSelf = self
newSelf.child = child
return newSelf
}
/// The key capture widget.
public func keyCaptureWidget(@ViewBuilder _ keyCaptureWidget: @escaping (() -> Body)) -> Self {
var newSelf = self
newSelf.keyCaptureWidget = keyCaptureWidget
return newSelf
}
/// Whether the search mode is on and the search bar shown.
public func searchModeEnabled(_ searchModeEnabled: Bool? = true) -> Self {
var newSelf = self
newSelf.searchModeEnabled = searchModeEnabled
return newSelf
}
/// Whether to show the close button in the search bar.
public func showCloseButton(_ showCloseButton: Bool? = true) -> Self {
var newSelf = self
newSelf.showCloseButton = showCloseButton
return newSelf
}
}

View File

@ -0,0 +1,476 @@
//
// SearchEntry.swift
// Adwaita
//
// Created by auto-generation on 14.02.24.
//
import CAdw
import LevenshteinTransformations
/// `GtkSearchEntry` is an entry widget that has been tailored for use
/// as a search entry.
///
/// The main API for interacting with a `GtkSearchEntry` as entry
/// is the `GtkEditable` interface.
///
/// ![An example GtkSearchEntry](search-entry.png)
///
/// It will show an inactive symbolic find icon when the search
/// entry is empty, and a symbolic clear icon when there is text.
/// Clicking on the clear icon will empty the search entry.
///
/// To make filtering appear more reactive, it is a good idea to
/// not react to every change in the entry text immediately, but
/// only after a short delay. To support this, `GtkSearchEntry`
/// emits the [signal@Gtk.SearchEntry::search-changed] signal which
/// can be used instead of the [signal@Gtk.Editable::changed] signal.
///
/// The [signal@Gtk.SearchEntry::previous-match],
/// [signal@Gtk.SearchEntry::next-match] and
/// [signal@Gtk.SearchEntry::stop-search] signals can be used to
/// implement moving between search results and ending the search.
///
/// Often, `GtkSearchEntry` will be fed events by means of being
/// placed inside a [class@Gtk.SearchBar]. If that is not the case,
/// you can use [method@Gtk.SearchEntry.set_key_capture_widget] to
/// let it capture key input from another widget.
///
/// `GtkSearchEntry` provides only minimal API and should be used with
/// the [iface@Gtk.Editable] API.
///
/// ## CSS Nodes
///
/// ```
/// entry.search
/// text
/// ```
///
/// `GtkSearchEntry` has a single CSS node with name entry that carries
/// a `.search` style class, and the text node is a child of that.
///
/// ## Accessibility
///
/// `GtkSearchEntry` uses the %GTK_ACCESSIBLE_ROLE_SEARCH_BOX role.
public struct SearchEntry: Widget {
/// Additional update functions for type extensions.
var updateFunctions: [(ViewStorage) -> Void] = []
/// Additional appear functions for type extensions.
var appearFunctions: [(ViewStorage) -> Void] = []
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
var accessibleRole: String?
/// Whether to activate the default widget when Enter is pressed.
var activatesDefault: Bool?
/// The current position of the insertion cursor in chars.
var cursorPosition: Int?
/// Whether the entry contents can be edited.
var editable: Bool?
/// If undo/redo should be enabled for the editable.
var enableUndo: Bool?
/// The desired maximum width of the entry, in characters.
var maxWidthChars: Int?
/// The text that will be displayed in the `GtkSearchEntry`
/// when it is empty and unfocused.
var placeholderText: String?
/// The delay in milliseconds from last keypress to the search
/// changed signal.
var searchDelay: UInt?
/// The position of the opposite end of the selection from the cursor in chars.
var selectionBound: Int?
/// The contents of the entry.
var text: Binding<String>?
/// Number of characters to leave space for in the entry.
var widthChars: Int?
/// The horizontal alignment, from 0 (left) to 1 (right).
///
/// Reversed for RTL layouts.
var xalign: Float?
/// Emitted when the entry is activated.
///
/// The keybindings for this signal are all forms of the Enter key.
var activate: (() -> Void)?
/// Emitted at the end of a single user-visible operation on the
/// contents.
///
/// E.g., a paste operation that replaces the contents of the
/// selection will cause only one signal emission (even though it
/// is implemented by first deleting the selection, then inserting
/// the new content, and may cause multiple ::notify::text signals
/// to be emitted).
var changed: (() -> Void)?
/// Emitted when text is deleted from the widget by the user.
///
/// The default handler for this signal will normally be responsible for
/// deleting the text, so by connecting to this signal and then stopping
/// the signal with g_signal_stop_emission(), it is possible to modify the
/// range of deleted text, or prevent it from being deleted entirely.
///
/// The @start_pos and @end_pos parameters are interpreted as for
/// [method@Gtk.Editable.delete_text].
var deleteText: (() -> Void)?
/// Emitted when text is inserted into the widget by the user.
///
/// The default handler for this signal will normally be responsible
/// for inserting the text, so by connecting to this signal and then
/// stopping the signal with g_signal_stop_emission(), it is possible
/// to modify the inserted text, or prevent it from being inserted entirely.
var insertText: (() -> Void)?
/// Emitted when the user initiates a move to the next match
/// for the current search string.
///
/// This is a [keybinding signal](class.SignalAction.html).
///
/// Applications should connect to it, to implement moving
/// between matches.
///
/// The default bindings for this signal is Ctrl-g.
var nextMatch: (() -> Void)?
/// Emitted when the user initiates a move to the previous match
/// for the current search string.
///
/// This is a [keybinding signal](class.SignalAction.html).
///
/// Applications should connect to it, to implement moving
/// between matches.
///
/// The default bindings for this signal is Ctrl-Shift-g.
var previousMatch: (() -> Void)?
/// Emitted with a delay. The length of the delay can be
/// changed with the [property@Gtk.SearchEntry:search-delay]
/// property.
var searchChanged: (() -> Void)?
/// Emitted when the user initiated a search on the entry.
var searchStarted: (() -> Void)?
/// Emitted when the user stops a search via keyboard input.
///
/// This is a [keybinding signal](class.SignalAction.html).
///
/// Applications should connect to it, to implement hiding
/// the search entry in this case.
///
/// The default bindings for this signal is Escape.
var stopSearch: (() -> Void)?
/// The application.
var app: GTUIApp?
/// The window.
var window: GTUIApplicationWindow?
/// Initialize `SearchEntry`.
public init() {
}
/// Get the widget's view storage.
/// - Parameter modifiers: The view modifiers.
/// - Returns: The view storage.
public func container(modifiers: [(View) -> View]) -> ViewStorage {
let storage = ViewStorage(gtk_search_entry_new()?.opaque())
update(storage, modifiers: modifiers, updateProperties: true)
storage.notify(name: "text") {
text?.wrappedValue = .init(cString: gtk_editable_get_text(storage.pointer))
}
for function in appearFunctions {
function(storage)
}
return storage
}
/// Update the widget's view storage.
/// - Parameters:
/// - storage: The view storage.
/// - modifiers: The view modifiers.
/// - 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", argCount: 0) {
activate()
}
}
if let changed {
storage.connectSignal(name: "changed", argCount: 0) {
changed()
}
}
if let deleteText {
storage.connectSignal(name: "delete-text", argCount: 2) {
deleteText()
}
}
if let insertText {
storage.connectSignal(name: "insert-text", argCount: 3) {
insertText()
}
}
if let nextMatch {
storage.connectSignal(name: "next-match", argCount: 0) {
nextMatch()
}
}
if let previousMatch {
storage.connectSignal(name: "previous-match", argCount: 0) {
previousMatch()
}
}
if let searchChanged {
storage.connectSignal(name: "search-changed", argCount: 0) {
searchChanged()
}
}
if let searchStarted {
storage.connectSignal(name: "search-started", argCount: 0) {
searchStarted()
}
}
if let stopSearch {
storage.connectSignal(name: "stop-search", argCount: 0) {
stopSearch()
}
}
storage.modify { widget in
if let editable, updateProperties {
gtk_editable_set_editable(widget, editable.cBool)
}
if let enableUndo, updateProperties {
gtk_editable_set_enable_undo(widget, enableUndo.cBool)
}
if let maxWidthChars, updateProperties {
gtk_editable_set_max_width_chars(widget, maxWidthChars.cInt)
}
if let placeholderText, updateProperties {
gtk_search_entry_set_placeholder_text(widget, placeholderText)
}
if let searchDelay, updateProperties {
gtk_search_entry_set_search_delay(widget, searchDelay.cInt)
}
if let text, updateProperties {
gtk_editable_set_text(widget, text.wrappedValue)
}
if let widthChars, updateProperties {
gtk_editable_set_width_chars(widget, widthChars.cInt)
}
}
for function in updateFunctions {
function(storage)
}
}
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
public func accessibleRole(_ accessibleRole: String?) -> Self {
var newSelf = self
newSelf.accessibleRole = accessibleRole
return newSelf
}
/// Whether to activate the default widget when Enter is pressed.
public func activatesDefault(_ activatesDefault: Bool? = true) -> Self {
var newSelf = self
newSelf.activatesDefault = activatesDefault
return newSelf
}
/// The current position of the insertion cursor in chars.
public func cursorPosition(_ cursorPosition: Int?) -> Self {
var newSelf = self
newSelf.cursorPosition = cursorPosition
return newSelf
}
/// Whether the entry contents can be edited.
public func editable(_ editable: Bool? = true) -> Self {
var newSelf = self
newSelf.editable = editable
return newSelf
}
/// If undo/redo should be enabled for the editable.
public func enableUndo(_ enableUndo: Bool? = true) -> Self {
var newSelf = self
newSelf.enableUndo = enableUndo
return newSelf
}
/// The desired maximum width of the entry, in characters.
public func maxWidthChars(_ maxWidthChars: Int?) -> Self {
var newSelf = self
newSelf.maxWidthChars = maxWidthChars
return newSelf
}
/// The text that will be displayed in the `GtkSearchEntry`
/// when it is empty and unfocused.
public func placeholderText(_ placeholderText: String?) -> Self {
var newSelf = self
newSelf.placeholderText = placeholderText
return newSelf
}
/// The delay in milliseconds from last keypress to the search
/// changed signal.
public func searchDelay(_ searchDelay: UInt?) -> Self {
var newSelf = self
newSelf.searchDelay = searchDelay
return newSelf
}
/// The position of the opposite end of the selection from the cursor in chars.
public func selectionBound(_ selectionBound: Int?) -> Self {
var newSelf = self
newSelf.selectionBound = selectionBound
return newSelf
}
/// The contents of the entry.
public func text(_ text: Binding<String>?) -> Self {
var newSelf = self
newSelf.text = text
return newSelf
}
/// Number of characters to leave space for in the entry.
public func widthChars(_ widthChars: Int?) -> Self {
var newSelf = self
newSelf.widthChars = widthChars
return newSelf
}
/// The horizontal alignment, from 0 (left) to 1 (right).
///
/// Reversed for RTL layouts.
public func xalign(_ xalign: Float?) -> Self {
var newSelf = self
newSelf.xalign = xalign
return newSelf
}
/// Emitted when the entry is activated.
///
/// The keybindings for this signal are all forms of the Enter key.
public func activate(_ activate: @escaping () -> Void) -> Self {
var newSelf = self
newSelf.activate = activate
return newSelf
}
/// Emitted at the end of a single user-visible operation on the
/// contents.
///
/// E.g., a paste operation that replaces the contents of the
/// selection will cause only one signal emission (even though it
/// is implemented by first deleting the selection, then inserting
/// the new content, and may cause multiple ::notify::text signals
/// to be emitted).
public func changed(_ changed: @escaping () -> Void) -> Self {
var newSelf = self
newSelf.changed = changed
return newSelf
}
/// Emitted when text is deleted from the widget by the user.
///
/// The default handler for this signal will normally be responsible for
/// deleting the text, so by connecting to this signal and then stopping
/// the signal with g_signal_stop_emission(), it is possible to modify the
/// range of deleted text, or prevent it from being deleted entirely.
///
/// The @start_pos and @end_pos parameters are interpreted as for
/// [method@Gtk.Editable.delete_text].
public func deleteText(_ deleteText: @escaping () -> Void) -> Self {
var newSelf = self
newSelf.deleteText = deleteText
return newSelf
}
/// Emitted when text is inserted into the widget by the user.
///
/// The default handler for this signal will normally be responsible
/// for inserting the text, so by connecting to this signal and then
/// stopping the signal with g_signal_stop_emission(), it is possible
/// to modify the inserted text, or prevent it from being inserted entirely.
public func insertText(_ insertText: @escaping () -> Void) -> Self {
var newSelf = self
newSelf.insertText = insertText
return newSelf
}
/// Emitted when the user initiates a move to the next match
/// for the current search string.
///
/// This is a [keybinding signal](class.SignalAction.html).
///
/// Applications should connect to it, to implement moving
/// between matches.
///
/// The default bindings for this signal is Ctrl-g.
public func nextMatch(_ nextMatch: @escaping () -> Void) -> Self {
var newSelf = self
newSelf.nextMatch = nextMatch
return newSelf
}
/// Emitted when the user initiates a move to the previous match
/// for the current search string.
///
/// This is a [keybinding signal](class.SignalAction.html).
///
/// Applications should connect to it, to implement moving
/// between matches.
///
/// The default bindings for this signal is Ctrl-Shift-g.
public func previousMatch(_ previousMatch: @escaping () -> Void) -> Self {
var newSelf = self
newSelf.previousMatch = previousMatch
return newSelf
}
/// Emitted with a delay. The length of the delay can be
/// changed with the [property@Gtk.SearchEntry:search-delay]
/// property.
public func searchChanged(_ searchChanged: @escaping () -> Void) -> Self {
var newSelf = self
newSelf.searchChanged = searchChanged
return newSelf
}
/// Emitted when the user initiated a search on the entry.
public func searchStarted(_ searchStarted: @escaping () -> Void) -> Self {
var newSelf = self
newSelf.searchStarted = searchStarted
return newSelf
}
/// Emitted when the user stops a search via keyboard input.
///
/// This is a [keybinding signal](class.SignalAction.html).
///
/// Applications should connect to it, to implement hiding
/// the search entry in this case.
///
/// The default bindings for this signal is Escape.
public func stopSearch(_ stopSearch: @escaping () -> Void) -> Self {
var newSelf = self
newSelf.stopSearch = stopSearch
return newSelf
}
}

View File

@ -2,7 +2,7 @@
// SpinRow.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw
@ -31,18 +31,6 @@ public struct SpinRow: Widget {
/// Additional appear functions for type extensions.
var appearFunctions: [(ViewStorage) -> Void] = []
/// The acceleration rate when you hold down a button or key.
var climbRate: Double
/// The number of decimal places to display.
var digits: UInt
/// Whether non-numeric characters should be ignored.
var numeric: Bool?
/// Whether invalid values are snapped to the nearest step increment.
var snapToTicks: Bool?
/// The current value.
var value: Binding<Double>?
/// Whether the spin row should wrap upon reaching its limits.
var wrap: Bool?
/// The widget to activate when the row is activated.
///
/// The row can be activated either by clicking on it, calling
@ -53,8 +41,16 @@ public struct SpinRow: Widget {
/// The target widget will be activated by emitting the
/// [signal@Gtk.Widget::mnemonic-activate] signal on it.
var activatableWidget: (() -> Body)?
/// The acceleration rate when you hold down a button or key.
var climbRate: Double
/// The number of decimal places to display.
var digits: UInt
/// The icon name for this row.
var iconName: String?
/// Whether non-numeric characters should be ignored.
var numeric: Bool?
/// Whether invalid values are snapped to the nearest step increment.
var snapToTicks: Bool?
/// The subtitle for this row.
///
/// The subtitle is interpreted as Pango markup unless
@ -69,15 +65,15 @@ public struct SpinRow: Widget {
///
/// See also [property@Gtk.Label:selectable].
var subtitleSelectable: Bool?
/// 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.
var titleLines: Int?
/// 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`.
var title: String?
/// 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.
var titleLines: Int?
/// Whether the user can copy the title from the label.
///
/// See also [property@Gtk.Label:selectable].
@ -90,6 +86,12 @@ public struct SpinRow: Widget {
var useMarkup: Bool?
/// Whether an embedded underline in the title indicates a mnemonic.
var useUnderline: Bool?
/// The current value.
var value: Binding<Double>?
/// Whether the spin row should wrap upon reaching its limits.
var wrap: Bool?
/// This signal is emitted after the row has been activated.
var activated: (() -> Void)?
/// Emitted to convert the user's input into a double value.
///
/// The signal handler is expected to use [method@Gtk.Editable.get_text] to
@ -107,8 +109,6 @@ public struct SpinRow: Widget {
///
/// See [signal@Gtk.SpinButton::wrapped].
var wrapped: (() -> Void)?
/// This signal is emitted after the row has been activated.
var activated: (() -> Void)?
/// The body for the widget "suffix".
var suffix: () -> Body = { [] }
/// The body for the widget "prefix".
@ -163,6 +163,11 @@ public struct SpinRow: Widget {
/// - modifiers: The view modifiers.
/// - 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", argCount: 0) {
activated()
}
}
if let input {
storage.connectSignal(name: "input", argCount: 1) {
input()
@ -178,36 +183,25 @@ public struct SpinRow: Widget {
wrapped()
}
}
if let activated {
storage.connectSignal(name: "activated", argCount: 0) {
activated()
}
}
storage.modify { widget in
if let widget = storage.content["activatableWidget"]?.first {
activatableWidget?().widget(modifiers: modifiers).update(widget, modifiers: modifiers, updateProperties: updateProperties)
}
if updateProperties {
adw_spin_row_set_climb_rate(widget, climbRate)
}
if updateProperties {
adw_spin_row_set_digits(widget, digits.cInt)
}
if let iconName, updateProperties {
adw_action_row_set_icon_name(widget?.cast(), iconName)
}
if let numeric, updateProperties {
adw_spin_row_set_numeric(widget, numeric.cBool)
}
if let snapToTicks, updateProperties {
adw_spin_row_set_snap_to_ticks(widget, snapToTicks.cBool)
}
if let value, updateProperties {
adw_spin_row_set_value(widget, value.wrappedValue)
}
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, updateProperties: updateProperties)
}
if let iconName, updateProperties {
adw_action_row_set_icon_name(widget?.cast(), iconName)
}
if let subtitle, updateProperties {
adw_action_row_set_subtitle(widget?.cast(), subtitle)
}
@ -217,12 +211,12 @@ public struct SpinRow: Widget {
if let subtitleSelectable, updateProperties {
adw_action_row_set_subtitle_selectable(widget?.cast(), subtitleSelectable.cBool)
}
if let titleLines, updateProperties {
adw_action_row_set_title_lines(widget?.cast(), titleLines.cInt)
}
if let title, updateProperties {
adw_preferences_row_set_title(widget?.cast(), title)
}
if let titleLines, updateProperties {
adw_action_row_set_title_lines(widget?.cast(), titleLines.cInt)
}
if let titleSelectable, updateProperties {
adw_preferences_row_set_title_selectable(widget?.cast(), titleSelectable.cBool)
}
@ -232,6 +226,12 @@ public struct SpinRow: Widget {
if let useUnderline, updateProperties {
adw_preferences_row_set_use_underline(widget?.cast(), useUnderline.cBool)
}
if let value, updateProperties {
adw_spin_row_set_value(widget, value.wrappedValue)
}
if let wrap, updateProperties {
adw_spin_row_set_wrap(widget, wrap.cBool)
}
}
@ -240,54 +240,6 @@ public struct SpinRow: Widget {
}
}
/// The acceleration rate when you hold down a button or key.
public func climbRate(_ climbRate: Double) -> Self {
var newSelf = self
newSelf.climbRate = climbRate
return newSelf
}
/// The number of decimal places to display.
public func digits(_ digits: UInt) -> Self {
var newSelf = self
newSelf.digits = digits
return newSelf
}
/// Whether non-numeric characters should be ignored.
public func numeric(_ numeric: Bool? = true) -> Self {
var newSelf = self
newSelf.numeric = numeric
return newSelf
}
/// Whether invalid values are snapped to the nearest step increment.
public func snapToTicks(_ snapToTicks: Bool? = true) -> Self {
var newSelf = self
newSelf.snapToTicks = snapToTicks
return newSelf
}
/// The current value.
public func value(_ value: Binding<Double>?) -> Self {
var newSelf = self
newSelf.value = value
return newSelf
}
/// Whether the spin row should wrap upon reaching its limits.
public func wrap(_ wrap: Bool? = true) -> Self {
var newSelf = self
newSelf.wrap = wrap
return newSelf
}
/// The widget to activate when the row is activated.
///
/// The row can be activated either by clicking on it, calling
@ -304,6 +256,22 @@ public struct SpinRow: Widget {
return newSelf
}
/// The acceleration rate when you hold down a button or key.
public func climbRate(_ climbRate: Double) -> Self {
var newSelf = self
newSelf.climbRate = climbRate
return newSelf
}
/// The number of decimal places to display.
public func digits(_ digits: UInt) -> Self {
var newSelf = self
newSelf.digits = digits
return newSelf
}
/// The icon name for this row.
public func iconName(_ iconName: String?) -> Self {
var newSelf = self
@ -312,6 +280,22 @@ public struct SpinRow: Widget {
return newSelf
}
/// Whether non-numeric characters should be ignored.
public func numeric(_ numeric: Bool? = true) -> Self {
var newSelf = self
newSelf.numeric = numeric
return newSelf
}
/// Whether invalid values are snapped to the nearest step increment.
public func snapToTicks(_ snapToTicks: Bool? = true) -> Self {
var newSelf = self
newSelf.snapToTicks = snapToTicks
return newSelf
}
/// The subtitle for this row.
///
/// The subtitle is interpreted as Pango markup unless
@ -344,16 +328,6 @@ public struct SpinRow: Widget {
return newSelf
}
/// 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.
public func titleLines(_ titleLines: Int?) -> Self {
var newSelf = self
newSelf.titleLines = titleLines
return newSelf
}
/// The title of the preference represented by this row.
///
/// The title is interpreted as Pango markup unless
@ -365,6 +339,16 @@ public struct SpinRow: Widget {
return newSelf
}
/// 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.
public func titleLines(_ titleLines: Int?) -> Self {
var newSelf = self
newSelf.titleLines = titleLines
return newSelf
}
/// Whether the user can copy the title from the label.
///
/// See also [property@Gtk.Label:selectable].
@ -395,6 +379,29 @@ public struct SpinRow: Widget {
return newSelf
}
/// The current value.
public func value(_ value: Binding<Double>?) -> Self {
var newSelf = self
newSelf.value = value
return newSelf
}
/// Whether the spin row should wrap upon reaching its limits.
public func wrap(_ wrap: Bool? = true) -> Self {
var newSelf = self
newSelf.wrap = wrap
return newSelf
}
/// This signal is emitted after the row has been activated.
public func activated(_ activated: @escaping () -> Void) -> Self {
var newSelf = self
newSelf.activated = activated
return newSelf
}
/// Emitted to convert the user's input into a double value.
///
/// The signal handler is expected to use [method@Gtk.Editable.get_text] to
@ -427,13 +434,6 @@ public struct SpinRow: Widget {
return newSelf
}
/// This signal is emitted after the row has been activated.
public func activated(_ activated: @escaping () -> Void) -> Self {
var newSelf = self
newSelf.activated = activated
return newSelf
}
/// Set the body for "suffix".
/// - Parameter body: The body.
/// - Returns: The widget.

View File

@ -2,7 +2,7 @@
// Spinner.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw
@ -30,6 +30,10 @@ public struct Spinner: Widget {
/// Additional appear functions for type extensions.
var appearFunctions: [(ViewStorage) -> Void] = []
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
var accessibleRole: String?
/// Whether the spinner is spinning
var spinning: Bool?
/// The application.
@ -73,6 +77,16 @@ public struct Spinner: Widget {
}
}
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
public func accessibleRole(_ accessibleRole: String?) -> Self {
var newSelf = self
newSelf.accessibleRole = accessibleRole
return newSelf
}
/// Whether the spinner is spinning
public func spinning(_ spinning: Bool? = true) -> Self {
var newSelf = self

View File

@ -2,7 +2,7 @@
// SplitButton.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// StatusPage.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// SwitchRow.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw
@ -35,8 +35,6 @@ public struct SwitchRow: Widget {
/// Additional appear functions for type extensions.
var appearFunctions: [(ViewStorage) -> Void] = []
/// Whether the switch row is in the "on" or "off" position.
var active: Binding<Bool>?
/// The widget to activate when the row is activated.
///
/// The row can be activated either by clicking on it, calling
@ -47,6 +45,8 @@ public struct SwitchRow: Widget {
/// The target widget will be activated by emitting the
/// [signal@Gtk.Widget::mnemonic-activate] signal on it.
var activatableWidget: (() -> Body)?
/// Whether the switch row is in the "on" or "off" position.
var active: Binding<Bool>?
/// The icon name for this row.
var iconName: String?
/// The subtitle for this row.
@ -63,15 +63,15 @@ public struct SwitchRow: Widget {
///
/// See also [property@Gtk.Label:selectable].
var subtitleSelectable: Bool?
/// 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.
var titleLines: Int?
/// 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`.
var title: String?
/// 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.
var titleLines: Int?
/// Whether the user can copy the title from the label.
///
/// See also [property@Gtk.Label:selectable].
@ -144,12 +144,12 @@ public struct SwitchRow: Widget {
}
}
storage.modify { widget in
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, updateProperties: updateProperties)
}
if let active, updateProperties {
adw_switch_row_set_active(widget, active.wrappedValue.cBool)
}
if let iconName, updateProperties {
adw_action_row_set_icon_name(widget?.cast(), iconName)
}
@ -162,12 +162,12 @@ public struct SwitchRow: Widget {
if let subtitleSelectable, updateProperties {
adw_action_row_set_subtitle_selectable(widget?.cast(), subtitleSelectable.cBool)
}
if let titleLines, updateProperties {
adw_action_row_set_title_lines(widget?.cast(), titleLines.cInt)
}
if let title, updateProperties {
adw_preferences_row_set_title(widget?.cast(), title)
}
if let titleLines, updateProperties {
adw_action_row_set_title_lines(widget?.cast(), titleLines.cInt)
}
if let titleSelectable, updateProperties {
adw_preferences_row_set_title_selectable(widget?.cast(), titleSelectable.cBool)
}
@ -185,14 +185,6 @@ public struct SwitchRow: Widget {
}
}
/// Whether the switch row is in the "on" or "off" position.
public func active(_ active: Binding<Bool>?) -> Self {
var newSelf = self
newSelf.active = active
return newSelf
}
/// The widget to activate when the row is activated.
///
/// The row can be activated either by clicking on it, calling
@ -209,6 +201,14 @@ public struct SwitchRow: Widget {
return newSelf
}
/// Whether the switch row is in the "on" or "off" position.
public func active(_ active: Binding<Bool>?) -> Self {
var newSelf = self
newSelf.active = active
return newSelf
}
/// The icon name for this row.
public func iconName(_ iconName: String?) -> Self {
var newSelf = self
@ -249,16 +249,6 @@ public struct SwitchRow: Widget {
return newSelf
}
/// 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.
public func titleLines(_ titleLines: Int?) -> Self {
var newSelf = self
newSelf.titleLines = titleLines
return newSelf
}
/// The title of the preference represented by this row.
///
/// The title is interpreted as Pango markup unless
@ -270,6 +260,16 @@ public struct SwitchRow: Widget {
return newSelf
}
/// 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.
public func titleLines(_ titleLines: Int?) -> Self {
var newSelf = self
newSelf.titleLines = titleLines
return newSelf
}
/// Whether the user can copy the title from the label.
///
/// See also [property@Gtk.Label:selectable].

View File

@ -2,7 +2,7 @@
// ToastOverlay.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// ToggleButton.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw
@ -90,6 +90,12 @@ public struct ToggleButton: Widget {
/// Additional appear functions for type extensions.
var appearFunctions: [(ViewStorage) -> Void] = []
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
var accessibleRole: String?
/// action-name
var actionName: String?
/// If the toggle button should be pressed in.
var active: Binding<Bool>?
/// Whether the size of the button can be made smaller than the natural
@ -111,8 +117,6 @@ public struct ToggleButton: Widget {
/// If set, an underline in the text indicates that the following character is
/// to be used as mnemonic.
var useUnderline: Bool?
/// Emitted whenever the `GtkToggleButton`'s state is changed.
var toggled: (() -> Void)?
/// Emitted to animate press then release.
///
/// This is an action signal. Applications should never connect
@ -123,6 +127,8 @@ public struct ToggleButton: Widget {
var activate: (() -> Void)?
/// Emitted when the button has been activated (pressed and released).
var clicked: (() -> Void)?
/// Emitted whenever the `GtkToggleButton`'s state is changed.
var toggled: (() -> Void)?
/// The application.
var app: GTUIApp?
/// The window.
@ -159,11 +165,6 @@ public struct ToggleButton: Widget {
/// - modifiers: The view modifiers.
/// - 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", argCount: 0) {
toggled()
}
}
if let activate {
storage.connectSignal(name: "activate", argCount: 0) {
activate()
@ -174,7 +175,15 @@ public struct ToggleButton: Widget {
clicked()
}
}
if let toggled {
storage.connectSignal(name: "toggled", argCount: 0) {
toggled()
}
}
storage.modify { widget in
if let actionName, updateProperties {
gtk_actionable_set_action_name(widget, actionName)
}
if let active, updateProperties {
gtk_toggle_button_set_active(widget?.cast(), active.wrappedValue.cBool)
}
@ -204,6 +213,24 @@ public struct ToggleButton: Widget {
}
}
/// The accessible role of the given `GtkAccessible` implementation.
///
/// The accessible role cannot be changed once set.
public func accessibleRole(_ accessibleRole: String?) -> Self {
var newSelf = self
newSelf.accessibleRole = accessibleRole
return newSelf
}
/// action-name
public func actionName(_ actionName: String?) -> Self {
var newSelf = self
newSelf.actionName = actionName
return newSelf
}
/// If the toggle button should be pressed in.
public func active(_ active: Binding<Bool>?) -> Self {
var newSelf = self
@ -267,13 +294,6 @@ public struct ToggleButton: Widget {
return newSelf
}
/// Emitted whenever the `GtkToggleButton`'s state is changed.
public func toggled(_ toggled: @escaping () -> Void) -> Self {
var newSelf = self
newSelf.toggled = toggled
return newSelf
}
/// Emitted to animate press then release.
///
/// This is an action signal. Applications should never connect
@ -294,4 +314,11 @@ public struct ToggleButton: Widget {
return newSelf
}
/// Emitted whenever the `GtkToggleButton`'s state is changed.
public func toggled(_ toggled: @escaping () -> Void) -> Self {
var newSelf = self
newSelf.toggled = toggled
return newSelf
}
}

View File

@ -2,7 +2,7 @@
// ToolbarView.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw

View File

@ -2,7 +2,7 @@
// WindowTitle.swift
// Adwaita
//
// Created by auto-generation on 12.02.24.
// Created by auto-generation on 14.02.24.
//
import CAdw

View File

@ -11,16 +11,16 @@ extension Class {
/// - Parameters:
/// - config: The widget configuration.
/// - genConfig: The generation configuration.
/// - classes: The available classes.
/// - namespace: The namespace.
/// - configs: The available widget configurations.
/// - Returns: The code.
func generateAdwaitaInitializer(
config: WidgetConfiguration,
genConfig: GenerationConfiguration,
classes: [Class],
namespace: Namespace,
configs: [WidgetConfiguration]
) -> String {
let requiredProperties = properties(classes: classes, configurations: configs)
let requiredProperties = properties(namespace: namespace, configurations: configs)
.filter { config.requiredProperties.contains($0.name) }
var initializer = "public init("
if config.dynamicWidget != nil {
@ -57,13 +57,13 @@ extension Class {
/// - Parameters:
/// - name: The class name.
/// - config: The widget configuration.
/// - classes: The available classes.
/// - namespace: The namespace.
/// - configs: The available widget configurations.
/// - Returns: The code.
func generateInitializer(
name: String,
config: WidgetConfiguration,
classes: [Class],
namespace: Namespace,
configs: [WidgetConfiguration]
) -> String {
if let initializer = config.initializer {
@ -81,25 +81,25 @@ extension Class {
/// - Parameters:
/// - config: The widget configuration.
/// - genConfig: The generation configuration.
/// - classes: The available classes.
/// - namespace: The namespace.
/// - configs: The available widget configurations.
/// - Returns: The code.
func generateWidgetAssignments(
config: WidgetConfiguration,
genConfig: GenerationConfiguration,
classes: [Class],
namespace: Namespace,
configs: [WidgetConfiguration]
) -> String {
var content = ""
for property in properties(classes: classes, configurations: configs)
for property in properties(namespace: namespace, configurations: configs)
where !config.excludeProperties.contains(property.name) && (property.type?.isWidget ?? false) {
content += property.generateWidgetAssignment(prefix: prefix(), config: config, genConfig: genConfig)
}
for property in properties(classes: classes, configurations: configs)
for property in properties(namespace: namespace, configurations: configs)
where !config.excludeProperties.contains(property.name) && (property.type?.isMenu ?? false) {
content += property.generateMenuAssignment(prefix: prefix(), config: config, genConfig: genConfig)
}
content += staticWidgets(classes: classes, configs: configs)
content += staticWidgets(namespace: namespace, configs: configs)
return content
}
@ -107,17 +107,17 @@ extension Class {
/// - Parameters:
/// - config: The widget configuration.
/// - genConfig: The generation configuration.
/// - classes: The available classes.
/// - namespace: The namespace.
/// - configs: The available widget configurations.
/// - Returns: The code.
func generateBindingAssignments(
config: WidgetConfiguration,
genConfig: GenerationConfiguration,
classes: [Class],
namespace: Namespace,
configs: [WidgetConfiguration]
) -> String {
var content = ""
for property in properties(classes: classes, configurations: configs) {
for property in properties(namespace: namespace, configurations: configs) {
if let binding = config.bindings.first(where: { $0.property == property.name }) {
content += property.generateBindingAssignment(
prefix: prefix(),
@ -134,21 +134,21 @@ extension Class {
/// - Parameters:
/// - config: The widget configuration.
/// - genConfig: The generation configuration.
/// - classes: The available classes.
/// - namespace: The namespace.
/// - configs: The available widget configurations.
/// - Returns: The code.
func generateProperties(
config: WidgetConfiguration,
genConfig: GenerationConfiguration,
classes: [Class],
namespace: Namespace,
configs: [WidgetConfiguration]
) -> String {
var content = ""
for property in properties(classes: classes, configurations: configs)
for property in properties(namespace: namespace, configurations: configs)
where !config.excludeProperties.contains(property.name) || config.requiredProperties.contains(property.name) {
content += property.generate(config: config, genConfig: genConfig)
}
for signal in signals(classes: classes) where !config.excludeSignals.contains(signal.name) {
for signal in signals(namespace: namespace) where !config.excludeSignals.contains(signal.name) {
content += signal.generateProperty(config: config, genConfig: genConfig)
}
if config.dynamicWidget != nil {
@ -160,7 +160,7 @@ extension Class {
var content: (Element) -> Body
"""
}
content += staticWidgetProperties(classes: classes, configs: configs)
content += staticWidgetProperties(namespace: namespace, configs: configs)
content += """
/// The application.
@ -175,17 +175,17 @@ extension Class {
/// - Parameters:
/// - config: The widget configuration.
/// - genConfig: The generation configuration.
/// - classes: The available classes.
/// - namespace: The namespace.
/// - configs: The available widget configurations.
/// - Returns: The code.
func generateModifications(
config: WidgetConfiguration,
genConfig: GenerationConfiguration,
classes: [Class],
namespace: Namespace,
configs: [WidgetConfiguration]
) -> String {
var content = ""
for property in properties(classes: classes, configurations: configs)
for property in properties(namespace: namespace, configurations: configs)
where !config.excludeProperties.contains(property.name) {
content += property.generateModification(config: config, genConfig: genConfig, prefix: prefix())
}
@ -255,15 +255,15 @@ extension Class {
/// - Parameters:
/// - config: The widget configuration.
/// - genConfig: The generation configuration.
/// - classes: The available classes.
/// - namespace: The namespace.
/// - Returns: The code.
func generateSignalModifications(
config: WidgetConfiguration,
genConfig: GenerationConfiguration,
classes: [Class]
namespace: Namespace
) -> String {
var content = ""
for signal in signals(classes: classes) where !config.excludeSignals.contains(signal.name) {
for signal in signals(namespace: namespace) where !config.excludeSignals.contains(signal.name) {
content += signal.generateModification(config: config, genConfig: genConfig)
}
return content
@ -273,56 +273,24 @@ extension Class {
/// - Parameters:
/// - config: The widget configuration.
/// - genConfig: The generation configuration.
/// - classes: The available classes.
/// - namespace: The namespace.
/// - configs: The available widget configurations.
/// - Returns: The code.
func generateModifiers(
config: WidgetConfiguration,
genConfig: GenerationConfiguration,
classes: [Class],
namespace: Namespace,
configs: [WidgetConfiguration]
) -> String {
var content = ""
for property in properties(classes: classes, configurations: configs)
for property in properties(namespace: namespace, configurations: configs)
where !config.excludeProperties.contains(property.name) {
content += property.generateModifier(config: config, genConfig: genConfig)
}
for signal in signals(classes: classes) where !config.excludeSignals.contains(signal.name) {
for signal in signals(namespace: namespace) where !config.excludeSignals.contains(signal.name) {
content += signal.generateModifier(config: config, genConfig: genConfig)
}
content += generateWidgetModifiers(config: config, configs: configs, classes: classes)
return content
}
/// Generate the modifiers for static widgets.
/// - Parameters:
/// - config: The widget configuration.
/// - configs: The available widget configurations.
/// - classes: The available classes.
/// - Returns: The code.
func generateWidgetModifiers(
config: WidgetConfiguration,
configs: [WidgetConfiguration],
classes: [Class]
) -> String {
var content = ""
for widget in config.staticWidgets {
content += """
/// Set the body for "\(widget.name)".
/// - Parameter body: The body.
/// - Returns: The widget.
public func \(widget.name)(@ViewBuilder _ body: @escaping () -> Body) -> Self {
var newSelf = self
newSelf.\(widget.name) = body
return newSelf
}
"""
}
if let parent = parentClass(classes: classes), let config = configs.first(where: { $0.class == parent.name }) {
print("Parent: \(parent.name), Self: \(self.name)")
content += parent.generateWidgetModifiers(config: config, configs: configs, classes: classes)
}
content += generateWidgetModifiers(config: config, configs: configs, namespace: namespace)
return content
}
}

View File

@ -8,7 +8,7 @@
import Foundation
/// A class.
struct Class: Decodable {
struct Class: ClassLike, Decodable {
/// The name of the class.
var name: String
@ -27,6 +27,8 @@ struct Class: Decodable {
var properties: [Property]
/// The available signals (callbacks).
var signals: [Signal]
/// Protocol conformances.
var conformances: [Conformance]
/// The coding keys for the class
enum CodingKeys: String, CodingKey {
@ -39,123 +41,23 @@ struct Class: Decodable {
case properties = "property"
/// Coding key
case signals = "glibSignal"
/// Coding key
case conformances = "implements"
}
/// Get the properties of the class and its parent classes.
/// - Parameters:
/// - classes: The classes in the namespace.
/// - configurations: The configurations for the classes in the namespace.
/// - Returns: The properties.
func properties(classes: [Self], configurations: [WidgetConfiguration]) -> [Property] {
if let parentClass = parentClass(classes: classes) {
return properties + parentClass
.properties(classes: classes, configurations: configurations)
.map { property in
var property = property
if property.prefix == nil {
property.prefix = parentClass.prefix()
property.cast = configurations.first { $0.class == parentClass.name }?.cast ?? false
}
return property
}
}
return properties
}
/// Get the signals of the class and its parent classes.
/// - Parameter classes: The classes in the namespace.
/// - Returns: The signals.
func signals(classes: [Self]) -> [Signal] {
if let parentClass = parentClass(classes: classes) {
return signals + parentClass.signals(classes: classes)
}
return signals
}
/// Get the assignments for the static widgets of the class and its parent classes.
/// - Parameters:
/// - classes: The classes in the namespace.
/// - configs: The configurations.
/// - Returns: The code.
func staticWidgets(classes: [Self], configs: [WidgetConfiguration]) -> String {
var content = ""
if let parentClass = parentClass(classes: classes) {
content += parentClass.staticWidgets(classes: classes, configs: configs)
}
guard let config = configs.first(where: { $0.class == name }) else {
return content
}
let widgetPointer = config.cast ? "storage.pointer?.cast()" : "storage.pointer"
for widget in config.staticWidgets {
content += """
var \(widget.name)Storage: [ViewStorage] = []
for view in \(widget.name)() {
\(widget.name)Storage.append(view.storage(modifiers: modifiers))
\(widget.add)(\(widgetPointer), \(widget.name)Storage.last?.pointer?.cast())
}
storage.content["\(widget.name)"] = \(widget.name)Storage
"""
}
return content
}
/// Get the code for the properties of the static widgets.
/// - Parameters:
/// - classes: The classes in the namespace.
/// - configs: The configurations.
/// - Returns: The code.
func staticWidgetProperties(classes: [Self], configs: [WidgetConfiguration]) -> String {
var content = ""
if let parentClass = parentClass(classes: classes) {
content += parentClass.staticWidgetProperties(classes: classes, configs: configs)
}
guard let config = configs.first(where: { $0.class == name }) else {
return content
}
for staticWidget in config.staticWidgets {
content += """
/// The body for the widget "\(staticWidget.name)".
var \(staticWidget.name): () -> Body = { [] }
"""
}
return content
}
/// Get the parent class.
/// - Parameter classes: The classes in the namespace.
/// - Returns: The class.
func parentClass(classes: [Self]) -> Self? {
if let parent = classes.first(where: { $0.name == parent }), parent.name != "Widget" {
return parent
}
return nil
}
/// Get the widget's prefix (e.g. "adw_preferences_row").
/// - Returns: The prefix.
func prefix() -> String {
if cType?.hasPrefix("Adw") ?? false {
return "adw_\(cSymbolPrefix)"
} else {
return "gtk_\(cSymbolPrefix)"
}
}
// swiftlint:disable function_body_length line_length
/// Generate the code for the class.
/// - Parameters:
/// - config: The widget configuration.
/// - genConfig: The generation configuration.
/// - classes: The available classes.
/// - namespace: The namespace.
/// - configs: The available widget configurations.
/// - Returns: The code.
func generate(
config: WidgetConfiguration,
genConfig: GenerationConfiguration,
classes: [Self],
namespace: Namespace,
configs: [WidgetConfiguration]
) -> String {
let dateFormatter = DateFormatter()
@ -185,19 +87,19 @@ struct Class: Decodable {
var updateFunctions: [(ViewStorage) -> Void] = []
/// Additional appear functions for type extensions.
var appearFunctions: [(ViewStorage) -> Void] = []
\(generateProperties(config: config, genConfig: genConfig, classes: classes, configs: configs))
\(generateProperties(config: config, genConfig: genConfig, namespace: namespace, configs: configs))
/// Initialize `\(widgetName)`.
\(generateAdwaitaInitializer(config: config, genConfig: genConfig, classes: classes, configs: configs))
\(generateAdwaitaInitializer(config: config, genConfig: genConfig, namespace: namespace, configs: configs))
/// Get the widget's view storage.
/// - Parameter modifiers: The view modifiers.
/// - Returns: The view storage.
public func container(modifiers: [(View) -> View]) -> ViewStorage {
let storage = ViewStorage(\(generateInitializer(name: widgetName, config: config, classes: classes, configs: configs))?.opaque())
let storage = ViewStorage(\(generateInitializer(name: widgetName, config: config, namespace: namespace, configs: configs))?.opaque())
update(storage, modifiers: modifiers, updateProperties: true)
\(generateWidgetAssignments(config: config, genConfig: genConfig, classes: classes, configs: configs))
\(generateBindingAssignments(config: config, genConfig: genConfig, classes: classes, configs: configs))
\(generateWidgetAssignments(config: config, genConfig: genConfig, namespace: namespace, configs: configs))
\(generateBindingAssignments(config: config, genConfig: genConfig, namespace: namespace, configs: configs))
for function in appearFunctions {
function(storage)
}
@ -209,16 +111,16 @@ struct Class: Decodable {
/// - storage: The view storage.
/// - modifiers: The view modifiers.
/// - 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))
public func update(_ storage: ViewStorage, modifiers: [(View) -> View], updateProperties: Bool) {\(generateSignalModifications(config: config, genConfig: genConfig, namespace: namespace))
storage.modify { widget in
\(generateModifications(config: config, genConfig: genConfig, classes: classes, configs: configs))
\(generateModifications(config: config, genConfig: genConfig, namespace: namespace, configs: configs))
\(generateDynamicWidgetUpdate(config: config, genConfig: genConfig))
}
for function in updateFunctions {
function(storage)
}
}
\(generateModifiers(config: config, genConfig: genConfig, classes: classes, configs: configs))
\(generateModifiers(config: config, genConfig: genConfig, namespace: namespace, configs: configs))
}
"""

View File

@ -0,0 +1,180 @@
//
// ClassLike.swift
// Adwaita
//
// Created by david-swift on 14.02.24.
//
/// Classes and interfaces share a lot of their properties.
protocol ClassLike {
/// The type name.
var name: String { get }
/// The C symbol prefix.
var cSymbolPrefix: String { get }
/// The C type.
var cType: String? { get }
/// The signals.
var signals: [Signal] { get }
/// The properties.
var properties: [Property] { get }
}
extension ClassLike {
/// Get the properties of the class and its parent classes.
/// - Parameters:
/// - namespace: The namespace.
/// - configurations: The configurations for the classes in the namespace.
/// - Returns: The properties.
func properties(namespace: Namespace, configurations: [WidgetConfiguration]) -> [Property] {
var properties = properties
for type in parentTypes(namespace: namespace) {
properties += type
.properties(namespace: namespace, configurations: configurations)
.map { property in
var property = property
if property.prefix == nil {
property.prefix = type.prefix()
property.cast = configurations.first { $0.class == type.name }?.cast ?? false
}
return property
}
}
return properties.reduce(into: [String: Property]()) { result, property in
result[property.name] = property
}
.values
.sorted { $0.name < $1.name }
}
/// Get the code for the properties of the static widgets.
/// - Parameters:
/// - namespace: The namespace.
/// - configs: The configurations.
/// - Returns: The code.
func staticWidgetProperties(namespace: Namespace, configs: [WidgetConfiguration]) -> String {
var content = ""
for type in parentTypes(namespace: namespace) {
content += type.staticWidgetProperties(namespace: namespace, configs: configs)
}
guard let config = configs.first(where: { $0.class == name }) else {
return content
}
for staticWidget in config.staticWidgets {
content += """
/// The body for the widget "\(staticWidget.name)".
var \(staticWidget.name): () -> Body = { [] }
"""
}
return content
}
/// Get the assignments for the static widgets of the class and its parent classes.
/// - Parameters:
/// - namespace: The namespace.
/// - configs: The configurations.
/// - Returns: The code.
func staticWidgets(namespace: Namespace, configs: [WidgetConfiguration]) -> String {
var content = ""
for type in parentTypes(namespace: namespace) {
content += type.staticWidgets(namespace: namespace, configs: configs)
}
guard let config = configs.first(where: { $0.class == name }) else {
return content
}
let widgetPointer = config.cast ? "storage.pointer?.cast()" : "storage.pointer"
for widget in config.staticWidgets {
content += """
var \(widget.name)Storage: [ViewStorage] = []
for view in \(widget.name)() {
\(widget.name)Storage.append(view.storage(modifiers: modifiers))
\(widget.add)(\(widgetPointer), \(widget.name)Storage.last?.pointer?.cast())
}
storage.content["\(widget.name)"] = \(widget.name)Storage
"""
}
return content
}
/// Generate the modifiers for static widgets.
/// - Parameters:
/// - config: The widget configuration.
/// - configs: The available widget configurations.
/// - namespace: The namespace.
/// - Returns: The code.
func generateWidgetModifiers(
config: WidgetConfiguration,
configs: [WidgetConfiguration],
namespace: Namespace
) -> String {
var content = ""
for widget in config.staticWidgets {
content += """
/// Set the body for "\(widget.name)".
/// - Parameter body: The body.
/// - Returns: The widget.
public func \(widget.name)(@ViewBuilder _ body: @escaping () -> Body) -> Self {
var newSelf = self
newSelf.\(widget.name) = body
return newSelf
}
"""
}
for type in parentTypes(namespace: namespace) {
if let config = configs.first(where: { $0.class == type.name }) {
content += type.generateWidgetModifiers(config: config, configs: configs, namespace: namespace)
}
}
return content
}
/// Get the signals of the class and its parent classes.
/// - Parameter namespace: The namespace.
/// - Returns: The signals.
func signals(namespace: Namespace) -> [Signal] {
var signals: [Signal] = signals
for type in parentTypes(namespace: namespace) {
signals += type.signals(namespace: namespace)
}
return signals.reduce(into: [String: Signal]()) { result, property in
result[property.name] = property
}
.values
.sorted { $0.name < $1.name }
}
/// Get the parent class and interfaces.
/// - Parameter namespace: The namespace in the namespace.
/// - Returns: The types.
func parentTypes(namespace: Namespace) -> [ClassLike] {
var types: [ClassLike] = []
guard let `class` = self as? Class else {
return types
}
if let parent = namespace.classes.first(where: { $0.name == `class`.parent }), parent.name != "Widget" {
types.append(parent)
}
for conformance in `class`.conformances {
if let type = namespace.interfaces.first(where: { $0.name == conformance.name }) {
types.append(type)
}
}
return types
}
/// Get the widget's prefix (e.g. "adw_preferences_row").
/// - Returns: The prefix.
func prefix() -> String {
if cType?.hasPrefix("Adw") ?? false {
return "adw_\(cSymbolPrefix)"
} else {
return "gtk_\(cSymbolPrefix)"
}
}
}

View File

@ -0,0 +1,14 @@
//
// Conformance.swift
// Adwaita
//
// Created by david-swift on 14.02.24.
//
/// A protocol conformance.
struct Conformance: Decodable {
/// The type name.
var name: String
}

View File

@ -0,0 +1,35 @@
//
// Interface.swift
// Adwaita
//
// Created by david-swift on 14.02.24.
//
/// An interface (protocol).
struct Interface: ClassLike, Decodable {
/// The type's name.
var name: String
/// The C symbol prefix.
var cSymbolPrefix: String
/// The C type.
var cType: String?
/// The signals.
var signals: [Signal]
/// The properties.
var properties: [Property]
/// The coding keys.
enum CodingKeys: String, CodingKey {
/// Coding key.
case name, cSymbolPrefix, cType
/// Coding key.
case signals = "glibSignal"
/// Coding key
case properties = "property"
}
}

View File

@ -10,12 +10,16 @@ struct Namespace: Decodable {
/// The classes.
var classes: [Class]
/// The interfaces (protocols).
var interfaces: [Interface]
/// The coding keys.
enum CodingKeys: String, CodingKey {
/// Coding key.
case classes = "class"
/// Coding key.
case interfaces = "interface"
}

View File

@ -150,7 +150,7 @@ struct Property: Decodable {
onlySetConditionsIndentation = " "
onlySetConditionsEnd = "\n }"
}
if config.bindings.contains { $0.property == self.name } {
if config.bindings.contains(where: { $0.property == self.name }) {
return """
if let \(name)\(setConditions), updateProperties {
\(setter)(\(widget), \(name).wrappedValue\(propertyString))

View File

@ -23,24 +23,26 @@ struct Generation {
/// The main function.
func run() throws {
removeOldFiles()
let gtkDefinitions = getDefinitions(path: configuration.gtkGirFilePath)
let adwDefinitions = getDefinitions(path: configuration.adwGirFilePath)
for `class` in gtkDefinitions?.namespace.classes ?? [] {
guard let gtkDefinitions = getDefinitions(path: configuration.gtkGirFilePath),
let adwDefinitions = getDefinitions(path: configuration.adwGirFilePath) else {
return
}
for `class` in gtkDefinitions.namespace.classes {
if let config = configuration.gtkWidgets.first(where: { $0.class == `class`.name }) {
createFile(
class: `class`,
config: config,
classes: gtkDefinitions?.namespace.classes ?? [],
namespace: gtkDefinitions.namespace,
configs: configuration.gtkWidgets
)
}
}
for `class` in adwDefinitions?.namespace.classes ?? [] {
for `class` in adwDefinitions.namespace.classes {
if let config = configuration.adwWidgets.first(where: { $0.class == `class`.name }) {
createFile(
class: `class`,
config: config,
classes: adwDefinitions?.namespace.classes ?? [],
namespace: adwDefinitions.namespace,
configs: configuration.adwWidgets
)
}
@ -89,13 +91,13 @@ struct Generation {
/// - Parameters:
/// - class: The class.
/// - config: The widget configuration.
/// - classes: All the available classes.
/// - namespace: The namespace.
/// - configs: All the available configs.
func createFile(`class`: Class, config: WidgetConfiguration, classes: [Class], configs: [WidgetConfiguration]) {
func createFile(`class`: Class, config: WidgetConfiguration, namespace: Namespace, configs: [WidgetConfiguration]) {
print("Generating \(config.name ?? `class`.name).swift")
let path = "\(configuration.folder)\(config.name ?? config.class).swift"
let data = `class`
.generate(config: config, genConfig: configuration, classes: classes, configs: configs)
.generate(config: config, genConfig: configuration, namespace: namespace, configs: configs)
.data(using: .utf8)
try? data?.write(to: .init(fileURLWithPath: path))
}

View File

@ -7,6 +7,8 @@
import Foundation
// swiftlint:disable type_body_length
/// The configuration for the generation.
struct GenerationConfiguration {
@ -15,6 +17,11 @@ struct GenerationConfiguration {
/// The directory containing the GIR files.
static let girFilePath = "\(includeDir)/../share/gir-1.0/"
/// Exclude properties of buttons.
static var excludeButtons: [String] {
["action-target", "related-action"]
}
/// The Gtk GIR file.
var gtkGirFilePath = girFilePath + "Gtk-4.0.gir"
/// The Adw GIR file.
@ -161,11 +168,11 @@ struct GenerationConfiguration {
.init(name: "prepend", add: "gtk_box_prepend")
],
requiredProperties: ["spacing"],
excludeProperties: ["baseline-position"],
excludeProperties: ["baseline-position", "orientation"],
cast: true
),
.init(class: "Spinner"),
.init(class: "LevelBar", excludeProperties: ["mode"]),
.init(class: "LevelBar", excludeProperties: ["mode", "orientation"]),
.init(
class: "ListBox",
dynamicWidget: .init(
@ -175,12 +182,17 @@ struct GenerationConfiguration {
),
excludeProperties: ["selection-mode"]
),
.init(class: "ProgressBar", excludeProperties: ["ellipsize"]),
.init(class: "Button", cast: true, setConditions: ["label": "storage.content[\"child\"] == nil"]),
.init(class: "ProgressBar", excludeProperties: ["ellipsize", "orientation"]),
.init(
class: "Button",
excludeProperties: excludeButtons,
cast: true,
setConditions: ["label": "storage.content[\"child\"] == nil"]
),
.init(
class: "ToggleButton",
bindings: [.init(property: "active")],
excludeProperties: ["group"],
excludeProperties: ["group"] + excludeButtons,
cast: true,
setConditions: ["label": "storage.content[\"child\"] == nil"]
),
@ -188,13 +200,14 @@ struct GenerationConfiguration {
class: "LinkButton",
initializer: "gtk_link_button_new(uri)",
requiredProperties: ["uri"],
excludeProperties: excludeButtons,
excludeSignals: ["activate-link"],
setConditions: ["label": "storage.content[\"child\"] == nil"]
),
.init(
class: "CheckButton",
bindings: [.init(property: "active")],
excludeProperties: ["group"],
excludeProperties: ["group"] + excludeButtons,
cast: true,
setConditions: ["label": "storage.content[\"child\"] == nil"]
),
@ -202,12 +215,12 @@ struct GenerationConfiguration {
class: "MenuButton",
name: "Menu",
bindings: [.init(property: "active")],
excludeProperties: ["direction", "popover"],
excludeProperties: ["direction", "popover"] + excludeButtons,
setConditions: ["label": "storage.content[\"child\"] == nil"]
),
.init(
class: "CenterBox",
excludeProperties: ["baseline-position"]
excludeProperties: ["baseline-position", "orientation"]
),
.init(
class: "ScrolledWindow",
@ -228,8 +241,10 @@ struct GenerationConfiguration {
remove: "gtk_flow_box_remove",
getElement: "gtk_flow_box_get_child_at_index(widget, index.cInt)?.cast()"
),
excludeProperties: ["selection-mode"]
)
excludeProperties: ["selection-mode", "orientation"]
),
.init(class: "SearchEntry", bindings: [.init(property: "text")]),
.init(class: "SearchBar")
]
/// The unshortening map.
@ -270,7 +285,10 @@ struct GenerationConfiguration {
/// Modifications for converting a C into a Swift type.
var getterTypeConversions: [String: (String) -> String] = [
"gboolean": { "\($0) != 0" },
"guint": { ".init(\($0))" }
"guint": { ".init(\($0))" },
"utf8": { ".init(cString: \($0))" }
]
}
// swiftlint:enable type_body_length