ctlCandidate // Make page-handling keys @discardableResult.

This commit is contained in:
ShikiSuen 2022-08-25 10:33:42 +08:00
parent f9942ceccc
commit 043c646878
3 changed files with 12 additions and 12 deletions

View File

@ -116,19 +116,19 @@ public class ctlCandidate: NSWindowController, ctlCandidateProtocol {
public func reloadData() {} public func reloadData() {}
public func showNextPage() -> Bool { @discardableResult public func showNextPage() -> Bool {
false false
} }
public func showPreviousPage() -> Bool { @discardableResult public func showPreviousPage() -> Bool {
false false
} }
public func highlightNextCandidate() -> Bool { @discardableResult public func highlightNextCandidate() -> Bool {
false false
} }
public func highlightPreviousCandidate() -> Bool { @discardableResult public func highlightPreviousCandidate() -> Bool {
false false
} }

View File

@ -123,7 +123,7 @@ public class ctlCandidateIMK: IMKCandidates, ctlCandidateProtocol {
} }
// IMK // IMK
public func showNextPage() -> Bool { @discardableResult public func showNextPage() -> Bool {
guard delegate != nil else { return false } guard delegate != nil else { return false }
if pageCount == 1 { return highlightNextCandidate() } if pageCount == 1 { return highlightNextCandidate() }
if currentPageIndex + 1 >= pageCount { clsSFX.beep() } if currentPageIndex + 1 >= pageCount { clsSFX.beep() }
@ -135,7 +135,7 @@ public class ctlCandidateIMK: IMKCandidates, ctlCandidateProtocol {
} }
// IMK // IMK
public func showPreviousPage() -> Bool { @discardableResult public func showPreviousPage() -> Bool {
guard delegate != nil else { return false } guard delegate != nil else { return false }
if pageCount == 1 { return highlightPreviousCandidate() } if pageCount == 1 { return highlightPreviousCandidate() }
if currentPageIndex == 0 { clsSFX.beep() } if currentPageIndex == 0 { clsSFX.beep() }
@ -147,7 +147,7 @@ public class ctlCandidateIMK: IMKCandidates, ctlCandidateProtocol {
} }
// IMK // IMK
public func highlightNextCandidate() -> Bool { @discardableResult public func highlightNextCandidate() -> Bool {
guard let delegate = delegate else { return false } guard let delegate = delegate else { return false }
selectedCandidateIndex = selectedCandidateIndex =
(selectedCandidateIndex + 1 >= delegate.candidateCountForController(self)) (selectedCandidateIndex + 1 >= delegate.candidateCountForController(self))
@ -157,7 +157,7 @@ public class ctlCandidateIMK: IMKCandidates, ctlCandidateProtocol {
} }
// IMK // IMK
public func highlightPreviousCandidate() -> Bool { @discardableResult public func highlightPreviousCandidate() -> Bool {
guard let delegate = delegate else { return false } guard let delegate = delegate else { return false }
selectedCandidateIndex = selectedCandidateIndex =
(selectedCandidateIndex == 0) (selectedCandidateIndex == 0)

View File

@ -432,7 +432,7 @@ public class ctlCandidateUniversal: ctlCandidate {
layoutCandidateView() layoutCandidateView()
} }
override public func showNextPage() -> Bool { @discardableResult override public func showNextPage() -> Bool {
guard delegate != nil else { return false } guard delegate != nil else { return false }
if pageCount == 1 { return highlightNextCandidate() } if pageCount == 1 { return highlightNextCandidate() }
if currentPageIndex + 1 >= pageCount { clsSFX.beep() } if currentPageIndex + 1 >= pageCount { clsSFX.beep() }
@ -445,7 +445,7 @@ public class ctlCandidateUniversal: ctlCandidate {
return true return true
} }
override public func showPreviousPage() -> Bool { @discardableResult override public func showPreviousPage() -> Bool {
guard delegate != nil else { return false } guard delegate != nil else { return false }
if pageCount == 1 { return highlightPreviousCandidate() } if pageCount == 1 { return highlightPreviousCandidate() }
if currentPageIndex == 0 { clsSFX.beep() } if currentPageIndex == 0 { clsSFX.beep() }
@ -458,7 +458,7 @@ public class ctlCandidateUniversal: ctlCandidate {
return true return true
} }
override public func highlightNextCandidate() -> Bool { @discardableResult override public func highlightNextCandidate() -> Bool {
guard let delegate = delegate else { return false } guard let delegate = delegate else { return false }
selectedCandidateIndex = selectedCandidateIndex =
(selectedCandidateIndex + 1 >= delegate.candidateCountForController(self)) (selectedCandidateIndex + 1 >= delegate.candidateCountForController(self))
@ -466,7 +466,7 @@ public class ctlCandidateUniversal: ctlCandidate {
return true return true
} }
override public func highlightPreviousCandidate() -> Bool { @discardableResult override public func highlightPreviousCandidate() -> Bool {
guard let delegate = delegate else { return false } guard let delegate = delegate else { return false }
selectedCandidateIndex = selectedCandidateIndex =
(selectedCandidateIndex == 0) (selectedCandidateIndex == 0)