Replace modifiers by new widget data
This commit is contained in:
parent
9f83b2309f
commit
fa344522a2
@ -39,24 +39,23 @@ public struct MenuButton: MenuWidget {
|
||||
/// - type: The type of the views.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(
|
||||
modifiers: [(any AnyView) -> any AnyView],
|
||||
data: WidgetData,
|
||||
type: Data.Type
|
||||
) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(nil)
|
||||
let getItem: (AdwaitaApp, AdwaitaWindow?) -> OpaquePointer? = { app, window in
|
||||
var label = filteredLabel
|
||||
storage.fields["app"] = app
|
||||
if let window, preferApplicationWindow {
|
||||
app.addKeyboardShortcut(shortcut, id: filteredLabel, window: window, handler: handler)
|
||||
label = "win." + label
|
||||
storage.fields["window"] = window
|
||||
} else {
|
||||
app.addKeyboardShortcut(shortcut, id: filteredLabel, handler: handler)
|
||||
label = "app." + label
|
||||
}
|
||||
return g_menu_item_new(self.label, label)
|
||||
var label = filteredLabel
|
||||
guard let app = data.appStorage as? AdwaitaApp else {
|
||||
return .init(nil)
|
||||
}
|
||||
storage.pointer = getItem
|
||||
if let window = data.sceneStorage.pointer as? AdwaitaWindow, preferApplicationWindow {
|
||||
app.addKeyboardShortcut(shortcut, id: filteredLabel, window: window, handler: handler)
|
||||
label = "win." + label
|
||||
} else {
|
||||
app.addKeyboardShortcut(shortcut, id: filteredLabel, handler: handler)
|
||||
label = "app." + label
|
||||
}
|
||||
let pointer = g_menu_item_new(self.label, label)
|
||||
storage.pointer = pointer
|
||||
return storage
|
||||
}
|
||||
|
||||
@ -68,14 +67,14 @@ public struct MenuButton: MenuWidget {
|
||||
/// - type: The type of the views.
|
||||
public func update<Data>(
|
||||
_ storage: ViewStorage,
|
||||
modifiers: [(AnyView) -> AnyView],
|
||||
data: WidgetData,
|
||||
updateProperties: Bool,
|
||||
type: Data.Type
|
||||
) where Data: ViewRenderData {
|
||||
guard let app = storage.fields["app"] as? AdwaitaApp else {
|
||||
guard let app = data.appStorage as? AdwaitaApp else {
|
||||
return
|
||||
}
|
||||
if let window = storage.fields["window"] as? AdwaitaWindow, preferApplicationWindow {
|
||||
if let window = data.sceneStorage.pointer as? AdwaitaWindow, preferApplicationWindow {
|
||||
app.addKeyboardShortcut(shortcut, id: filteredLabel, window: window, handler: handler)
|
||||
} else {
|
||||
app.addKeyboardShortcut(shortcut, id: filteredLabel, handler: handler)
|
||||
|
@ -26,10 +26,10 @@ public struct MenuCollection: MenuWidget, Wrapper {
|
||||
/// - type: The type of the views.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(
|
||||
modifiers: [(any AnyView) -> any AnyView],
|
||||
data: WidgetData,
|
||||
type: Data.Type
|
||||
) -> ViewStorage where Data: ViewRenderData {
|
||||
let storages = content.storages(modifiers: modifiers, type: type)
|
||||
let storages = content.storages(data: data, type: type)
|
||||
return .init(nil, content: [.mainContent: storages])
|
||||
}
|
||||
|
||||
@ -41,25 +41,25 @@ public struct MenuCollection: MenuWidget, Wrapper {
|
||||
/// - type: The type of the views.
|
||||
public func update<Data>(
|
||||
_ storage: ViewStorage,
|
||||
modifiers: [(AnyView) -> AnyView],
|
||||
data: WidgetData,
|
||||
updateProperties: Bool,
|
||||
type: Data.Type
|
||||
) where Data: ViewRenderData {
|
||||
guard let storages = storage.content[.mainContent] else {
|
||||
return
|
||||
}
|
||||
content.update(storages, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
content.update(storages, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
|
||||
/// Render the collection as a menu.
|
||||
/// - Parameters:
|
||||
/// - app: The app object.
|
||||
/// - window: The window object.
|
||||
/// - Parameter data: The widget data.
|
||||
/// - Returns: The view storage with the GMenu as the pointer.
|
||||
public func getMenu(app: AdwaitaApp, window: AdwaitaWindow?) -> ViewStorage {
|
||||
public func getMenu(data: WidgetData) -> ViewStorage {
|
||||
let menu = g_menu_new()
|
||||
let storage = container(modifiers: [], type: MenuContext.self)
|
||||
initializeMenu(menu: menu, storage: storage, app: app, window: window)
|
||||
let storage = container(data: data.noModifiers, type: MenuContext.self)
|
||||
if let app = data.appStorage as? AdwaitaApp, let window = data.sceneStorage.pointer as? AdwaitaWindow {
|
||||
initializeMenu(menu: menu, storage: storage, app: app, window: window)
|
||||
}
|
||||
storage.pointer = menu
|
||||
return storage
|
||||
}
|
||||
@ -71,14 +71,13 @@ public struct MenuCollection: MenuWidget, Wrapper {
|
||||
/// - app: The app object.
|
||||
/// - window: The window object.
|
||||
func initializeMenu(menu: OpaquePointer?, storage: ViewStorage, app: AdwaitaApp, window: AdwaitaWindow?) {
|
||||
if storage.pointer == nil {
|
||||
if let item = storage.opaquePointer {
|
||||
g_menu_append_item(menu, item)
|
||||
storage.pointer = item
|
||||
} else {
|
||||
for element in storage.content[.mainContent] ?? [] {
|
||||
initializeMenu(menu: menu, storage: element, app: app, window: window)
|
||||
}
|
||||
} else if let item = (storage.pointer as? (AdwaitaApp, AdwaitaWindow?) -> OpaquePointer?) {
|
||||
let item = item(app, window)
|
||||
g_menu_append_item(menu, item)
|
||||
storage.pointer = item
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,16 +25,14 @@ public struct MenuSection: MenuWidget {
|
||||
/// - type: The type of the views.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(
|
||||
modifiers: [(any AnyView) -> any AnyView],
|
||||
data: WidgetData,
|
||||
type: Data.Type
|
||||
) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(nil)
|
||||
let getItem: (AdwaitaApp, AdwaitaWindow?) -> OpaquePointer? = { app, window in
|
||||
let childStorage = MenuCollection { sectionContent }.getMenu(app: app, window: window)
|
||||
storage.content[.mainContent] = [childStorage]
|
||||
return g_menu_item_new_section(nil, childStorage.opaquePointer?.cast())
|
||||
}
|
||||
storage.pointer = getItem
|
||||
let childStorage = MenuCollection { sectionContent }.getMenu(data: data)
|
||||
storage.content[.mainContent] = [childStorage]
|
||||
let pointer = g_menu_item_new_section(nil, childStorage.opaquePointer?.cast())
|
||||
storage.pointer = pointer
|
||||
return storage
|
||||
}
|
||||
|
||||
@ -46,7 +44,7 @@ public struct MenuSection: MenuWidget {
|
||||
/// - type: The type of the views.
|
||||
public func update<Data>(
|
||||
_ storage: ViewStorage,
|
||||
modifiers: [(AnyView) -> AnyView],
|
||||
data: WidgetData,
|
||||
updateProperties: Bool,
|
||||
type: Data.Type
|
||||
) where Data: ViewRenderData {
|
||||
@ -54,7 +52,7 @@ public struct MenuSection: MenuWidget {
|
||||
return
|
||||
}
|
||||
MenuCollection { sectionContent }
|
||||
.updateStorage(content, modifiers: [], updateProperties: updateProperties, type: MenuContext.self)
|
||||
.updateStorage(content, data: data, updateProperties: updateProperties, type: MenuContext.self)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,16 +30,14 @@ public struct Submenu: MenuWidget {
|
||||
/// - type: The type of the views.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(
|
||||
modifiers: [(any AnyView) -> any AnyView],
|
||||
data: WidgetData,
|
||||
type: Data.Type
|
||||
) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(nil)
|
||||
let getItem: (AdwaitaApp, AdwaitaWindow?) -> OpaquePointer? = { app, window in
|
||||
let childStorage = MenuCollection { content }.getMenu(app: app, window: window)
|
||||
storage.content[.mainContent] = [childStorage]
|
||||
return g_menu_item_new_submenu(label, childStorage.opaquePointer?.cast())
|
||||
}
|
||||
storage.pointer = getItem
|
||||
let childStorage = MenuCollection { content }.getMenu(data: data)
|
||||
storage.content[.mainContent] = [childStorage]
|
||||
let pointer = g_menu_item_new_submenu(label, childStorage.opaquePointer?.cast())
|
||||
storage.pointer = pointer
|
||||
return storage
|
||||
}
|
||||
|
||||
@ -51,7 +49,7 @@ public struct Submenu: MenuWidget {
|
||||
/// - type: The type of the views.
|
||||
public func update<Data>(
|
||||
_ storage: ViewStorage,
|
||||
modifiers: [(AnyView) -> AnyView],
|
||||
data: WidgetData,
|
||||
updateProperties: Bool,
|
||||
type: Data.Type
|
||||
) where Data: ViewRenderData {
|
||||
@ -59,7 +57,7 @@ public struct Submenu: MenuWidget {
|
||||
return
|
||||
}
|
||||
MenuCollection { self.content }
|
||||
.updateStorage(content, modifiers: [], updateProperties: updateProperties, type: MenuContext.self)
|
||||
.updateStorage(content, data: data, updateProperties: updateProperties, type: MenuContext.self)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,9 +37,9 @@ struct AboutDialog: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = child.storage(modifiers: modifiers, type: type)
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = child.storage(data: data, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
return storage
|
||||
}
|
||||
|
||||
@ -51,11 +51,11 @@ struct AboutDialog: AdwaitaWidget {
|
||||
/// - type: The type of the app storage.
|
||||
func update<Data>(
|
||||
_ storage: ViewStorage,
|
||||
modifiers: [(AnyView) -> AnyView],
|
||||
data: WidgetData,
|
||||
updateProperties: Bool,
|
||||
type: Data.Type
|
||||
) where Data: ViewRenderData {
|
||||
child.updateStorage(storage, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
child.updateStorage(storage, data: data, updateProperties: updateProperties, type: type)
|
||||
guard updateProperties, (storage.previousState as? Self)?.visible != visible else {
|
||||
return
|
||||
}
|
||||
|
@ -77,11 +77,11 @@ public struct AlertDialog: AdwaitaWidget {
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(
|
||||
modifiers: [(AnyView) -> AnyView],
|
||||
data: WidgetData,
|
||||
type: Data.Type
|
||||
) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = child.storage(modifiers: modifiers, type: type)
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
let storage = child.storage(data: data, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
return storage
|
||||
}
|
||||
|
||||
@ -93,12 +93,12 @@ public struct AlertDialog: AdwaitaWidget {
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(
|
||||
_ storage: ViewStorage,
|
||||
modifiers: [(AnyView) -> AnyView],
|
||||
data: WidgetData,
|
||||
updateProperties: Bool,
|
||||
type: Data.Type
|
||||
) where Data: ViewRenderData {
|
||||
storage.fields[Self.visibleID + id] = _visible
|
||||
child.updateStorage(storage, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
child.updateStorage(storage, data: data, updateProperties: updateProperties, type: type)
|
||||
guard updateProperties else {
|
||||
return
|
||||
}
|
||||
|
@ -35,10 +35,10 @@ struct Dialog: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let child = child.storage(modifiers: modifiers, type: type)
|
||||
func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let child = child.storage(data: data, type: type)
|
||||
let storage = ViewStorage(child.opaquePointer, content: [.mainContent: [child]])
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
return storage
|
||||
}
|
||||
|
||||
@ -50,23 +50,23 @@ struct Dialog: AdwaitaWidget {
|
||||
/// - type: The type of the app storage.
|
||||
func update<Data>(
|
||||
_ storage: ViewStorage,
|
||||
modifiers: [(AnyView) -> AnyView],
|
||||
data: WidgetData,
|
||||
updateProperties: Bool,
|
||||
type: Data.Type
|
||||
) where Data: ViewRenderData {
|
||||
if let storage = storage.content[.mainContent]?.first {
|
||||
child.updateStorage(storage, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
child.updateStorage(storage, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let storage = storage.content[contentID + id]?.first {
|
||||
content
|
||||
.updateStorage(storage, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
.updateStorage(storage, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
guard updateProperties else {
|
||||
return
|
||||
}
|
||||
if visible {
|
||||
if storage.content[dialogID + id]?.first == nil {
|
||||
createDialog(storage: storage, modifiers: modifiers, type: type)
|
||||
createDialog(storage: storage, data: data, type: type)
|
||||
adw_dialog_present(
|
||||
storage.content[dialogID + id]?.first?.opaquePointer?.cast(),
|
||||
storage.opaquePointer?.cast()
|
||||
@ -96,13 +96,13 @@ struct Dialog: AdwaitaWidget {
|
||||
/// - type: The view render data type.
|
||||
func createDialog<Data>(
|
||||
storage: ViewStorage,
|
||||
modifiers: [(AnyView) -> AnyView],
|
||||
data: WidgetData,
|
||||
type: Data.Type
|
||||
) where Data: ViewRenderData {
|
||||
let pointer = adw_dialog_new()
|
||||
let dialog = ViewStorage(pointer?.opaque())
|
||||
storage.content[dialogID + id] = [dialog]
|
||||
let contentStorage = content.storage(modifiers: modifiers, type: type)
|
||||
let contentStorage = content.storage(data: data, type: type)
|
||||
adw_dialog_set_child(pointer, contentStorage.opaquePointer?.cast())
|
||||
storage.content[contentID + id] = [contentStorage]
|
||||
dialog.connectSignal(name: "closed") {
|
||||
|
@ -33,10 +33,10 @@ struct FileDialog: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let child = child.storage(modifiers: modifiers, type: type)
|
||||
func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let child = child.storage(data: data, type: type)
|
||||
let storage = ViewStorage(child.opaquePointer, content: [.mainContent: [child]])
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
return storage
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ struct FileDialog: AdwaitaWidget {
|
||||
/// - type: The type of the app storage.
|
||||
func update<Data>(
|
||||
_ storage: ViewStorage,
|
||||
modifiers: [(AnyView) -> AnyView],
|
||||
data: WidgetData,
|
||||
updateProperties: Bool,
|
||||
type: Data.Type
|
||||
) where Data: ViewRenderData {
|
||||
@ -57,7 +57,7 @@ struct FileDialog: AdwaitaWidget {
|
||||
guard let mainStorage = storage.content[.mainContent]?.first else {
|
||||
return
|
||||
}
|
||||
child.updateStorage(storage, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
child.updateStorage(storage, data: data, updateProperties: updateProperties, type: type)
|
||||
if open.update, storage.fields["callbacks"] == nil {
|
||||
let pointer = gtk_file_dialog_new()
|
||||
if let initialName {
|
||||
|
@ -23,8 +23,8 @@ extension Fixed {
|
||||
@ViewBuilder view: @escaping () -> Body
|
||||
) -> Self {
|
||||
var newSelf = self
|
||||
newSelf.appearFunctions.append { storage, modifiers in
|
||||
let view = view().storage(modifiers: modifiers, type: AdwaitaMainView.self)
|
||||
newSelf.appearFunctions.append { storage, data in
|
||||
let view = view().storage(data: data, type: AdwaitaMainView.self)
|
||||
gtk_fixed_put(
|
||||
storage.opaquePointer?.cast(),
|
||||
view.opaquePointer?.cast(),
|
||||
@ -33,14 +33,14 @@ extension Fixed {
|
||||
)
|
||||
storage.content[id] = [view]
|
||||
}
|
||||
newSelf.updateFunctions.append { storage, modifiers, updateProperties in
|
||||
newSelf.updateFunctions.append { storage, data, updateProperties in
|
||||
guard let content = storage.content[id]?.first else {
|
||||
return
|
||||
}
|
||||
view()
|
||||
.updateStorage(
|
||||
content,
|
||||
modifiers: modifiers,
|
||||
data: data,
|
||||
updateProperties: updateProperties,
|
||||
type: AdwaitaMainView.self
|
||||
)
|
||||
|
@ -31,13 +31,13 @@ public struct ForEach<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(
|
||||
modifiers: [(AnyView) -> AnyView],
|
||||
data: WidgetData,
|
||||
type: Data.Type
|
||||
) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(
|
||||
gtk_box_new(horizontal ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, 0)?.opaque()
|
||||
)
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
return storage
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ public struct ForEach<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(
|
||||
_ storage: ViewStorage,
|
||||
modifiers: [(AnyView) -> AnyView],
|
||||
data: WidgetData,
|
||||
updateProperties: Bool,
|
||||
type: Data.Type
|
||||
) where Data: ViewRenderData {
|
||||
@ -59,7 +59,7 @@ public struct ForEach<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
old.identifiableTransform(
|
||||
to: elements,
|
||||
functions: .init { index, element in
|
||||
let child = content(element).storage(modifiers: modifiers, type: type)
|
||||
let child = content(element).storage(data: data, type: type)
|
||||
gtk_box_remove(widget, contentStorage[safe: index]?.opaquePointer?.cast())
|
||||
gtk_box_insert_child_after(
|
||||
widget,
|
||||
@ -72,7 +72,7 @@ public struct ForEach<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
gtk_box_remove(widget, contentStorage[safe: index]?.opaquePointer?.cast())
|
||||
contentStorage.remove(at: index)
|
||||
} insert: { index, element in
|
||||
let child = content(element).storage(modifiers: modifiers, type: type)
|
||||
let child = content(element).storage(data: data, type: type)
|
||||
gtk_box_insert_child_after(
|
||||
widget,
|
||||
child.opaquePointer?.cast(),
|
||||
@ -93,7 +93,7 @@ public struct ForEach<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
content(element)
|
||||
.updateStorage(
|
||||
contentStorage[index],
|
||||
modifiers: modifiers,
|
||||
data: data,
|
||||
updateProperties: updateProperties,
|
||||
type: type
|
||||
)
|
||||
|
@ -2,7 +2,7 @@
|
||||
// ActionRow.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -47,9 +47,9 @@ import LevenshteinTransformations
|
||||
public struct ActionRow: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The widget to activate when the row is activated.
|
||||
///
|
||||
@ -102,10 +102,6 @@ public struct ActionRow: AdwaitaWidget {
|
||||
var suffix: () -> Body = { [] }
|
||||
/// The body for the widget "prefix".
|
||||
var prefix: () -> Body = { [] }
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `ActionRow`.
|
||||
public init() {
|
||||
@ -116,26 +112,26 @@ public struct ActionRow: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_action_row_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let activatableWidgetStorage = activatableWidget?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let activatableWidgetStorage = activatableWidget?().storage(data: data, type: type) {
|
||||
storage.content["activatableWidget"] = [activatableWidgetStorage]
|
||||
adw_action_row_set_activatable_widget(storage.opaquePointer?.cast(), activatableWidgetStorage.opaquePointer?.cast())
|
||||
}
|
||||
|
||||
var suffixStorage: [ViewStorage] = []
|
||||
for view in suffix() {
|
||||
suffixStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
suffixStorage.append(view.storage(data: data, type: type))
|
||||
adw_action_row_add_suffix(storage.opaquePointer?.cast(), suffixStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["suffix"] = suffixStorage
|
||||
var prefixStorage: [ViewStorage] = []
|
||||
for view in prefix() {
|
||||
prefixStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
prefixStorage.append(view.storage(data: data, type: type))
|
||||
adw_action_row_add_prefix(storage.opaquePointer?.cast(), prefixStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["prefix"] = prefixStorage
|
||||
@ -148,7 +144,7 @@ public struct ActionRow: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
if let activated {
|
||||
storage.connectSignal(name: "activated", argCount: 0) {
|
||||
activated()
|
||||
@ -157,7 +153,7 @@ public struct ActionRow: AdwaitaWidget {
|
||||
storage.modify { widget in
|
||||
|
||||
if let widget = storage.content["activatableWidget"]?.first {
|
||||
activatableWidget?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
activatableWidget?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let subtitleLines, updateProperties, (storage.previousState as? Self)?.subtitleLines != subtitleLines {
|
||||
adw_action_row_set_subtitle_lines(widget?.cast(), subtitleLines.cInt)
|
||||
@ -189,7 +185,7 @@ public struct ActionRow: AdwaitaWidget {
|
||||
if let storage = suffixStorage[safe: index] {
|
||||
view.updateStorage(
|
||||
storage,
|
||||
modifiers: modifiers,
|
||||
data: data,
|
||||
updateProperties: updateProperties,
|
||||
type: type
|
||||
)
|
||||
@ -201,7 +197,7 @@ public struct ActionRow: AdwaitaWidget {
|
||||
if let storage = prefixStorage[safe: index] {
|
||||
view.updateStorage(
|
||||
storage,
|
||||
modifiers: modifiers,
|
||||
data: data,
|
||||
updateProperties: updateProperties,
|
||||
type: type
|
||||
)
|
||||
@ -211,7 +207,7 @@ public struct ActionRow: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// AspectFrame.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -25,9 +25,9 @@ import LevenshteinTransformations
|
||||
public struct AspectFrame: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The accessible role of the given `GtkAccessible` implementation.
|
||||
///
|
||||
@ -46,10 +46,6 @@ public struct AspectFrame: AdwaitaWidget {
|
||||
var xalign: Float?
|
||||
/// The vertical alignment of the child.
|
||||
var yalign: Float?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `AspectFrame`.
|
||||
public init(ratio: Float) {
|
||||
@ -61,13 +57,13 @@ public struct AspectFrame: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(gtk_aspect_frame_new(0.5, 0.5, ratio, 0)?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(data: data, type: type) {
|
||||
storage.content["child"] = [childStorage]
|
||||
gtk_aspect_frame_set_child(storage.opaquePointer, childStorage.opaquePointer?.cast())
|
||||
}
|
||||
@ -81,11 +77,11 @@ public struct AspectFrame: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
if let widget = storage.content["child"]?.first {
|
||||
child?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let obeyChild, updateProperties, (storage.previousState as? Self)?.obeyChild != obeyChild {
|
||||
gtk_aspect_frame_set_obey_child(widget, obeyChild.cBool)
|
||||
@ -103,7 +99,7 @@ public struct AspectFrame: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Avatar.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -31,9 +31,9 @@ import LevenshteinTransformations
|
||||
public struct Avatar: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The name of an icon to use as a fallback.
|
||||
///
|
||||
@ -50,10 +50,6 @@ public struct Avatar: AdwaitaWidget {
|
||||
/// It's only used to generate the color if [property@Avatar:show-initials] is
|
||||
/// `FALSE`.
|
||||
var text: String?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `Avatar`.
|
||||
public init(showInitials: Bool, size: Int) {
|
||||
@ -66,12 +62,12 @@ public struct Avatar: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_avatar_new(size.cInt, text, showInitials.cBool)?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
|
||||
return storage
|
||||
}
|
||||
@ -82,7 +78,7 @@ public struct Avatar: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
if let iconName, updateProperties, (storage.previousState as? Self)?.iconName != iconName {
|
||||
@ -101,7 +97,7 @@ public struct Avatar: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Banner.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -30,9 +30,9 @@ import LevenshteinTransformations
|
||||
public struct Banner: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The label to show on the button.
|
||||
///
|
||||
@ -55,10 +55,6 @@ public struct Banner: AdwaitaWidget {
|
||||
///
|
||||
/// It can be used as an alternative to setting an action.
|
||||
var buttonClicked: (() -> Void)?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `Banner`.
|
||||
public init(title: String) {
|
||||
@ -70,12 +66,12 @@ public struct Banner: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_banner_new(title)?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
|
||||
return storage
|
||||
}
|
||||
@ -86,7 +82,7 @@ public struct Banner: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
if let buttonClicked {
|
||||
storage.connectSignal(name: "button-clicked", argCount: 0) {
|
||||
buttonClicked()
|
||||
@ -110,7 +106,7 @@ public struct Banner: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Bin.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -20,16 +20,12 @@ import LevenshteinTransformations
|
||||
public struct Bin: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The child widget of the `AdwBin`.
|
||||
var child: (() -> Body)?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `Bin`.
|
||||
public init() {
|
||||
@ -40,13 +36,13 @@ public struct Bin: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_bin_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(data: data, type: type) {
|
||||
storage.content["child"] = [childStorage]
|
||||
adw_bin_set_child(storage.opaquePointer?.cast(), childStorage.opaquePointer?.cast())
|
||||
}
|
||||
@ -60,17 +56,17 @@ public struct Bin: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
if let widget = storage.content["child"]?.first {
|
||||
child?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Box.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -45,9 +45,9 @@ import LevenshteinTransformations
|
||||
public struct Box: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The accessible role of the given `GtkAccessible` implementation.
|
||||
///
|
||||
@ -63,10 +63,6 @@ public struct Box: AdwaitaWidget {
|
||||
var append: () -> Body = { [] }
|
||||
/// The body for the widget "prepend".
|
||||
var prepend: () -> Body = { [] }
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `Box`.
|
||||
public init(spacing: Int) {
|
||||
@ -78,22 +74,22 @@ public struct Box: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(gtk_box_new(GTK_ORIENTATION_VERTICAL, spacing.cInt)?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
|
||||
var appendStorage: [ViewStorage] = []
|
||||
for view in append() {
|
||||
appendStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
appendStorage.append(view.storage(data: data, type: type))
|
||||
gtk_box_append(storage.opaquePointer?.cast(), appendStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["append"] = appendStorage
|
||||
var prependStorage: [ViewStorage] = []
|
||||
for view in prepend() {
|
||||
prependStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
prependStorage.append(view.storage(data: data, type: type))
|
||||
gtk_box_prepend(storage.opaquePointer?.cast(), prependStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["prepend"] = prependStorage
|
||||
@ -106,7 +102,7 @@ public struct Box: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
if let baselineChild, updateProperties, (storage.previousState as? Self)?.baselineChild != baselineChild {
|
||||
@ -124,7 +120,7 @@ public struct Box: AdwaitaWidget {
|
||||
if let storage = appendStorage[safe: index] {
|
||||
view.updateStorage(
|
||||
storage,
|
||||
modifiers: modifiers,
|
||||
data: data,
|
||||
updateProperties: updateProperties,
|
||||
type: type
|
||||
)
|
||||
@ -136,7 +132,7 @@ public struct Box: AdwaitaWidget {
|
||||
if let storage = prependStorage[safe: index] {
|
||||
view.updateStorage(
|
||||
storage,
|
||||
modifiers: modifiers,
|
||||
data: data,
|
||||
updateProperties: updateProperties,
|
||||
type: type
|
||||
)
|
||||
@ -146,7 +142,7 @@ public struct Box: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Button.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -41,9 +41,9 @@ import LevenshteinTransformations
|
||||
public struct Button: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The accessible role of the given `GtkAccessible` implementation.
|
||||
///
|
||||
@ -80,10 +80,6 @@ public struct Button: AdwaitaWidget {
|
||||
var activate: (() -> Void)?
|
||||
/// Emitted when the button has been activated (pressed and released).
|
||||
var clicked: (() -> Void)?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `Button`.
|
||||
public init() {
|
||||
@ -94,13 +90,13 @@ public struct Button: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(gtk_button_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(data: data, type: type) {
|
||||
storage.content["child"] = [childStorage]
|
||||
gtk_button_set_child(storage.opaquePointer?.cast(), childStorage.opaquePointer?.cast())
|
||||
}
|
||||
@ -114,7 +110,7 @@ public struct Button: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
if let activate {
|
||||
storage.connectSignal(name: "activate", argCount: 0) {
|
||||
activate()
|
||||
@ -134,7 +130,7 @@ public struct Button: AdwaitaWidget {
|
||||
gtk_button_set_can_shrink(widget?.cast(), canShrink.cBool)
|
||||
}
|
||||
if let widget = storage.content["child"]?.first {
|
||||
child?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let hasFrame, updateProperties, (storage.previousState as? Self)?.hasFrame != hasFrame {
|
||||
gtk_button_set_has_frame(widget?.cast(), hasFrame.cBool)
|
||||
@ -152,7 +148,7 @@ public struct Button: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// ButtonContent.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -47,9 +47,9 @@ import LevenshteinTransformations
|
||||
public struct ButtonContent: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// Whether the button can be smaller than the natural size of its contents.
|
||||
///
|
||||
@ -69,10 +69,6 @@ public struct ButtonContent: AdwaitaWidget {
|
||||
///
|
||||
/// See [property@ButtonContent:label].
|
||||
var useUnderline: Bool?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `ButtonContent`.
|
||||
public init() {
|
||||
@ -83,12 +79,12 @@ public struct ButtonContent: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_button_content_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
|
||||
return storage
|
||||
}
|
||||
@ -99,7 +95,7 @@ public struct ButtonContent: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
if let canShrink, updateProperties, (storage.previousState as? Self)?.canShrink != canShrink {
|
||||
@ -118,7 +114,7 @@ public struct ButtonContent: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Carousel.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -24,9 +24,9 @@ import LevenshteinTransformations
|
||||
public struct Carousel<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// Whether to allow swiping for more than one page at a time.
|
||||
///
|
||||
@ -65,10 +65,6 @@ public struct Carousel<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
var elements: [Element]
|
||||
/// The dynamic widget content.
|
||||
var content: (Element) -> Body
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `Carousel`.
|
||||
public init(_ elements: [Element], @ViewBuilder content: @escaping (Element) -> Body) {
|
||||
@ -81,12 +77,12 @@ public struct Carousel<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_carousel_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
|
||||
return storage
|
||||
}
|
||||
@ -97,7 +93,7 @@ public struct Carousel<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
if let pageChanged {
|
||||
storage.connectSignal(name: "page-changed", argCount: 1) {
|
||||
pageChanged()
|
||||
@ -129,7 +125,7 @@ public struct Carousel<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
old.identifiableTransform(
|
||||
to: elements,
|
||||
functions: .init { index, element in
|
||||
let child = content(element).storage(modifiers: modifiers, type: type)
|
||||
let child = content(element).storage(data: data, type: type)
|
||||
adw_carousel_remove(widget, adw_carousel_get_nth_page(widget, UInt(index).cInt))
|
||||
adw_carousel_insert(widget, child.opaquePointer?.cast(), index.cInt)
|
||||
contentStorage.remove(at: index)
|
||||
@ -138,7 +134,7 @@ public struct Carousel<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
adw_carousel_remove(widget, adw_carousel_get_nth_page(widget, UInt(index).cInt))
|
||||
contentStorage.remove(at: index)
|
||||
} insert: { index, element in
|
||||
let child = content(element).storage(modifiers: modifiers, type: type)
|
||||
let child = content(element).storage(data: data, type: type)
|
||||
adw_carousel_insert(widget, child.opaquePointer?.cast(), index.cInt)
|
||||
contentStorage.insert(child, at: index)
|
||||
}
|
||||
@ -146,11 +142,11 @@ public struct Carousel<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
storage.fields["element"] = elements
|
||||
storage.content[.mainContent] = contentStorage
|
||||
for (index, element) in elements.enumerated() {
|
||||
content(element).updateStorage(contentStorage[index], modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
content(element).updateStorage(contentStorage[index], data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// CenterBox.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -45,9 +45,9 @@ import LevenshteinTransformations
|
||||
public struct CenterBox: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The accessible role of the given `GtkAccessible` implementation.
|
||||
///
|
||||
@ -76,10 +76,6 @@ public struct CenterBox: AdwaitaWidget {
|
||||
/// In horizontal orientation, the start position is at the leading
|
||||
/// edge wrt. to the text direction.
|
||||
var startWidget: (() -> Body)?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `CenterBox`.
|
||||
public init() {
|
||||
@ -90,21 +86,21 @@ public struct CenterBox: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(gtk_center_box_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let centerWidgetStorage = centerWidget?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let centerWidgetStorage = centerWidget?().storage(data: data, type: type) {
|
||||
storage.content["centerWidget"] = [centerWidgetStorage]
|
||||
gtk_center_box_set_center_widget(storage.opaquePointer, centerWidgetStorage.opaquePointer?.cast())
|
||||
}
|
||||
if let endWidgetStorage = endWidget?().storage(modifiers: modifiers, type: type) {
|
||||
if let endWidgetStorage = endWidget?().storage(data: data, type: type) {
|
||||
storage.content["endWidget"] = [endWidgetStorage]
|
||||
gtk_center_box_set_end_widget(storage.opaquePointer, endWidgetStorage.opaquePointer?.cast())
|
||||
}
|
||||
if let startWidgetStorage = startWidget?().storage(modifiers: modifiers, type: type) {
|
||||
if let startWidgetStorage = startWidget?().storage(data: data, type: type) {
|
||||
storage.content["startWidget"] = [startWidgetStorage]
|
||||
gtk_center_box_set_start_widget(storage.opaquePointer, startWidgetStorage.opaquePointer?.cast())
|
||||
}
|
||||
@ -118,26 +114,26 @@ public struct CenterBox: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
if let widget = storage.content["centerWidget"]?.first {
|
||||
centerWidget?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
centerWidget?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let widget = storage.content["endWidget"]?.first {
|
||||
endWidget?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
endWidget?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let shrinkCenterLast, updateProperties, (storage.previousState as? Self)?.shrinkCenterLast != shrinkCenterLast {
|
||||
gtk_center_box_set_shrink_center_last(widget, shrinkCenterLast.cBool)
|
||||
}
|
||||
if let widget = storage.content["startWidget"]?.first {
|
||||
startWidget?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
startWidget?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// CheckButton.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -68,9 +68,9 @@ import LevenshteinTransformations
|
||||
public struct CheckButton: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The accessible role of the given `GtkAccessible` implementation.
|
||||
///
|
||||
@ -109,10 +109,6 @@ public struct CheckButton: AdwaitaWidget {
|
||||
/// Emitted when the buttons's [property@Gtk.CheckButton:active]
|
||||
/// property changes.
|
||||
var toggled: (() -> Void)?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `CheckButton`.
|
||||
public init() {
|
||||
@ -123,13 +119,13 @@ public struct CheckButton: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(gtk_check_button_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(data: data, type: type) {
|
||||
storage.content["child"] = [childStorage]
|
||||
gtk_check_button_set_child(storage.opaquePointer?.cast(), childStorage.opaquePointer?.cast())
|
||||
}
|
||||
@ -143,7 +139,7 @@ public struct CheckButton: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
if let activate {
|
||||
storage.connectSignal(name: "activate", argCount: 0) {
|
||||
activate()
|
||||
@ -169,7 +165,7 @@ if let active, newValue != active.wrappedValue {
|
||||
gtk_check_button_set_active(storage.opaquePointer?.cast(), active.wrappedValue.cBool)
|
||||
}
|
||||
if let widget = storage.content["child"]?.first {
|
||||
child?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let inconsistent, updateProperties, (storage.previousState as? Self)?.inconsistent != inconsistent {
|
||||
gtk_check_button_set_inconsistent(widget?.cast(), inconsistent.cBool)
|
||||
@ -184,7 +180,7 @@ if let active, newValue != active.wrappedValue {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Clamp.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -29,9 +29,9 @@ import LevenshteinTransformations
|
||||
public struct Clamp: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The child widget of the `AdwClamp`.
|
||||
var child: (() -> Body)?
|
||||
@ -54,10 +54,6 @@ public struct Clamp: AdwaitaWidget {
|
||||
/// Effectively, tightening the grip on the child before it reaches its maximum
|
||||
/// size makes transitions to and from the maximum size smoother when resizing.
|
||||
var tighteningThreshold: Int?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `Clamp`.
|
||||
public init() {
|
||||
@ -68,13 +64,13 @@ public struct Clamp: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_clamp_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(data: data, type: type) {
|
||||
storage.content["child"] = [childStorage]
|
||||
adw_clamp_set_child(storage.opaquePointer, childStorage.opaquePointer?.cast())
|
||||
}
|
||||
@ -88,11 +84,11 @@ public struct Clamp: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
if let widget = storage.content["child"]?.first {
|
||||
child?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let maximumSize, updateProperties, (storage.previousState as? Self)?.maximumSize != maximumSize {
|
||||
adw_clamp_set_maximum_size(widget, maximumSize.cInt)
|
||||
@ -104,7 +100,7 @@ public struct Clamp: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// ComboRow.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -44,9 +44,9 @@ import LevenshteinTransformations
|
||||
public struct ComboRow: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The widget to activate when the row is activated.
|
||||
///
|
||||
@ -121,10 +121,6 @@ public struct ComboRow: AdwaitaWidget {
|
||||
var suffix: () -> Body = { [] }
|
||||
/// The body for the widget "prefix".
|
||||
var prefix: () -> Body = { [] }
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `ComboRow`.
|
||||
public init() {
|
||||
@ -135,26 +131,26 @@ public struct ComboRow: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_combo_row_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let activatableWidgetStorage = activatableWidget?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let activatableWidgetStorage = activatableWidget?().storage(data: data, type: type) {
|
||||
storage.content["activatableWidget"] = [activatableWidgetStorage]
|
||||
adw_action_row_set_activatable_widget(storage.opaquePointer?.cast(), activatableWidgetStorage.opaquePointer?.cast())
|
||||
}
|
||||
|
||||
var suffixStorage: [ViewStorage] = []
|
||||
for view in suffix() {
|
||||
suffixStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
suffixStorage.append(view.storage(data: data, type: type))
|
||||
adw_action_row_add_suffix(storage.opaquePointer?.cast(), suffixStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["suffix"] = suffixStorage
|
||||
var prefixStorage: [ViewStorage] = []
|
||||
for view in prefix() {
|
||||
prefixStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
prefixStorage.append(view.storage(data: data, type: type))
|
||||
adw_action_row_add_prefix(storage.opaquePointer?.cast(), prefixStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["prefix"] = prefixStorage
|
||||
@ -167,7 +163,7 @@ public struct ComboRow: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
if let activated {
|
||||
storage.connectSignal(name: "activated", argCount: 0) {
|
||||
activated()
|
||||
@ -182,7 +178,7 @@ if let selected, newValue != selected.wrappedValue {
|
||||
}
|
||||
}
|
||||
if let widget = storage.content["activatableWidget"]?.first {
|
||||
activatableWidget?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
activatableWidget?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let enableSearch, updateProperties, (storage.previousState as? Self)?.enableSearch != enableSearch {
|
||||
adw_combo_row_set_enable_search(widget?.cast(), enableSearch.cBool)
|
||||
@ -221,7 +217,7 @@ if let selected, newValue != selected.wrappedValue {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// EntryRow.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -42,9 +42,9 @@ import LevenshteinTransformations
|
||||
public struct EntryRow: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// Whether activating the embedded entry can activate the default widget.
|
||||
var activatesDefault: Bool?
|
||||
@ -91,10 +91,6 @@ public struct EntryRow: AdwaitaWidget {
|
||||
var suffix: () -> Body = { [] }
|
||||
/// The body for the widget "prefix".
|
||||
var prefix: () -> Body = { [] }
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `EntryRow`.
|
||||
public init() {
|
||||
@ -105,22 +101,22 @@ public struct EntryRow: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_entry_row_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
|
||||
var suffixStorage: [ViewStorage] = []
|
||||
for view in suffix() {
|
||||
suffixStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
suffixStorage.append(view.storage(data: data, type: type))
|
||||
adw_entry_row_add_suffix(storage.opaquePointer?.cast(), suffixStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["suffix"] = suffixStorage
|
||||
var prefixStorage: [ViewStorage] = []
|
||||
for view in prefix() {
|
||||
prefixStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
prefixStorage.append(view.storage(data: data, type: type))
|
||||
adw_entry_row_add_prefix(storage.opaquePointer?.cast(), prefixStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["prefix"] = prefixStorage
|
||||
@ -133,7 +129,7 @@ public struct EntryRow: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
if let apply {
|
||||
storage.connectSignal(name: "apply", argCount: 0) {
|
||||
apply()
|
||||
@ -173,7 +169,7 @@ public struct EntryRow: AdwaitaWidget {
|
||||
if let storage = suffixStorage[safe: index] {
|
||||
view.updateStorage(
|
||||
storage,
|
||||
modifiers: modifiers,
|
||||
data: data,
|
||||
updateProperties: updateProperties,
|
||||
type: type
|
||||
)
|
||||
@ -185,7 +181,7 @@ public struct EntryRow: AdwaitaWidget {
|
||||
if let storage = prefixStorage[safe: index] {
|
||||
view.updateStorage(
|
||||
storage,
|
||||
modifiers: modifiers,
|
||||
data: data,
|
||||
updateProperties: updateProperties,
|
||||
type: type
|
||||
)
|
||||
@ -195,7 +191,7 @@ public struct EntryRow: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// ExpanderRow.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -36,9 +36,9 @@ import LevenshteinTransformations
|
||||
public struct ExpanderRow: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// Whether expansion is enabled.
|
||||
var enableExpansion: Binding<Bool>?
|
||||
@ -83,10 +83,6 @@ public struct ExpanderRow: AdwaitaWidget {
|
||||
var suffix: () -> Body = { [] }
|
||||
/// The body for the widget "prefix".
|
||||
var prefix: () -> Body = { [] }
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `ExpanderRow`.
|
||||
public init() {
|
||||
@ -97,28 +93,28 @@ public struct ExpanderRow: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_expander_row_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
|
||||
var rowsStorage: [ViewStorage] = []
|
||||
for view in rows() {
|
||||
rowsStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
rowsStorage.append(view.storage(data: data, type: type))
|
||||
adw_expander_row_add_row(storage.opaquePointer?.cast(), rowsStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["rows"] = rowsStorage
|
||||
var suffixStorage: [ViewStorage] = []
|
||||
for view in suffix() {
|
||||
suffixStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
suffixStorage.append(view.storage(data: data, type: type))
|
||||
adw_expander_row_add_suffix(storage.opaquePointer?.cast(), suffixStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["suffix"] = suffixStorage
|
||||
var prefixStorage: [ViewStorage] = []
|
||||
for view in prefix() {
|
||||
prefixStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
prefixStorage.append(view.storage(data: data, type: type))
|
||||
adw_expander_row_add_prefix(storage.opaquePointer?.cast(), prefixStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["prefix"] = prefixStorage
|
||||
@ -131,7 +127,7 @@ public struct ExpanderRow: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
storage.notify(name: "enable-expansion") {
|
||||
@ -182,7 +178,7 @@ if let expanded, newValue != expanded.wrappedValue {
|
||||
if let storage = rowsStorage[safe: index] {
|
||||
view.updateStorage(
|
||||
storage,
|
||||
modifiers: modifiers,
|
||||
data: data,
|
||||
updateProperties: updateProperties,
|
||||
type: type
|
||||
)
|
||||
@ -194,7 +190,7 @@ if let expanded, newValue != expanded.wrappedValue {
|
||||
if let storage = suffixStorage[safe: index] {
|
||||
view.updateStorage(
|
||||
storage,
|
||||
modifiers: modifiers,
|
||||
data: data,
|
||||
updateProperties: updateProperties,
|
||||
type: type
|
||||
)
|
||||
@ -206,7 +202,7 @@ if let expanded, newValue != expanded.wrappedValue {
|
||||
if let storage = prefixStorage[safe: index] {
|
||||
view.updateStorage(
|
||||
storage,
|
||||
modifiers: modifiers,
|
||||
data: data,
|
||||
updateProperties: updateProperties,
|
||||
type: type
|
||||
)
|
||||
@ -216,7 +212,7 @@ if let expanded, newValue != expanded.wrappedValue {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Fixed.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -48,18 +48,14 @@ import LevenshteinTransformations
|
||||
public struct Fixed: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The accessible role of the given `GtkAccessible` implementation.
|
||||
///
|
||||
/// The accessible role cannot be changed once set.
|
||||
var accessibleRole: String?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `Fixed`.
|
||||
public init() {
|
||||
@ -70,12 +66,12 @@ public struct Fixed: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(gtk_fixed_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
|
||||
return storage
|
||||
}
|
||||
@ -86,14 +82,14 @@ public struct Fixed: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// FlowBox.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -55,9 +55,9 @@ import LevenshteinTransformations
|
||||
public struct FlowBox<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// accept-unpaired-release
|
||||
var acceptUnpairedRelease: Bool?
|
||||
@ -138,10 +138,6 @@ public struct FlowBox<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
var elements: [Element]
|
||||
/// The dynamic widget content.
|
||||
var content: (Element) -> Body
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `FlowBox`.
|
||||
public init(_ elements: [Element], @ViewBuilder content: @escaping (Element) -> Body) {
|
||||
@ -154,12 +150,12 @@ public struct FlowBox<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(gtk_flow_box_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
|
||||
return storage
|
||||
}
|
||||
@ -170,7 +166,7 @@ public struct FlowBox<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
if let activateCursorChild {
|
||||
storage.connectSignal(name: "activate-cursor-child", argCount: 0) {
|
||||
activateCursorChild()
|
||||
@ -232,7 +228,7 @@ public struct FlowBox<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
old.identifiableTransform(
|
||||
to: elements,
|
||||
functions: .init { index, element in
|
||||
let child = content(element).storage(modifiers: modifiers, type: type)
|
||||
let child = content(element).storage(data: data, type: type)
|
||||
gtk_flow_box_remove(widget, gtk_flow_box_get_child_at_index(widget, index.cInt)?.cast())
|
||||
gtk_flow_box_insert(widget, child.opaquePointer?.cast(), index.cInt)
|
||||
contentStorage.remove(at: index)
|
||||
@ -241,7 +237,7 @@ public struct FlowBox<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
gtk_flow_box_remove(widget, gtk_flow_box_get_child_at_index(widget, index.cInt)?.cast())
|
||||
contentStorage.remove(at: index)
|
||||
} insert: { index, element in
|
||||
let child = content(element).storage(modifiers: modifiers, type: type)
|
||||
let child = content(element).storage(data: data, type: type)
|
||||
gtk_flow_box_insert(widget, child.opaquePointer?.cast(), index.cInt)
|
||||
contentStorage.insert(child, at: index)
|
||||
}
|
||||
@ -249,11 +245,11 @@ public struct FlowBox<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
storage.fields["element"] = elements
|
||||
storage.content[.mainContent] = contentStorage
|
||||
for (index, element) in elements.enumerated() {
|
||||
content(element).updateStorage(contentStorage[index], modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
content(element).updateStorage(contentStorage[index], data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// HeaderBar.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -95,9 +95,9 @@ import LevenshteinTransformations
|
||||
public struct HeaderBar: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The decoration layout for buttons.
|
||||
///
|
||||
@ -152,10 +152,6 @@ public struct HeaderBar: AdwaitaWidget {
|
||||
var start: () -> Body = { [] }
|
||||
/// The body for the widget "end".
|
||||
var end: () -> Body = { [] }
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `HeaderBar`.
|
||||
public init() {
|
||||
@ -166,26 +162,26 @@ public struct HeaderBar: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_header_bar_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let titleWidgetStorage = titleWidget?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let titleWidgetStorage = titleWidget?().storage(data: data, type: type) {
|
||||
storage.content["titleWidget"] = [titleWidgetStorage]
|
||||
adw_header_bar_set_title_widget(storage.opaquePointer, titleWidgetStorage.opaquePointer?.cast())
|
||||
}
|
||||
|
||||
var startStorage: [ViewStorage] = []
|
||||
for view in start() {
|
||||
startStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
startStorage.append(view.storage(data: data, type: type))
|
||||
adw_header_bar_pack_start(storage.opaquePointer, startStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["start"] = startStorage
|
||||
var endStorage: [ViewStorage] = []
|
||||
for view in end() {
|
||||
endStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
endStorage.append(view.storage(data: data, type: type))
|
||||
adw_header_bar_pack_end(storage.opaquePointer, endStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["end"] = endStorage
|
||||
@ -198,7 +194,7 @@ public struct HeaderBar: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
if let decorationLayout, updateProperties, (storage.previousState as? Self)?.decorationLayout != decorationLayout {
|
||||
@ -217,7 +213,7 @@ public struct HeaderBar: AdwaitaWidget {
|
||||
adw_header_bar_set_show_title(widget, showTitle.cBool)
|
||||
}
|
||||
if let widget = storage.content["titleWidget"]?.first {
|
||||
titleWidget?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
titleWidget?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
|
||||
if let startStorage = storage.content["start"] {
|
||||
@ -225,7 +221,7 @@ public struct HeaderBar: AdwaitaWidget {
|
||||
if let storage = startStorage[safe: index] {
|
||||
view.updateStorage(
|
||||
storage,
|
||||
modifiers: modifiers,
|
||||
data: data,
|
||||
updateProperties: updateProperties,
|
||||
type: type
|
||||
)
|
||||
@ -237,7 +233,7 @@ public struct HeaderBar: AdwaitaWidget {
|
||||
if let storage = endStorage[safe: index] {
|
||||
view.updateStorage(
|
||||
storage,
|
||||
modifiers: modifiers,
|
||||
data: data,
|
||||
updateProperties: updateProperties,
|
||||
type: type
|
||||
)
|
||||
@ -247,7 +243,7 @@ public struct HeaderBar: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Label.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -187,9 +187,9 @@ import LevenshteinTransformations
|
||||
public struct Label: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The accessible role of the given `GtkAccessible` implementation.
|
||||
///
|
||||
@ -268,10 +268,6 @@ public struct Label: AdwaitaWidget {
|
||||
///
|
||||
/// The default binding for this signal is <kbd>Ctrl</kbd>+<kbd>c</kbd>.
|
||||
var copyClipboard: (() -> Void)?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `Label`.
|
||||
public init(label: String) {
|
||||
@ -283,13 +279,13 @@ public struct Label: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(gtk_label_new(label)?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let mnemonicWidgetStorage = mnemonicWidget?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let mnemonicWidgetStorage = mnemonicWidget?().storage(data: data, type: type) {
|
||||
storage.content["mnemonicWidget"] = [mnemonicWidgetStorage]
|
||||
gtk_label_set_mnemonic_widget(storage.opaquePointer, mnemonicWidgetStorage.opaquePointer?.cast())
|
||||
}
|
||||
@ -303,7 +299,7 @@ public struct Label: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
if let copyClipboard {
|
||||
storage.connectSignal(name: "copy-clipboard", argCount: 0) {
|
||||
copyClipboard()
|
||||
@ -321,7 +317,7 @@ public struct Label: AdwaitaWidget {
|
||||
gtk_label_set_max_width_chars(widget, maxWidthChars.cInt)
|
||||
}
|
||||
if let widget = storage.content["mnemonicWidget"]?.first {
|
||||
mnemonicWidget?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
mnemonicWidget?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let selectable, updateProperties, (storage.previousState as? Self)?.selectable != selectable {
|
||||
gtk_label_set_selectable(widget, selectable.cBool)
|
||||
@ -351,7 +347,7 @@ public struct Label: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// LevelBar.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -108,9 +108,9 @@ import LevenshteinTransformations
|
||||
public struct LevelBar: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The accessible role of the given `GtkAccessible` implementation.
|
||||
///
|
||||
@ -136,10 +136,6 @@ public struct LevelBar: AdwaitaWidget {
|
||||
/// detailed signal "changed::x" in order to only receive callbacks when
|
||||
/// the value of offset "x" changes.
|
||||
var offsetChanged: (() -> Void)?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `LevelBar`.
|
||||
public init() {
|
||||
@ -150,12 +146,12 @@ public struct LevelBar: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(gtk_level_bar_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
|
||||
return storage
|
||||
}
|
||||
@ -166,7 +162,7 @@ public struct LevelBar: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
if let offsetChanged {
|
||||
storage.connectSignal(name: "offset-changed", argCount: 1) {
|
||||
offsetChanged()
|
||||
@ -190,7 +186,7 @@ public struct LevelBar: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// LinkButton.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -37,9 +37,9 @@ import LevenshteinTransformations
|
||||
public struct LinkButton: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The accessible role of the given `GtkAccessible` implementation.
|
||||
///
|
||||
@ -82,10 +82,6 @@ public struct LinkButton: AdwaitaWidget {
|
||||
var activate: (() -> Void)?
|
||||
/// Emitted when the button has been activated (pressed and released).
|
||||
var clicked: (() -> Void)?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `LinkButton`.
|
||||
public init(uri: String) {
|
||||
@ -97,13 +93,13 @@ public struct LinkButton: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(gtk_link_button_new(uri)?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(data: data, type: type) {
|
||||
storage.content["child"] = [childStorage]
|
||||
gtk_button_set_child(storage.opaquePointer?.cast(), childStorage.opaquePointer?.cast())
|
||||
}
|
||||
@ -117,7 +113,7 @@ public struct LinkButton: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
if let activate {
|
||||
storage.connectSignal(name: "activate", argCount: 0) {
|
||||
activate()
|
||||
@ -137,7 +133,7 @@ public struct LinkButton: AdwaitaWidget {
|
||||
gtk_button_set_can_shrink(widget?.cast(), canShrink.cBool)
|
||||
}
|
||||
if let widget = storage.content["child"]?.first {
|
||||
child?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let hasFrame, updateProperties, (storage.previousState as? Self)?.hasFrame != hasFrame {
|
||||
gtk_button_set_has_frame(widget?.cast(), hasFrame.cBool)
|
||||
@ -161,7 +157,7 @@ public struct LinkButton: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// ListBox.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -64,9 +64,9 @@ import LevenshteinTransformations
|
||||
public struct ListBox<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// Whether to accept unpaired release events.
|
||||
var acceptUnpairedRelease: Bool?
|
||||
@ -115,10 +115,6 @@ public struct ListBox<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
var elements: [Element]
|
||||
/// The dynamic widget content.
|
||||
var content: (Element) -> Body
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `ListBox`.
|
||||
public init(_ elements: [Element], @ViewBuilder content: @escaping (Element) -> Body) {
|
||||
@ -131,12 +127,12 @@ public struct ListBox<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(gtk_list_box_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
|
||||
return storage
|
||||
}
|
||||
@ -147,7 +143,7 @@ public struct ListBox<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
if let activateCursorRow {
|
||||
storage.connectSignal(name: "activate-cursor-row", argCount: 0) {
|
||||
activateCursorRow()
|
||||
@ -202,7 +198,7 @@ public struct ListBox<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
old.identifiableTransform(
|
||||
to: elements,
|
||||
functions: .init { index, element in
|
||||
let child = content(element).storage(modifiers: modifiers, type: type)
|
||||
let child = content(element).storage(data: data, type: type)
|
||||
gtk_list_box_remove(widget, gtk_list_box_get_row_at_index(widget, index.cInt)?.cast())
|
||||
gtk_list_box_insert(widget, child.opaquePointer?.cast(), index.cInt)
|
||||
contentStorage.remove(at: index)
|
||||
@ -211,7 +207,7 @@ public struct ListBox<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
gtk_list_box_remove(widget, gtk_list_box_get_row_at_index(widget, index.cInt)?.cast())
|
||||
contentStorage.remove(at: index)
|
||||
} insert: { index, element in
|
||||
let child = content(element).storage(modifiers: modifiers, type: type)
|
||||
let child = content(element).storage(data: data, type: type)
|
||||
gtk_list_box_insert(widget, child.opaquePointer?.cast(), index.cInt)
|
||||
contentStorage.insert(child, at: index)
|
||||
}
|
||||
@ -219,11 +215,11 @@ public struct ListBox<Element>: AdwaitaWidget where Element: Identifiable {
|
||||
storage.fields["element"] = elements
|
||||
storage.content[.mainContent] = contentStorage
|
||||
for (index, element) in elements.enumerated() {
|
||||
content(element).updateStorage(contentStorage[index], modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
content(element).updateStorage(contentStorage[index], data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Menu.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -72,9 +72,9 @@ import LevenshteinTransformations
|
||||
public struct Menu: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The accessible role of the given `GtkAccessible` implementation.
|
||||
///
|
||||
@ -111,10 +111,6 @@ public struct Menu: AdwaitaWidget {
|
||||
/// The `::activate` signal on `GtkMenuButton` is an action signal and
|
||||
/// emitting it causes the button to pop up its menu.
|
||||
var activate: (() -> Void)?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `Menu`.
|
||||
public init() {
|
||||
@ -125,18 +121,18 @@ public struct Menu: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(gtk_menu_button_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(data: data, type: type) {
|
||||
storage.content["child"] = [childStorage]
|
||||
gtk_menu_button_set_child(storage.opaquePointer, childStorage.opaquePointer?.cast())
|
||||
}
|
||||
if let menu = menuModel?(), let app {
|
||||
let childStorage = MenuCollection { menu }.getMenu(app: app, window: window)
|
||||
if let menu = menuModel?() {
|
||||
let childStorage = MenuCollection { menu }.getMenu(data: data)
|
||||
storage.content["menuModel"] = [childStorage]
|
||||
gtk_menu_button_set_menu_model(storage.opaquePointer, childStorage.opaquePointer?.cast())
|
||||
}
|
||||
@ -150,7 +146,7 @@ public struct Menu: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
if let activate {
|
||||
storage.connectSignal(name: "activate", argCount: 0) {
|
||||
activate()
|
||||
@ -174,7 +170,7 @@ if let active, newValue != active.wrappedValue {
|
||||
gtk_menu_button_set_can_shrink(widget, canShrink.cBool)
|
||||
}
|
||||
if let widget = storage.content["child"]?.first {
|
||||
child?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let hasFrame, updateProperties, (storage.previousState as? Self)?.hasFrame != hasFrame {
|
||||
gtk_menu_button_set_has_frame(widget, hasFrame.cBool)
|
||||
@ -187,7 +183,7 @@ if let active, newValue != active.wrappedValue {
|
||||
}
|
||||
if let menu = storage.content["menuModel"]?.first {
|
||||
MenuCollection { menuModel?() ?? [] }
|
||||
.updateStorage(menu, modifiers: [], updateProperties: updateProperties, type: MenuContext.self)
|
||||
.updateStorage(menu, data: data.noModifiers, updateProperties: updateProperties, type: MenuContext.self)
|
||||
}
|
||||
if let primary, updateProperties, (storage.previousState as? Self)?.primary != primary {
|
||||
gtk_menu_button_set_primary(widget, primary.cBool)
|
||||
@ -199,7 +195,7 @@ if let active, newValue != active.wrappedValue {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
@ -277,10 +273,10 @@ if let active, newValue != active.wrappedValue {
|
||||
///
|
||||
/// See [method@Gtk.MenuButton.set_menu_model] for the interaction
|
||||
/// with the [property@Gtk.MenuButton:popover] property.
|
||||
public func menuModel(app: AdwaitaApp, window: AdwaitaWindow? = nil, @ViewBuilder _ menuModel: @escaping (() -> Body)) -> Self {
|
||||
public func menuModel(@ViewBuilder _ menuModel: @escaping (() -> Body)) -> Self {
|
||||
var newSelf = self
|
||||
newSelf.menuModel = menuModel
|
||||
newSelf.app = app; newSelf.window = window
|
||||
|
||||
return newSelf
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// NavigationView.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -121,9 +121,9 @@ import LevenshteinTransformations
|
||||
public struct NavigationView: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// Whether to animate page transitions.
|
||||
///
|
||||
@ -162,10 +162,6 @@ public struct NavigationView: AdwaitaWidget {
|
||||
///
|
||||
/// See [method@NavigationView.replace].
|
||||
var replaced: (() -> Void)?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `NavigationView`.
|
||||
public init() {
|
||||
@ -176,12 +172,12 @@ public struct NavigationView: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_navigation_view_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
|
||||
return storage
|
||||
}
|
||||
@ -192,7 +188,7 @@ public struct NavigationView: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
if let getNextPage {
|
||||
storage.connectSignal(name: "get-next-page", argCount: 0) {
|
||||
getNextPage()
|
||||
@ -225,7 +221,7 @@ public struct NavigationView: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Overlay.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -43,9 +43,9 @@ import LevenshteinTransformations
|
||||
public struct Overlay: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The accessible role of the given `GtkAccessible` implementation.
|
||||
///
|
||||
@ -70,10 +70,6 @@ public struct Overlay: AdwaitaWidget {
|
||||
var getChildPosition: (() -> Void)?
|
||||
/// The body for the widget "overlay".
|
||||
var overlay: () -> Body = { [] }
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `Overlay`.
|
||||
public init() {
|
||||
@ -84,20 +80,20 @@ public struct Overlay: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(gtk_overlay_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(data: data, type: type) {
|
||||
storage.content["child"] = [childStorage]
|
||||
gtk_overlay_set_child(storage.opaquePointer, childStorage.opaquePointer?.cast())
|
||||
}
|
||||
|
||||
var overlayStorage: [ViewStorage] = []
|
||||
for view in overlay() {
|
||||
overlayStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
overlayStorage.append(view.storage(data: data, type: type))
|
||||
gtk_overlay_add_overlay(storage.opaquePointer, overlayStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["overlay"] = overlayStorage
|
||||
@ -110,7 +106,7 @@ public struct Overlay: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
if let getChildPosition {
|
||||
storage.connectSignal(name: "get-child-position", argCount: 2) {
|
||||
getChildPosition()
|
||||
@ -119,7 +115,7 @@ public struct Overlay: AdwaitaWidget {
|
||||
storage.modify { widget in
|
||||
|
||||
if let widget = storage.content["child"]?.first {
|
||||
child?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
|
||||
if let overlayStorage = storage.content["overlay"] {
|
||||
@ -127,7 +123,7 @@ public struct Overlay: AdwaitaWidget {
|
||||
if let storage = overlayStorage[safe: index] {
|
||||
view.updateStorage(
|
||||
storage,
|
||||
modifiers: modifiers,
|
||||
data: data,
|
||||
updateProperties: updateProperties,
|
||||
type: type
|
||||
)
|
||||
@ -137,7 +133,7 @@ public struct Overlay: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// OverlaySplitView.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -116,9 +116,9 @@ import LevenshteinTransformations
|
||||
public struct OverlaySplitView: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// Whether the split view is collapsed.
|
||||
///
|
||||
@ -170,10 +170,6 @@ public struct OverlaySplitView: AdwaitaWidget {
|
||||
/// The sidebar widget can be allocated with larger width if its own minimum
|
||||
/// width exceeds the preferred width.
|
||||
var sidebarWidthFraction: Double?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `OverlaySplitView`.
|
||||
public init() {
|
||||
@ -184,17 +180,17 @@ public struct OverlaySplitView: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_overlay_split_view_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let contentStorage = content?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let contentStorage = content?().storage(data: data, type: type) {
|
||||
storage.content["content"] = [contentStorage]
|
||||
adw_overlay_split_view_set_content(storage.opaquePointer, contentStorage.opaquePointer?.cast())
|
||||
}
|
||||
if let sidebarStorage = sidebar?().storage(modifiers: modifiers, type: type) {
|
||||
if let sidebarStorage = sidebar?().storage(data: data, type: type) {
|
||||
storage.content["sidebar"] = [sidebarStorage]
|
||||
adw_overlay_split_view_set_sidebar(storage.opaquePointer, sidebarStorage.opaquePointer?.cast())
|
||||
}
|
||||
@ -208,7 +204,7 @@ public struct OverlaySplitView: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
storage.notify(name: "show-sidebar") {
|
||||
@ -221,7 +217,7 @@ if let showSidebar, newValue != showSidebar.wrappedValue {
|
||||
adw_overlay_split_view_set_collapsed(widget, collapsed.cBool)
|
||||
}
|
||||
if let widget = storage.content["content"]?.first {
|
||||
content?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
content?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let enableHideGesture, updateProperties, (storage.previousState as? Self)?.enableHideGesture != enableHideGesture {
|
||||
adw_overlay_split_view_set_enable_hide_gesture(widget, enableHideGesture.cBool)
|
||||
@ -242,7 +238,7 @@ if let showSidebar, newValue != showSidebar.wrappedValue {
|
||||
adw_overlay_split_view_set_show_sidebar(storage.opaquePointer, showSidebar.wrappedValue.cBool)
|
||||
}
|
||||
if let widget = storage.content["sidebar"]?.first {
|
||||
sidebar?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
sidebar?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let sidebarWidthFraction, updateProperties, (storage.previousState as? Self)?.sidebarWidthFraction != sidebarWidthFraction {
|
||||
adw_overlay_split_view_set_sidebar_width_fraction(widget, sidebarWidthFraction)
|
||||
@ -251,7 +247,7 @@ if let showSidebar, newValue != showSidebar.wrappedValue {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// PasswordEntryRow.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -27,9 +27,9 @@ import LevenshteinTransformations
|
||||
public struct PasswordEntryRow: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// Whether activating the embedded entry can activate the default widget.
|
||||
var activatesDefault: Bool?
|
||||
@ -76,10 +76,6 @@ public struct PasswordEntryRow: AdwaitaWidget {
|
||||
var suffix: () -> Body = { [] }
|
||||
/// The body for the widget "prefix".
|
||||
var prefix: () -> Body = { [] }
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `PasswordEntryRow`.
|
||||
public init() {
|
||||
@ -90,22 +86,22 @@ public struct PasswordEntryRow: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_password_entry_row_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
|
||||
var suffixStorage: [ViewStorage] = []
|
||||
for view in suffix() {
|
||||
suffixStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
suffixStorage.append(view.storage(data: data, type: type))
|
||||
adw_entry_row_add_suffix(storage.opaquePointer?.cast(), suffixStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["suffix"] = suffixStorage
|
||||
var prefixStorage: [ViewStorage] = []
|
||||
for view in prefix() {
|
||||
prefixStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
prefixStorage.append(view.storage(data: data, type: type))
|
||||
adw_entry_row_add_prefix(storage.opaquePointer?.cast(), prefixStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["prefix"] = prefixStorage
|
||||
@ -118,7 +114,7 @@ public struct PasswordEntryRow: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
if let apply {
|
||||
storage.connectSignal(name: "apply", argCount: 0) {
|
||||
apply()
|
||||
@ -156,7 +152,7 @@ public struct PasswordEntryRow: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Picture.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -57,9 +57,9 @@ import LevenshteinTransformations
|
||||
public struct Picture: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The accessible role of the given `GtkAccessible` implementation.
|
||||
///
|
||||
@ -71,10 +71,6 @@ public struct Picture: AdwaitaWidget {
|
||||
var canShrink: Bool?
|
||||
/// How the content should be resized to fit inside the `GtkPicture`.
|
||||
var contentFit: ContentFit?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `Picture`.
|
||||
public init() {
|
||||
@ -85,12 +81,12 @@ public struct Picture: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(gtk_picture_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
|
||||
return storage
|
||||
}
|
||||
@ -101,7 +97,7 @@ public struct Picture: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
if let alternativeText, updateProperties, (storage.previousState as? Self)?.alternativeText != alternativeText {
|
||||
@ -117,7 +113,7 @@ public struct Picture: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Popover.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -71,9 +71,9 @@ import LevenshteinTransformations
|
||||
public struct Popover: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The accessible role of the given `GtkAccessible` implementation.
|
||||
///
|
||||
@ -99,10 +99,6 @@ public struct Popover: AdwaitaWidget {
|
||||
var activateDefault: (() -> Void)?
|
||||
/// Emitted when the popover is closed.
|
||||
var closed: (() -> Void)?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `Popover`.
|
||||
public init() {
|
||||
@ -113,17 +109,17 @@ public struct Popover: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(gtk_popover_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(data: data, type: type) {
|
||||
storage.content["child"] = [childStorage]
|
||||
gtk_popover_set_child(storage.opaquePointer?.cast(), childStorage.opaquePointer?.cast())
|
||||
}
|
||||
if let defaultWidgetStorage = defaultWidget?().storage(modifiers: modifiers, type: type) {
|
||||
if let defaultWidgetStorage = defaultWidget?().storage(data: data, type: type) {
|
||||
storage.content["defaultWidget"] = [defaultWidgetStorage]
|
||||
gtk_popover_set_default_widget(storage.opaquePointer?.cast(), defaultWidgetStorage.opaquePointer?.cast())
|
||||
}
|
||||
@ -137,7 +133,7 @@ public struct Popover: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
if let activateDefault {
|
||||
storage.connectSignal(name: "activate-default", argCount: 0) {
|
||||
activateDefault()
|
||||
@ -157,10 +153,10 @@ public struct Popover: AdwaitaWidget {
|
||||
gtk_popover_set_cascade_popdown(widget?.cast(), cascadePopdown.cBool)
|
||||
}
|
||||
if let widget = storage.content["child"]?.first {
|
||||
child?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let widget = storage.content["defaultWidget"]?.first {
|
||||
defaultWidget?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
defaultWidget?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let hasArrow, updateProperties, (storage.previousState as? Self)?.hasArrow != hasArrow {
|
||||
gtk_popover_set_has_arrow(widget?.cast(), hasArrow.cBool)
|
||||
@ -172,7 +168,7 @@ public struct Popover: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// PreferencesGroup.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -39,9 +39,9 @@ import LevenshteinTransformations
|
||||
public struct PreferencesGroup: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The description for this group of preferences.
|
||||
var description: String?
|
||||
@ -56,10 +56,6 @@ public struct PreferencesGroup: AdwaitaWidget {
|
||||
var title: String?
|
||||
/// The body for the widget "child".
|
||||
var child: () -> Body = { [] }
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `PreferencesGroup`.
|
||||
public init() {
|
||||
@ -70,20 +66,20 @@ public struct PreferencesGroup: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_preferences_group_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let headerSuffixStorage = headerSuffix?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let headerSuffixStorage = headerSuffix?().storage(data: data, type: type) {
|
||||
storage.content["headerSuffix"] = [headerSuffixStorage]
|
||||
adw_preferences_group_set_header_suffix(storage.opaquePointer?.cast(), headerSuffixStorage.opaquePointer?.cast())
|
||||
}
|
||||
|
||||
var childStorage: [ViewStorage] = []
|
||||
for view in child() {
|
||||
childStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
childStorage.append(view.storage(data: data, type: type))
|
||||
adw_preferences_group_add(storage.opaquePointer?.cast(), childStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["child"] = childStorage
|
||||
@ -96,14 +92,14 @@ public struct PreferencesGroup: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
if let description, updateProperties, (storage.previousState as? Self)?.description != description {
|
||||
adw_preferences_group_set_description(widget?.cast(), description)
|
||||
}
|
||||
if let widget = storage.content["headerSuffix"]?.first {
|
||||
headerSuffix?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
headerSuffix?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let title, updateProperties, (storage.previousState as? Self)?.title != title {
|
||||
adw_preferences_group_set_title(widget?.cast(), title)
|
||||
@ -114,7 +110,7 @@ public struct PreferencesGroup: AdwaitaWidget {
|
||||
if let storage = childStorage[safe: index] {
|
||||
view.updateStorage(
|
||||
storage,
|
||||
modifiers: modifiers,
|
||||
data: data,
|
||||
updateProperties: updateProperties,
|
||||
type: type
|
||||
)
|
||||
@ -124,7 +120,7 @@ public struct PreferencesGroup: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// PreferencesPage.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -25,9 +25,9 @@ import LevenshteinTransformations
|
||||
public struct PreferencesPage: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The description to be displayed at the top of the page.
|
||||
var description: String?
|
||||
@ -41,10 +41,6 @@ public struct PreferencesPage: AdwaitaWidget {
|
||||
var useUnderline: Bool?
|
||||
/// The body for the widget "child".
|
||||
var child: () -> Body = { [] }
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `PreferencesPage`.
|
||||
public init() {
|
||||
@ -55,16 +51,16 @@ public struct PreferencesPage: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_preferences_page_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
|
||||
var childStorage: [ViewStorage] = []
|
||||
for view in child() {
|
||||
childStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
childStorage.append(view.storage(data: data, type: type))
|
||||
adw_preferences_group_add(storage.opaquePointer?.cast(), childStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["child"] = childStorage
|
||||
@ -77,7 +73,7 @@ public struct PreferencesPage: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
if let description, updateProperties, (storage.previousState as? Self)?.description != description {
|
||||
@ -101,7 +97,7 @@ public struct PreferencesPage: AdwaitaWidget {
|
||||
if let storage = childStorage[safe: index] {
|
||||
view.updateStorage(
|
||||
storage,
|
||||
modifiers: modifiers,
|
||||
data: data,
|
||||
updateProperties: updateProperties,
|
||||
type: type
|
||||
)
|
||||
@ -111,7 +107,7 @@ public struct PreferencesPage: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// PreferencesRow.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -20,9 +20,9 @@ import LevenshteinTransformations
|
||||
public struct PreferencesRow: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The title of the preference represented by this row.
|
||||
///
|
||||
@ -41,10 +41,6 @@ public struct PreferencesRow: AdwaitaWidget {
|
||||
var useMarkup: Bool?
|
||||
/// Whether an embedded underline in the title indicates a mnemonic.
|
||||
var useUnderline: Bool?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `PreferencesRow`.
|
||||
public init() {
|
||||
@ -55,12 +51,12 @@ public struct PreferencesRow: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_preferences_row_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
|
||||
return storage
|
||||
}
|
||||
@ -71,7 +67,7 @@ public struct PreferencesRow: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
if let title, updateProperties, (storage.previousState as? Self)?.title != title {
|
||||
@ -90,7 +86,7 @@ public struct PreferencesRow: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// ProgressBar.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -57,9 +57,9 @@ import LevenshteinTransformations
|
||||
public struct ProgressBar: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The accessible role of the given `GtkAccessible` implementation.
|
||||
///
|
||||
@ -84,10 +84,6 @@ public struct ProgressBar: AdwaitaWidget {
|
||||
var showText: Bool?
|
||||
/// Text to be displayed in the progress bar.
|
||||
var text: String?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `ProgressBar`.
|
||||
public init() {
|
||||
@ -98,12 +94,12 @@ public struct ProgressBar: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(gtk_progress_bar_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
|
||||
return storage
|
||||
}
|
||||
@ -114,7 +110,7 @@ public struct ProgressBar: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
if let fraction, updateProperties, (storage.previousState as? Self)?.fraction != fraction {
|
||||
@ -136,7 +132,7 @@ public struct ProgressBar: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// ScrolledWindow.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -79,9 +79,9 @@ import LevenshteinTransformations
|
||||
public struct ScrolledWindow: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The accessible role of the given `GtkAccessible` implementation.
|
||||
///
|
||||
@ -164,10 +164,6 @@ public struct ScrolledWindow: AdwaitaWidget {
|
||||
/// The horizontal or vertical adjustment is updated which triggers a
|
||||
/// signal that the scrolled window’s child may listen to and scroll itself.
|
||||
var scrollChild: (() -> Void)?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `ScrolledWindow`.
|
||||
public init() {
|
||||
@ -178,13 +174,13 @@ public struct ScrolledWindow: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(gtk_scrolled_window_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(data: data, type: type) {
|
||||
storage.content["child"] = [childStorage]
|
||||
gtk_scrolled_window_set_child(storage.opaquePointer, childStorage.opaquePointer?.cast())
|
||||
}
|
||||
@ -198,7 +194,7 @@ public struct ScrolledWindow: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
if let edgeOvershot {
|
||||
storage.connectSignal(name: "edge-overshot", argCount: 1) {
|
||||
edgeOvershot()
|
||||
@ -222,7 +218,7 @@ public struct ScrolledWindow: AdwaitaWidget {
|
||||
storage.modify { widget in
|
||||
|
||||
if let widget = storage.content["child"]?.first {
|
||||
child?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let hasFrame, updateProperties, (storage.previousState as? Self)?.hasFrame != hasFrame {
|
||||
gtk_scrolled_window_set_has_frame(widget, hasFrame.cBool)
|
||||
@ -255,7 +251,7 @@ public struct ScrolledWindow: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// SearchBar.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -55,9 +55,9 @@ import LevenshteinTransformations
|
||||
public struct SearchBar: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The accessible role of the given `GtkAccessible` implementation.
|
||||
///
|
||||
@ -71,10 +71,6 @@ public struct SearchBar: AdwaitaWidget {
|
||||
var searchModeEnabled: Bool?
|
||||
/// Whether to show the close button in the search bar.
|
||||
var showCloseButton: Bool?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `SearchBar`.
|
||||
public init() {
|
||||
@ -85,17 +81,17 @@ public struct SearchBar: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(gtk_search_bar_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(data: data, type: type) {
|
||||
storage.content["child"] = [childStorage]
|
||||
gtk_search_bar_set_child(storage.opaquePointer, childStorage.opaquePointer?.cast())
|
||||
}
|
||||
if let keyCaptureWidgetStorage = keyCaptureWidget?().storage(modifiers: modifiers, type: type) {
|
||||
if let keyCaptureWidgetStorage = keyCaptureWidget?().storage(data: data, type: type) {
|
||||
storage.content["keyCaptureWidget"] = [keyCaptureWidgetStorage]
|
||||
gtk_search_bar_set_key_capture_widget(storage.opaquePointer, keyCaptureWidgetStorage.opaquePointer?.cast())
|
||||
}
|
||||
@ -109,14 +105,14 @@ public struct SearchBar: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
if let widget = storage.content["child"]?.first {
|
||||
child?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let widget = storage.content["keyCaptureWidget"]?.first {
|
||||
keyCaptureWidget?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
keyCaptureWidget?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let showCloseButton, updateProperties, (storage.previousState as? Self)?.showCloseButton != showCloseButton {
|
||||
gtk_search_bar_set_show_close_button(widget, showCloseButton.cBool)
|
||||
@ -125,7 +121,7 @@ public struct SearchBar: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// SearchEntry.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -55,9 +55,9 @@ import LevenshteinTransformations
|
||||
public struct SearchEntry: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The accessible role of the given `GtkAccessible` implementation.
|
||||
///
|
||||
@ -154,10 +154,6 @@ public struct SearchEntry: AdwaitaWidget {
|
||||
///
|
||||
/// The default bindings for this signal is Escape.
|
||||
var stopSearch: (() -> Void)?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `SearchEntry`.
|
||||
public init() {
|
||||
@ -168,12 +164,12 @@ public struct SearchEntry: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(gtk_search_entry_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
|
||||
return storage
|
||||
}
|
||||
@ -184,7 +180,7 @@ public struct SearchEntry: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
if let activate {
|
||||
storage.connectSignal(name: "activate", argCount: 0) {
|
||||
activate()
|
||||
@ -263,7 +259,7 @@ if let text, newValue != text.wrappedValue {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Separator.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -27,18 +27,14 @@ import LevenshteinTransformations
|
||||
public struct Separator: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The accessible role of the given `GtkAccessible` implementation.
|
||||
///
|
||||
/// The accessible role cannot be changed once set.
|
||||
var accessibleRole: String?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `Separator`.
|
||||
public init() {
|
||||
@ -49,12 +45,12 @@ public struct Separator: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(gtk_separator_new(GTK_ORIENTATION_VERTICAL)?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
|
||||
return storage
|
||||
}
|
||||
@ -65,14 +61,14 @@ public struct Separator: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// SpinRow.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -27,9 +27,9 @@ import LevenshteinTransformations
|
||||
public struct SpinRow: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The widget to activate when the row is activated.
|
||||
///
|
||||
@ -111,10 +111,6 @@ public struct SpinRow: AdwaitaWidget {
|
||||
var suffix: () -> Body = { [] }
|
||||
/// The body for the widget "prefix".
|
||||
var prefix: () -> Body = { [] }
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `SpinRow`.
|
||||
public init(climbRate: Double, digits: UInt) {
|
||||
@ -127,26 +123,26 @@ public struct SpinRow: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_spin_row_new(nil, climbRate, digits.cInt)?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let activatableWidgetStorage = activatableWidget?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let activatableWidgetStorage = activatableWidget?().storage(data: data, type: type) {
|
||||
storage.content["activatableWidget"] = [activatableWidgetStorage]
|
||||
adw_action_row_set_activatable_widget(storage.opaquePointer?.cast(), activatableWidgetStorage.opaquePointer?.cast())
|
||||
}
|
||||
|
||||
var suffixStorage: [ViewStorage] = []
|
||||
for view in suffix() {
|
||||
suffixStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
suffixStorage.append(view.storage(data: data, type: type))
|
||||
adw_action_row_add_suffix(storage.opaquePointer?.cast(), suffixStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["suffix"] = suffixStorage
|
||||
var prefixStorage: [ViewStorage] = []
|
||||
for view in prefix() {
|
||||
prefixStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
prefixStorage.append(view.storage(data: data, type: type))
|
||||
adw_action_row_add_prefix(storage.opaquePointer?.cast(), prefixStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["prefix"] = prefixStorage
|
||||
@ -159,7 +155,7 @@ public struct SpinRow: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
if let activated {
|
||||
storage.connectSignal(name: "activated", argCount: 0) {
|
||||
activated()
|
||||
@ -189,7 +185,7 @@ if let value, newValue != value.wrappedValue {
|
||||
}
|
||||
}
|
||||
if let widget = storage.content["activatableWidget"]?.first {
|
||||
activatableWidget?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
activatableWidget?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if updateProperties, (storage.previousState as? Self)?.climbRate != climbRate {
|
||||
adw_spin_row_set_climb_rate(widget, climbRate)
|
||||
@ -237,7 +233,7 @@ if let value, newValue != value.wrappedValue {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Spinner.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -26,9 +26,9 @@ import LevenshteinTransformations
|
||||
public struct Spinner: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The accessible role of the given `GtkAccessible` implementation.
|
||||
///
|
||||
@ -36,10 +36,6 @@ public struct Spinner: AdwaitaWidget {
|
||||
var accessibleRole: String?
|
||||
/// Whether the spinner is spinning
|
||||
var spinning: Bool?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `Spinner`.
|
||||
public init() {
|
||||
@ -50,12 +46,12 @@ public struct Spinner: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(gtk_spinner_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
|
||||
return storage
|
||||
}
|
||||
@ -66,7 +62,7 @@ public struct Spinner: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
if let spinning, updateProperties, (storage.previousState as? Self)?.spinning != spinning {
|
||||
@ -76,7 +72,7 @@ public struct Spinner: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// SplitButton.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -43,9 +43,9 @@ import LevenshteinTransformations
|
||||
public struct SplitButton: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// Whether the button can be smaller than the natural size of its contents.
|
||||
///
|
||||
@ -95,10 +95,6 @@ public struct SplitButton: AdwaitaWidget {
|
||||
var activate: (() -> Void)?
|
||||
/// Emitted when the button has been activated (pressed and released).
|
||||
var clicked: (() -> Void)?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `SplitButton`.
|
||||
public init() {
|
||||
@ -109,18 +105,18 @@ public struct SplitButton: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_split_button_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(data: data, type: type) {
|
||||
storage.content["child"] = [childStorage]
|
||||
adw_split_button_set_child(storage.opaquePointer, childStorage.opaquePointer?.cast())
|
||||
}
|
||||
if let menu = menuModel?(), let app {
|
||||
let childStorage = MenuCollection { menu }.getMenu(app: app, window: window)
|
||||
if let menu = menuModel?() {
|
||||
let childStorage = MenuCollection { menu }.getMenu(data: data)
|
||||
storage.content["menuModel"] = [childStorage]
|
||||
adw_split_button_set_menu_model(storage.opaquePointer, childStorage.opaquePointer?.cast())
|
||||
}
|
||||
@ -134,7 +130,7 @@ public struct SplitButton: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
if let activate {
|
||||
storage.connectSignal(name: "activate", argCount: 0) {
|
||||
activate()
|
||||
@ -151,7 +147,7 @@ public struct SplitButton: AdwaitaWidget {
|
||||
adw_split_button_set_can_shrink(widget, canShrink.cBool)
|
||||
}
|
||||
if let widget = storage.content["child"]?.first {
|
||||
child?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let dropdownTooltip, updateProperties, (storage.previousState as? Self)?.dropdownTooltip != dropdownTooltip {
|
||||
adw_split_button_set_dropdown_tooltip(widget, dropdownTooltip)
|
||||
@ -164,7 +160,7 @@ public struct SplitButton: AdwaitaWidget {
|
||||
}
|
||||
if let menu = storage.content["menuModel"]?.first {
|
||||
MenuCollection { menuModel?() ?? [] }
|
||||
.updateStorage(menu, modifiers: [], updateProperties: updateProperties, type: MenuContext.self)
|
||||
.updateStorage(menu, data: data.noModifiers, updateProperties: updateProperties, type: MenuContext.self)
|
||||
}
|
||||
if let useUnderline, updateProperties, (storage.previousState as? Self)?.useUnderline != useUnderline {
|
||||
adw_split_button_set_use_underline(widget, useUnderline.cBool)
|
||||
@ -173,7 +169,7 @@ public struct SplitButton: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
@ -246,10 +242,10 @@ public struct SplitButton: AdwaitaWidget {
|
||||
///
|
||||
/// If [property@SplitButton:popover] is already set, it will be dissociated
|
||||
/// from the button, and the property is set to `NULL`.
|
||||
public func menuModel(app: AdwaitaApp, window: AdwaitaWindow? = nil, @ViewBuilder _ menuModel: @escaping (() -> Body)) -> Self {
|
||||
public func menuModel(@ViewBuilder _ menuModel: @escaping (() -> Body)) -> Self {
|
||||
var newSelf = self
|
||||
newSelf.menuModel = menuModel
|
||||
newSelf.app = app; newSelf.window = window
|
||||
|
||||
return newSelf
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// StatusPage.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -25,9 +25,9 @@ import LevenshteinTransformations
|
||||
public struct StatusPage: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The child widget.
|
||||
var child: (() -> Body)?
|
||||
@ -41,10 +41,6 @@ public struct StatusPage: AdwaitaWidget {
|
||||
///
|
||||
/// It is not parsed as Pango markup.
|
||||
var title: String?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `StatusPage`.
|
||||
public init() {
|
||||
@ -55,13 +51,13 @@ public struct StatusPage: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_status_page_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(data: data, type: type) {
|
||||
storage.content["child"] = [childStorage]
|
||||
adw_status_page_set_child(storage.opaquePointer, childStorage.opaquePointer?.cast())
|
||||
}
|
||||
@ -75,11 +71,11 @@ public struct StatusPage: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
if let widget = storage.content["child"]?.first {
|
||||
child?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let description, updateProperties, (storage.previousState as? Self)?.description != description {
|
||||
adw_status_page_set_description(widget, description)
|
||||
@ -94,7 +90,7 @@ public struct StatusPage: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// SwitchRow.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -31,9 +31,9 @@ import LevenshteinTransformations
|
||||
public struct SwitchRow: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The widget to activate when the row is activated.
|
||||
///
|
||||
@ -88,10 +88,6 @@ public struct SwitchRow: AdwaitaWidget {
|
||||
var suffix: () -> Body = { [] }
|
||||
/// The body for the widget "prefix".
|
||||
var prefix: () -> Body = { [] }
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `SwitchRow`.
|
||||
public init() {
|
||||
@ -102,26 +98,26 @@ public struct SwitchRow: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_switch_row_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let activatableWidgetStorage = activatableWidget?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let activatableWidgetStorage = activatableWidget?().storage(data: data, type: type) {
|
||||
storage.content["activatableWidget"] = [activatableWidgetStorage]
|
||||
adw_action_row_set_activatable_widget(storage.opaquePointer?.cast(), activatableWidgetStorage.opaquePointer?.cast())
|
||||
}
|
||||
|
||||
var suffixStorage: [ViewStorage] = []
|
||||
for view in suffix() {
|
||||
suffixStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
suffixStorage.append(view.storage(data: data, type: type))
|
||||
adw_action_row_add_suffix(storage.opaquePointer?.cast(), suffixStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["suffix"] = suffixStorage
|
||||
var prefixStorage: [ViewStorage] = []
|
||||
for view in prefix() {
|
||||
prefixStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
prefixStorage.append(view.storage(data: data, type: type))
|
||||
adw_action_row_add_prefix(storage.opaquePointer?.cast(), prefixStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["prefix"] = prefixStorage
|
||||
@ -134,7 +130,7 @@ public struct SwitchRow: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
if let activated {
|
||||
storage.connectSignal(name: "activated", argCount: 0) {
|
||||
activated()
|
||||
@ -149,7 +145,7 @@ if let active, newValue != active.wrappedValue {
|
||||
}
|
||||
}
|
||||
if let widget = storage.content["activatableWidget"]?.first {
|
||||
activatableWidget?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
activatableWidget?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let active, updateProperties, (adw_switch_row_get_active(storage.opaquePointer) != 0) != active.wrappedValue {
|
||||
adw_switch_row_set_active(storage.opaquePointer, active.wrappedValue.cBool)
|
||||
@ -182,7 +178,7 @@ if let active, newValue != active.wrappedValue {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// ToastOverlay.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -47,16 +47,12 @@ import LevenshteinTransformations
|
||||
public struct ToastOverlay: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The child widget.
|
||||
var child: (() -> Body)?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `ToastOverlay`.
|
||||
public init() {
|
||||
@ -67,13 +63,13 @@ public struct ToastOverlay: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_toast_overlay_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(data: data, type: type) {
|
||||
storage.content["child"] = [childStorage]
|
||||
adw_toast_overlay_set_child(storage.opaquePointer, childStorage.opaquePointer?.cast())
|
||||
}
|
||||
@ -87,17 +83,17 @@ public struct ToastOverlay: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
if let widget = storage.content["child"]?.first {
|
||||
child?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// ToggleButton.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -86,9 +86,9 @@ import LevenshteinTransformations
|
||||
public struct ToggleButton: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The accessible role of the given `GtkAccessible` implementation.
|
||||
///
|
||||
@ -129,10 +129,6 @@ public struct ToggleButton: AdwaitaWidget {
|
||||
var clicked: (() -> Void)?
|
||||
/// Emitted whenever the `GtkToggleButton`'s state is changed.
|
||||
var toggled: (() -> Void)?
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `ToggleButton`.
|
||||
public init() {
|
||||
@ -143,13 +139,13 @@ public struct ToggleButton: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(gtk_toggle_button_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let childStorage = child?().storage(data: data, type: type) {
|
||||
storage.content["child"] = [childStorage]
|
||||
gtk_button_set_child(storage.opaquePointer?.cast(), childStorage.opaquePointer?.cast())
|
||||
}
|
||||
@ -163,7 +159,7 @@ public struct ToggleButton: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
if let activate {
|
||||
storage.connectSignal(name: "activate", argCount: 0) {
|
||||
activate()
|
||||
@ -197,7 +193,7 @@ if let active, newValue != active.wrappedValue {
|
||||
gtk_button_set_can_shrink(widget?.cast(), canShrink.cBool)
|
||||
}
|
||||
if let widget = storage.content["child"]?.first {
|
||||
child?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
child?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let hasFrame, updateProperties, (storage.previousState as? Self)?.hasFrame != hasFrame {
|
||||
gtk_button_set_has_frame(widget?.cast(), hasFrame.cBool)
|
||||
@ -215,7 +211,7 @@ if let active, newValue != active.wrappedValue {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// ToolbarView.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -79,9 +79,9 @@ import LevenshteinTransformations
|
||||
public struct ToolbarView: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The current bottom bar height.
|
||||
///
|
||||
@ -138,10 +138,6 @@ public struct ToolbarView: AdwaitaWidget {
|
||||
var bottom: () -> Body = { [] }
|
||||
/// The body for the widget "top".
|
||||
var top: () -> Body = { [] }
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `ToolbarView`.
|
||||
public init() {
|
||||
@ -152,26 +148,26 @@ public struct ToolbarView: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_toolbar_view_new()?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
if let contentStorage = content?().storage(modifiers: modifiers, type: type) {
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
if let contentStorage = content?().storage(data: data, type: type) {
|
||||
storage.content["content"] = [contentStorage]
|
||||
adw_toolbar_view_set_content(storage.opaquePointer, contentStorage.opaquePointer?.cast())
|
||||
}
|
||||
|
||||
var bottomStorage: [ViewStorage] = []
|
||||
for view in bottom() {
|
||||
bottomStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
bottomStorage.append(view.storage(data: data, type: type))
|
||||
adw_toolbar_view_add_bottom_bar(storage.opaquePointer, bottomStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["bottom"] = bottomStorage
|
||||
var topStorage: [ViewStorage] = []
|
||||
for view in top() {
|
||||
topStorage.append(view.storage(modifiers: modifiers, type: type))
|
||||
topStorage.append(view.storage(data: data, type: type))
|
||||
adw_toolbar_view_add_top_bar(storage.opaquePointer, topStorage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["top"] = topStorage
|
||||
@ -184,11 +180,11 @@ public struct ToolbarView: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
if let widget = storage.content["content"]?.first {
|
||||
content?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
content?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let extendContentToBottomEdge, updateProperties, (storage.previousState as? Self)?.extendContentToBottomEdge != extendContentToBottomEdge {
|
||||
adw_toolbar_view_set_extend_content_to_bottom_edge(widget, extendContentToBottomEdge.cBool)
|
||||
@ -208,7 +204,7 @@ public struct ToolbarView: AdwaitaWidget {
|
||||
if let storage = bottomStorage[safe: index] {
|
||||
view.updateStorage(
|
||||
storage,
|
||||
modifiers: modifiers,
|
||||
data: data,
|
||||
updateProperties: updateProperties,
|
||||
type: type
|
||||
)
|
||||
@ -220,7 +216,7 @@ public struct ToolbarView: AdwaitaWidget {
|
||||
if let storage = topStorage[safe: index] {
|
||||
view.updateStorage(
|
||||
storage,
|
||||
modifiers: modifiers,
|
||||
data: data,
|
||||
updateProperties: updateProperties,
|
||||
type: type
|
||||
)
|
||||
@ -230,7 +226,7 @@ public struct ToolbarView: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -2,7 +2,7 @@
|
||||
// WindowTitle.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by auto-generation on 03.08.24.
|
||||
// Created by auto-generation on 15.08.24.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
@ -21,9 +21,9 @@ import LevenshteinTransformations
|
||||
public struct WindowTitle: AdwaitaWidget {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
|
||||
/// The subtitle to display.
|
||||
///
|
||||
@ -34,10 +34,6 @@ public struct WindowTitle: AdwaitaWidget {
|
||||
/// The title typically identifies the current view or content item, and
|
||||
/// generally does not use the application name.
|
||||
var title: String
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
|
||||
/// Initialize `WindowTitle`.
|
||||
public init(subtitle: String, title: String) {
|
||||
@ -50,12 +46,12 @@ public struct WindowTitle: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(adw_window_title_new(title, subtitle)?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
|
||||
return storage
|
||||
}
|
||||
@ -66,7 +62,7 @@ public struct WindowTitle: AdwaitaWidget {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {
|
||||
storage.modify { widget in
|
||||
|
||||
if updateProperties, (storage.previousState as? Self)?.subtitle != subtitle {
|
||||
@ -79,7 +75,7 @@ public struct WindowTitle: AdwaitaWidget {
|
||||
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -14,14 +14,10 @@ extension Menu {
|
||||
/// - Parameters:
|
||||
/// - label: The button's label.
|
||||
/// - icon: The button's icon.
|
||||
/// - app: The application.
|
||||
/// - window: The application window.
|
||||
/// - content: The menu's content.
|
||||
public init(
|
||||
_ label: String? = nil,
|
||||
icon: Icon,
|
||||
app: AdwaitaApp,
|
||||
window: AdwaitaWindow?,
|
||||
@ViewBuilder content: @escaping () -> Body
|
||||
) {
|
||||
self.init()
|
||||
@ -31,26 +27,22 @@ extension Menu {
|
||||
.iconName(icon.string)
|
||||
.label(label)
|
||||
}
|
||||
.menuModel(app: app, window: window, content)
|
||||
.menuModel(content)
|
||||
}
|
||||
// swiftlint:enable function_default_parameter_at_end
|
||||
|
||||
/// Initialize a menu button.
|
||||
/// - Parameters:
|
||||
/// - label: The buttons label.
|
||||
/// - app: The application.
|
||||
/// - window: The application window.
|
||||
/// - content: The menu's content.
|
||||
public init(
|
||||
_ label: String,
|
||||
app: AdwaitaApp,
|
||||
window: AdwaitaWindow?,
|
||||
@ViewBuilder content: @escaping () -> Body
|
||||
) {
|
||||
self.init()
|
||||
self = self
|
||||
.label(label)
|
||||
.menuModel(app: app, window: window, content)
|
||||
.menuModel(content)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ extension ToastOverlay {
|
||||
/// - Returns: The toast overlay.
|
||||
public func action(button: String, handler: @escaping () -> Void) -> Self {
|
||||
var newSelf = self
|
||||
let action: (ViewStorage, [(AnyView) -> AnyView], Bool) -> Void = { storage, _, _ in
|
||||
let action: (ViewStorage, WidgetData, Bool) -> Void = { storage, _, _ in
|
||||
storage.fields["button"] = button
|
||||
storage.fields["handler"] = handler
|
||||
}
|
||||
|
@ -39,26 +39,26 @@ public struct NavigationSplitView: AdwaitaWidget {
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(
|
||||
modifiers: [(AnyView) -> AnyView],
|
||||
data: WidgetData,
|
||||
type: Data.Type
|
||||
) -> ViewStorage where Data: ViewRenderData {
|
||||
let splitView = adw_navigation_split_view_new()
|
||||
var content: [String: [ViewStorage]] = [:]
|
||||
|
||||
let sidebar = sidebar.storage(modifiers: modifiers, type: type)
|
||||
let sidebar = sidebar.storage(data: data, type: type)
|
||||
let label = sidebar.fields[.navigationLabel] as? String ?? ""
|
||||
let sidebarPage = adw_navigation_page_new(sidebar.opaquePointer?.cast(), label)
|
||||
adw_navigation_split_view_set_sidebar(.init(splitView), sidebarPage?.cast())
|
||||
content[sidebarID] = [sidebar]
|
||||
|
||||
let mainContent = self.content.storage(modifiers: modifiers, type: type)
|
||||
let mainContent = self.content.storage(data: data, type: type)
|
||||
let mainLabel = mainContent.fields[.navigationLabel] as? String ?? ""
|
||||
let mainPage = adw_navigation_page_new(mainContent.opaquePointer?.cast(), mainLabel)
|
||||
adw_navigation_split_view_set_content(.init(splitView), mainPage?.cast())
|
||||
content[contentID] = [mainContent]
|
||||
|
||||
let storage = ViewStorage(splitView?.opaque(), content: content)
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
|
||||
storage.notify(name: "show-content") {
|
||||
showContent?.wrappedValue = adw_navigation_split_view_get_show_content(storage.opaquePointer) != 0
|
||||
@ -75,17 +75,17 @@ public struct NavigationSplitView: AdwaitaWidget {
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(
|
||||
_ storage: ViewStorage,
|
||||
modifiers: [(AnyView) -> AnyView],
|
||||
data: WidgetData,
|
||||
updateProperties: Bool,
|
||||
type: Data.Type
|
||||
) where Data: ViewRenderData {
|
||||
if let storage = storage.content[contentID]?[safe: 0] {
|
||||
content
|
||||
.updateStorage(storage, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
.updateStorage(storage, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
if let storage = storage.content[sidebarID]?[safe: 0] {
|
||||
sidebar
|
||||
.updateStorage(storage, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
.updateStorage(storage, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
guard updateProperties else {
|
||||
return
|
||||
|
@ -25,8 +25,8 @@ extension NavigationView {
|
||||
@ViewBuilder initialView: @escaping () -> Body
|
||||
) {
|
||||
self.init()
|
||||
appearFunctions.append { storage, modifiers in
|
||||
let initialStorage = initialView().storage(modifiers: modifiers, type: AdwaitaMainView.self)
|
||||
appearFunctions.append { storage, data in
|
||||
let initialStorage = initialView().storage(data: data, type: AdwaitaMainView.self)
|
||||
storage.fields[.mainContent] = [initialStorage]
|
||||
adw_navigation_view_push(
|
||||
storage.opaquePointer,
|
||||
@ -43,10 +43,10 @@ extension NavigationView {
|
||||
}
|
||||
}
|
||||
}
|
||||
updateFunctions.append { [self] storage, modifiers, updateProperties in
|
||||
updateFunctions.append { [self] storage, data, updateProperties in
|
||||
updateFunction(
|
||||
storage: storage,
|
||||
modifiers: modifiers,
|
||||
data: data,
|
||||
stack: stack,
|
||||
views: (content, initialView()),
|
||||
updateProperties: updateProperties
|
||||
@ -95,7 +95,7 @@ extension NavigationView {
|
||||
/// - updateProperties: Whether to update properties.
|
||||
func updateFunction<Component>(
|
||||
storage: ViewStorage,
|
||||
modifiers: [(AnyView) -> AnyView],
|
||||
data: WidgetData,
|
||||
stack: Binding<NavigationStack<Component>>,
|
||||
views: ((Component) -> Body, Body),
|
||||
updateProperties: Bool
|
||||
@ -110,7 +110,7 @@ extension NavigationView {
|
||||
storages.removeLast()
|
||||
} else { print("Warning: removing the initial view is not allowed.") }
|
||||
case let .push(component):
|
||||
let contentStorage = views.0(component).storage(modifiers: modifiers, type: AdwaitaMainView.self)
|
||||
let contentStorage = views.0(component).storage(data: data, type: AdwaitaMainView.self)
|
||||
contentStorage.fields[Self.componentID] = component
|
||||
storages.append(contentStorage)
|
||||
adw_navigation_view_push(
|
||||
@ -127,7 +127,7 @@ extension NavigationView {
|
||||
views.0(component)
|
||||
.updateStorage(
|
||||
storage,
|
||||
modifiers: modifiers,
|
||||
data: data,
|
||||
updateProperties: updateProperties,
|
||||
type: AdwaitaMainView.self
|
||||
)
|
||||
@ -135,7 +135,7 @@ extension NavigationView {
|
||||
views.1
|
||||
.updateStorage(
|
||||
storage,
|
||||
modifiers: modifiers,
|
||||
data: data,
|
||||
updateProperties: updateProperties,
|
||||
type: AdwaitaMainView.self
|
||||
)
|
||||
|
@ -53,13 +53,13 @@ public struct VStackWrapper: AdwaitaWidget, Wrapper {
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(
|
||||
modifiers: [(AnyView) -> AnyView],
|
||||
data: WidgetData,
|
||||
type: Data.Type
|
||||
) -> ViewStorage where Data: ViewRenderData {
|
||||
if content.count == 1, let element = content.first {
|
||||
return element.storage(modifiers: modifiers, type: type)
|
||||
return element.storage(data: data, type: type)
|
||||
} else {
|
||||
return VStack { content }.storage(modifiers: modifiers, type: type)
|
||||
return VStack { content }.storage(data: data, type: type)
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,15 +71,15 @@ public struct VStackWrapper: AdwaitaWidget, Wrapper {
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(
|
||||
_ storage: ViewStorage,
|
||||
modifiers: [(AnyView) -> AnyView],
|
||||
data: WidgetData,
|
||||
updateProperties: Bool,
|
||||
type: Data.Type
|
||||
) where Data: ViewRenderData {
|
||||
if content.count == 1, let element = content.first {
|
||||
element.updateStorage(storage, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
element.updateStorage(storage, data: data, updateProperties: updateProperties, type: type)
|
||||
} else {
|
||||
VStack { content }
|
||||
.updateStorage(storage, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
.updateStorage(storage, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,12 +47,12 @@ public struct ViewStack: AdwaitaWidget {
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(
|
||||
modifiers: [(AnyView) -> AnyView],
|
||||
data: WidgetData,
|
||||
type: Data.Type
|
||||
) -> ViewStorage where Data: ViewRenderData {
|
||||
let stack = gtk_stack_new()
|
||||
let storage = ViewStorage(stack?.opaque())
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
return storage
|
||||
}
|
||||
|
||||
@ -64,14 +64,14 @@ public struct ViewStack: AdwaitaWidget {
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(
|
||||
_ storage: ViewStorage,
|
||||
modifiers: [(AnyView) -> AnyView],
|
||||
data: WidgetData,
|
||||
updateProperties: Bool,
|
||||
type: Data.Type
|
||||
) where Data: ViewRenderData {
|
||||
if let view = storage.content[id.description]?.first {
|
||||
content.updateStorage(view, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
content.updateStorage(view, data: data, updateProperties: updateProperties, type: type)
|
||||
} else {
|
||||
let view = content.storage(modifiers: modifiers, type: type)
|
||||
let view = content.storage(data: data, type: type)
|
||||
gtk_stack_add_named(storage.opaquePointer, view.opaquePointer?.cast(), id.description)
|
||||
storage.content[id.description] = [view]
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public struct ViewSwitcher<Element>: AdwaitaWidget where Element: ViewSwitcherOp
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(
|
||||
modifiers: [(AnyView) -> AnyView],
|
||||
data: WidgetData,
|
||||
type: Data.Type
|
||||
) -> ViewStorage where Data: ViewRenderData {
|
||||
let switcher = ViewStorage(adw_view_switcher_new()?.opaque())
|
||||
@ -57,7 +57,7 @@ public struct ViewSwitcher<Element>: AdwaitaWidget where Element: ViewSwitcherOp
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(
|
||||
_ storage: ViewStorage,
|
||||
modifiers: [(AnyView) -> AnyView],
|
||||
data: WidgetData,
|
||||
updateProperties: Bool,
|
||||
type: Data.Type
|
||||
) where Data: ViewRenderData {
|
||||
|
@ -111,7 +111,8 @@ public struct Window: AdwaitaSceneElement {
|
||||
let storage = SceneStorage(id: id, pointer: window) {
|
||||
gtk_window_present(window.pointer?.cast())
|
||||
}
|
||||
let viewStorage = content.storage(modifiers: [], type: AdwaitaMainView.self)
|
||||
let viewStorage = content
|
||||
.storage(data: .init(sceneStorage: storage, appStorage: app), type: AdwaitaMainView.self)
|
||||
adw_application_window_set_content(window.pointer?.cast(), viewStorage.opaquePointer?.cast())
|
||||
storage.content[.mainContent] = [viewStorage]
|
||||
let data = SignalData {
|
||||
@ -163,7 +164,12 @@ public struct Window: AdwaitaSceneElement {
|
||||
}
|
||||
let content = content(window)
|
||||
content
|
||||
.updateStorage(viewStorage, modifiers: [], updateProperties: updateProperties, type: AdwaitaMainView.self)
|
||||
.updateStorage(
|
||||
viewStorage,
|
||||
data: .init(sceneStorage: storage, appStorage: app),
|
||||
updateProperties: updateProperties,
|
||||
type: AdwaitaMainView.self
|
||||
)
|
||||
let template = getTemplate(content: content)
|
||||
if let app = app as? AdwaitaApp {
|
||||
for shortcut in template.shortcuts {
|
||||
|
@ -138,7 +138,7 @@ struct Demo: App {
|
||||
}
|
||||
|
||||
var menu: AnyView {
|
||||
Menu(icon: .default(icon: .openMenu), app: app, window: window) {
|
||||
Menu(icon: .default(icon: .openMenu)) {
|
||||
MenuButton("New Window", window: false) {
|
||||
app.addWindow("main")
|
||||
}
|
||||
|
@ -161,13 +161,6 @@ extension Class {
|
||||
"""
|
||||
}
|
||||
content += staticWidgetProperties(namespace: namespace, configs: configs)
|
||||
content += """
|
||||
|
||||
/// The application.
|
||||
var app: AdwaitaApp?
|
||||
/// The window.
|
||||
var window: AdwaitaWindow?
|
||||
"""
|
||||
return content
|
||||
}
|
||||
|
||||
@ -198,7 +191,7 @@ extension Class {
|
||||
if let storage = \(widget.name)Storage[safe: index] {
|
||||
view.updateStorage(
|
||||
storage,
|
||||
modifiers: modifiers,
|
||||
data: data,
|
||||
updateProperties: updateProperties,
|
||||
type: type
|
||||
)
|
||||
@ -216,7 +209,7 @@ extension Class {
|
||||
/// - genConfig: The generation configuration.
|
||||
/// - Returns: The code.
|
||||
func generateDynamicWidgetUpdate(config: WidgetConfiguration, genConfig: GenerationConfiguration) -> String {
|
||||
let child = "let child = content(element).storage(modifiers: modifiers, type: type)"
|
||||
let child = "let child = content(element).storage(data: data, type: type)"
|
||||
let pointer = "child.opaquePointer?.cast()"
|
||||
let widget = "widget" + (config.cast ? "?.cast()" : "")
|
||||
if let dynamicWidget = config.dynamicWidget {
|
||||
@ -244,7 +237,7 @@ extension Class {
|
||||
storage.fields["element"] = elements
|
||||
storage.content[.mainContent] = contentStorage
|
||||
for (index, element) in elements.enumerated() {
|
||||
content(element).updateStorage(contentStorage[index], modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
content(element).updateStorage(contentStorage[index], data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
"""
|
||||
// swiftlint:enable line_length
|
||||
|
@ -84,9 +84,9 @@ struct Class: ClassLike, Decodable {
|
||||
public struct \(definition) {
|
||||
|
||||
/// Additional update functions for type extensions.
|
||||
var updateFunctions: [(ViewStorage, [(AnyView) -> AnyView], Bool) -> Void] = []
|
||||
var updateFunctions: [(ViewStorage, WidgetData, Bool) -> Void] = []
|
||||
/// Additional appear functions for type extensions.
|
||||
var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = []
|
||||
var appearFunctions: [(ViewStorage, WidgetData) -> Void] = []
|
||||
\(generateProperties(config: config, genConfig: genConfig, namespace: namespace, configs: configs))
|
||||
|
||||
/// Initialize `\(widgetName)`.
|
||||
@ -97,12 +97,12 @@ struct Class: ClassLike, Decodable {
|
||||
/// - modifiers: Modify views before being updated.
|
||||
/// - type: The type of the app storage.
|
||||
/// - Returns: The view storage.
|
||||
public func container<Data>(modifiers: [(AnyView) -> AnyView], type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
public func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||
let storage = ViewStorage(\(generateInitializer(name: widgetName, config: config, namespace: namespace, configs: configs))?.opaque())
|
||||
for function in appearFunctions {
|
||||
function(storage, modifiers)
|
||||
function(storage, data)
|
||||
}
|
||||
update(storage, modifiers: modifiers, updateProperties: true, type: type)
|
||||
update(storage, data: data, updateProperties: true, type: type)
|
||||
\(generateWidgetAssignments(config: config, genConfig: genConfig, namespace: namespace, configs: configs))
|
||||
return storage
|
||||
}
|
||||
@ -113,14 +113,14 @@ struct Class: ClassLike, Decodable {
|
||||
/// - modifiers: Modify views before being updated
|
||||
/// - updateProperties: Whether to update the view's properties.
|
||||
/// - type: The type of the app storage.
|
||||
public func update<Data>(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {\(generateSignalModifications(config: config, genConfig: genConfig, namespace: namespace))
|
||||
public func update<Data>(_ storage: ViewStorage, data: WidgetData, updateProperties: Bool, type: Data.Type) where Data: ViewRenderData {\(generateSignalModifications(config: config, genConfig: genConfig, namespace: namespace))
|
||||
storage.modify { widget in
|
||||
\(generateBindingAssignments(config: config, genConfig: genConfig, namespace: namespace, configs: configs))
|
||||
\(generateModifications(config: config, genConfig: genConfig, namespace: namespace, configs: configs))
|
||||
\(generateDynamicWidgetUpdate(config: config, genConfig: genConfig))
|
||||
}
|
||||
for function in updateFunctions {
|
||||
function(storage, modifiers, updateProperties)
|
||||
function(storage, data, updateProperties)
|
||||
}
|
||||
if updateProperties {
|
||||
storage.previousState = self
|
||||
|
@ -91,7 +91,7 @@ extension ClassLike {
|
||||
|
||||
var \(widget.name)Storage: [ViewStorage] = []
|
||||
for view in \(widget.name)() {
|
||||
\(widget.name)Storage.append(view.storage(modifiers: modifiers, type: type))
|
||||
\(widget.name)Storage.append(view.storage(data: data, type: type))
|
||||
\(widget.add)(\(widgetPointer), \(widget.name)Storage.last?.opaquePointer?.cast())
|
||||
}
|
||||
storage.content["\(widget.name)"] = \(widget.name)Storage
|
||||
|
@ -91,10 +91,6 @@ struct Property: Decodable {
|
||||
let mainParameter = parameter(config: config, genConfig: genConfig, modifier: true, defaultValue: true)
|
||||
var sideParameters = ""
|
||||
var sideAssignments = ""
|
||||
if type?.isMenu ?? false {
|
||||
sideParameters += "app: AdwaitaApp, window: AdwaitaWindow? = nil, "
|
||||
sideAssignments += "newSelf.app = app; newSelf.window = window"
|
||||
}
|
||||
return """
|
||||
|
||||
\(doc?.docComment(indent: " ") ?? "/// \(name)")
|
||||
@ -124,7 +120,7 @@ struct Property: Decodable {
|
||||
guard !(type?.isWidget ?? false) else {
|
||||
return """
|
||||
if let widget = storage.content["\(name)"]?.first {
|
||||
\(name)?().updateStorage(widget, modifiers: modifiers, updateProperties: updateProperties, type: type)
|
||||
\(name)?().updateStorage(widget, data: data, updateProperties: updateProperties, type: type)
|
||||
}
|
||||
|
||||
"""
|
||||
@ -133,7 +129,7 @@ struct Property: Decodable {
|
||||
return """
|
||||
if let menu = storage.content["\(name)"]?.first {
|
||||
MenuCollection { \(name)?() ?? [] }
|
||||
.updateStorage(menu, modifiers: [], updateProperties: updateProperties, type: MenuContext.self)
|
||||
.updateStorage(menu, data: data.noModifiers, updateProperties: updateProperties, type: MenuContext.self)
|
||||
}
|
||||
|
||||
"""
|
||||
@ -205,7 +201,7 @@ struct Property: Decodable {
|
||||
let name = convertPropertyName(configuration: genConfig)
|
||||
let view = (self.cast ?? config.cast) ? "storage.opaquePointer?.cast()" : "storage.opaquePointer"
|
||||
return """
|
||||
if let \(name)Storage = \(name)?().storage(modifiers: modifiers, type: type) {
|
||||
if let \(name)Storage = \(name)?().storage(data: data, type: type) {
|
||||
storage.content["\(name)"] = [\(name)Storage]
|
||||
\(setter)(\(view), \(name)Storage.opaquePointer?.cast())
|
||||
}
|
||||
@ -231,8 +227,8 @@ struct Property: Decodable {
|
||||
let name = convertPropertyName(configuration: genConfig)
|
||||
let view = (self.cast ?? config.cast) ? "storage.opaquePointer?.cast()" : "storage.opaquePointer"
|
||||
return """
|
||||
if let menu = \(name)?(), let app {
|
||||
let childStorage = MenuCollection { menu }.getMenu(app: app, window: window)
|
||||
if let menu = \(name)?() {
|
||||
let childStorage = MenuCollection { menu }.getMenu(data: data)
|
||||
storage.content["\(name)"] = [childStorage]
|
||||
\(setter)(\(view), childStorage.opaquePointer?.cast())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user