nsITextInputProcessorCallback 编辑
dom/interfaces/base/nsITextInputProcessor.idl
Scriptable A callback interface for nsITextInputProcessor user 1.0 66 Introduced Gecko 38 Inherits from: nsISupports
Last changed in Gecko 38.0 (Firefox 38.0 / Thunderbird 38.0 / SeaMonkey 2.35)nsITextInputProcessorCallback is defined for receiving requests and notifications to IME from Gecko. This interface has a "function" attribute. Therefore, JS-IME can implement this as a function.
Example of simple JS-IME:
var simpleIME = { _hasFocus: false, _hasRightsToCompose: false, _TIP: null, _callback: function simpleIME_callback(aTIP, aNotification) { try { switch (aNotification.type) { case "request-to-commit": aTIP.commitComposition(); break; case "request-to-cancel": aTIP.cancelComposition(); break; case "notify-focus": this._hasFocus = true; break; case "notify-blur": this._hasFocus = false; break; case "notify-detached": this._hasFocus = false; this._hasRightsToCompose = false; break; } return true; } catch (e) { return false; } }, setComposition: function simpleIME_setComposition(aText, aClauses, aCaret) { if (!this._TIP) { this._TIP = Components.classes["@mozilla.org/text-input-processor;1"]. createInstance(Components.interfaces.nsITextInputProcessor); } if (!this._TIP.beginInputTransaction(window, this._callback)) { return false; } ... }, }
Method overview
boolean onNotify(in nsITextInputProcessor aTextInputProcessor, in nsITextInputProcessorNotification aNotification); |
Methods
onNotify()
This is called when Gecko requests or notifies something to IME.
boolean onNotify(in nsITextInputProcessor aTextInputProcessor, in nsITextInputProcessorNotification aNotification);
Parameters
- aTextInputProcessor
- The instance which receives the notification. If the handler needs to do something with composition, you can use this.
- aNotification
- A notification or request. See the document of
nsITextInputProcessorNotification
for the details.
Return value
If this handles the notification normally or does nothing, it should return true. Otherwise, false.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论