public HRESULT OnPopContext(ITfContext pic) { return(new HRESULT() { Code = 0 }); }
public void OnEndEdit(ITfContext context, int ecReadOnly, ITfEditRecord editRecord) { ITfProperty property; context.GetProperty(GUID_PROP_COMPOSING, out property); ITfRangeACP rangeACP; TextServicesContext.Current.ContextOwnerServices.CreateRange(_compositionStart, _compositionStart + _compositionLength, out rangeACP); Variant val; property.GetValue(ecReadOnly, rangeACP, out val); property.Dispose(); rangeACP.Dispose(); if (val.Value == null || (int)val.Value == 0) { if (_commitLength == 0 || _inputBuffer.Count == 0) { return; } //Debug.WriteLine("Composition result: {0}", new object[] { new string(_inputBuffer.GetRange(_commitStart, _commitLength).ToArray()) }); _commited = true; for (int i = _commitStart; i < _commitLength; i++) { InputMethod.OnTextInput(this, _inputBuffer[i]); } } if (_commited) { return; } if (_inputBuffer.Count == 0 && _compositionLength > 0) // Composition just ended { return; } _currentComposition.Clear(); for (int i = _compositionStart; i < _compositionLength; i++) { _currentComposition.Add(_inputBuffer[i]); } InputMethod.OnTextComposition(this, new IMEString(_currentComposition), _acpEnd); //var compStr = new string(_currentComposition.ToArray()); //compStr = compStr.Insert(_acpEnd, "|"); //Debug.WriteLine("Composition string: {0}, cursor pos: {1}", compStr, _acpEnd); }
private void InsertTextAtSelection(uint ec, ITfContext pContext, string pchText, int cchText) { // we need a special interface to insert text at the selection var pInsertAtSelection = (ITfInsertAtSelection)pContext; // insert the text ITfRange pRange = pInsertAtSelection.InsertTextAtSelection(ec, 0, pchText, cchText); // update the selection, we'll make it an insertion point just past the inserted text. pRange.Collapse(ec, TfAnchor.TF_ANCHOR_END); var tfSelection = new TF_SELECTION[] { new TF_SELECTION { range = pRange, style = new TF_SELECTIONSTYLE { ase = TfActiveSelEnd.TF_AE_NONE, fInterimChar = false } } }; pContext.SetSelection(ec, 1, tfSelection); }
HRESULT ITfThreadMgrEventSink.OnPopContext(ITfContext pic) { throw new NotImplementedException(); }
public HRESULT OnPreservedKey(ITfContext pic, ref Guid rguid, out bool pfEaten) { throw new NotImplementedException(); }
public HRESULT OnKeyUp(ITfContext pic, UIntPtr wParam, IntPtr lParam, out bool pfEaten) { throw new NotImplementedException(); }
public HRESULT OnEndEdit(ITfContext pic, uint ecReadOnly, ITfEditRecord pEditRecord) { throw new NotImplementedException(); }
public CKeystrokeEditSession(ITfContext pContext) : base(pContext) { }
public CHelloEditSession(ITfContext pContext) : base(pContext) { }
public CFlipEditSession(ITfContext pContext) : base(pContext) { }
HRESULT ITfKeyEventSink.OnKeyDown(ITfContext pic, UIntPtr wParam, IntPtr lParam, out bool pfEaten) { throw new NotImplementedException(); }
public CEditSessionBase(ITfContext pContext) => this.pContext = pContext;