ctlCandidate // Make page-handling keys @discardableResult.

This commit is contained in:
ShikiSuen 2022-08-25 10:33:42 +08:00
parent 15af0f74ef
commit 860289af46
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 showNextPage() -> Bool {
@discardableResult public func showNextPage() -> Bool {
false
}
public func showPreviousPage() -> Bool {
@discardableResult public func showPreviousPage() -> Bool {
false
}
public func highlightNextCandidate() -> Bool {
@discardableResult public func highlightNextCandidate() -> Bool {
false
}
public func highlightPreviousCandidate() -> Bool {
@discardableResult public func highlightPreviousCandidate() -> Bool {
false
}

View File

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

View File

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