Next Page > Hide TOC

Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

NSInputManager

Inherits from
Implements
Package
com.apple.cocoa.application
Companion guide

Overview

NSInputManager is one of the three players in the Cocoa text input management system. The input manager acts as a proxy between “NSInputServer” and text views. You never have to instantiate or subclass NSInputManager, and unless you are implementing a text view that does not inherit from NSTextView, you never have to directly access its methods either.

If an application needs more complex text handling than the standard Cocoa text view classes can provide, then it will use its own text view class that implements the “NSTextInput” interface, and that class will call NSInputManager’s methods. The current input manager’s input server will call some of the text view’s NSTextInput interface methods.

The wantsToDelayTextChangeNotifications, wantsToHandleMouseEvents, and wantsToInterpretAllKeystrokes methods call methods of the same names on the input manager’s current input server and return the result.

Interfaces Implemented

NSTextInput

Tasks

Constructors

Input Server Selection

Marked Text

Event Handling

Input Server Information

Input Server Options

NSTextInput Interface (used Internally Only)

Constructors

NSInputManager

Cocoa constructs an NSInputManager automatically. This method is an implementation detail. You will never call this method.

public NSInputManager(String inputServerName, String hostName)

Static Methods

currentInputManager

The current input manager is the one that has been chosen to handle keyboard events at the time this method is called.

public static NSInputManager currentInputManager()

Discussion

Don’t cache the return value, because the user can switch to a different input manager at any time.

cycleToNextInputLanguage

Deprecated.

public static void cycleToNextInputLanguage(Object sender)

cycleToNextInputServerInLanguage

Deprecated.

public static void cycleToNextInputServerInLanguage(Object sender)

Instance Methods

attributedSubstringWithRange

From NSTextInput interface; called internally only.

public NSAttributedString attributedSubstringWithRange(NSRange theRange)

characterIndexForPoint

From NSTextInput interface; called internally only.

public int characterIndexForPoint(NSPoint thePoint)

conversationIdentifier

From NSTextInput interface; called internally only.

public int conversationIdentifier()

doCommandBySelector

From NSTextInput interface; called internally only.

public void doCommandBySelector(NSSelector aSelector)

firstRectForCharacterRange

From NSTextInput interface; called internally only.

public NSRect firstRectForCharacterRange(NSRange theRange)

handleMouseEvent

public boolean handleMouseEvent(NSEvent theMouseEvent)

Discussion

Forwards a mouse event passed in theMouseEvent to the input server. If wantsToHandleMouseEvents returns true, then the text view must forward all mouse events that occur within it. As usual, a return value of false means that the text view should proceed with handling the event.

hasMarkedText

From NSTextInput interface; called internally only.

public boolean hasMarkedText()

image

Deprecated.

public NSImage image()

insertText

From NSTextInput interface; called internally only.

public void insertText(Object aString)

language

Returns the Language property from the input server’s Info file, or null if none is specified there.

public String language()

Discussion

For additional information, see “Deploying Input Servers”.

localizedInputManagerName

Returns the name of the input server as it appears in the Edit>Input submenu.

public String localizedInputManagerName()

Discussion

This value comes from the input server’s Info file.For additional information, see “Deploying Input Servers”.

markedRange

From NSTextInput interface; called internally only.

public NSRange markedRange()

markedTextAbandoned

The input server must abandon whatever it was doing with marked text.

public void markedTextAbandoned(Object client)

Discussion

The NSTextView object client calls this when the user clicks outside the marked text (anywhere other than the beginning of marked text, the end of marked text, or in between), then NSTextView promotes the marked text to normal text as if it had been inserted. A custom text view is free to choose not to keep the marked text.

See Also

markedTextSelectionChanged

The user clicked at the beginning of marked text, the end of marked text, or in between, or the user made a selection within the marked text in the client text view.

public void markedTextSelectionChanged(NSRange newSel, Object client)

Discussion

The range newSel is relative to the beginning of the marked text.

See Also

selectedRange

From NSTextInput interface; called internally only.

public NSRange selectedRange()

server

Deprecated.

public NSInputServer server()

setMarkedTextAndSelectedRange

From NSTextInput interface; called internally only.

public void setMarkedTextAndSelectedRange(Object aString, NSRange selRange)

unmarkText

From NSTextInput interface; called internally only.

public void unmarkText()

validAttributesForMarkedText

From NSTextInput interface; called internally only.

public NSArray validAttributesForMarkedText()

wantsToDelayTextChangeNotifications

A true return value tells the sender that only a call to its insertText method constitutes a modification to its text storage.

public boolean wantsToDelayTextChangeNotifications()

Discussion

A false return value tells the sender that all text given to it, either by insertion or as part of marked text, should constitute a modification to its text storage. The sender may for example want to filter all text that is part of a modification but leave marked text unfiltered.

See Also

wantsToHandleMouseEvents

Returns true if the sender should forward all mouse events within the text view to the input server.

public boolean wantsToHandleMouseEvents()

See Also

wantsToInterpretAllKeystrokes

Returns true if the server wants all keystrokes to be sent to it as characters.

public boolean wantsToInterpretAllKeystrokes()

Discussion

This method is needed only by the inner workings of Cocoa. You will probably not need to call this method.

See Also


Next Page > Hide TOC


© 1997, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-02-01)


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.