示例#1
0
文件: EditUI.cs 项目: lineCode/QUILib
        public override void eventProc(ref TEventUI newEvent)
        {
            if (!isMouseEnabled() && newEvent.mType > (int)EVENTTYPE_UI.UIEVENT__MOUSEBEGIN && newEvent.mType < (int)EVENTTYPE_UI.UIEVENT__MOUSEEND)
            {
                if (mParent != null)
                {
                    mParent.eventProc(ref newEvent);
                }
                else
                {
                    base.eventProc(ref newEvent);
                }
                return;
            }

            if (newEvent.mType == (int)EVENTTYPE_UI.UIEVENT_SETCURSOR && isEnabled())
            {
                if (mManager.getPaintWindow().Cursor != Cursors.IBeam)
                {
                    mManager.getPaintWindow().Cursor = Cursors.IBeam;
                }
                return;
            }
            if (newEvent.mType == (int)EVENTTYPE_UI.UIEVENT_WINDOWSIZE)
            {
                ControlUI ctlUI = null;
                if (mWindow != null)
                {
                    mManager.setFocus(ref ctlUI);
                }
            }
            if (newEvent.mType == (int)EVENTTYPE_UI.UIEVENT_SCROLLWHEEL)
            {
                ControlUI ctlUI = null;
                if (mWindow != null)
                {
                    closeEditWnd();
                    mManager.setFocus(ref ctlUI);
                }
            }
            if (newEvent.mType == (int)EVENTTYPE_UI.UIEVENT_SETFOCUS && isEnabled())
            {
                if (mWindow != null)
                {
                    return;
                }

                mWindow = new EditWnd();
                mWindow.init(this);
                if (OnCharMessageEvent != null)
                {
                    mWindow.OnCharMessageEvent = OnCharMessageEvent;
                }
                invalidate();
            }
            if (newEvent.mType == (int)EVENTTYPE_UI.UIEVENT_KILLFOCUS && isEnabled())
            {
                invalidate();
            }
            if (newEvent.mType == (int)EVENTTYPE_UI.UIEVENT_BUTTONDOWN || newEvent.mType == (int)EVENTTYPE_UI.UIEVENT_DBLCLICK)
            {
                if (isEnabled())
                {
                    if (isFocused() && mWindow == null)
                    {
                        mWindow = new EditWnd();
                        mWindow.init(this);
                        if (OnCharMessageEvent != null)
                        {
                            mWindow.OnCharMessageEvent = OnCharMessageEvent;
                        }
                    }
                }
                return;
            }
            if (newEvent.mType == (int)EVENTTYPE_UI.UIEVENT_MOUSEMOVE)
            {
                return;
            }
            if (newEvent.mType == (int)EVENTTYPE_UI.UIEVENT_BUTTONUP)
            {
                return;
            }
            if (newEvent.mType == (int)EVENTTYPE_UI.UIEVENT_MOUSEENTER)
            {
                if (isEnabled())
                {
                    mButtonState |= (int)ControlFlag.UISTATE_HOT;
                    invalidate();
                }
                return;
            }
            if (newEvent.mType == (int)EVENTTYPE_UI.UIEVENT_MOUSELEAVE)
            {
                if (isEnabled())
                {
                    mButtonState &= (int)ControlFlag.UISTATE_HOT;
                    invalidate();
                }
                return;
            }
            base.eventProc(ref newEvent);
        }
示例#2
0
        public override void eventProc(ref TEventUI newEvent)
        {
            if (!isMouseEnabled() && newEvent.mType > (int)EVENTTYPE_UI.UIEVENT__MOUSEBEGIN && newEvent.mType < (int)EVENTTYPE_UI.UIEVENT__MOUSEEND)
            {
                if (mParent != null)
                {
                    mParent.eventProc(ref newEvent);
                }
                else
                {
                    base.eventProc(ref newEvent);
                }
                return;
            }

            if (newEvent.mType == (int)EVENTTYPE_UI.UIEVENT_SETCURSOR && isEnabled())
            {
                if (mManager.getPaintWindow().Cursor != Cursors.IBeam)
                {
                    mManager.getPaintWindow().Cursor = Cursors.IBeam;
                }
                return;
            }
            if (newEvent.mType == (int)EVENTTYPE_UI.UIEVENT_WINDOWSIZE)
            {
                ControlUI ctlUI = null;
                if (mWindow != null)
                {
                    mManager.setFocus(ref ctlUI);
                }
            }
            if (newEvent.mType == (int)EVENTTYPE_UI.UIEVENT_SCROLLWHEEL)
            {
                ControlUI ctlUI = null;
                if (mWindow != null)
                {
                    mManager.setFocus(ref ctlUI);
                }
            }
            if (newEvent.mType == (int)EVENTTYPE_UI.UIEVENT_SETFOCUS && isEnabled())
            {
                if (mWindow != null)
                {
                    return;
                }

                mWindow = new EditWnd();
                mWindow.init(this);
                invalidate();
            }
            if (newEvent.mType == (int)EVENTTYPE_UI.UIEVENT_KILLFOCUS && isEnabled())
            {
                invalidate();
            }
            if (newEvent.mType == (int)EVENTTYPE_UI.UIEVENT_BUTTONDOWN || newEvent.mType == (int)EVENTTYPE_UI.UIEVENT_DBLCLICK)
            {
                if (isEnabled())
                {
                    if (isFocused() && mWindow == null)
                    {
                        mWindow = new EditWnd();
                        mWindow.init(this);
                    }
                    else if (mWindow == null)
                    {
                        //POINT pt = event.ptMouse;
                        //pt.x -= m_rcItem.left + m_rcTextPadding.left;
                        //pt.y -= m_rcItem.top + m_rcTextPadding.top;
                        //::SendMessage(*m_pWindow, WM_LBUTTONDOWN, event.wParam, MAKELPARAM(pt.x, pt.y));
                    }
                }
                return;
            }
            if (newEvent.mType == (int)EVENTTYPE_UI.UIEVENT_MOUSEMOVE)
            {
                return;
            }
            if (newEvent.mType == (int)EVENTTYPE_UI.UIEVENT_BUTTONUP)
            {
                return;
            }
            if (newEvent.mType == (int)EVENTTYPE_UI.UIEVENT_MOUSEENTER)
            {
                if (isEnabled())
                {
                    mButtonState |= (int)ControlFlag.UISTATE_HOT;
                    invalidate();
                }
                return;
            }
            if (newEvent.mType == (int)EVENTTYPE_UI.UIEVENT_MOUSELEAVE)
            {
                if (isEnabled())
                {
                    mButtonState &= (int)ControlFlag.UISTATE_HOT;
                    invalidate();
                }
                return;
            }
            base.eventProc(ref newEvent);
        }