/// <summary> /// Occurs when mouse button was released.(if WantsMouseEvents = true) /// </summary> /// <param name="args"> MouseClickEventArgs </param> protected virtual void MouseUpEvent(MouseClickEventArgs args) { if (MouseUp != null) { MouseUp(this, args); } }
/// <summary> /// Occurs when mouse button was pressed.(if WantsMouseEvents = true) /// </summary> /// <param name="args"> MouseClickEventArgs </param> protected virtual void MouseDownEvent(MouseClickEventArgs args) { if (MouseDown != null) { MouseDown(this, args); } }
/// <summary> /// MouseDownEvent /// </summary> /// <param name="args">MouseClickEventArgs</param> protected override void MouseDownEvent(Skill.Framework.UI.MouseClickEventArgs args) { // show properties when used select this event if (args.Button == Skill.Framework.UI.MouseButton.Left) { InspectorProperties.Select(this); } base.MouseDownEvent(args); }
/// <summary> /// Occurs when mouse button was pressed.(if WantsMouseEvents = true) /// </summary> /// <param name="args"> MouseClickEventArgs </param> protected override void MouseDownEvent(MouseClickEventArgs args) { if (args.Button == MouseButton.Left) { _IsMouseDown = OwnerFrame.RegisterPrecedenceEvent(this); args.Handled = true; } base.MouseDownEvent(args); }
/// <summary> /// Occurs when mouse button was released.(if WantsMouseEvents = true) /// </summary> /// <param name="args"> MouseClickEventArgs </param> protected override void MouseUpEvent(MouseClickEventArgs args) { if (args.Button == MouseButton.Left) { if (_IsMouseDown) { OwnerFrame.UnregisterPrecedenceEvent(this); } _IsMouseDown = false; args.Handled = true; } base.MouseUpEvent(args); }
public override void HandleEvent(Event e) { if (!IsEnabled) { return; } if (e != null && e.type != EventType.Used) { if (_IsMouseDown) { EventType type = e.type; if (type == EventType.MouseDrag) { MouseButton mb = ConvertButton(e.button); MouseMoveEventArgs args = new MouseMoveEventArgs(e.mousePosition, e.modifiers, mb, e.delta); MouseDragEvent(args); if (args.Handled) { e.Use(); } } else if (type == EventType.mouseDown) { if (!Contains(e.mousePosition)) { if (_IsMouseDown) { OwnerFrame.UnregisterPrecedenceEvent(this); } _IsMouseDown = false; } } else if (type == EventType.MouseUp || e.rawType == EventType.MouseUp) { MouseButton mb = ConvertButton(e.button); MouseClickEventArgs args = new MouseClickEventArgs(e.mousePosition, e.modifiers, mb, e.clickCount); MouseUpEvent(args); if (args.Handled) { e.Use(); } } else { base.HandleEvent(e); } } else { if (WantsMouseEvents) { if (e.isMouse) { EventType type = e.type; Vector2 localMouse = e.mousePosition; if (_RenderAreaWidthOverFlow.Contains(localMouse)) { if (type == EventType.MouseDown) { MouseButton mb = ConvertButton(e.button); if (mb == MouseButton.Left) { MouseClickEventArgs args = new MouseClickEventArgs(e.mousePosition, e.modifiers, mb, e.clickCount); MouseDownEvent(args); if (args.Handled) { e.Use(); } } } } } } base.HandleEvent(e); } } }
protected void BaseHandleEvent(Event e) { if (IsInScrollView && !IsHandlingEventInternal || !IsEnabled) { return; } if (e != null) { if (WantsMouseEvents) { if (e.isMouse) { EventType type = e.type; Vector2 localMouse = e.mousePosition; if (Contains(localMouse)) { if (!IsMouseOver) { IsMouseOver = true; MouseEnterEvent(new MouseEventArgs(e.mousePosition, e.modifiers)); } if (type == EventType.MouseDown || type == EventType.MouseUp) { MouseButton mb = ConvertButton(e.button); MouseClickEventArgs args = new MouseClickEventArgs(e.mousePosition, e.modifiers, mb, e.clickCount); if (type == EventType.MouseDown) { MouseDownEvent(args); } else { MouseUpEvent(args); } if (args.Handled) { e.Use(); } } else if (type == EventType.ScrollWheel || type == EventType.MouseMove || type == EventType.MouseDrag) { MouseButton mb = ConvertButton(e.button); MouseMoveEventArgs args = new MouseMoveEventArgs(e.mousePosition, e.modifiers, mb, e.delta); if (type == EventType.ScrollWheel) { OnScrollWheel(args); } else if (type == EventType.MouseMove) { MouseMoveEvent(args); } else { MouseDragEvent(args); } if (args.Handled) { e.Use(); } } } else { if (IsMouseOver) { IsMouseOver = false; MouseLeaveEvent(new MouseEventArgs(e.mousePosition, e.modifiers)); } } } } if (ContextMenu != null && e.type != EventType.Used && e.type == EventType.ContextClick) { Vector2 localMouse = e.mousePosition; if (Contains(localMouse)) { ContextMenu.Show(this, e.mousePosition); e.Use(); } } } }