From 5837b8e768ffa054ea7bb9a353e7ff80b4739eff Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 19 Jan 2022 00:40:54 +0800 Subject: [PATCH] Zonble: Reload cand. data when CandidateControllerDelegate did set --- .../UI/CandidateUI/VTCandidateController.swift | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Source/UI/CandidateUI/VTCandidateController.swift b/Source/UI/CandidateUI/VTCandidateController.swift index 6af0f20b..be334f25 100644 --- a/Source/UI/CandidateUI/VTCandidateController.swift +++ b/Source/UI/CandidateUI/VTCandidateController.swift @@ -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()) {