Esempio n. 1
0
 public HRESULT OnPopContext(ITfContext pic)
 {
     return(new HRESULT()
     {
         Code = 0
     });
 }
Esempio n. 2
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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
 HRESULT ITfThreadMgrEventSink.OnPopContext(ITfContext pic)
 {
     throw new NotImplementedException();
 }
Esempio n. 5
0
 public HRESULT OnPreservedKey(ITfContext pic, ref Guid rguid, out bool pfEaten)
 {
     throw new NotImplementedException();
 }
Esempio n. 6
0
 public HRESULT OnKeyUp(ITfContext pic, UIntPtr wParam, IntPtr lParam, out bool pfEaten)
 {
     throw new NotImplementedException();
 }
Esempio n. 7
0
 public HRESULT OnEndEdit(ITfContext pic, uint ecReadOnly, ITfEditRecord pEditRecord)
 {
     throw new NotImplementedException();
 }
Esempio n. 8
0
 public CKeystrokeEditSession(ITfContext pContext) : base(pContext)
 {
 }
Esempio n. 9
0
 public CHelloEditSession(ITfContext pContext) : base(pContext)
 {
 }
Esempio n. 10
0
 public CFlipEditSession(ITfContext pContext) : base(pContext)
 {
 }
Esempio n. 11
0
 HRESULT ITfKeyEventSink.OnKeyDown(ITfContext pic, UIntPtr wParam, IntPtr lParam, out bool pfEaten)
 {
     throw new NotImplementedException();
 }
Esempio n. 12
0
 public CEditSessionBase(ITfContext pContext) => this.pContext = pContext;