Mac Developer Library

Developer

InputMethodKit Framework Reference IMKStateSetting Protocol Reference

Options
Deployment Target:

On This Page
Language:

IMKStateSetting

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import InputMethodKit

Objective-C

@import InputMethodKit;

Availability


Available in OS X v10.5 and later.

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

  • Activates the input method server. (required)

    Declaration

    Swift

    func activateServer(_ sender: AnyObject!)

    Objective-C

    - (void)activateServer:(id)sender

    Parameters

    sender

    The object sending the activation message.

    Import Statement

    Objective-C

    @import InputMethodKit;

    Swift

    import InputMethodKit

    Availability

    Available in OS X v10.5 and later.

  • Deactivates the input method server. (required)

    Declaration

    Swift

    func deactivateServer(_ sender: AnyObject!)

    Objective-C

    - (void)deactivateServer:(id)sender

    Parameters

    sender

    The object sending the deactivation message.

    Import Statement

    Objective-C

    @import InputMethodKit;

    Swift

    import InputMethodKit

    Availability

    Available in OS X v10.5 and later.

  • Displays a preferences window. (required)

    Declaration

    Swift

    func showPreferences(_ sender: AnyObject!)

    Objective-C

    - (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.

    Import Statement

    Objective-C

    @import InputMethodKit;

    Swift

    import InputMethodKit

    Availability

    Available in OS X v10.5 and later.

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

    Declaration

    Swift

    func recognizedEvents(_ sender: AnyObject!) -> Int

    Objective-C

    - (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.

    Import Statement

    Objective-C

    @import InputMethodKit;

    Swift

    import InputMethodKit

    Availability

    Available in OS X v10.5 and later.

  • modes(_:) - modes: Required

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

    Declaration

    Swift

    func modes(_ sender: AnyObject!) -> [NSObject : AnyObject]!

    Objective-C

    - (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.

    Import Statement

    Objective-C

    @import InputMethodKit;

    Swift

    import InputMethodKit

    Availability

    Available in OS X v10.5 and later.

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

    Declaration

    Swift

    func valueForTag(_ tag: Int, client sender: AnyObject!) -> AnyObject!

    Objective-C

    - (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.

    Import Statement

    Objective-C

    @import InputMethodKit;

    Swift

    import InputMethodKit

    Availability

    Available in OS X v10.5 and later.

  • Set the value for the provided key. (required)

    Declaration

    Swift

    func setValue(_ value: AnyObject!, forTag tag: Int, client sender: AnyObject!)

    Objective-C

    - (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.

    Import Statement

    Objective-C

    @import InputMethodKit;

    Swift

    import InputMethodKit

    Availability

    Available in OS X v10.5 and later.