IMKStateSetting Protocol Reference

Adopted by
Framework
System/Library/Frameworks/InputMethodKit.framework
Availability
Available in OS X v10.5 and later.
Declared in
IMKInputController.h

Overview

The IMKStateSetting protocol defines methods for setting or accessing values that indicate the state of an input method.

Tasks

Activating and Deactivating the Server

Showing a Preferences Window

Getting the Supported Events

Getting the Mode Dictionary

Getting and Setting Values

Instance Methods

activateServer:

Activates the input method server. (required)

- (void)activateServer:(id)sender
Parameters
sender

The object sending the activation message.

Availability
  • Available in OS X v10.5 and later.
Declared In
IMKInputController.h

deactivateServer:

Deactivates the input method server. (required)

- (void)deactivateServer:(id)sender
Parameters
sender

The object sending the deactivation message.

Availability
  • Available in OS X v10.5 and later.
Declared In
IMKInputController.h

modes:

Returns the modes dictionary associated with the input method. (required)

- (NSDictionary*)modes:(id)sender
Parameters
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.

Availability
  • Available in OS X v10.5 and later.
Declared In
IMKInputController.h

recognizedEvents:

Returns an unsigned integer that contains a union of event masks (required)

- (NSUInteger)recognizedEvents:(id)sender
Parameters
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 commitComposition: message. This happens only for input methods that return only the default value—NSKeyDownMask.

Availability
  • Available in OS X v10.5 and later.
Declared In
IMKInputController.h

setValue:forTag:client:

Set the value for the provided key. (required)

- (void)setValue:(id)value forTag:(long)tag client:(id)sender
Parameters
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.

Availability
  • Available in OS X v10.5 and later.
Declared In
IMKInputController.h

showPreferences:

Displays a preferences window. (required)

- (void)showPreferences:(id)sender
Parameters
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 showPreferences:. When a user selects that item, the Input Method Kit invokes your showPreferences: 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.

Availability
  • Available in OS X v10.5 and later.
Declared In
IMKInputController.h

valueForTag:client:

Returns a value object whose key is the provided tag. (required)

- (id)valueForTag:(long)tag client:(id)sender
Parameters
tag

The key whose value you want to retrieve.

sender

The client requesting the value.

Return Value

The value object.

Availability
  • Available in OS X v10.5 and later.
Declared In
IMKInputController.h