Documentation
¶
Overview ¶
Package inputmethodkit provides Go bindings for the InputMethodKit framework.
Develop input methods and manage communication with client applications, candidates windows, and input method modes.
The Input Method Kit, introduced in OS X v10.5, provides a streamlined programming interface that lets you develop input methods with far less code than older Mac programming interfaces. It is fully integrated with the Text Services Manager. The Input Method Kit allows 32-bit applications to work with 64-bit applications.
Classes ¶
- IMKCandidates: The class presents candidates to users and notifies the appropriate object when the user selects a candidate. (IMKCandidatePanelType, IMKCandidatesLocationHint)
- IMKInputController: The class provides a base class for custom input controller classes.
- IMKServer: The class manages client connections to your input method.
Protocols ¶
- IMKMouseHandling: The protocol defines methods that your input method can implement to handle mouse events.
- IMKStateSetting: The protocol defines methods for setting or accessing values that indicate the state of an input method.
Key Types ¶
- IMKCandidates - The IMKCandidates class presents candidates to users and notifies the appropriate IMKInputController object when the user selects a candidate.
- IMKInputController - The IMKInputController class provides a base class for custom input controller classes.
- IMKServer - The IMKServer class manages client connections to your input method.
Code generated from Apple documentation. DO NOT EDIT.
Index ¶
- Variables
- type IIMKCandidates
- type IIMKInputController
- type IIMKServer
- type IMKCandidatePanelType
- type IMKCandidates
- func IMKCandidatesFromID(id objc.ID) IMKCandidates
- func NewIMKCandidates() IMKCandidates
- func NewIMKCandidatesWithServerPanelType(server IIMKServer, panelType IMKCandidatePanelType) IMKCandidates
- func NewIMKCandidatesWithServerPanelTypeStyleType(server IIMKServer, panelType IMKCandidatePanelType, style IMKStyleType) IMKCandidates
- func (i IMKCandidates) AttachChildToCandidateType(child IIMKCandidates, candidateIdentifier int, theType IMKStyleType)
- func (i IMKCandidates) Attributes() foundation.INSDictionary
- func (i IMKCandidates) Autorelease() IMKCandidates
- func (i IMKCandidates) CandidateFrame() corefoundation.CGRect
- func (i IMKCandidates) CandidateIdentifierAtLineNumber(lineNumber int) int
- func (i IMKCandidates) CandidateStringIdentifier(candidateString objectivec.IObject) int
- func (i IMKCandidates) ClearSelection()
- func (i IMKCandidates) DetachChild(candidateIdentifier int)
- func (i IMKCandidates) DismissesAutomatically() bool
- func (i IMKCandidates) Hide()
- func (i IMKCandidates) HideChild()
- func (i IMKCandidates) Init() IMKCandidates
- func (i IMKCandidates) InitWithServerPanelType(server IIMKServer, panelType IMKCandidatePanelType) IMKCandidates
- func (i IMKCandidates) InitWithServerPanelTypeStyleType(server IIMKServer, panelType IMKCandidatePanelType, style IMKStyleType) IMKCandidates
- func (i IMKCandidates) IsVisible() bool
- func (i IMKCandidates) LineNumberForCandidateWithIdentifier(candidateIdentifier int) int
- func (i IMKCandidates) PanelType() IMKCandidatePanelType
- func (i IMKCandidates) SelectCandidate(candidateIdentifier int)
- func (i IMKCandidates) SelectCandidateWithIdentifier(candidateIdentifier int) bool
- func (i IMKCandidates) SelectedCandidate() int
- func (i IMKCandidates) SelectedCandidateString() foundation.NSAttributedString
- func (i IMKCandidates) SelectionKeys() foundation.INSArray
- func (i IMKCandidates) SelectionKeysKeylayout() uintptr
- func (i IMKCandidates) SetAttributes(attributes foundation.INSDictionary)
- func (i IMKCandidates) SetCandidateData(candidatesArray foundation.INSArray)
- func (i IMKCandidates) SetCandidateFrameTopLeft(point corefoundation.CGPoint)
- func (i IMKCandidates) SetDismissesAutomatically(flag bool)
- func (i IMKCandidates) SetPanelType(panelType IMKCandidatePanelType)
- func (i IMKCandidates) SetSelectionKeys(keyCodes foundation.INSArray)
- func (i IMKCandidates) SetSelectionKeysKeylayout(layout uintptr)
- func (i IMKCandidates) Show(locationHint IMKCandidatesLocationHint)
- func (i IMKCandidates) ShowAnnotation(annotationString foundation.NSAttributedString)
- func (i IMKCandidates) ShowCandidates()
- func (i IMKCandidates) ShowChild()
- func (i IMKCandidates) ShowSublistSubListDelegate(candidates foundation.INSArray, delegate objectivec.IObject)
- func (i IMKCandidates) UpdateCandidates()
- type IMKCandidatesClass
- type IMKCandidatesLocationHint
- type IMKInputController
- func (i IMKInputController) ActivateServer(sender objectivec.IObject)
- func (i IMKInputController) AnnotationSelectedForCandidate(annotationString foundation.NSAttributedString, ...)
- func (i IMKInputController) Autorelease() IMKInputController
- func (i IMKInputController) CancelComposition()
- func (i IMKInputController) CandidateSelected(candidateString foundation.NSAttributedString)
- func (i IMKInputController) CandidateSelectionChanged(candidateString foundation.NSAttributedString)
- func (i IMKInputController) Client() objectivec.IObject
- func (i IMKInputController) CompositionAttributesAtRange(range_ foundation.NSRange) foundation.INSDictionary
- func (i IMKInputController) DeactivateServer(sender objectivec.IObject)
- func (i IMKInputController) Delegate() objectivec.IObject
- func (i IMKInputController) DoCommandBySelectorCommandDictionary(aSelector objc.SEL, infoDictionary foundation.INSDictionary)
- func (i IMKInputController) HidePalettes()
- func (i IMKInputController) Init() IMKInputController
- func (i IMKInputController) InitWithServerDelegateClient(server IIMKServer, delegate objectivec.IObject, inputClient objectivec.IObject) IMKInputController
- func (i IMKInputController) InputControllerWillClose()
- func (i IMKInputController) MarkForStyleAtRange(style int, range_ foundation.NSRange) foundation.INSDictionary
- func (i IMKInputController) Menu() appkit.NSMenu
- func (i IMKInputController) Modes(sender objectivec.IObject) foundation.INSDictionary
- func (i IMKInputController) MouseDownOnCharacterIndexCoordinateWithModifierContinueTrackingClient(index uint, point corefoundation.CGPoint, flags uint, ...) (bool, bool)
- func (i IMKInputController) MouseMovedOnCharacterIndexCoordinateWithModifierClient(index uint, point corefoundation.CGPoint, flags uint, ...) bool
- func (i IMKInputController) MouseUpOnCharacterIndexCoordinateWithModifierClient(index uint, point corefoundation.CGPoint, flags uint, ...) bool
- func (i IMKInputController) RecognizedEvents(sender objectivec.IObject) uint
- func (i IMKInputController) ReplacementRange() foundation.NSRange
- func (i IMKInputController) SelectionRange() foundation.NSRange
- func (i IMKInputController) Server() IIMKServer
- func (i IMKInputController) SetDelegate(newDelegate objectivec.IObject)
- func (i IMKInputController) SetValueForTagClient(value objectivec.IObject, tag int, sender objectivec.IObject)
- func (i IMKInputController) ShowPreferences(sender objectivec.IObject)
- func (i IMKInputController) UpdateComposition()
- func (i IMKInputController) ValueForTagClient(tag int, sender objectivec.IObject) objectivec.IObject
- type IMKInputControllerClass
- type IMKMouseHandling
- type IMKMouseHandlingObject
- func (o IMKMouseHandlingObject) BaseObject() objectivec.Object
- func (o IMKMouseHandlingObject) MouseDownOnCharacterIndexCoordinateWithModifierContinueTrackingClient(index uint, point corefoundation.CGPoint, flags uint, ...) (bool, bool)
- func (o IMKMouseHandlingObject) MouseMovedOnCharacterIndexCoordinateWithModifierClient(index uint, point corefoundation.CGPoint, flags uint, ...) bool
- func (o IMKMouseHandlingObject) MouseUpOnCharacterIndexCoordinateWithModifierClient(index uint, point corefoundation.CGPoint, flags uint, ...) bool
- type IMKServer
- func (i IMKServer) Autorelease() IMKServer
- func (i IMKServer) Bundle() foundation.Bundle
- func (i IMKServer) Init() IMKServer
- func (i IMKServer) InitWithNameBundleIdentifier(name string, bundleIdentifier string) IMKServer
- func (i IMKServer) InitWithNameControllerClassDelegateClass(name string, controllerClassID objectivec.Class, ...) IMKServer
- func (i IMKServer) LastKeyEventWasDeadKey() bool
- func (i IMKServer) PaletteWillTerminate() bool
- type IMKServerClass
- type IMKStateSetting
- type IMKStateSettingObject
- func (o IMKStateSettingObject) ActivateServer(sender objectivec.IObject)
- func (o IMKStateSettingObject) BaseObject() objectivec.Object
- func (o IMKStateSettingObject) DeactivateServer(sender objectivec.IObject)
- func (o IMKStateSettingObject) Modes(sender objectivec.IObject) foundation.INSDictionary
- func (o IMKStateSettingObject) RecognizedEvents(sender objectivec.IObject) uint
- func (o IMKStateSettingObject) SetValueForTagClient(value objectivec.IObject, tag int, sender objectivec.IObject)
- func (o IMKStateSettingObject) ShowPreferences(sender objectivec.IObject)
- func (o IMKStateSettingObject) ValueForTagClient(tag int, sender objectivec.IObject) objectivec.IObject
- type IMKStyleType
- type KIMKLocateCandidates
- type KIMKMain
- type KIMKSingleColumnScrollingCandidatePanel
Constants ¶
This section is empty.
Variables ¶
var ( // See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidatesOpacityAttributeName IMKCandidatesOpacityAttributeName string // See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidatesSendServerKeyEventFirst IMKCandidatesSendServerKeyEventFirst string // See: https://developer.apple.com/documentation/InputMethodKit/IMKControllerClass IMKControllerClass string // See: https://developer.apple.com/documentation/InputMethodKit/IMKDelegateClass IMKDelegateClass string // See: https://developer.apple.com/documentation/InputMethodKit/IMKModeDictionary IMKModeDictionary string // See: https://developer.apple.com/documentation/InputMethodKit/kIMKCommandClientName KIMKCommandClientName string // See: https://developer.apple.com/documentation/InputMethodKit/kIMKCommandMenuItemName KIMKCommandMenuItemName string )
Functions ¶
This section is empty.
Types ¶
type IIMKCandidates ¶
type IIMKCandidates interface {
appkit.INSResponder
// Returns the initialized [IMKCandidates] object.
InitWithServerPanelType(server IIMKServer, panelType IMKCandidatePanelType) IMKCandidates
// Sets the selection keys for the candidates.
SetSelectionKeys(keyCodes foundation.INSArray)
// Returns an array of [NSNumber] objects where each [NSNumber] object represents a virtual key code.
SelectionKeys() foundation.INSArray
// Sets the key layout that is used to map virtual key codes to characters.
SetSelectionKeysKeylayout(layout uintptr)
// Returns the key layout that maps virtual key codes to selection keys.
SelectionKeysKeylayout() uintptr
// Shows the candidates window.
Show(locationHint IMKCandidatesLocationHint)
// Hides a candidates window, if it is visible.
Hide()
// Returns whether or not the candidates window is visible.
IsVisible() bool
// Sets the state of the flag that determines whether the candidates window dismisses automatically.
SetDismissesAutomatically(flag bool)
// Returns the state of the flag that determines whether the candidates window dismisses automatically.
DismissesAutomatically() bool
// Updates the candidates that are displayed in the candidates window.
UpdateCandidates()
// Returns the style of the candidates window.
PanelType() IMKCandidatePanelType
// Sets the style of the candidates window.
SetPanelType(panelType IMKCandidatePanelType)
// Sets the style attributes for the candidates window.
SetAttributes(attributes foundation.INSDictionary)
// Returns a dictionary of the style attributes used for the candidates window..
Attributes() foundation.INSDictionary
// Displays an annotation string in an annotation window.
ShowAnnotation(annotationString foundation.NSAttributedString)
InitWithServerPanelTypeStyleType(server IIMKServer, panelType IMKCandidatePanelType, style IMKStyleType) IMKCandidates
AttachChildToCandidateType(child IIMKCandidates, candidateIdentifier int, theType IMKStyleType)
CandidateFrame() corefoundation.CGRect
CandidateIdentifierAtLineNumber(lineNumber int) int
CandidateStringIdentifier(candidateString objectivec.IObject) int
ClearSelection()
DetachChild(candidateIdentifier int)
HideChild()
LineNumberForCandidateWithIdentifier(candidateIdentifier int) int
SelectCandidate(candidateIdentifier int)
SelectCandidateWithIdentifier(candidateIdentifier int) bool
SelectedCandidate() int
SelectedCandidateString() foundation.NSAttributedString
SetCandidateData(candidatesArray foundation.INSArray)
SetCandidateFrameTopLeft(point corefoundation.CGPoint)
ShowCandidates()
ShowChild()
ShowSublistSubListDelegate(candidates foundation.INSArray, delegate objectivec.IObject)
}
An interface definition for the IMKCandidates class.
Initializing a Candidates Window ¶
- IIMKCandidates.InitWithServerPanelType: Returns the initialized IMKCandidates object.
Managing Selection Keys ¶
- IIMKCandidates.SetSelectionKeys: Sets the selection keys for the candidates.
- IIMKCandidates.SelectionKeys: Returns an array of [NSNumber] objects where each [NSNumber] object represents a virtual key code.
- IIMKCandidates.SetSelectionKeysKeylayout: Sets the key layout that is used to map virtual key codes to characters.
- IIMKCandidates.SelectionKeysKeylayout: Returns the key layout that maps virtual key codes to selection keys.
Managing Window Visibility and Behavior ¶
- IIMKCandidates.Show: Shows the candidates window.
- IIMKCandidates.Hide: Hides a candidates window, if it is visible.
- IIMKCandidates.IsVisible: Returns whether or not the candidates window is visible.
- IIMKCandidates.SetDismissesAutomatically: Sets the state of the flag that determines whether the candidates window dismisses automatically.
- IIMKCandidates.DismissesAutomatically: Returns the state of the flag that determines whether the candidates window dismisses automatically.
- IIMKCandidates.UpdateCandidates: Updates the candidates that are displayed in the candidates window.
Managing Window Type and Text Attributes ¶
- IIMKCandidates.PanelType: Returns the style of the candidates window.
- IIMKCandidates.SetPanelType: Sets the style of the candidates window.
- IIMKCandidates.SetAttributes: Sets the style attributes for the candidates window.
- IIMKCandidates.Attributes: Returns a dictionary of the style attributes used for the candidates window..
Showing an Annotation Window ¶
- IIMKCandidates.ShowAnnotation: Displays an annotation string in an annotation window.
Initializers ¶
Instance Methods ¶
- IIMKCandidates.AttachChildToCandidateType
- IIMKCandidates.CandidateFrame
- IIMKCandidates.CandidateIdentifierAtLineNumber
- IIMKCandidates.CandidateStringIdentifier
- IIMKCandidates.ClearSelection
- IIMKCandidates.DetachChild
- IIMKCandidates.HideChild
- IIMKCandidates.LineNumberForCandidateWithIdentifier
- IIMKCandidates.SelectCandidate
- IIMKCandidates.SelectCandidateWithIdentifier
- IIMKCandidates.SelectedCandidate
- IIMKCandidates.SelectedCandidateString
- IIMKCandidates.SetCandidateData
- IIMKCandidates.SetCandidateFrameTopLeft
- IIMKCandidates.ShowCandidates
- IIMKCandidates.ShowChild
- IIMKCandidates.ShowSublistSubListDelegate
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates
type IIMKInputController ¶
type IIMKInputController interface {
objectivec.IObject
// Initializes the input control by setting the delegate.
InitWithServerDelegateClient(server IIMKServer, delegate objectivec.IObject, inputClient objectivec.IObject) IMKInputController
// Returns a dictionary of text attributes.
CompositionAttributesAtRange(range_ foundation.NSRange) foundation.INSDictionary
// Returns where the range of the selection that should be placed inside marked text.
SelectionRange() foundation.NSRange
// Returns the range in the client document that the text should replace.
ReplacementRange() foundation.NSRange
// Returns a dictionary of text attributes that can mark a range of an attributed string to send to a client.
MarkForStyleAtRange(style int, range_ foundation.NSRange) foundation.INSDictionary
// Returns the delegate for input controller object.
Delegate() objectivec.IObject
// Sets the delegate for input controller object.
SetDelegate(newDelegate objectivec.IObject)
// Returns the server object that manages the input controller.
Server() IIMKServer
// Returns the client object associated with the input controller.
Client() objectivec.IObject
// Sends the selected candidate string and annotation string to the input controller.
AnnotationSelectedForCandidate(annotationString foundation.NSAttributedString, candidateString foundation.NSAttributedString)
// Informs an input controller that the current candidate selection in the candidate window has changed.
CandidateSelectionChanged(candidateString foundation.NSAttributedString)
// Informs an input controller that a new candidate is selected.
CandidateSelected(candidateString foundation.NSAttributedString)
// Informs the input controller that the composition has changed.
UpdateComposition()
// Stops the current composition and replaces marked text with the original text.
CancelComposition()
// Informs an input method that it should close any visible user interface.
HidePalettes()
// Passes commands that are not generated as part of the text input process.
DoCommandBySelectorCommandDictionary(aSelector objc.SEL, infoDictionary foundation.INSDictionary)
// Returns a menu of commands that are specific to an input method.
Menu() appkit.NSMenu
InputControllerWillClose()
// Activates the input method server.
ActivateServer(sender objectivec.IObject)
// Deactivates the input method server.
DeactivateServer(sender objectivec.IObject)
// Returns the modes dictionary associated with the input method.
Modes(sender objectivec.IObject) foundation.INSDictionary
// Handles mouse-down event send to an input method.
MouseDownOnCharacterIndexCoordinateWithModifierContinueTrackingClient(index uint, point corefoundation.CGPoint, flags uint, sender objectivec.IObject) (bool, bool)
// Handles a mouse-moved event sent to an input method.
MouseMovedOnCharacterIndexCoordinateWithModifierClient(index uint, point corefoundation.CGPoint, flags uint, sender objectivec.IObject) bool
// Handles a mouse-up event sent to an input method.
MouseUpOnCharacterIndexCoordinateWithModifierClient(index uint, point corefoundation.CGPoint, flags uint, sender objectivec.IObject) bool
// Returns an unsigned integer that contains a union of event masks
RecognizedEvents(sender objectivec.IObject) uint
// Set the value for the provided key.
SetValueForTagClient(value objectivec.IObject, tag int, sender objectivec.IObject)
// Displays a preferences window.
ShowPreferences(sender objectivec.IObject)
// Returns a value object whose key is the provided tag.
ValueForTagClient(tag int, sender objectivec.IObject) objectivec.IObject
}
An interface definition for the IMKInputController class.
Initializing an Input Controller ¶
- IIMKInputController.InitWithServerDelegateClient: Initializes the input control by setting the delegate.
Working with Ranges ¶
- IIMKInputController.CompositionAttributesAtRange: Returns a dictionary of text attributes.
- IIMKInputController.SelectionRange: Returns where the range of the selection that should be placed inside marked text.
- IIMKInputController.ReplacementRange: Returns the range in the client document that the text should replace.
- IIMKInputController.MarkForStyleAtRange: Returns a dictionary of text attributes that can mark a range of an attributed string to send to a client.
Managing the Delegate ¶
- IIMKInputController.Delegate: Returns the delegate for input controller object.
- IIMKInputController.SetDelegate: Sets the delegate for input controller object.
Getting the Client and Server Objects ¶
- IIMKInputController.Server: Returns the server object that manages the input controller.
- IIMKInputController.Client: Returns the client object associated with the input controller.
Tracking Selections ¶
- IIMKInputController.AnnotationSelectedForCandidate: Sends the selected candidate string and annotation string to the input controller.
- IIMKInputController.CandidateSelectionChanged: Informs an input controller that the current candidate selection in the candidate window has changed.
- IIMKInputController.CandidateSelected: Informs an input controller that a new candidate is selected.
Managing Composition ¶
- IIMKInputController.UpdateComposition: Informs the input controller that the composition has changed.
- IIMKInputController.CancelComposition: Stops the current composition and replaces marked text with the original text.
Hiding the User Interface ¶
- IIMKInputController.HidePalettes: Informs an input method that it should close any visible user interface.
Working with Custom Commands ¶
- IIMKInputController.DoCommandBySelectorCommandDictionary: Passes commands that are not generated as part of the text input process.
- IIMKInputController.Menu: Returns a menu of commands that are specific to an input method.
Instance Methods ¶
See: https://developer.apple.com/documentation/InputMethodKit/IMKInputController
type IIMKServer ¶
type IIMKServer interface {
objectivec.IObject
// Creates and returns a server object from property list information contained in the provided bundle.
InitWithNameBundleIdentifier(name string, bundleIdentifier string) IMKServer
// Creates and returns a server object initialized with the provided parameters.
InitWithNameControllerClassDelegateClass(name string, controllerClassID objectivec.Class, delegateClassID objectivec.Class) IMKServer
// Returns an [NSBundle] object for the input method.
Bundle() foundation.Bundle
LastKeyEventWasDeadKey() bool
PaletteWillTerminate() bool
}
An interface definition for the IMKServer class.
Initializing a Server Object ¶
- IIMKServer.InitWithNameBundleIdentifier: Creates and returns a server object from property list information contained in the provided bundle.
- IIMKServer.InitWithNameControllerClassDelegateClass: Creates and returns a server object initialized with the provided parameters.
Getting a Bundle for the Input Method ¶
- IIMKServer.Bundle: Returns an [NSBundle] object for the input method.
Instance Methods ¶
See: https://developer.apple.com/documentation/InputMethodKit/IMKServer
type IMKCandidatePanelType ¶
type IMKCandidatePanelType = uint
IMKCandidatePanelType is types of candidates windows provide by the Input Method Kit.
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidatePanelType
type IMKCandidates ¶
type IMKCandidates struct {
appkit.NSResponder
}
The IMKCandidates class presents candidates to users and notifies the appropriate IMKInputController object when the user selects a candidate. Candidates are alternate characters for a given input sequence. The IMKCandidates class supports using a candidates window in your input method; using IMKCandidates is optional. Not all input methods require them.
Overview ¶
When you create an IMKCandidates object, you attach it to the IMKServer object for your input method. You then need to override the IMKInputController methods “ and “ as well as implement a candidates method in your delegate object. The IMKInputController subclass supplies candidates to the IMKCandidates object by implementing the candidates method. When you are ready to display a candidates window, call the candidates method to update candidates and to show the candidates window.
Initializing a Candidates Window ¶
- IMKCandidates.InitWithServerPanelType: Returns the initialized IMKCandidates object.
Managing Selection Keys ¶
- IMKCandidates.SetSelectionKeys: Sets the selection keys for the candidates.
- IMKCandidates.SelectionKeys: Returns an array of [NSNumber] objects where each [NSNumber] object represents a virtual key code.
- IMKCandidates.SetSelectionKeysKeylayout: Sets the key layout that is used to map virtual key codes to characters.
- IMKCandidates.SelectionKeysKeylayout: Returns the key layout that maps virtual key codes to selection keys.
Managing Window Visibility and Behavior ¶
- IMKCandidates.Show: Shows the candidates window.
- IMKCandidates.Hide: Hides a candidates window, if it is visible.
- IMKCandidates.IsVisible: Returns whether or not the candidates window is visible.
- IMKCandidates.SetDismissesAutomatically: Sets the state of the flag that determines whether the candidates window dismisses automatically.
- IMKCandidates.DismissesAutomatically: Returns the state of the flag that determines whether the candidates window dismisses automatically.
- IMKCandidates.UpdateCandidates: Updates the candidates that are displayed in the candidates window.
Managing Window Type and Text Attributes ¶
- IMKCandidates.PanelType: Returns the style of the candidates window.
- IMKCandidates.SetPanelType: Sets the style of the candidates window.
- IMKCandidates.SetAttributes: Sets the style attributes for the candidates window.
- IMKCandidates.Attributes: Returns a dictionary of the style attributes used for the candidates window..
Showing an Annotation Window ¶
- IMKCandidates.ShowAnnotation: Displays an annotation string in an annotation window.
Initializers ¶
Instance Methods ¶
- IMKCandidates.AttachChildToCandidateType
- IMKCandidates.CandidateFrame
- IMKCandidates.CandidateIdentifierAtLineNumber
- IMKCandidates.CandidateStringIdentifier
- IMKCandidates.ClearSelection
- IMKCandidates.DetachChild
- IMKCandidates.HideChild
- IMKCandidates.LineNumberForCandidateWithIdentifier
- IMKCandidates.SelectCandidate
- IMKCandidates.SelectCandidateWithIdentifier
- IMKCandidates.SelectedCandidate
- IMKCandidates.SelectedCandidateString
- IMKCandidates.SetCandidateData
- IMKCandidates.SetCandidateFrameTopLeft
- IMKCandidates.ShowCandidates
- IMKCandidates.ShowChild
- IMKCandidates.ShowSublistSubListDelegate
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates
func IMKCandidatesFromID ¶
func IMKCandidatesFromID(id objc.ID) IMKCandidates
IMKCandidatesFromID constructs a IMKCandidates from an objc.ID.
The IMKCandidates class presents candidates to users and notifies the appropriate IMKInputController object when the user selects a candidate. Candidates are alternate characters for a given input sequence. The IMKCandidates class supports using a candidates window in your input method; using IMKCandidates is optional. Not all input methods require them.
func NewIMKCandidates ¶
func NewIMKCandidates() IMKCandidates
NewIMKCandidates creates a new IMKCandidates instance.
func NewIMKCandidatesWithServerPanelType ¶
func NewIMKCandidatesWithServerPanelType(server IIMKServer, panelType IMKCandidatePanelType) IMKCandidates
Returns the initialized IMKCandidates object.
server: The IMKServer object that manages the candidate and the panel type.
panelType: A panel type for the candidate window.
Return Value ¶
The initialized IMKCandidates object.
Discussion ¶
When an input method allocates an IMKCandidates object it should initialize that object by calling this method.
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/init(server:panelType:)
func NewIMKCandidatesWithServerPanelTypeStyleType ¶
func NewIMKCandidatesWithServerPanelTypeStyleType(server IIMKServer, panelType IMKCandidatePanelType, style IMKStyleType) IMKCandidates
func (IMKCandidates) AttachChildToCandidateType ¶
func (i IMKCandidates) AttachChildToCandidateType(child IIMKCandidates, candidateIdentifier int, theType IMKStyleType)
func (IMKCandidates) Attributes ¶
func (i IMKCandidates) Attributes() foundation.INSDictionary
Returns a dictionary of the style attributes used for the candidates window..
Return Value ¶
The dictionary that contains the keys and values for the styles.
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/attributes()
func (IMKCandidates) Autorelease ¶
func (i IMKCandidates) Autorelease() IMKCandidates
Autorelease adds the receiver to the current autorelease pool.
func (IMKCandidates) CandidateFrame ¶
func (i IMKCandidates) CandidateFrame() corefoundation.CGRect
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/candidateFrame()
func (IMKCandidates) CandidateIdentifierAtLineNumber ¶
func (i IMKCandidates) CandidateIdentifierAtLineNumber(lineNumber int) int
func (IMKCandidates) CandidateStringIdentifier ¶
func (i IMKCandidates) CandidateStringIdentifier(candidateString objectivec.IObject) int
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/candidateStringIdentifier(_:)
func (IMKCandidates) ClearSelection ¶
func (i IMKCandidates) ClearSelection()
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/clearSelection()
func (IMKCandidates) DetachChild ¶
func (i IMKCandidates) DetachChild(candidateIdentifier int)
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/detachChild(_:)
func (IMKCandidates) DismissesAutomatically ¶
func (i IMKCandidates) DismissesAutomatically() bool
Returns the state of the flag that determines whether the candidates window dismisses automatically.
Return Value ¶
true if the candidates window dismisses automatically; otherwise false.
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/dismissesAutomatically()
func (IMKCandidates) Hide ¶
func (i IMKCandidates) Hide()
Hides a candidates window, if it is visible.
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/hide()
func (IMKCandidates) HideChild ¶
func (i IMKCandidates) HideChild()
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/hideChild()
func (IMKCandidates) Init ¶
func (i IMKCandidates) Init() IMKCandidates
Init initializes the instance.
func (IMKCandidates) InitWithServerPanelType ¶
func (i IMKCandidates) InitWithServerPanelType(server IIMKServer, panelType IMKCandidatePanelType) IMKCandidates
Returns the initialized IMKCandidates object.
server: The IMKServer object that manages the candidate and the panel type.
panelType: A panel type for the candidate window.
Return Value ¶
The initialized IMKCandidates object.
Discussion ¶
When an input method allocates an IMKCandidates object it should initialize that object by calling this method.
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/init(server:panelType:)
func (IMKCandidates) InitWithServerPanelTypeStyleType ¶
func (i IMKCandidates) InitWithServerPanelTypeStyleType(server IIMKServer, panelType IMKCandidatePanelType, style IMKStyleType) IMKCandidates
func (IMKCandidates) IsVisible ¶
func (i IMKCandidates) IsVisible() bool
Returns whether or not the candidates window is visible.
Return Value ¶
true if the candidates window is visible; otherwise false.
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/isVisible()
func (IMKCandidates) LineNumberForCandidateWithIdentifier ¶
func (i IMKCandidates) LineNumberForCandidateWithIdentifier(candidateIdentifier int) int
func (IMKCandidates) PanelType ¶
func (i IMKCandidates) PanelType() IMKCandidatePanelType
Returns the style of the candidates window.
Return Value ¶
A IMKCandidatePanelType constant that represents the style of the candidates window.
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/panelType()
func (IMKCandidates) SelectCandidate ¶
func (i IMKCandidates) SelectCandidate(candidateIdentifier int)
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/selectCandidate(_:)
func (IMKCandidates) SelectCandidateWithIdentifier ¶
func (i IMKCandidates) SelectCandidateWithIdentifier(candidateIdentifier int) bool
func (IMKCandidates) SelectedCandidate ¶
func (i IMKCandidates) SelectedCandidate() int
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/selectedCandidate()
func (IMKCandidates) SelectedCandidateString ¶
func (i IMKCandidates) SelectedCandidateString() foundation.NSAttributedString
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/selectedCandidateString()
func (IMKCandidates) SelectionKeys ¶
func (i IMKCandidates) SelectionKeys() foundation.INSArray
Returns an array of [NSNumber] objects where each [NSNumber] object represents a virtual key code.
Return Value ¶
The array of [NSNumber] objects.
Discussion ¶
Selection keys are keys that can be used to select one of the candidates. They are displayed next to the candidate that will be selected when the user types that key.
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/selectionKeys()
func (IMKCandidates) SelectionKeysKeylayout ¶
func (i IMKCandidates) SelectionKeysKeylayout() uintptr
Returns the key layout that maps virtual key codes to selection keys.
Return Value ¶
The key layout in use. By default this is the key layout whose source id is `com.AppleXCUIElementTypeKeylayout().US`.
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/selectionKeysKeylayout()
func (IMKCandidates) SetAttributes ¶
func (i IMKCandidates) SetAttributes(attributes foundation.INSDictionary)
Sets the style attributes for the candidates window.
attributes: A dictionary that contains keys and values for the styles to use. You can supply the keys and values listed in the following table:
[Table data omitted]
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/setAttributes(_:)
func (IMKCandidates) SetCandidateData ¶
func (i IMKCandidates) SetCandidateData(candidatesArray foundation.INSArray)
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/setCandidateData(_:)
func (IMKCandidates) SetCandidateFrameTopLeft ¶
func (i IMKCandidates) SetCandidateFrameTopLeft(point corefoundation.CGPoint)
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/setCandidateFrameTopLeft(_:)
func (IMKCandidates) SetDismissesAutomatically ¶
func (i IMKCandidates) SetDismissesAutomatically(flag bool)
Sets the state of the flag that determines whether the candidates window dismisses automatically.
flag: true to have the candidates window dismiss automatically; otherwise false.
Discussion ¶
By default, if the user presses the Return or Enter keys, the candidates are dismissed and a “ message is sent to the input controller. You can call the “ method, passing false as the `flag` parameter to change the default dismissal behavior. The input controller still receives a “ message.
When you set the flag to false, an input method processes text input while dynamically updating the content of the candidates as the user inputs text. When a session deactivates, candidate window is hidden regardless of the state of the flag.
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/setDismissesAutomatically(_:)
func (IMKCandidates) SetPanelType ¶
func (i IMKCandidates) SetPanelType(panelType IMKCandidatePanelType)
Sets the style of the candidates window.
panelType: A IMKCandidatePanelType constant that represents the style of the candidates window.
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/setPanelType(_:)
func (IMKCandidates) SetSelectionKeys ¶
func (i IMKCandidates) SetSelectionKeys(keyCodes foundation.INSArray)
Sets the selection keys for the candidates.
keyCodes: An array of [NSNumber] objects where each [NSNumber] object represents a virtual key code. The input controller maps these key codes to characters that are displayed either across the top of the candidates, if the candidates are laid out horizontally, or along the left edge of the candidates, if they are aligned vertically.
Discussion ¶
Selection keys are keys that can be used to select one of the candidates. They are displayed next to the candidate that will be selected when the user types that key.
The number of selection keys determines how many candidates are displayed per page. For example, if you pass an array of four key codes, four candidates are displayed per page. If you pass eleven key codes, eleven candidates are displayed. By default, the key codes are mapped using the keyboard layout whose source id is `com.AppleXCUIElementTypeKeylayout().US`. You can replace the default layout by calling IMKCandidates.SetSelectionKeysKeylayout. The default selection keys are the digits 1 through 9 or, in terms of key codes, 18, 19, 20, 21, 23, 22, 26, 28, and 25.
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/setSelectionKeys(_:)
func (IMKCandidates) SetSelectionKeysKeylayout ¶
func (i IMKCandidates) SetSelectionKeysKeylayout(layout uintptr)
Sets the key layout that is used to map virtual key codes to characters.
layout: The key layout to use.
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/setSelectionKeysKeylayout(_:)
func (IMKCandidates) Show ¶
func (i IMKCandidates) Show(locationHint IMKCandidatesLocationHint)
Shows the candidates window.
locationHint: A IMKCandidatesLocationHint constant that specifies the desired position of the candidates window. The Input Method Kit uses the hint to place the candidates window in a location that is in the vicinity of the hint location and ensures that the candidates window is fully visible.
Discussion ¶
Your input method calls this method when it is appropriate during text conversion to display a list of candidates.
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/show(_:)
func (IMKCandidates) ShowAnnotation ¶
func (i IMKCandidates) ShowAnnotation(annotationString foundation.NSAttributedString)
Displays an annotation string in an annotation window.
annotationString: The string to display.
Discussion ¶
An annotation string explains or comments on the candidate string in the candidates window. An annotation window is a small, borderless window that is aligned with the current candidates window. An input method calls “ when the “ method of the IMKInputController class is called, and the candidate string has annotations.
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/showAnnotation(_:)
func (IMKCandidates) ShowCandidates ¶
func (i IMKCandidates) ShowCandidates()
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/show()
func (IMKCandidates) ShowChild ¶
func (i IMKCandidates) ShowChild()
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/showChild()
func (IMKCandidates) ShowSublistSubListDelegate ¶
func (i IMKCandidates) ShowSublistSubListDelegate(candidates foundation.INSArray, delegate objectivec.IObject)
func (IMKCandidates) UpdateCandidates ¶
func (i IMKCandidates) UpdateCandidates()
Updates the candidates that are displayed in the candidates window.
Discussion ¶
When you call this method, the Input Method Kit calls the candidates method of the IMKInputController class. Note that the candidates list is updated, but the visible state of the window does not change. In other words, if the window is hidden, it remains hidden. If the window is visible, it remains visible.
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidates/update()
type IMKCandidatesClass ¶
type IMKCandidatesClass struct {
// contains filtered or unexported fields
}
func GetIMKCandidatesClass ¶
func GetIMKCandidatesClass() IMKCandidatesClass
GetIMKCandidatesClass returns the class object for IMKCandidates.
func (IMKCandidatesClass) Alloc ¶
func (ic IMKCandidatesClass) Alloc() IMKCandidates
Alloc allocates memory for a new instance of the class.
func (IMKCandidatesClass) Class ¶
func (ic IMKCandidatesClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type IMKCandidatesLocationHint ¶
type IMKCandidatesLocationHint = uint
IMKCandidatesLocationHint is hints that suggest where to place the candidates window.
See: https://developer.apple.com/documentation/InputMethodKit/IMKCandidatesLocationHint
type IMKInputController ¶
type IMKInputController struct {
objectivec.Object
}
The IMKInputController class provides a base class for custom input controller classes. The IMKServer class, which is allocated in the main function of an input method, creates an input controller object for each input session created by a client application. For every input session there is a corresponding IMKInputController object.
Overview ¶
An IMKInputController object controls text input on the input method side. It manages events and text from the applications and converted text from the input method engine. IMKInputController implements fully the IMKStateSetting and IMKMouseHandling protocols. Typically you do not need to override this class, but you do need to provide a delegate object that implements the methods that your are interested in. The IMKInputController versions of the protocol methods check whether the delegate object implements a method, and calls the delegate version if it exists.
Initializing an Input Controller ¶
- IMKInputController.InitWithServerDelegateClient: Initializes the input control by setting the delegate.
Working with Ranges ¶
- IMKInputController.CompositionAttributesAtRange: Returns a dictionary of text attributes.
- IMKInputController.SelectionRange: Returns where the range of the selection that should be placed inside marked text.
- IMKInputController.ReplacementRange: Returns the range in the client document that the text should replace.
- IMKInputController.MarkForStyleAtRange: Returns a dictionary of text attributes that can mark a range of an attributed string to send to a client.
Managing the Delegate ¶
- IMKInputController.Delegate: Returns the delegate for input controller object.
- IMKInputController.SetDelegate: Sets the delegate for input controller object.
Getting the Client and Server Objects ¶
- IMKInputController.Server: Returns the server object that manages the input controller.
- IMKInputController.Client: Returns the client object associated with the input controller.
Tracking Selections ¶
- IMKInputController.AnnotationSelectedForCandidate: Sends the selected candidate string and annotation string to the input controller.
- IMKInputController.CandidateSelectionChanged: Informs an input controller that the current candidate selection in the candidate window has changed.
- IMKInputController.CandidateSelected: Informs an input controller that a new candidate is selected.
Managing Composition ¶
- IMKInputController.UpdateComposition: Informs the input controller that the composition has changed.
- IMKInputController.CancelComposition: Stops the current composition and replaces marked text with the original text.
Hiding the User Interface ¶
- IMKInputController.HidePalettes: Informs an input method that it should close any visible user interface.
Working with Custom Commands ¶
- IMKInputController.DoCommandBySelectorCommandDictionary: Passes commands that are not generated as part of the text input process.
- IMKInputController.Menu: Returns a menu of commands that are specific to an input method.
Instance Methods ¶
See: https://developer.apple.com/documentation/InputMethodKit/IMKInputController
func IMKInputControllerFromID ¶
func IMKInputControllerFromID(id objc.ID) IMKInputController
IMKInputControllerFromID constructs a IMKInputController from an objc.ID.
The IMKInputController class provides a base class for custom input controller classes. The IMKServer class, which is allocated in the main function of an input method, creates an input controller object for each input session created by a client application. For every input session there is a corresponding IMKInputController object.
func NewIMKInputController ¶
func NewIMKInputController() IMKInputController
NewIMKInputController creates a new IMKInputController instance.
func NewIMKInputControllerWithServerDelegateClient ¶
func NewIMKInputControllerWithServerDelegateClient(server IIMKServer, delegate objectivec.IObject, inputClient objectivec.IObject) IMKInputController
Initializes the input control by setting the delegate.
server: The server object for the controller.
delegate: The delegate object.
inputClient: The client object that will send messages to the controller using the server object. The client object must confirm to the [IMKTextInput] protocol.
Return Value ¶
The initialized input controller object.
Discussion ¶
Methods in the IMKStateSetting and IMKMouseHandling protocols that are implemented by the delegate object always include a client parameter. Methods in the IMKInputController class do not need to take a client because the “ method stores the client object you supply as an ivar when it initializes the IMKInputController object.
func (IMKInputController) ActivateServer ¶
func (i IMKInputController) ActivateServer(sender objectivec.IObject)
Activates the input method server.
sender: The object sending the activation message.
See: https://developer.apple.com/documentation/InputMethodKit/IMKStateSetting/activateServer(_:)
func (IMKInputController) AnnotationSelectedForCandidate ¶
func (i IMKInputController) AnnotationSelectedForCandidate(annotationString foundation.NSAttributedString, candidateString foundation.NSAttributedString)
Sends the selected candidate string and annotation string to the input controller.
annotationString: The annotation string associated with the candidate.
candidateString: The candidate string that the user moved to.
Discussion ¶
This method is called when the user moves to a candidate.
func (IMKInputController) Autorelease ¶
func (i IMKInputController) Autorelease() IMKInputController
Autorelease adds the receiver to the current autorelease pool.
func (IMKInputController) CancelComposition ¶
func (i IMKInputController) CancelComposition()
Stops the current composition and replaces marked text with the original text.
Discussion ¶
This method calls the method originalString: to obtain the original text and sends that text to the client using a call to the [IMKTextInput] protocol method `insertText(_:)`
See: https://developer.apple.com/documentation/InputMethodKit/IMKInputController/cancelComposition()
func (IMKInputController) CandidateSelected ¶
func (i IMKInputController) CandidateSelected(candidateString foundation.NSAttributedString)
Informs an input controller that a new candidate is selected.
candidateString: The changed candidate string.
Discussion ¶
The candidate object is the user’s final choice from the candidate window. The candidate window is closed before this method is called.
See: https://developer.apple.com/documentation/InputMethodKit/IMKInputController/candidateSelected(_:)
func (IMKInputController) CandidateSelectionChanged ¶
func (i IMKInputController) CandidateSelectionChanged(candidateString foundation.NSAttributedString)
Informs an input controller that the current candidate selection in the candidate window has changed.
candidateString: The changed candidate string.
Discussion ¶
Note this method is called to indicate user activity in the candidate window. The candidate object might not be the user’s final selection.
func (IMKInputController) Client ¶
func (i IMKInputController) Client() objectivec.IObject
Returns the client object associated with the input controller.
Return Value ¶
The client object.
Discussion ¶
The client object conforms to the [IMKTextInput] protocol.
See: https://developer.apple.com/documentation/InputMethodKit/IMKInputController/client()
func (IMKInputController) CompositionAttributesAtRange ¶
func (i IMKInputController) CompositionAttributesAtRange(range_ foundation.NSRange) foundation.INSDictionary
Returns a dictionary of text attributes.
range: The range of text whose attributes you want to obtain.
Return Value ¶
The dictionary of text attributes. The default implementation returns an empty dictionary.
func (IMKInputController) DeactivateServer ¶
func (i IMKInputController) DeactivateServer(sender objectivec.IObject)
Deactivates the input method server.
sender: The object sending the deactivation message.
See: https://developer.apple.com/documentation/InputMethodKit/IMKStateSetting/deactivateServer(_:)
func (IMKInputController) Delegate ¶
func (i IMKInputController) Delegate() objectivec.IObject
Returns the delegate for input controller object.
Return Value ¶
The delegate object.
See: https://developer.apple.com/documentation/InputMethodKit/IMKInputController/delegate()
func (IMKInputController) DoCommandBySelectorCommandDictionary ¶
func (i IMKInputController) DoCommandBySelectorCommandDictionary(aSelector objc.SEL, infoDictionary foundation.INSDictionary)
Passes commands that are not generated as part of the text input process.
aSelector: A selector that represents a command from the text input menu.
infoDictionary: A dictionary that contains two key-value pairs:
- kIMKCommandMenuItemName, whose value is an [NSMenuItem] object. That is, the item selected by the user. - kIMKCommandClientName, whose value is the current client—`id`.
Discussion ¶
The default implementation checks if the input controller object (that is, self) responds to the selector. If so, it sends the message perform(_:with:) to the input controller class. The object parameter in that case is the `infoDictionary` parameter.
This method is called when a user selects a command from the text input menu. To support this, an input method must provide actions for each menu item that is placed in the menu. For example, `(void)(id)sender`. Note that the sender in this instance is the info dictionary.
See: https://developer.apple.com/documentation/InputMethodKit/IMKInputController/doCommand(by:command:)
func (IMKInputController) HidePalettes ¶
func (i IMKInputController) HidePalettes()
Informs an input method that it should close any visible user interface.
See: https://developer.apple.com/documentation/InputMethodKit/IMKInputController/hidePalettes()
func (IMKInputController) Init ¶
func (i IMKInputController) Init() IMKInputController
Init initializes the instance.
func (IMKInputController) InitWithServerDelegateClient ¶
func (i IMKInputController) InitWithServerDelegateClient(server IIMKServer, delegate objectivec.IObject, inputClient objectivec.IObject) IMKInputController
Initializes the input control by setting the delegate.
server: The server object for the controller.
delegate: The delegate object.
inputClient: The client object that will send messages to the controller using the server object. The client object must confirm to the [IMKTextInput] protocol.
Return Value ¶
The initialized input controller object.
Discussion ¶
Methods in the IMKStateSetting and IMKMouseHandling protocols that are implemented by the delegate object always include a client parameter. Methods in the IMKInputController class do not need to take a client because the “ method stores the client object you supply as an ivar when it initializes the IMKInputController object.
func (IMKInputController) InputControllerWillClose ¶
func (i IMKInputController) InputControllerWillClose()
func (IMKInputController) MarkForStyleAtRange ¶
func (i IMKInputController) MarkForStyleAtRange(style int, range_ foundation.NSRange) foundation.INSDictionary
Returns a dictionary of text attributes that can mark a range of an attributed string to send to a client.
style: A style, which should be one of the following values: kTSMHiliteSelectedRawText, kTSMHiliteConvertedText, or kTSMHiliteSelectedConvertedText. See the `AERegistry.H()` header file for the definition of these values.
range: The range (that is, a clause) to mark.
Return Value ¶
The dictionary of text attributes.
Discussion ¶
This utility function can be called by input methods to mark each range (i.e. clause ) of marked text. T
The default implementation first calls the method IMKInputController.CompositionAttributesAtRange to obtain the additional attributes that an input method wants to include, such as font or glyph information. Then, it adds the appropriate underline and underline color information to the attributes dictionary for the style parameter. Finally it adds the style value as the dictionary value. The key for the style value is markedClauseSegment.
See: https://developer.apple.com/documentation/InputMethodKit/IMKInputController/mark(forStyle:at:)
func (IMKInputController) Menu ¶
func (i IMKInputController) Menu() appkit.NSMenu
Returns a menu of commands that are specific to an input method.
Return Value ¶
The menu object.
Discussion ¶
This method is called whenever the menu needs to be drawn so that an input method can update the menu to reflect the current state.
See: https://developer.apple.com/documentation/InputMethodKit/IMKInputController/menu()
func (IMKInputController) Modes ¶
func (i IMKInputController) Modes(sender objectivec.IObject) foundation.INSDictionary
Returns the modes dictionary associated with the input method.
sender: The client object requesting the modes dictionary.
Return Value ¶
The modes dictionary associated with the input method.
Discussion ¶
Typically a client object calls this method to to build the text input menu. By calling the input method rather than reading the modes from the `Info.Plist()` file, the input method can dynamically modify the modes supported.
See: https://developer.apple.com/documentation/InputMethodKit/IMKStateSetting/modes(_:)
func (IMKInputController) MouseDownOnCharacterIndexCoordinateWithModifierContinueTrackingClient ¶
func (i IMKInputController) MouseDownOnCharacterIndexCoordinateWithModifierContinueTrackingClient(index uint, point corefoundation.CGPoint, flags uint, sender objectivec.IObject) (bool, bool)
Handles mouse-down event send to an input method.
index: The index within the sender’s text storage where the mouse-down event occurred.
point: The point at which the mouse-down event occurred.
flags: The modifier keys.
keepTracking: Set this parameter to true if you want to receive subsequent mouse-moved and mouse -up events.
sender: The client object.
Return Value ¶
true if handled; otherwise false.
Discussion ¶
Implement this method if your input method handles mouse-down events.
func (IMKInputController) MouseMovedOnCharacterIndexCoordinateWithModifierClient ¶
func (i IMKInputController) MouseMovedOnCharacterIndexCoordinateWithModifierClient(index uint, point corefoundation.CGPoint, flags uint, sender objectivec.IObject) bool
Handles a mouse-moved event sent to an input method.
index: The index within the sender’s text storage where the mouse-moved event occurred.
point: The point at which the mouse-moved event occurred.
flags: The modifier keys.
sender: The client object.
Return Value ¶
true if handled; otherwise false.
Discussion ¶
Implement this method if your input method handles mouse-moved events.
func (IMKInputController) MouseUpOnCharacterIndexCoordinateWithModifierClient ¶
func (i IMKInputController) MouseUpOnCharacterIndexCoordinateWithModifierClient(index uint, point corefoundation.CGPoint, flags uint, sender objectivec.IObject) bool
Handles a mouse-up event sent to an input method.
index: The index within the sender’s text storage where the mouse-up event occurred.
point: The point at which the mouse-up event occurred.
flags: The modifier keys.
sender: The client object.
Return Value ¶
true if handled; otherwise false.
Discussion ¶
Implement this method if your input method handles mouse-up events.
func (IMKInputController) RecognizedEvents ¶
func (i IMKInputController) RecognizedEvents(sender objectivec.IObject) uint
Returns an unsigned integer that contains a union of event masks
sender: The client object requesting the supported events.
Return Value ¶
An unsigned integer that contains a union of event masks (See the `NSEvent.H()` header file.
Discussion ¶
A client calls this method to check whether an input method supports an event. The default implementation returns [NSKeyDownMask]. If your input method handles only key down events, the Input Method Kit provides the default mouse handling. The default mouse-down handling behavior is as follows: If there is an active composition area and the user clicks in the text but outside of the composition area, the Input Method Kit sends your input method a “ message. This happens only for input methods that return only the default value—[NSKeyDownMask].
See: https://developer.apple.com/documentation/InputMethodKit/IMKStateSetting/recognizedEvents(_:)
func (IMKInputController) ReplacementRange ¶
func (i IMKInputController) ReplacementRange() foundation.NSRange
Returns the range in the client document that the text should replace.
Return Value ¶
The range to replace.
Discussion ¶
This method is called by IMKInputController.UpdateComposition to obtain the range in the client document where marked text should be placed. The default implementation returns an [NSRange] object whose location and length are [NSNotFound]. That indicates that the marked text should be placed at the current insertion point. Input methods that insert marked text somewhere other than at the current insertion point should override this method.
An example of an input method that might override this method would be one replaces words with synonyms. That input method would watch for certain words and when it detects such a word it would replaced the word by marked text that was a synonym of the word.
See: https://developer.apple.com/documentation/InputMethodKit/IMKInputController/replacementRange()
func (IMKInputController) SelectionRange ¶
func (i IMKInputController) SelectionRange() foundation.NSRange
Returns where the range of the selection that should be placed inside marked text.
Return Value ¶
The range of the selection.
Discussion ¶
This method is called by IMKInputController.UpdateComposition to obtain the selection range for marked text. The default implementation sets the selection range at the end of the marked text. You should override this method if your input method provides font or glyph information.
See: https://developer.apple.com/documentation/InputMethodKit/IMKInputController/selectionRange()
func (IMKInputController) Server ¶
func (i IMKInputController) Server() IIMKServer
Returns the server object that manages the input controller.
Return Value ¶
The server object.
See: https://developer.apple.com/documentation/InputMethodKit/IMKInputController/server()
func (IMKInputController) SetDelegate ¶
func (i IMKInputController) SetDelegate(newDelegate objectivec.IObject)
Sets the delegate for input controller object.
newDelegate: The delegate object to set.
See: https://developer.apple.com/documentation/InputMethodKit/IMKInputController/setDelegate(_:)
func (IMKInputController) SetValueForTagClient ¶
func (i IMKInputController) SetValueForTagClient(value objectivec.IObject, tag int, sender objectivec.IObject)
Set the value for the provided key.
value: The value, specified as the appropriate object (such as [NSNumber]), to set.
tag: The key whose value you want to set.
sender: The client setting the value.
See: https://developer.apple.com/documentation/InputMethodKit/IMKStateSetting/setValue(_:forTag:client:)
func (IMKInputController) ShowPreferences ¶
func (i IMKInputController) ShowPreferences(sender objectivec.IObject)
Displays a preferences window.
sender: The object sending the message to show the preference window.
Discussion ¶
This method looks for a nib file that contains a window controller class and a preferences utility. If found, it displays the window. To use this method you must create a menu item in your input method menu whose action is “. When a user selects that item, the Input Method Kit invokes your “ method. The default implementation looks for a nib file named `preferences.Nib()`. If found, it allocates a window controller class loads the nib file. You can provide a custom window controller class by naming the class in your input method `info.Plist()` file, providing a key-value pair. The key must be [InputMethodServerPreferencesWindowControllerClass] and the associated value must be the name of your custom class.
See: https://developer.apple.com/documentation/InputMethodKit/IMKStateSetting/showPreferences(_:)
func (IMKInputController) UpdateComposition ¶
func (i IMKInputController) UpdateComposition()
Informs the input controller that the composition has changed.
Discussion ¶
This method calls the protocol method composedString: to obtain the current composition. The current composition is sent to the client by a call to the method `setMarkedText(_:)`.
See: https://developer.apple.com/documentation/InputMethodKit/IMKInputController/updateComposition()
func (IMKInputController) ValueForTagClient ¶
func (i IMKInputController) ValueForTagClient(tag int, sender objectivec.IObject) objectivec.IObject
Returns a value object whose key is the provided tag.
tag: The key whose value you want to retrieve.
sender: The client requesting the value.
Return Value ¶
The value object.
See: https://developer.apple.com/documentation/InputMethodKit/IMKStateSetting/value(forTag:client:)
type IMKInputControllerClass ¶
type IMKInputControllerClass struct {
// contains filtered or unexported fields
}
func GetIMKInputControllerClass ¶
func GetIMKInputControllerClass() IMKInputControllerClass
GetIMKInputControllerClass returns the class object for IMKInputController.
func (IMKInputControllerClass) Alloc ¶
func (ic IMKInputControllerClass) Alloc() IMKInputController
Alloc allocates memory for a new instance of the class.
func (IMKInputControllerClass) Class ¶
func (ic IMKInputControllerClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type IMKMouseHandling ¶
type IMKMouseHandling interface {
objectivec.IObject
// Handles mouse-down event send to an input method.
//
// See: https://developer.apple.com/documentation/InputMethodKit/IMKMouseHandling/mouseDown(onCharacterIndex:coordinate:withModifier:continueTracking:client:)
MouseDownOnCharacterIndexCoordinateWithModifierContinueTrackingClient(index uint, point corefoundation.CGPoint, flags uint, sender objectivec.IObject) (bool, bool)
// Handles a mouse-up event sent to an input method.
//
// See: https://developer.apple.com/documentation/InputMethodKit/IMKMouseHandling/mouseUp(onCharacterIndex:coordinate:withModifier:client:)
MouseUpOnCharacterIndexCoordinateWithModifierClient(index uint, point corefoundation.CGPoint, flags uint, sender objectivec.IObject) bool
// Handles a mouse-moved event sent to an input method.
//
// See: https://developer.apple.com/documentation/InputMethodKit/IMKMouseHandling/mouseMoved(onCharacterIndex:coordinate:withModifier:client:)
MouseMovedOnCharacterIndexCoordinateWithModifierClient(index uint, point corefoundation.CGPoint, flags uint, sender objectivec.IObject) bool
}
The IMKMouseHandling protocol defines methods that your input method can implement to handle mouse events.
See: https://developer.apple.com/documentation/InputMethodKit/IMKMouseHandling
type IMKMouseHandlingObject ¶
type IMKMouseHandlingObject struct {
objectivec.Object
}
IMKMouseHandlingObject wraps an existing Objective-C object that conforms to the IMKMouseHandling protocol.
func IMKMouseHandlingObjectFromID ¶
func IMKMouseHandlingObjectFromID(id objc.ID) IMKMouseHandlingObject
IMKMouseHandlingObjectFromID constructs a IMKMouseHandlingObject from an objc.ID. The object is determined to conform to the protocol at runtime.
func (IMKMouseHandlingObject) BaseObject ¶
func (o IMKMouseHandlingObject) BaseObject() objectivec.Object
func (IMKMouseHandlingObject) MouseDownOnCharacterIndexCoordinateWithModifierContinueTrackingClient ¶
func (o IMKMouseHandlingObject) MouseDownOnCharacterIndexCoordinateWithModifierContinueTrackingClient(index uint, point corefoundation.CGPoint, flags uint, sender objectivec.IObject) (bool, bool)
Handles mouse-down event send to an input method.
index: The index within the sender’s text storage where the mouse-down event occurred.
point: The point at which the mouse-down event occurred.
flags: The modifier keys.
keepTracking: Set this parameter to true if you want to receive subsequent mouse-moved and mouse -up events.
sender: The client object.
Return Value ¶
true if handled; otherwise false.
Discussion ¶
Implement this method if your input method handles mouse-down events.
func (IMKMouseHandlingObject) MouseMovedOnCharacterIndexCoordinateWithModifierClient ¶
func (o IMKMouseHandlingObject) MouseMovedOnCharacterIndexCoordinateWithModifierClient(index uint, point corefoundation.CGPoint, flags uint, sender objectivec.IObject) bool
Handles a mouse-moved event sent to an input method.
index: The index within the sender’s text storage where the mouse-moved event occurred.
point: The point at which the mouse-moved event occurred.
flags: The modifier keys.
sender: The client object.
Return Value ¶
true if handled; otherwise false.
Discussion ¶
Implement this method if your input method handles mouse-moved events.
func (IMKMouseHandlingObject) MouseUpOnCharacterIndexCoordinateWithModifierClient ¶
func (o IMKMouseHandlingObject) MouseUpOnCharacterIndexCoordinateWithModifierClient(index uint, point corefoundation.CGPoint, flags uint, sender objectivec.IObject) bool
Handles a mouse-up event sent to an input method.
index: The index within the sender’s text storage where the mouse-up event occurred.
point: The point at which the mouse-up event occurred.
flags: The modifier keys.
sender: The client object.
Return Value ¶
true if handled; otherwise false.
Discussion ¶
Implement this method if your input method handles mouse-up events.
type IMKServer ¶
type IMKServer struct {
objectivec.Object
}
The IMKServer class manages client connections to your input method. When you write the main function for your input method, you create an IMKServer object. You should never need to override this class.
Initializing a Server Object ¶
- IMKServer.InitWithNameBundleIdentifier: Creates and returns a server object from property list information contained in the provided bundle.
- IMKServer.InitWithNameControllerClassDelegateClass: Creates and returns a server object initialized with the provided parameters.
Getting a Bundle for the Input Method ¶
- IMKServer.Bundle: Returns an [NSBundle] object for the input method.
Instance Methods ¶
See: https://developer.apple.com/documentation/InputMethodKit/IMKServer
func IMKServerFromID ¶
IMKServerFromID constructs a IMKServer from an objc.ID.
The IMKServer class manages client connections to your input method. When you write the main function for your input method, you create an IMKServer object. You should never need to override this class.
func NewIMKServerWithNameBundleIdentifier ¶
Creates and returns a server object from property list information contained in the provided bundle.
name: The name to initialize the server object with.
bundleIdentifier: The bundle identifier.
Return Value ¶
An initialized server object.
Discussion ¶
This method examines the `Info.Plist()` file for the entries shown in the table below. The class names are loaded, but no classes are instantiated. Additionally, an NSConnection object is allocated and registered using the input method connection name supplied in the `Info.Plist()` file.
[Table data omitted]
See: https://developer.apple.com/documentation/InputMethodKit/IMKServer/init(name:bundleIdentifier:)
func NewIMKServerWithNameControllerClassDelegateClass ¶
func NewIMKServerWithNameControllerClassDelegateClass(name string, controllerClassID objectivec.Class, delegateClassID objectivec.Class) IMKServer
Creates and returns a server object initialized with the provided parameters.
name: The name to initialize the server object with.
controllerClassID: The id for the input controller class.
delegateClassID: The id for the delegate class.
Return Value ¶
An initialized server object.
func (IMKServer) Autorelease ¶
Autorelease adds the receiver to the current autorelease pool.
func (IMKServer) Bundle ¶
func (i IMKServer) Bundle() foundation.Bundle
Returns an [NSBundle] object for the input method.
Return Value ¶
An [NSBundle] object that is either created from the bundle identifier contained in the server object, or from the main bundle.
See: https://developer.apple.com/documentation/InputMethodKit/IMKServer/bundle()
func (IMKServer) InitWithNameBundleIdentifier ¶
Creates and returns a server object from property list information contained in the provided bundle.
name: The name to initialize the server object with.
bundleIdentifier: The bundle identifier.
Return Value ¶
An initialized server object.
Discussion ¶
This method examines the `Info.Plist()` file for the entries shown in the table below. The class names are loaded, but no classes are instantiated. Additionally, an NSConnection object is allocated and registered using the input method connection name supplied in the `Info.Plist()` file.
[Table data omitted]
See: https://developer.apple.com/documentation/InputMethodKit/IMKServer/init(name:bundleIdentifier:)
func (IMKServer) InitWithNameControllerClassDelegateClass ¶
func (i IMKServer) InitWithNameControllerClassDelegateClass(name string, controllerClassID objectivec.Class, delegateClassID objectivec.Class) IMKServer
Creates and returns a server object initialized with the provided parameters.
name: The name to initialize the server object with.
controllerClassID: The id for the input controller class.
delegateClassID: The id for the delegate class.
Return Value ¶
An initialized server object.
func (IMKServer) LastKeyEventWasDeadKey ¶
See: https://developer.apple.com/documentation/InputMethodKit/IMKServer/lastKeyEventWasDeadKey()
type IMKServerClass ¶
type IMKServerClass struct {
// contains filtered or unexported fields
}
func GetIMKServerClass ¶
func GetIMKServerClass() IMKServerClass
GetIMKServerClass returns the class object for IMKServer.
func (IMKServerClass) Alloc ¶
func (ic IMKServerClass) Alloc() IMKServer
Alloc allocates memory for a new instance of the class.
func (IMKServerClass) Class ¶
func (ic IMKServerClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type IMKStateSetting ¶
type IMKStateSetting interface {
objectivec.IObject
// Activates the input method server.
//
// See: https://developer.apple.com/documentation/InputMethodKit/IMKStateSetting/activateServer(_:)
ActivateServer(sender objectivec.IObject)
// Deactivates the input method server.
//
// See: https://developer.apple.com/documentation/InputMethodKit/IMKStateSetting/deactivateServer(_:)
DeactivateServer(sender objectivec.IObject)
// Displays a preferences window.
//
// See: https://developer.apple.com/documentation/InputMethodKit/IMKStateSetting/showPreferences(_:)
ShowPreferences(sender objectivec.IObject)
// Returns an unsigned integer that contains a union of event masks
//
// See: https://developer.apple.com/documentation/InputMethodKit/IMKStateSetting/recognizedEvents(_:)
RecognizedEvents(sender objectivec.IObject) uint
// Returns the modes dictionary associated with the input method.
//
// See: https://developer.apple.com/documentation/InputMethodKit/IMKStateSetting/modes(_:)
Modes(sender objectivec.IObject) foundation.INSDictionary
// Returns a value object whose key is the provided tag.
//
// See: https://developer.apple.com/documentation/InputMethodKit/IMKStateSetting/value(forTag:client:)
ValueForTagClient(tag int, sender objectivec.IObject) objectivec.IObject
// Set the value for the provided key.
//
// See: https://developer.apple.com/documentation/InputMethodKit/IMKStateSetting/setValue(_:forTag:client:)
SetValueForTagClient(value objectivec.IObject, tag int, sender objectivec.IObject)
}
The IMKStateSetting protocol defines methods for setting or accessing values that indicate the state of an input method.
See: https://developer.apple.com/documentation/InputMethodKit/IMKStateSetting
type IMKStateSettingObject ¶
type IMKStateSettingObject struct {
objectivec.Object
}
IMKStateSettingObject wraps an existing Objective-C object that conforms to the IMKStateSetting protocol.
func IMKStateSettingObjectFromID ¶
func IMKStateSettingObjectFromID(id objc.ID) IMKStateSettingObject
IMKStateSettingObjectFromID constructs a IMKStateSettingObject from an objc.ID. The object is determined to conform to the protocol at runtime.
func (IMKStateSettingObject) ActivateServer ¶
func (o IMKStateSettingObject) ActivateServer(sender objectivec.IObject)
Activates the input method server.
sender: The object sending the activation message.
See: https://developer.apple.com/documentation/InputMethodKit/IMKStateSetting/activateServer(_:)
func (IMKStateSettingObject) BaseObject ¶
func (o IMKStateSettingObject) BaseObject() objectivec.Object
func (IMKStateSettingObject) DeactivateServer ¶
func (o IMKStateSettingObject) DeactivateServer(sender objectivec.IObject)
Deactivates the input method server.
sender: The object sending the deactivation message.
See: https://developer.apple.com/documentation/InputMethodKit/IMKStateSetting/deactivateServer(_:)
func (IMKStateSettingObject) Modes ¶
func (o IMKStateSettingObject) Modes(sender objectivec.IObject) foundation.INSDictionary
Returns the modes dictionary associated with the input method.
sender: The client object requesting the modes dictionary.
Return Value ¶
The modes dictionary associated with the input method.
Discussion ¶
Typically a client object calls this method to to build the text input menu. By calling the input method rather than reading the modes from the `Info.Plist()` file, the input method can dynamically modify the modes supported.
See: https://developer.apple.com/documentation/InputMethodKit/IMKStateSetting/modes(_:)
func (IMKStateSettingObject) RecognizedEvents ¶
func (o IMKStateSettingObject) RecognizedEvents(sender objectivec.IObject) uint
Returns an unsigned integer that contains a union of event masks
sender: The client object requesting the supported events.
Return Value ¶
An unsigned integer that contains a union of event masks (See the `NSEvent.H()` header file.
Discussion ¶
A client calls this method to check whether an input method supports an event. The default implementation returns [NSKeyDownMask]. If your input method handles only key down events, the Input Method Kit provides the default mouse handling. The default mouse-down handling behavior is as follows: If there is an active composition area and the user clicks in the text but outside of the composition area, the Input Method Kit sends your input method a “ message. This happens only for input methods that return only the default value—[NSKeyDownMask].
See: https://developer.apple.com/documentation/InputMethodKit/IMKStateSetting/recognizedEvents(_:)
func (IMKStateSettingObject) SetValueForTagClient ¶
func (o IMKStateSettingObject) SetValueForTagClient(value objectivec.IObject, tag int, sender objectivec.IObject)
Set the value for the provided key.
value: The value, specified as the appropriate object (such as [NSNumber]), to set.
tag: The key whose value you want to set.
sender: The client setting the value.
See: https://developer.apple.com/documentation/InputMethodKit/IMKStateSetting/setValue(_:forTag:client:)
func (IMKStateSettingObject) ShowPreferences ¶
func (o IMKStateSettingObject) ShowPreferences(sender objectivec.IObject)
Displays a preferences window.
sender: The object sending the message to show the preference window.
Discussion ¶
This method looks for a nib file that contains a window controller class and a preferences utility. If found, it displays the window. To use this method you must create a menu item in your input method menu whose action is “. When a user selects that item, the Input Method Kit invokes your “ method. The default implementation looks for a nib file named `preferences.Nib()`. If found, it allocates a window controller class loads the nib file. You can provide a custom window controller class by naming the class in your input method `info.Plist()` file, providing a key-value pair. The key must be [InputMethodServerPreferencesWindowControllerClass] and the associated value must be the name of your custom class.
See: https://developer.apple.com/documentation/InputMethodKit/IMKStateSetting/showPreferences(_:)
func (IMKStateSettingObject) ValueForTagClient ¶
func (o IMKStateSettingObject) ValueForTagClient(tag int, sender objectivec.IObject) objectivec.IObject
Returns a value object whose key is the provided tag.
tag: The key whose value you want to retrieve.
sender: The client requesting the value.
Return Value ¶
The value object.
See: https://developer.apple.com/documentation/InputMethodKit/IMKStateSetting/value(forTag:client:)
type IMKStyleType ¶
type IMKStyleType = uint
See: https://developer.apple.com/documentation/InputMethodKit/IMKStyleType
type KIMKLocateCandidates ¶
type KIMKLocateCandidates uint32
const ( // KIMKLocateCandidatesAboveHint: # Discussion KIMKLocateCandidatesAboveHint KIMKLocateCandidates = 1 // KIMKLocateCandidatesBelowHint: # Discussion KIMKLocateCandidatesBelowHint KIMKLocateCandidates = 2 // KIMKLocateCandidatesLeftHint: # Discussion KIMKLocateCandidatesLeftHint KIMKLocateCandidates = 3 // KIMKLocateCandidatesRightHint: # Discussion KIMKLocateCandidatesRightHint KIMKLocateCandidates = 4 )
func (KIMKLocateCandidates) String ¶
func (e KIMKLocateCandidates) String() string
type KIMKSingleColumnScrollingCandidatePanel ¶
type KIMKSingleColumnScrollingCandidatePanel uint32
const ( // KIMKScrollingGridCandidatePanel: # Discussion KIMKScrollingGridCandidatePanel KIMKSingleColumnScrollingCandidatePanel = 2 // KIMKSingleColumnScrollingCandidatePanelValue: # Discussion KIMKSingleColumnScrollingCandidatePanelValue KIMKSingleColumnScrollingCandidatePanel = 1 // KIMKSingleRowSteppingCandidatePanel: # Discussion KIMKSingleRowSteppingCandidatePanel KIMKSingleColumnScrollingCandidatePanel = 3 )
func (KIMKSingleColumnScrollingCandidatePanel) String ¶
func (e KIMKSingleColumnScrollingCandidatePanel) String() string