Exemple #1
0
        public override bool PreProcessMessage(ref Message msg)
        {
            if (FInputHelper.Visible && (msg.Msg == User.WM_KEYDOWN) && (msg.WParam.ToInt32() == Imm.VK_PROCESSKEY))
            {
                uint vVirtualKey = Imm.ImmGetVirtualKey(msg.HWnd);
                if (vVirtualKey - 127 == 59)  // ; 需要设置输入法;号的功能,如二三候选
                {
                    FInputHelper.ActiveEx = !FInputHelper.ActiveEx;
                    return(true);
                }
                else
                if ((FInputHelper.ActiveEx) && ((vVirtualKey == 32) || ((vVirtualKey >= 49) && (vVirtualKey <= 57))))
                {
                    User.keybd_event(User.VK_ESCAPE, 0, 0, 0);
                    User.keybd_event(User.VK_ESCAPE, 0, User.KEYEVENTF_KEYUP, 0);
                    if (vVirtualKey == 32)
                    {
                        vVirtualKey = 49;
                    }

                    string vText = FInputHelper.GetCandiText(vVirtualKey - 49);
                    this.InsertText(vText);
                    return(true);
                }
            }

            return(base.PreProcessMessage(ref msg));
        }
Exemple #2
0
        protected override void UpdateImeComposition(int aLParam)
        {
            if (FInputHelper.EnableEx && ((aLParam & Imm.GCS_COMPSTR) != 0))
            {
                string vS = GetCompositionStr(Imm.GCS_COMPSTR);
                FInputHelper.SetCompositionString(vS);

                if (FInputHelper.ChangeSize)
                {
                    COMPOSITIONFORM vCF = new COMPOSITIONFORM();
                    if (Imm.ImmGetCompositionWindow(this.hImc, ref vCF))
                    {
                        if (FInputHelper.ResetImeCompRect(ref vCF.ptCurrentPos))
                        {
                            Imm.ImmSetCompositionWindow(this.hImc, ref vCF);
                        }
                    }
                }
            }

            if ((aLParam & Imm.GCS_RESULTSTR) != 0)
            {
                string vS = GetCompositionStr(Imm.GCS_RESULTSTR);
                if (vS != "")
                {
                    if (DoProcessIMECandi(vS))
                    {
                        InsertText(vS);
                    }
                }
            }
        }
Exemple #3
0
        public void RegisterFieldsAlignedCorrectly()
        {
            Imm reg = new Imm
            {
                hi = 0xff,
                lo = 0x00
            };

            Assert.AreEqual(0xff00, reg.wide);

            reg.wide = 0x1ff1;
            Assert.AreEqual(0x1f, reg.hi);
            Assert.AreEqual(0xf1, reg.lo);
        }
Exemple #4
0
        private string GetCompositionStr(int aType)
        {
            string Result = "";

            if (this.hImc != IntPtr.Zero)
            {
                int vSize = Imm.ImmGetCompositionString(this.hImc, aType, null, 0);
                if (vSize > 0)
                {
                    byte[] vBuffer = new byte[vSize];
                    Imm.ImmGetCompositionString(this.hImc, aType, vBuffer, vSize);
                    Result = System.Text.Encoding.Default.GetString(vBuffer);
                }
            }

            return(Result);
        }
Exemple #5
0
        protected override void UpdateImePosition()
        {
            COMPOSITIONFORM vCF = new COMPOSITIONFORM();

            vCF.ptCurrentPos.X = Caret.X;
            vCF.ptCurrentPos.Y = Caret.Y + Caret.Height + 4;

            if (FInputHelper.EnableEx)
            {
                FInputHelper.ResetImeCompRect(ref vCF.ptCurrentPos);
            }

            vCF.dwStyle = 0x0020;
            Rectangle vr = this.ClientRectangle;

            vCF.rcArea = new RECT(vr.Left, vr.Top, vr.Right, vr.Bottom);
            Imm.ImmSetCompositionWindow(this.hImc, ref vCF);

            if (FInputHelper.EnableEx)
            {
                FInputHelper.CompWndMove(this.Handle, Caret.X, Caret.Y + Caret.Height);
            }
        }
Exemple #6
0
 public override void ResetIme() => ScheduleCommand(() => Imm.CancelComposition(WindowHandle));
Exemple #7
0
 public override void StartTextInput(bool allowIme)
 {
     base.StartTextInput(allowIme);
     ScheduleCommand(() => Imm.SetImeAllowed(WindowHandle, allowIme));
 }
Exemple #8
0
 public static @string String(this Imm i)
 {
     return(fmt.Sprintf("#%#x", uint32(i)));
 }
Exemple #9
0
 public static void IsArg(this Imm _p0)
 {
 }
Exemple #10
0
 public static @string String(this Imm i)
 {
     return(fmt.Sprintf("%d", int32(i)));
 }