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