IMEState // Add tooltip duration property.

This commit is contained in:
ShikiSuen 2022-11-27 08:24:29 +08:00
parent 1f7be00263
commit 401b79a831
3 changed files with 8 additions and 0 deletions

View File

@ -22,6 +22,7 @@ public protocol IMEStateProtocol {
var displayedTextConverted: String { get } var displayedTextConverted: String { get }
var textToCommit: String { get set } var textToCommit: String { get set }
var tooltip: String { get set } var tooltip: String { get set }
var tooltipDuration: Double { get set }
var attributedString: NSAttributedString { get } var attributedString: NSAttributedString { get }
var convertedToInputting: IMEStateProtocol { get } var convertedToInputting: IMEStateProtocol { get }
var isFilterable: Bool { get } var isFilterable: Bool { get }
@ -53,6 +54,7 @@ public protocol IMEStateDataProtocol {
var displayedTextConverted: String { get } var displayedTextConverted: String { get }
var tooltipBackupForInputting: String { get set } var tooltipBackupForInputting: String { get set }
var tooltip: String { get set } var tooltip: String { get set }
var tooltipDuration: Double { get set }
var attributedStringNormal: NSAttributedString { get } var attributedStringNormal: NSAttributedString { get }
var attributedStringMarking: NSAttributedString { get } var attributedStringMarking: NSAttributedString { get }
var attributedStringPlaceholder: NSAttributedString { get } var attributedStringPlaceholder: NSAttributedString { get }

View File

@ -225,4 +225,9 @@ extension IMEState {
get { data.tooltipBackupForInputting } get { data.tooltipBackupForInputting }
set { data.tooltipBackupForInputting = newValue } set { data.tooltipBackupForInputting = newValue }
} }
public var tooltipDuration: Double {
get { type == .ofMarking ? 0 : data.tooltipDuration }
set { data.tooltipDuration = newValue }
}
} }

View File

@ -94,6 +94,7 @@ public struct IMEStateData: IMEStateDataProtocol {
public var candidates = [(String, String)]() public var candidates = [(String, String)]()
public var textToCommit: String = "" public var textToCommit: String = ""
public var tooltip: String = "" public var tooltip: String = ""
public var tooltipDuration: Double = 1.0
public var tooltipBackupForInputting: String = "" public var tooltipBackupForInputting: String = ""
public var attributedStringPlaceholder: NSAttributedString = .init( public var attributedStringPlaceholder: NSAttributedString = .init(
string: " ", string: " ",