Important: The information in this document is obsolete and should not be used for new development.
Package | com.apple.cocoa.application |
Companion guide |
The NSInputServiceProvider interface embodies most of the functionality of NSInputServer.
There are two ways you might use this interface:
You can subclass NSInputServer and create an instance of your subclass. Your subclass must override most or all of the NSInputServiceProvider interface methods.
You can create an NSInputServer object and designate a delegate. The delegate must implement the NSInputServiceProvider interface.
All messages in this interface are sent by the client text view except insertText
and doCommandBySelector
, which are sent by NSInputManager.
activeConversationChanged
activeConversationWillChange
canBeDisabled
inputClientBecomeActive
inputClientDisabled
inputClientEnabled
inputClientResignActive
markedTextAbandoned
markedTextSelectionChanged
terminate
Keyboard focus just switched from another text view to this one.
public abstract void activeConversationChanged
(Object sender, int newConversation)
This is called only when switching within the same application. sender can be cast to NSTextInput.
activeConversationWillChange
conversationIdentifier
(NSTextInput)Keyboard focus is about to move away from this text view.
public abstract void activeConversationWillChange
(Object sender, int oldConversation)
This is called only when switching within the same application. sender can be cast to NSTextInput.
activeConversationChanged
conversationIdentifier
(NSTextInput)Returns true
if the receiver can be disabled when the sender is not a text view, false
public abstract boolean canBeDisabled
()
otherwise.
Handle the command identified by aSelector.
public abstract void doCommandBySelector
(NSSelector aSelector, Object sender)
The command can be from the set of NSResponder
action methods or from the set of selector values in the DefaultKeyBindings dictionary referenced in the input server’s “Info
” file. sender can be cast to NSTextInput.
If you are subclassing NSInputServer, there is no need to override this method in the subclass. All you have to do is implement in the subclass the command methods you want to handle. If you do need to override this method, then you must call super for commands not handled.
If your NSInputServer uses a delegate, the delegate’s implementation of this method must call doCommandBySelector(sender, aSelector)
for commands it does not handle.
doCommandBySelector
(NSTextInput)The client, sender, has become active.
public abstract void inputClientBecomeActive
(Object sender)
This is called when the client application starts up and whenever it becomes active after being inactive. sender can be cast to NSTextInput.
A text view in the client, sender, has ceased to be the key-receiving first responder.
public abstract void inputClientDisabled
(Object sender)
inputClientResignActive
may also be called just after this is called. sender can be cast to NSTextInput.
A text view in the client, sender, has become the key-receiving first responder.
public abstract void inputClientEnabled
(Object sender)
This is called the first time any text view becomes enabled after client application activation and again whenever focus switches to a text view. inputClientBecomeActive
may have been called just before this is called. sender can be cast to NSTextInput.
The client, sender, is about to become inactive.
public abstract void inputClientResignActive
(Object sender)
This is called when the client application quits and whenever it is deactivated. sender can be cast to NSTextInput.
Interpret the characters in aString, which is actually always a String
.
public abstract void insertText
(Object aString, Object sender)
Here is where you do the interpreting of keyboard input. If your server’s interpretation is disabled or the characters in aString are not of interest to the server, you can simply pass aString along to the sender’s insertText
method. sender can be cast to NSTextInput.
insertText
(NSTextInput)Abandon any marked text state that may be in process.
public abstract void markedTextAbandoned
(Object sender)
This can happen if the user clicks the mouse outside of the marked text area or if the window containing the text view closes. The client can do what it wants with the marked text. NSTextView
leaves it as inserted text. sender can be cast to NSTextInput.
public abstract void markedTextSelectionChanged
(NSRange newSelection, Object sender)
The user selected a portion of the marked text or clicked at the beginning or end of marked text or somewhere in between. sender can be cast to NSTextInput.
The client application is quitting.
public abstract void terminate
(Object sender)
This is called after inputClientResignActive
. sender can be cast to NSTextInput.
A true
return value tells the client that only a call to its insertText
method constitutes a modification to its text storage.
public abstract boolean wantsToDelayTextChangeNotifications
()
A false
return value tells the client that all text given to it, whether marked text or not, should constitute a modification to its text storage. A true
return value tells the client that only unmarked text given to it should constitute a modification to its text storage. The client may for example want to filter all text that is part of a modification but leave marked text unfiltered.
wantsToDelayTextChangeNotifications
(NSInputManager)Returns true
if the client should forward all mouse events within the text view to the input server.
public abstract boolean wantsToHandleMouseEvents
()
If the server needs to implement the NSInputServerMouseTracker interface, return true
.
wantsToHandleMouseEvents
(NSInputManager)Returns true
if the server wants all keystrokes to be sent to it as characters.
public abstract boolean wantsToInterpretAllKeystrokes
()
If this method returns false
, control key combinations and function keys (the arrow keys, PageDown, F5, and so on) are delivered to the input server via the key binding mechanism and doCommandBySelector
.
The Unicode values for the characters representing keyboard function keys (the arrow keys, PageDown, F5, and so on) names like NSEvent.UpArrowFunctionKey
, and are documented in NSEvent. Control-key combinations are the usual ASCII control character codes.
For more information on key bindings, see “About Key Bindings”.
wantsToInterpretAllKeystrokes
(NSInputManager)© 1997, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-02-01)