/// <summary> /// Converts <see cref="MouseEventArgs" /> to <see cref="OxyMouseEventArgs" /> for a mouse event. /// </summary> /// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param> /// <param name="modifiers">The modifiers.</param> /// <returns>A <see cref="OxyMouseEventArgs" /> containing the converted event arguments.</returns> public static OxyMouseEventArgs ToMouseEventArgs(this EventArgs e, OxyModifierKeys modifiers) { return(new OxyMouseEventArgs { ModifierKeys = modifiers }); }
/// <summary> /// Converts <see cref="MouseEventArgs" /> to <see cref="OxyMouseEventArgs" /> for a mouse event. /// </summary> /// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param> /// <param name="modifiers">The modifiers.</param> /// <returns>A <see cref="OxyMouseEventArgs" /> containing the converted event arguments.</returns> public static OxyMouseEventArgs ToMouseEventArgs(this MouseEventArgs e, OxyModifierKeys modifiers) { return(new OxyMouseEventArgs { Position = e.Location.ToScreenPoint(), ModifierKeys = modifiers }); }
/// <summary> /// Converts <see cref="SciterXBehaviors.MOUSE_PARAMS" /> to <see cref="OxyMouseEventArgs" /> for a mouse down event. /// </summary> /// <param name="e">The <see cref="SciterXBehaviors.MOUSE_PARAMS" /> instance containing the event data.</param> /// <param name="modifiers">The modifiers.</param> /// <returns>A <see cref="OxyMouseDownEventArgs" /> containing the converted event arguments.</returns> /*public static OxyMouseDownEventArgs ToMouseDownEventArgs(this SciterXBehaviors.MOUSE_PARAMS e, OxyModifierKeys modifiers) * { * return new OxyMouseDownEventArgs * { * ChangedButton = OxyMouseButton., * ClickCount = e.Clicks, * Position = e.Location.ToScreenPoint(), * ModifierKeys = modifiers * }; * }*/ public static OxyModifierKeys GetModifiers(this SciterXBehaviors.KEYBOARD_STATES state) { OxyModifierKeys modifier = OxyModifierKeys.None; if ((state & SciterXBehaviors.KEYBOARD_STATES.SHIFT_KEY_PRESSED) == SciterXBehaviors.KEYBOARD_STATES.SHIFT_KEY_PRESSED) { modifier |= OxyModifierKeys.Shift; } if ((state & SciterXBehaviors.KEYBOARD_STATES.CONTROL_KEY_PRESSED) == SciterXBehaviors.KEYBOARD_STATES.CONTROL_KEY_PRESSED) { modifier |= OxyModifierKeys.Control; } if ((state & SciterXBehaviors.KEYBOARD_STATES.ALT_KEY_PRESSED) == SciterXBehaviors.KEYBOARD_STATES.ALT_KEY_PRESSED) { modifier |= OxyModifierKeys.Alt; } return(modifier); }
/// <summary> /// Initializes a new instance of the <see cref="InputCommandBinding" /> class by a key gesture. /// </summary> /// <param name="key">The key.</param> /// <param name="modifiers">The modifiers.</param> /// <param name="command">The command.</param> public InputCommandBinding(OxyKey key, OxyModifierKeys modifiers, IViewCommand command) : this(new OxyKeyGesture(key, modifiers), command) { }
/// <summary> /// Converts <see cref="MouseEventArgs" /> to <see cref="OxyMouseEventArgs" /> for a mouse event. /// </summary> /// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param> /// <param name="modifiers">The modifiers.</param> /// <returns>A <see cref="OxyMouseEventArgs" /> containing the converted event arguments.</returns> public static OxyMouseEventArgs ToMouseEventArgs(this MouseEventArgs e, OxyModifierKeys modifiers) { return new OxyMouseEventArgs { Position = e.Location.ToScreenPoint(), ModifierKeys = modifiers }; }
/// <summary> /// Binds the specified modifiers+mouse button+click count gesture to the specified command. /// </summary> /// <param name="controller">The plot controller.</param> /// <param name="mouseButton">The mouse button.</param> /// <param name="modifiers">The modifiers.</param> /// <param name="clickCount">The click count.</param> /// <param name="command">A plot controller command that takes mouse event arguments.</param> public static void BindMouseDown(this IController controller, OxyMouseButton mouseButton, OxyModifierKeys modifiers, int clickCount, IViewCommand <OxyMouseDownEventArgs> command) { controller.Bind(new OxyMouseDownGesture(mouseButton, modifiers, clickCount), command); }
/// <summary> /// Unbinds the specified key down gesture. /// </summary> /// <param name="controller">The controller.</param> /// <param name="key">The key.</param> /// <param name="modifiers">The modifier keys.</param> public static void UnbindKeyDown(this IController controller, OxyKey key, OxyModifierKeys modifiers = OxyModifierKeys.None) { controller.Unbind(new OxyKeyGesture(key, modifiers)); }
/// <summary> /// Binds the modifier+mouse wheel event to the specified command. /// </summary> /// <param name="controller">The plot controller.</param> /// <param name="modifiers">The modifier key(s).</param> /// <param name="command">A plot controller command that takes mouse wheel event arguments.</param> public static void BindMouseWheel(this IController controller, OxyModifierKeys modifiers, IViewCommand <OxyMouseWheelEventArgs> command) { controller.Bind(new OxyMouseWheelGesture(modifiers), command); }
/// <summary> /// Converts <see cref="MouseEventArgs" /> to <see cref="OxyMouseEventArgs" /> for a mouse down event. /// </summary> /// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param> /// <param name="modifiers">The modifiers.</param> /// <returns>A <see cref="OxyMouseDownEventArgs" /> containing the converted event arguments.</returns> public static OxyMouseDownEventArgs ToMouseDownEventArgs(this MouseEventArgs e, OxyModifierKeys modifiers) { return(new OxyMouseDownEventArgs { ChangedButton = e.Button.Convert(), ClickCount = e.Clicks, Position = e.Location.ToScreenPoint(), ModifierKeys = modifiers }); }
/// <summary> /// Initializes a new instance of the <see cref="OxyMouseDownGesture" /> class. /// </summary> /// <param name="mouseButton">The mouse button.</param> /// <param name="modifiers">The modifiers.</param> /// <param name="clickCount">The click count.</param> public OxyMouseDownGesture(OxyMouseButton mouseButton, OxyModifierKeys modifiers = OxyModifierKeys.None, int clickCount = 1) { this.MouseButton = mouseButton; this.Modifiers = modifiers; this.ClickCount = clickCount; }
/// <summary> /// Initializes a new instance of the <see cref="OxyMouseEnterGesture" /> class. /// </summary> /// <param name="modifiers">The modifiers.</param> public OxyMouseEnterGesture(OxyModifierKeys modifiers = OxyModifierKeys.None) { this.Modifiers = modifiers; }
/// <summary> /// Initializes a new instance of the <see cref="InputCommandBinding" /> class by a mouse gesture. /// </summary> /// <param name="mouseButton">The mouse button.</param> /// <param name="modifiers">The modifiers.</param> /// <param name="command">The command.</param> public InputCommandBinding(OxyMouseButton mouseButton, OxyModifierKeys modifiers, IViewCommand command) : this(new OxyMouseDownGesture(mouseButton, modifiers), command) { }
/// <summary> /// Initializes a new instance of the <see cref="OxyMouseWheelGesture" /> class. /// </summary> /// <param name="modifiers">The modifiers.</param> public OxyMouseWheelGesture(OxyModifierKeys modifiers = OxyModifierKeys.None) { this.Modifiers = modifiers; }
/// <summary> /// Initializes a new instance of the <see cref="OxyKeyGesture" /> class. /// </summary> /// <param name="key">The key.</param> /// <param name="modifiers">The modifier keys.</param> public OxyKeyGesture(OxyKey key, OxyModifierKeys modifiers = OxyModifierKeys.None) { this.Key = key; this.Modifiers = modifiers; }
/// <summary> /// Binds the modifier+mouse wheel event to the specified command. /// </summary> /// <param name="controller">The plot controller.</param> /// <param name="modifiers">The modifier key(s).</param> /// <param name="command">A plot controller command that takes mouse wheel event arguments.</param> public static void BindMouseWheel(this IController controller, OxyModifierKeys modifiers, IViewCommand<OxyMouseWheelEventArgs> command) { controller.Bind(new OxyMouseWheelGesture(modifiers), command); }
/// <summary> /// Unbinds the specified mouse down gesture. /// </summary> /// <param name="controller">The controller.</param> /// <param name="mouseButton">The mouse button.</param> /// <param name="modifiers">The modifier keys.</param> /// <param name="clickCount">The click count.</param> public static void UnbindMouseDown(this IController controller, OxyMouseButton mouseButton, OxyModifierKeys modifiers = OxyModifierKeys.None, int clickCount = 1) { controller.Unbind(new OxyMouseDownGesture(mouseButton, modifiers, clickCount)); }
/// <summary> /// Binds the specified modifier+key to the specified command. /// </summary> /// <param name="controller">The plot controller.</param> /// <param name="key">The key.</param> /// <param name="modifiers">The key modifiers.</param> /// <param name="command">A plot controller command that takes key event arguments.</param> public static void BindKeyDown(this IController controller, OxyKey key, OxyModifierKeys modifiers, IViewCommand<OxyKeyEventArgs> command) { controller.Bind(new OxyKeyGesture(key, modifiers), command); }
/// <summary> /// Binds the specified modifiers+mouse button+click count gesture to the specified command. /// </summary> /// <param name="controller">The plot controller.</param> /// <param name="mouseButton">The mouse button.</param> /// <param name="modifiers">The modifiers.</param> /// <param name="clickCount">The click count.</param> /// <param name="command">A plot controller command that takes mouse event arguments.</param> public static void BindMouseDown(this IController controller, OxyMouseButton mouseButton, OxyModifierKeys modifiers, int clickCount, IViewCommand<OxyMouseDownEventArgs> command) { controller.Bind(new OxyMouseDownGesture(mouseButton, modifiers, clickCount), command); }
/// <summary> /// Binds the specified modifier+key to the specified command. /// </summary> /// <param name="controller">The plot controller.</param> /// <param name="key">The key.</param> /// <param name="modifiers">The key modifiers.</param> /// <param name="command">A plot controller command that takes key event arguments.</param> public static void BindKeyDown(this IController controller, OxyKey key, OxyModifierKeys modifiers, IViewCommand <OxyKeyEventArgs> command) { controller.Bind(new OxyKeyGesture(key, modifiers), command); }
/// <summary> /// Converts <see cref="MouseEventArgs" /> to <see cref="OxyMouseEventArgs" /> for a mouse down event. /// </summary> /// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param> /// <param name="modifiers">The modifiers.</param> /// <returns>A <see cref="OxyMouseDownEventArgs" /> containing the converted event arguments.</returns> public static OxyMouseDownEventArgs ToMouseDownEventArgs(this MouseEventArgs e, OxyModifierKeys modifiers) { return new OxyMouseDownEventArgs { ChangedButton = e.Button.Convert(), ClickCount = e.Clicks, Position = e.Location.ToScreenPoint(), ModifierKeys = modifiers }; }
/// <summary> /// Converts <see cref="MouseEventArgs" /> to <see cref="OxyMouseEventArgs" /> for a mouse event. /// </summary> /// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param> /// <param name="modifiers">The modifiers.</param> /// <returns>A <see cref="OxyMouseEventArgs" /> containing the converted event arguments.</returns> public static OxyMouseEventArgs ToMouseEventArgs(this EventArgs e, OxyModifierKeys modifiers) { return new OxyMouseEventArgs { ModifierKeys = modifiers }; }