This commit is contained in:
parent
0af3864058
commit
87b970d844
@ -1,22 +1,43 @@
|
||||
//
|
||||
// WrapMode.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by mlm on 24.08.25.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
/// Wrap modes for `TextView`/`TextEditor`
|
||||
public enum WrapMode: GtkWrapMode, RawRepresentable {
|
||||
case none // GTK_WRAP_NONE
|
||||
case char // GTK_WRAP_CHAR
|
||||
case word // GTK_WRAP_WORD
|
||||
case wordChar // GTK_WRAP_WORD_CHAR
|
||||
|
||||
// swiftlint:disable discouraged_none_name
|
||||
/// GTK_WRAP_NONE
|
||||
case none
|
||||
// swiftlint:enable discouraged_none_name
|
||||
/// GTK_WRAP_CHAR
|
||||
case char
|
||||
/// GTK_WRAP_WORD
|
||||
case word
|
||||
/// GTK_WRAP_WORD_CHAR
|
||||
case wordChar
|
||||
|
||||
/// Get the GtkWrapMode.
|
||||
public var rawValue: GtkWrapMode {
|
||||
switch self {
|
||||
case .none: GTK_WRAP_NONE
|
||||
case .char: GTK_WRAP_CHAR
|
||||
case .word: GTK_WRAP_WORD
|
||||
case .wordChar: GTK_WRAP_WORD_CHAR
|
||||
case .none:
|
||||
GTK_WRAP_NONE
|
||||
case .char:
|
||||
GTK_WRAP_CHAR
|
||||
case .word:
|
||||
GTK_WRAP_WORD
|
||||
case .wordChar:
|
||||
GTK_WRAP_WORD_CHAR
|
||||
}
|
||||
}
|
||||
|
||||
/// Initialize from the GtkWrapMode.
|
||||
/// - Parameter rawValue: The GtkWrapMode.
|
||||
public init?(rawValue: GtkWrapMode) {
|
||||
return nil
|
||||
nil
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,19 @@
|
||||
//
|
||||
// GtkWrapMode.swift
|
||||
// Adwaita
|
||||
//
|
||||
// Created by mlm on 24.08.25.
|
||||
//
|
||||
|
||||
import CAdw
|
||||
|
||||
/// Add ExpressibleByIntegerLiteral conformance to make GtkWrapMode usable as
|
||||
// a RawValue in an enum.
|
||||
/// a RawValue in an enum.
|
||||
extension GtkWrapMode: @retroactive ExpressibleByIntegerLiteral {
|
||||
|
||||
/// Initialize from an integer literal.
|
||||
public init(integerLiteral value: Int) {
|
||||
self.init(UInt32(value))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user