inputmethodkit

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Rendered for darwin/amd64

Overview

Package inputmethodkit provides a fluent Go API over the macOS InputMethodKit framework.

Each With… method sets one property and returns its receiver, so configuration calls can be chained.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IMKCandidatesOpacityAttributeName added in v0.8.0

func IMKCandidatesOpacityAttributeName() obj.Object

IMKCandidatesOpacityAttributeName returns the string constant IMKCandidatesOpacityAttributeName, for use as a dictionary key or argument.

func IMKCandidatesSendServerKeyEventFirst added in v0.8.0

func IMKCandidatesSendServerKeyEventFirst() obj.Object

IMKCandidatesSendServerKeyEventFirst returns the string constant IMKCandidatesSendServerKeyEventFirst, for use as a dictionary key or argument.

func IMKControllerClass added in v0.8.0

func IMKControllerClass() obj.Object

IMKControllerClass returns the string constant IMKControllerClass, for use as a dictionary key or argument.

func IMKDelegateClass added in v0.8.0

func IMKDelegateClass() obj.Object

IMKDelegateClass returns the string constant IMKDelegateClass, for use as a dictionary key or argument.

func IMKModeDictionary added in v0.8.0

func IMKModeDictionary() obj.Object

IMKModeDictionary returns the string constant IMKModeDictionary, for use as a dictionary key or argument.

func KIMKCommandClientName added in v0.8.0

func KIMKCommandClientName() obj.Object

KIMKCommandClientName returns the string constant kIMKCommandClientName, for use as a dictionary key or argument.

func KIMKCommandMenuItemName added in v0.8.0

func KIMKCommandMenuItemName() obj.Object

KIMKCommandMenuItemName returns the string constant kIMKCommandMenuItemName, for use as a dictionary key or argument.

Types

type Candidates

type Candidates struct {
	objref.Handle
}

Candidates is an idiomatic wrapper over the Objective-C class IMKCandidates.

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 CandidatesFromID

func CandidatesFromID(id objc.ID) *Candidates

CandidatesFromID adopts an existing Objective-C object as a Candidates (nil for 0), retaining it and registering a release finalizer.

func NewCandidatesWithServerPanelType

func NewCandidatesWithServerPanelType(server *Server, panelType int) *Candidates

NewCandidatesWithServerPanelType returns the initialized IMKCandidates object.

func NewCandidatesWithServerPanelTypeStyleType

func NewCandidatesWithServerPanelTypeStyleType(server *Server, panelType int, style int) *Candidates

NewCandidatesWithServerPanelTypeStyleType creates a new Candidates.

func (*Candidates) AttachChildToCandidateType

func (c *Candidates) AttachChildToCandidateType(child *Candidates, candidateIdentifier int, theType int)

AttachChildToCandidateType attach an IMKCandidates object to the specified selection. The IMKCandidate can be a sublist or an annotation.

func (*Candidates) Attributes

func (c *Candidates) Attributes() obj.Object

Attributes returns a dictionary of the style attributes used for the candidates window..

func (*Candidates) CandidateFrame

func (c *Candidates) CandidateFrame() corefoundation.CGRect

CandidateFrame returns the candidate frame.

func (*Candidates) CandidateIdentifierAtLineNumber

func (c *Candidates) CandidateIdentifierAtLineNumber(lineNumber int) int

CandidateIdentifierAtLineNumber returns the candidate identifier for a given line in the candidate window display. Maps the lineNumber to a candidate identifier. Line number 0 corresponds to the candidate in the cell currently in the first (top for vertical) line of the candidate window. This is convienient for input methods that support selecting a candidate by a number key. Line Number values depend on the column arrangement of your candidate. If you are displaying a single column candidate window, lines that have been scrolled out of view will have negative values. For a single row grid line, numbers will correspond to the cell's position in the row (i.e. the first cell will be 0, the second 1, etc). Finally, for a grid, the line numbers correspond to the grid row. If the line number is invalid, NSNotFound is returned.

func (*Candidates) CandidateStringIdentifier

func (c *Candidates) CandidateStringIdentifier(candidateString obj.Object) int

CandidateStringIdentifier map a candidateString to an identifier. Beginning with MacOS 10.7, candidate strings are mapped internally to an unique identifier of type NSInteger. Using identifiers to identify a particular candidate is the first stage of enabling data types other than NSString and NSAttributedString for containing the contents of a candidate.

func (*Candidates) ClearSelection

func (c *Candidates) ClearSelection()

ClearSelection clears selection.

func (*Candidates) Description added in v0.10.0

func (c *Candidates) Description() string

Description returns the object's -description text.

func (*Candidates) DetachChild

func (c *Candidates) DetachChild(candidateIdentifier int)

DetachChild detach the IMKCandidates object attached to candidate

func (*Candidates) DismissesAutomatically

func (c *Candidates) DismissesAutomatically() bool

DismissesAutomatically reports whether returns the state of the flag that determines whether the candidates window dismisses automatically.

func (*Candidates) Hide

func (c *Candidates) Hide()

Hide hides a candidates window, if it is visible.

func (*Candidates) HideChild

func (c *Candidates) HideChild()

HideChild if the current selection has a child IMKCandidates that is being shown hide it. Typically a client will not need to call this as IMKCandidates automatically hides and shows children.

func (*Candidates) IsEqual added in v0.10.0

func (c *Candidates) IsEqual(other obj.Object) bool

IsEqual reports Objective-C equality (isEqual:) with another object.

func (*Candidates) IsKind added in v0.10.0

func (c *Candidates) IsKind(className string) bool

IsKind reports whether the object is an instance of the named class or a subclass.

func (*Candidates) IsVisible

func (c *Candidates) IsVisible() bool

IsVisible reports whether the candidates window is visible.

func (*Candidates) LineNumberForCandidateWithIdentifier

func (c *Candidates) LineNumberForCandidateWithIdentifier(candidateIdentifier int) int

LineNumberForCandidateWithIdentifier returns the line number for a given CandidateID. If the cell that contains the candidate is at the top line of the candidate window, the return value will be 0.

func (*Candidates) PanelType

func (c *Candidates) PanelType() int

PanelType returns the style of the candidates window.

func (*Candidates) SelectCandidate

func (c *Candidates) SelectCandidate(candidateIdentifier int)

SelectCandidate selects candidate.

func (*Candidates) SelectCandidateWithIdentifier

func (c *Candidates) SelectCandidateWithIdentifier(candidateIdentifier int) bool

SelectCandidateWithIdentifier select the candidate whose identifier matches the identifier parameter.

func (*Candidates) SelectedCandidate

func (c *Candidates) SelectedCandidate() int

SelectedCandidate returns the currently selected candidate identifer. Attempts to determine the identifier for the selected candidate. If there is no selection the return value will be NSNotFound.

func (*Candidates) SelectedCandidateString

func (c *Candidates) SelectedCandidateString() obj.Object

SelectedCandidateString returns the currently selected candidate string. Attempts to determine the string for the selected candidate. If there is no selection the return value can be nil. The attributed string is an autoreleased object.

func (*Candidates) SelectionKeys

func (c *Candidates) SelectionKeys() obj.Object

SelectionKeys returns an array of NSNumber objects where each NSNumber object represents a virtual key code.

func (*Candidates) SelectionKeysKeylayout

func (c *Candidates) SelectionKeysKeylayout() obj.Object

SelectionKeysKeylayout returns the key layout that maps virtual key codes to selection keys.

func (*Candidates) SetAttributes

func (c *Candidates) SetAttributes(attributes obj.Object)

SetAttributes sets the style attributes for the candidates window.

func (*Candidates) SetCandidateData

func (c *Candidates) SetCandidateData(candidatesArray obj.Object)

SetCandidateData set the candidates data directly rather than supplying data via [IMKInputContoller candidates:]. The elements of the array can be strings or attributed strings.

func (*Candidates) SetCandidateFrameTopLeft

func (c *Candidates) SetCandidateFrameTopLeft(point corefoundation.CGPoint)

SetCandidateFrameTopLeft positions the top-left corner of the candidate window’s frame rectangle at a given point in screen coordinates.

func (*Candidates) SetDismissesAutomatically

func (c *Candidates) SetDismissesAutomatically(flag bool)

SetDismissesAutomatically sets the state of the flag that determines whether the candidates window dismisses automatically.

func (*Candidates) SetPanelType

func (c *Candidates) SetPanelType(panelType int)

SetPanelType sets the style of the candidates window.

func (*Candidates) SetSelectionKeys

func (c *Candidates) SetSelectionKeys(keyCodes obj.Object)

SetSelectionKeys sets the selection keys for the candidates.

func (*Candidates) SetSelectionKeysKeylayout

func (c *Candidates) SetSelectionKeysKeylayout(layout obj.Object)

SetSelectionKeysKeylayout sets the key layout that is used to map virtual key codes to characters.

func (*Candidates) Show

func (c *Candidates) Show(locationHint int)

Show shows the candidates window.

func (*Candidates) ShowAnnotation

func (c *Candidates) ShowAnnotation(annotationString obj.Object)

ShowAnnotation displays an annotation string in an annotation window.

func (*Candidates) ShowCandidates

func (c *Candidates) ShowCandidates()

ShowCandidates show the candidate window. This simply shows the candidates. No effort is made to position the candidate. The caller should move the candidate window to an appropriate location prior to showing.

func (*Candidates) ShowChild

func (c *Candidates) ShowChild()

ShowChild if the current selection has a child IMKCandidates object that will be shown. If there is a failure in showing the child this method will throw an exception.

func (*Candidates) ShowSublistSubListDelegate

func (c *Candidates) ShowSublistSubListDelegate(candidates obj.Object, delegate obj.Object)

ShowSublistSubListDelegate shows sublist sub list delegate.

func (*Candidates) String added in v0.10.0

func (c *Candidates) String() string

String returns the object's -description text, so a wrapper prints usefully under fmt.

func (*Candidates) UpdateCandidates

func (c *Candidates) UpdateCandidates()

UpdateCandidates updates the candidates that are displayed in the candidates window.

type InputController

type InputController struct {
	objref.Handle
}

InputController is an idiomatic wrapper over the Objective-C class IMKInputController.

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 InputControllerFromID

func InputControllerFromID(id objc.ID) *InputController

InputControllerFromID adopts an existing Objective-C object as a InputController (nil for 0), retaining it and registering a release finalizer.

func NewInputControllerWithServerDelegateClient

func NewInputControllerWithServerDelegateClient(server *Server, delegate obj.Object, inputClient obj.Object) *InputController

NewInputControllerWithServerDelegateClient initializes the input control by setting the delegate.

func (*InputController) AnnotationSelectedForCandidate

func (ic *InputController) AnnotationSelectedForCandidate(annotationString obj.Object, candidateString obj.Object)

AnnotationSelectedForCandidate sends the selected candidate string and annotation string to the input controller.

func (*InputController) CancelComposition

func (ic *InputController) CancelComposition()

CancelComposition stops the current composition and replaces marked text with the original text.

func (*InputController) CandidateSelected

func (ic *InputController) CandidateSelected(candidateString obj.Object)

CandidateSelected informs an input controller that a new candidate is selected.

func (*InputController) CandidateSelectionChanged

func (ic *InputController) CandidateSelectionChanged(candidateString obj.Object)

CandidateSelectionChanged informs an input controller that the current candidate selection in the candidate window has changed.

func (*InputController) Client

func (ic *InputController) Client() obj.Object

Client returns the client object associated with the input controller.

func (*InputController) CompositionAttributesAtRange

func (ic *InputController) CompositionAttributesAtRange(range_ foundation.NSRange) obj.Object

CompositionAttributesAtRange returns a dictionary of text attributes.

func (*InputController) Delegate

func (ic *InputController) Delegate() obj.Object

Delegate returns the delegate for input controller object.

func (*InputController) Description added in v0.10.0

func (ic *InputController) Description() string

Description returns the object's -description text.

func (*InputController) HidePalettes

func (ic *InputController) HidePalettes()

HidePalettes informs an input method that it should close any visible user interface.

func (*InputController) InputControllerWillClose

func (ic *InputController) InputControllerWillClose()

InputControllerWillClose called to notify an input controller that it is about to be closed.

func (*InputController) IsEqual added in v0.10.0

func (ic *InputController) IsEqual(other obj.Object) bool

IsEqual reports Objective-C equality (isEqual:) with another object.

func (*InputController) IsKind added in v0.10.0

func (ic *InputController) IsKind(className string) bool

IsKind reports whether the object is an instance of the named class or a subclass.

func (*InputController) MarkForStyleAtRange

func (ic *InputController) MarkForStyleAtRange(style int, range_ foundation.NSRange) obj.Object

MarkForStyleAtRange returns a dictionary of text attributes that can mark a range of an attributed string to send to a client.

func (*InputController) Menu

func (ic *InputController) Menu() obj.Object

Menu returns a menu of commands that are specific to an input method.

func (*InputController) ReplacementRange

func (ic *InputController) ReplacementRange() foundation.NSRange

ReplacementRange returns the range in the client document that the text should replace.

func (*InputController) SelectionRange

func (ic *InputController) SelectionRange() foundation.NSRange

SelectionRange returns where the range of the selection that should be placed inside marked text.

func (*InputController) Server

func (ic *InputController) Server() *Server

Server returns the server object that manages the input controller.

func (*InputController) SetDelegate

func (ic *InputController) SetDelegate(newDelegate obj.Object)

SetDelegate sets the delegate for input controller object.

func (*InputController) String added in v0.10.0

func (ic *InputController) String() string

String returns the object's -description text, so a wrapper prints usefully under fmt.

func (*InputController) UpdateComposition

func (ic *InputController) UpdateComposition()

UpdateComposition informs the input controller that the composition has changed.

type Server

type Server struct {
	objref.Handle
}

Server is an idiomatic wrapper over the Objective-C class IMKServer.

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 NewServerWithNameBundleIdentifier

func NewServerWithNameBundleIdentifier(name string, bundleIdentifier string) *Server

NewServerWithNameBundleIdentifier creates and returns a server object from property list information contained in the provided bundle.

func ServerFromID

func ServerFromID(id objc.ID) *Server

ServerFromID adopts an existing Objective-C object as a Server (nil for 0), retaining it and registering a release finalizer.

func (*Server) Bundle

func (s *Server) Bundle() obj.Object

Bundle returns an NSBundle object for the input method.

func (*Server) Description added in v0.10.0

func (s *Server) Description() string

Description returns the object's -description text.

func (*Server) IsEqual added in v0.10.0

func (s *Server) IsEqual(other obj.Object) bool

IsEqual reports Objective-C equality (isEqual:) with another object.

func (*Server) IsKind added in v0.10.0

func (s *Server) IsKind(className string) bool

IsKind reports whether the object is an instance of the named class or a subclass.

func (*Server) LastKeyEventWasDeadKey

func (s *Server) LastKeyEventWasDeadKey() bool

LastKeyEventWasDeadKey reports whether returns a BOOL indicating whether or not the last key press was a dead key.

func (*Server) PaletteWillTerminate

func (s *Server) PaletteWillTerminate() bool

PaletteWillTerminate reports whether call this before terminating a palette IM. Palettes need to be able to terminate. When this method is called the IMKServer will notify each client of the palette that the palette is about to terminate. The palette can terminate safely if a value of true is returned. If the caller of this method is not an input method of type palette an exception will be thrown. If the method returns false the palette should not terminate.

func (*Server) String added in v0.10.0

func (s *Server) String() string

String returns the object's -description text, so a wrapper prints usefully under fmt.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL