Zonble: Reload cand. data when CandidateControllerDelegate did set

This commit is contained in:
ShikiSuen 2022-01-19 00:40:54 +08:00
parent 339c3a5650
commit 90464543bd
1 changed files with 15 additions and 1 deletions

View File

@ -17,7 +17,11 @@ public protocol CandidateControllerDelegate: AnyObject {
@objc(VTCandidateController)
public class CandidateController: NSWindowController {
@objc public weak var delegate: CandidateControllerDelegate?
@objc public weak var delegate: CandidateControllerDelegate? {
didSet {
reloadData()
}
}
@objc public var selectedCandidateIndex: UInt = UInt.max
@objc public var visible: Bool = false {
didSet {
@ -69,6 +73,16 @@ public class CandidateController: NSWindowController {
UInt.max
}
/// Sets the location of the candidate window.
///
/// Please note that the method has side effects that modifies
/// `windowTopLeftPoint` to make the candidate window to stay in at least
/// in a screen.
///
/// - Parameters:
/// - windowTopLeftPoint: The given location.
/// - height: The height that helps the window not to be out of the bottom
/// of a screen.
@objc(setWindowTopLeftPoint:bottomOutOfScreenAdjustmentHeight:)
public func set(windowTopLeftPoint: NSPoint, bottomOutOfScreenAdjustmentHeight height: CGFloat) {
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now()) {