Exemple #1
0
        protected ImeParam KoreanImeMessageParam(Message m)
        {
            ImeParam im = null;

            switch (m.Msg)
            {
            case NativeWindowCommon.WM_IME_STARTCOMPOSITION:
                if (MaxLength > 0)
                {
                    MaxLength = MaxLength + 1;
                }
                im = new ImeParam(m.HWnd, m.Msg, m.WParam, m.LParam);
                break;

            case NativeWindowCommon.WM_IME_COMPOSITION:
                // send to work thread unless this is the result str (might follow the ENDCOMPOSITION)
                if (((int)m.LParam & NativeWindowCommon.GCS_RESULTSTR) == 0)
                {
                    im = new ImeParam(m.HWnd, m.Msg, m.WParam, m.LParam);
                }
                break;

            case NativeWindowCommon.WM_IME_CHAR:
                // WM_IME_CHAR is handled as KeyPressEvent
                break;
            }

            return(im);
        }
Exemple #2
0
 /// <summary>
 ///   CTOR - creates a new run time event by copying the member variables of a given
 ///   event and the member variables of a given run time event
 /// </summary>
 /// <param name = "evt">a reference to the event to be used </param>
 /// <param name = "rtEvt">a reference to the run time event to be used </param>
 internal RunTimeEvent(Event evt, RunTimeEvent rtEvt)
     : base(evt)
 {
     _taskTag           = rtEvt._taskTag;
     _task              = rtEvt._task;
     Control            = rtEvt.Control;
     _eventFld          = rtEvt._eventFld;
     _mgdId             = rtEvt._mgdId;
     _displayLine       = rtEvt._displayLine;
     _reversibleExit    = rtEvt._reversibleExit;
     _argList           = rtEvt._argList;
     _immediate         = rtEvt._immediate;
     _mprgCreator       = rtEvt._mprgCreator;
     _priority          = rtEvt._priority;
     _guiTriggeredEvent = rtEvt._guiTriggeredEvent;
     _isIdleTimer       = rtEvt._isIdleTimer;
     _val            = rtEvt._val;
     _selectionStart = rtEvt._selectionStart;
     _selectionEnd   = rtEvt._selectionEnd;
     _controlsList   = rtEvt._controlsList;
     _direction      = rtEvt._direction;
     _dotNetObject   = rtEvt._dotNetObject;
     DotNetArgs      = rtEvt.DotNetArgs;
     LastFocusedVal  = rtEvt.LastFocusedVal;
     _imeParam       = rtEvt._imeParam;
 }
Exemple #3
0
        /// <summary>
        ///   (Korean IME) Send IME Message
        /// </summary>
        /// <param name = "ctrl"> </param>
        /// <param name="im"></param>
        /// <returns> </returns>
        public static int SendImeMessage(MgControlBase ctrl, ImeParam im)
        {
            if (ctrl.isTextControl() && im != null)
            {
                return(Commands.sendImeMsg(ctrl, ctrl.getDisplayLine(true), im));
            }

            return(0);
        }
Exemple #4
0
        /// <summary></summary>
        /// <param name = "guiMgForm"></param>
        /// <param name = "guiMgCtrl"></param>
        /// <param name = "modifier"></param>
        /// <param name = "keyCode"></param>
        /// <param name = "start"></param>
        /// <param name = "end"></param>
        /// <param name = "text"></param>
        /// <param name = "im"></param>
        /// <param name = "isActChar"></param>
        /// <param name = "suggestedValue"></param>
        /// <param name = "dotNetArgs"></param>
        /// <param name = "comboIsDropDown"></param>
        /// <param name="handled">boolean variable event is handled or not.</param>
        /// <returns> true only if we have handled the KeyDown event (otherwise the CLR should handle). If true magic will handle else CLR will handle.</returns>
        protected override bool processKeyDown(GuiMgForm guiMgForm, GuiMgControl guiMgCtrl, Modifiers modifier,
                                               int keyCode,
                                               int start, int end,
                                               String text, ImeParam im, bool isActChar, String suggestedValue,
                                               bool comboIsDropDown, bool handled)
        {
            // time of last user action for IDLE function
            ClientManager.Instance.LastActionTime = Misc.getSystemMilliseconds();

            // DOWN or UP invoked on a SELECT/RADIO control
            return(base.processKeyDown(guiMgForm, guiMgCtrl, modifier, keyCode,
                                       start, end, text, im, isActChar, suggestedValue, comboIsDropDown, handled));
        }
Exemple #5
0
        /// <summary>Pass keycode and modifier to bridge, bridge then converts it to keyboard action and adds in MgCore.dll
        /// events queue</summary>
        /// <param name="form"></param>
        /// <param name="guiMgCtrl"></param>
        /// <param name="modifier"></param>
        /// <param name="keyCode"></param>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="caretPos"></param>
        /// <param name="text"></param>
        /// <param name="im"></param>
        /// <param name="isActChar"></param>
        /// <param name="suggestedValue"></param>
        /// <param name="ComboIsDropDown"></param>
        /// <param name="handled">boolean variable event is handled or not.</param>
        /// <returns> true only if we have handled the KeyDown event (otherwise the CLR should handle). If true magic will handle else CLR will handle.</returns>
        protected virtual bool processKeyDown(GuiMgForm guiMgForm, GuiMgControl guiMgCtrl, Modifiers modifier, int keyCode,
                                              int start, int end, string text, ImeParam im,
                                              bool isActChar, string suggestedValue, bool ComboIsDropDown, bool handled)
        {
            bool eventHandled     = handled;
            bool addKeyBoardEvent = true;

            MgControlBase mgControl = (MgControlBase)guiMgCtrl;
            MgFormBase    mgForm    = (MgFormBase)guiMgForm;

            if (mgControl != null)
            {
                //In case of help window, the events like up arrow\down arrow key, should be handled by the
                //CLR.So first check if the form is help form and return the value true or false.

                if (mgControl.getForm() != null && mgControl.getForm().IsHelpWindow&& keyCode != GuiConstants.KEY_ESC)
                {
                    //events related with the help window will NOT be handled by magic.
                    return(false);
                }

                // DOWN or UP invoked on a SELECT/RADIO control
                if ((mgControl.isRadio() || mgControl.isListBox() ||
                     (mgControl.isComboBox() && ComboIsDropDown) ||
                     (mgControl.isTabControl() && !suggestedValue.Equals("-1"))))
                {
                    if (processKeyForSelectionControl(mgForm, mgControl, modifier, keyCode, suggestedValue))
                    {
                        addKeyBoardEvent = false;
                    }
                }
            }

            if (addKeyBoardEvent)
            {
                // raise event
                Manager.EventsManager.AddKeyboardEvent(mgForm, mgControl, modifier, keyCode,
                                                       start, end, text, im,
                                                       isActChar, suggestedValue, InternalInterface.MG_ACT_CTRL_KEYDOWN);
            }

            return(eventHandled);
        }
Exemple #6
0
 public ImeEventArgs(ImeParam i)
 {
     im      = i;
     Handled = false;
 }
Exemple #7
0
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == NativeWindowCommon.WM_LBUTTONDOWN)
            {
                SaveSelectionStart  = SelectionStart;
                SaveSelectionLength = SelectionLength;
            }
            else if (m.Msg == NativeWindowCommon.WM_PAINT)
            {
                if (!Focused)
                {
                    //Allow framework to draw the borders, we will draw text & other things.
                    //So called base.WndProc & removed ValidateRect() from PaintNotFocusedControl() method.
                    base.WndProc(ref m);
                    PaintNotFocusedControl();
                    return;
                }
            }

            if (isJapanese()) // JPN: ZIMERead function
            {
                if (m.Msg == NativeWindowCommon.WM_IME_COMPOSITION)
                {
                    if (((int)m.LParam & NativeWindowCommon.GCS_RESULTREADSTR) > 0)
                    {
                        int hIMC = NativeWindowCommon.ImmGetContext(this.Handle);

                        try
                        {
                            int size = NativeWindowCommon.ImmGetCompositionString(hIMC, NativeWindowCommon.GCS_RESULTREADSTR, null, 0);

                            StringBuilder buffer = new StringBuilder(size);
                            NativeWindowCommon.ImmGetCompositionString(hIMC, NativeWindowCommon.GCS_RESULTREADSTR, buffer, (uint)size);
                            string str = buffer.ToString().Substring(0, size / 2);
                            ImeReadStrBuilder.Append(str);
                        }
                        finally
                        {
                            NativeWindowCommon.ImmReleaseContext(this.Handle, hIMC);
                        }
                    }
                }
            }

            // handling of cut/copy/paste event raised from default(system) conext menu invoked on text box
            switch (m.Msg)
            {
            case NativeWindowCommon.WM_CUT:
                if (CutEvent != null)
                {
                    CutEvent(this, new EventArgs());
                    return;
                }
                else
                {
                    break;
                }

            case NativeWindowCommon.WM_COPY:
                if (CopyEvent != null)
                {
                    CopyEvent(this, new EventArgs());
                    return;
                }
                else
                {
                    break;
                }

            case NativeWindowCommon.WM_PASTE:
                if (PasteEvent != null)
                {
                    PasteEvent(this, new EventArgs());
                    return;
                }
                else
                {
                    break;
                }

            case NativeWindowCommon.WM_CLEAR:
                if (ClearEvent != null)
                {
                    ClearEvent(this, new EventArgs());
                    return;
                }
                else
                {
                    break;
                }

            case NativeWindowCommon.WM_UNDO:
                if (UndoEvent != null)
                {
                    UndoEvent(this, new EventArgs());
                    return;
                }
                else
                {
                    break;
                }
            }

            if (isKorean() && !Multiline)
            {
                if (CheckClickSequence(m))
                {
                    return;
                }

                ImeParam im = KoreanImeMessageParam(m);
                if (im != null)
                {
                    // (Korean) Some IME messages must be postponed until processing in
                    // TextMaskEditor.action() is finished.  So it is routed to RT Event loop.
                    ImeEventArgs iea = new ImeEventArgs(im);
                    ImeEvent(this, iea);
                    if (iea.Handled)
                    {
                        return;
                    }
                }
                else
                {
                    // RT Event handler send back those IME messagesas MG_IME_XX
                    // to avoid confusion, so it is translated to WM_IME_XX
                    KoreanMessageTranslation(ref m);
                }
            }
            base.WndProc(ref m);
        }
Exemple #8
0
 internal void setImeParam(ImeParam im)
 {
     _imeParam = im;
 }