Skip to content

Commit 77794a0

Browse files
committed
added gtk4 support
1 parent 95261cf commit 77794a0

File tree

139 files changed

+7867
-7920
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+7867
-7920
lines changed

Examples/Sources/HoverExample/HoverApp.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ struct HoverExample: App {
2020
}
2121
}
2222
.background(Color.black)
23+
.onAppear {
24+
print(type(of: backend))
25+
}
2326
}
2427
.defaultSize(width: 900, height: 540)
2528
}
Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,40 @@
11
import CGtk
22

33
/// An interface for describing UI elements for Assistive Technologies.
4-
///
4+
///
55
/// Every accessible implementation has:
6-
///
6+
///
77
/// - a “role”, represented by a value of the [[email protected]] enumeration
88
/// - “attributes”, represented by a set of [[email protected]],
99
10-
///
10+
///
1111
/// The role cannot be changed after instantiating a `GtkAccessible`
1212
/// implementation.
13-
///
13+
///
1414
/// The attributes are updated every time a UI element's state changes in
1515
/// a way that should be reflected by assistive technologies. For instance,
1616
/// if a `GtkWidget` visibility changes, the %GTK_ACCESSIBLE_STATE_HIDDEN
1717
/// state will also change to reflect the [[email protected]:visible] property.
18-
///
18+
///
1919
/// Every accessible implementation is part of a tree of accessible objects.
2020
/// Normally, this tree corresponds to the widget tree, but can be customized
2121
/// by reimplementing the [[email protected]_accessible_parent],
2222
/// [[email protected]_first_accessible_child] and
2323
/// [[email protected]_next_accessible_sibling] virtual functions.
24-
///
24+
///
2525
/// Note that you can not create a top-level accessible object as of now,
2626
/// which means that you must always have a parent accessible object.
27-
///
27+
///
2828
/// Also note that when an accessible object does not correspond to a widget,
2929
/// and it has children, whose implementation you don't control,
3030
/// it is necessary to ensure the correct shape of the a11y tree
3131
/// by calling [[email protected]_accessible_parent] and
3232
/// updating the sibling by [[email protected]_next_accessible_sibling].
3333
public protocol Accessible: GObjectRepresentable {
3434
/// The accessible role of the given `GtkAccessible` implementation.
35-
///
36-
/// The accessible role cannot be changed once set.
37-
var accessibleRole: AccessibleRole { get set }
35+
///
36+
/// The accessible role cannot be changed once set.
37+
var accessibleRole: AccessibleRole { get set }
3838

39-
}
39+
40+
}

Sources/Gtk/Generated/AccessibleAutocomplete.swift

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,36 @@ public enum AccessibleAutocomplete: GValueRepresentableEnum {
66
public typealias GtkEnum = GtkAccessibleAutocomplete
77

88
/// Automatic suggestions are not displayed.
9-
case none
10-
/// When a user is providing input, text
11-
/// suggesting one way to complete the provided input may be dynamically
12-
/// inserted after the caret.
13-
case inline
14-
/// When a user is providing input, an element
15-
/// containing a collection of values that could complete the provided input
16-
/// may be displayed.
17-
case list
18-
/// When a user is providing input, an element
19-
/// containing a collection of values that could complete the provided input
20-
/// may be displayed. If displayed, one value in the collection is automatically
21-
/// selected, and the text needed to complete the automatically selected value
22-
/// appears after the caret in the input.
23-
case both
9+
case none
10+
/// When a user is providing input, text
11+
/// suggesting one way to complete the provided input may be dynamically
12+
/// inserted after the caret.
13+
case inline
14+
/// When a user is providing input, an element
15+
/// containing a collection of values that could complete the provided input
16+
/// may be displayed.
17+
case list
18+
/// When a user is providing input, an element
19+
/// containing a collection of values that could complete the provided input
20+
/// may be displayed. If displayed, one value in the collection is automatically
21+
/// selected, and the text needed to complete the automatically selected value
22+
/// appears after the caret in the input.
23+
case both
2424

2525
public static var type: GType {
26-
gtk_accessible_autocomplete_get_type()
27-
}
26+
gtk_accessible_autocomplete_get_type()
27+
}
2828

2929
public init(from gtkEnum: GtkAccessibleAutocomplete) {
3030
switch gtkEnum {
3131
case GTK_ACCESSIBLE_AUTOCOMPLETE_NONE:
32-
self = .none
33-
case GTK_ACCESSIBLE_AUTOCOMPLETE_INLINE:
34-
self = .inline
35-
case GTK_ACCESSIBLE_AUTOCOMPLETE_LIST:
36-
self = .list
37-
case GTK_ACCESSIBLE_AUTOCOMPLETE_BOTH:
38-
self = .both
32+
self = .none
33+
case GTK_ACCESSIBLE_AUTOCOMPLETE_INLINE:
34+
self = .inline
35+
case GTK_ACCESSIBLE_AUTOCOMPLETE_LIST:
36+
self = .list
37+
case GTK_ACCESSIBLE_AUTOCOMPLETE_BOTH:
38+
self = .both
3939
default:
4040
fatalError("Unsupported GtkAccessibleAutocomplete enum value: \(gtkEnum.rawValue)")
4141
}
@@ -44,13 +44,13 @@ public enum AccessibleAutocomplete: GValueRepresentableEnum {
4444
public func toGtk() -> GtkAccessibleAutocomplete {
4545
switch self {
4646
case .none:
47-
return GTK_ACCESSIBLE_AUTOCOMPLETE_NONE
48-
case .inline:
49-
return GTK_ACCESSIBLE_AUTOCOMPLETE_INLINE
50-
case .list:
51-
return GTK_ACCESSIBLE_AUTOCOMPLETE_LIST
52-
case .both:
53-
return GTK_ACCESSIBLE_AUTOCOMPLETE_BOTH
47+
return GTK_ACCESSIBLE_AUTOCOMPLETE_NONE
48+
case .inline:
49+
return GTK_ACCESSIBLE_AUTOCOMPLETE_INLINE
50+
case .list:
51+
return GTK_ACCESSIBLE_AUTOCOMPLETE_LIST
52+
case .both:
53+
return GTK_ACCESSIBLE_AUTOCOMPLETE_BOTH
5454
}
5555
}
56-
}
56+
}

Sources/Gtk/Generated/AccessibleInvalidState.swift

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,36 @@ import CGtk
22

33
/// The possible values for the %GTK_ACCESSIBLE_STATE_INVALID
44
/// accessible state.
5-
///
5+
///
66
/// Note that the %GTK_ACCESSIBLE_INVALID_FALSE and
77
/// %GTK_ACCESSIBLE_INVALID_TRUE have the same values
88
/// as %FALSE and %TRUE.
99
public enum AccessibleInvalidState: GValueRepresentableEnum {
1010
public typealias GtkEnum = GtkAccessibleInvalidState
1111

1212
/// There are no detected errors in the value
13-
case false_
14-
/// The value entered by the user has failed validation
15-
case true_
16-
/// A grammatical error was detected
17-
case grammar
18-
/// A spelling error was detected
19-
case spelling
13+
case false_
14+
/// The value entered by the user has failed validation
15+
case true_
16+
/// A grammatical error was detected
17+
case grammar
18+
/// A spelling error was detected
19+
case spelling
2020

2121
public static var type: GType {
22-
gtk_accessible_invalid_state_get_type()
23-
}
22+
gtk_accessible_invalid_state_get_type()
23+
}
2424

2525
public init(from gtkEnum: GtkAccessibleInvalidState) {
2626
switch gtkEnum {
2727
case GTK_ACCESSIBLE_INVALID_FALSE:
28-
self = .false_
29-
case GTK_ACCESSIBLE_INVALID_TRUE:
30-
self = .true_
31-
case GTK_ACCESSIBLE_INVALID_GRAMMAR:
32-
self = .grammar
33-
case GTK_ACCESSIBLE_INVALID_SPELLING:
34-
self = .spelling
28+
self = .false_
29+
case GTK_ACCESSIBLE_INVALID_TRUE:
30+
self = .true_
31+
case GTK_ACCESSIBLE_INVALID_GRAMMAR:
32+
self = .grammar
33+
case GTK_ACCESSIBLE_INVALID_SPELLING:
34+
self = .spelling
3535
default:
3636
fatalError("Unsupported GtkAccessibleInvalidState enum value: \(gtkEnum.rawValue)")
3737
}
@@ -40,13 +40,13 @@ public enum AccessibleInvalidState: GValueRepresentableEnum {
4040
public func toGtk() -> GtkAccessibleInvalidState {
4141
switch self {
4242
case .false_:
43-
return GTK_ACCESSIBLE_INVALID_FALSE
44-
case .true_:
45-
return GTK_ACCESSIBLE_INVALID_TRUE
46-
case .grammar:
47-
return GTK_ACCESSIBLE_INVALID_GRAMMAR
48-
case .spelling:
49-
return GTK_ACCESSIBLE_INVALID_SPELLING
43+
return GTK_ACCESSIBLE_INVALID_FALSE
44+
case .true_:
45+
return GTK_ACCESSIBLE_INVALID_TRUE
46+
case .grammar:
47+
return GTK_ACCESSIBLE_INVALID_GRAMMAR
48+
case .spelling:
49+
return GTK_ACCESSIBLE_INVALID_SPELLING
5050
}
5151
}
52-
}
52+
}

0 commit comments

Comments
 (0)