示例#1
0
        public bool setNumericUpDownWnd(NumericUpDownWnd wnd)
        {
            mWindow = wnd;

            return(true);
        }
示例#2
0
        public override void eventProc(ref TEventUI newEvent)
        {
            if (!isMouseEnabled() && newEvent.mType > (int)EventTypeUI.UIEVENT__MOUSEBEGIN && newEvent.mType < (int)EventTypeUI.UIEVENT__MOUSEEND)
            {
                if (mOwner != null)
                {
                    mOwner.eventProc(ref newEvent);
                }
                else
                {
                    base.eventProc(ref newEvent);
                }
                return;
            }

            if (newEvent.mType == (int)EventTypeUI.UIEVENT_KILLFOCUS)
            {
                return;
            }
            if (newEvent.mType == (int)EventTypeUI.UIEVENT_BUTTONDOWN || newEvent.mType == (int)EventTypeUI.UIEVENT_DBLCLICK)
            {
                if (!isEnabled())
                {
                    return;
                }

                if (mRectButton1.Contains(newEvent.mMousePos))
                {
                    mButton1State |= (int)PaintFlags.UISTATE_PUSHED;
                    setValue(mCurValue + 1);
                }
                else if (mRectButton2.Contains(newEvent.mMousePos))
                {
                    mButton2State |= (int)PaintFlags.UISTATE_PUSHED;
                    setValue(mCurValue - 1);
                }
                else if (isFocused() && mWindow == null)
                {
                    mWindow = new NumericUpDownWnd();
                    mWindow.init(this);
                }

                return;
            }
            if (newEvent.mType == (int)EventTypeUI.UIEVENT_BUTTONUP)
            {
                if ((mButton1State & (int)PaintFlags.UISTATE_PUSHED) != 0)
                {
                    mButton1State &= ~(int)PaintFlags.UISTATE_PUSHED;
                    invalidate();
                }
                else if ((mButton2State & (int)PaintFlags.UISTATE_PUSHED) != 0)
                {
                    mButton2State &= ~(int)PaintFlags.UISTATE_PUSHED;
                    invalidate();
                }
                return;
            }
            if (newEvent.mType == (int)EventTypeUI.UIEVENT_MOUSEENTER)
            {
                if (isEnabled())
                {
                    mButton1State |= (int)PaintFlags.UISTATE_HOT;
                    mButton2State |= (int)PaintFlags.UISTATE_HOT;
                    invalidate();
                }
                return;
            }
            if (newEvent.mType == (int)EventTypeUI.UIEVENT_MOUSELEAVE)
            {
                if (isEnabled())
                {
                    mButton1State &= ~(int)PaintFlags.UISTATE_HOT;
                    mButton2State &= ~(int)PaintFlags.UISTATE_HOT;
                    invalidate();
                }
                return;
            }
            if (newEvent.mType == (int)EVENTTYPE_UI.UIEVENT_SCROLLWHEEL)
            {
                ControlUI ctlUI = null;
                if (mWindow != null)
                {
                    closeEditWnd();
                    mManager.setFocus(ref ctlUI);
                }
            }

            if (mOwner != null)
            {
                mOwner.eventProc(ref newEvent);
            }
            else
            {
                base.eventProc(ref newEvent);
            }
        }