Exemple #1
0
        static bool MouseEvent(BubbleEventArgs be, Action <Control, MouseEventArgs> action, bool?capture, Func <MouseButtons, MouseButtons> modifyButtons = null)
        {
            var modifiers = swf.Control.ModifierKeys.ToEto();
            var delta     = new SizeF(0, Win32.GetWheelDeltaWParam(be.Message.WParam) / Conversions.WheelDelta);
            var buttons   = Win32.GetMouseButtonWParam(be.Message.WParam).ToEto();

            if (modifyButtons != null)
            {
                buttons = modifyButtons(buttons);
            }
            var handler       = be.WindowsControl;
            var mousePosition = swf.Control.MousePosition.ToEto();
            var ret           = false;

            foreach (var control in be.Controls)
            {
                var me = new MouseEventArgs(buttons, modifiers, control.PointFromScreen(mousePosition), delta);
                action(control, me);
                if (me.Handled)
                {
                    ret = true;
                    break;
                }
            }
            if (capture != null && ret || (handler != null && handler.ShouldCaptureMouse))
            {
                //be.WinControl.Capture = capture.Value;
            }
            return(ret);
        }
Exemple #2
0
        public bool PreFilterMessage(ref swf.Message message)
        {
            BubbleEvent bubble;

            if (messages.TryGetValue(message.Msg, out bubble))
            {
                var child = swf.Control.FromHandle(message.HWnd);

                if (child != null)
                {
                    var args = new BubbleEventArgs(message, child);
                    if (bubble.HandleEvent(args))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Exemple #3
0
        static bool KeyCharEvent(BubbleEventArgs be, Action <Control, KeyEventArgs> action, KeyEventType keyEventType)
        {
            Keys keyData = Keys.None;

            char keyChar = (char)((long)be.Message.WParam);
            var  kevt    = new KeyEventArgs(keyData, keyEventType, keyChar);

            if (be.Control != null)
            {
                action(be.Control, kevt);
            }
            if (!kevt.Handled && !IsInputChar(be.Message.HWnd, keyChar))
            {
                foreach (var control in be.Parents)
                {
                    action(control, kevt);
                    if (kevt.Handled)
                    {
                        break;
                    }
                }
            }
            return(kevt.Handled);
        }
Exemple #4
0
        static bool KeyEvent(BubbleEventArgs be, Action <Control, KeyEventArgs> action, KeyEventType keyEventType)
        {
            Keys keyData = ((swf.Keys)(long) be.Message.WParam | swf.Control.ModifierKeys).ToEto();

            char?keyChar = null;
            var  kevt    = new KeyEventArgs(keyData, keyEventType, keyChar);

            if (be.Control != null)
            {
                action(be.Control, kevt);
            }
            if (!kevt.Handled && (keyEventType != KeyEventType.KeyDown || !IsInputKey(be.Message.HWnd, keyData)))
            {
                foreach (var control in be.Parents)
                {
                    action(control, kevt);
                    if (kevt.Handled)
                    {
                        break;
                    }
                }
            }
            return(kevt.Handled);
        }
		public bool PreFilterMessage(ref swf.Message message)
		{
			BubbleEvent bubble;
			if (messages.TryGetValue(message.Msg, out bubble))
			{
				var child = swf.Control.FromHandle(message.HWnd);

				if (child != null)
				{
					var args = new BubbleEventArgs(message, child);
					if (bubble.HandleEvent(args))
						return true;
				}
			}
			return false;
		}
		static bool KeyCharEvent(BubbleEventArgs be, Action<Control, KeyEventArgs> action, KeyEventType keyEventType)
		{
			Keys keyData = Keys.None;

			char keyChar = (char)((long)be.Message.WParam);
			var kevt = new KeyEventArgs(keyData, keyEventType, keyChar);
			if (be.Control != null)
				action(be.Control, kevt);
			if (!kevt.Handled && !IsInputChar(be.Message.HWnd, keyChar))
			{
				foreach (var control in be.Parents)
				{
					action(control, kevt);
					if (kevt.Handled)
						break;
				}
			}
			return kevt.Handled;
		}
		static bool KeyEvent(BubbleEventArgs be, Action<Control, KeyEventArgs> action, KeyEventType keyEventType)
		{
			Keys keyData = ((swf.Keys)(long)be.Message.WParam | swf.Control.ModifierKeys).ToEto();
			
			char? keyChar = null;
			var kevt = new KeyEventArgs(keyData, keyEventType, keyChar);
			if (be.Control != null)
				action(be.Control, kevt);
			if (!kevt.Handled && (keyEventType != KeyEventType.KeyDown || !IsInputKey(be.Message.HWnd, keyData)))
			{
				foreach (var control in be.Parents)
				{
					action(control, kevt);
					if (kevt.Handled)
						break;
				}
			}
			return kevt.Handled;
		}
		static bool MouseEvent(BubbleEventArgs be, Action<Control, MouseEventArgs> action, bool? capture, Func<MouseButtons, MouseButtons> modifyButtons = null)
		{
			var modifiers = swf.Control.ModifierKeys.ToEto();
			var delta = new SizeF(0, Win32.GetWheelDeltaWParam(be.Message.WParam) / Conversions.WheelDelta);
			var buttons = Win32.GetMouseButtonWParam(be.Message.WParam).ToEto();
			if (modifyButtons != null)
				buttons = modifyButtons(buttons);
			var handler = be.WindowsControl;
			var mousePosition = swf.Control.MousePosition.ToEto();
			var ret = false;
			foreach (var control in be.Controls)
			{
				var me = new MouseEventArgs(buttons, modifiers, control.PointFromScreen(mousePosition), delta);
				action(control, me);
				if (me.Handled)
				{
					ret = true;
					break;
				}
			}
			if (capture != null && ret || (handler != null && handler.ShouldCaptureMouse))
			{
				//be.WinControl.Capture = capture.Value;
			}
			return ret;
		}