Next Page > Hide TOC

IMKStateSetting Protocol Reference

Adopted by
Framework
System/Library/Frameworks/InputMethodKit.framework
Availability
Available in Mac 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.

- (void)activateServer:(id)sender

Parameters
sender

The object sending the activation message.

Availability
See Also
Declared In
IMKInputController.h

deactivateServer:

Deactivates the input method server.

- (void)deactivateServer:(id)sender

Parameters
sender

The object sending the deactivation message.

Availability
See Also
Declared In
IMKInputController.h

modes:

Returns the modes dictionary associated with the input method.

- (NSDictionary*)modes:(id)sender

Parameters
sender

The client object requesting the modes dictionary.

Return Value

The modes dictionary associated with the input method. The dictionary should be an autoreleased object.

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
Declared In
IMKInputController.h

recognizedEvents:

Returns an unsigned integer that contains a union of event masks

- (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
Declared In
IMKInputController.h

setValue:forTag:client:

Set the value for the provided key.

- (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
See Also
Declared In
IMKInputController.h

showPreferences:

Displays a preferences window.

- (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
Declared In
IMKInputController.h

valueForTag:client:

Returns a value object whose key is the provided tag.

- (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. The returned object should be autoreleased.

Availability
See Also
Declared In
IMKInputController.h

Next Page > Hide TOC


© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-06-05)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.