diff --git a/WindowsInput/IMouseSimulator.cs b/WindowsInput/IMouseSimulator.cs index 7cce7b7..8e98404 100644 --- a/WindowsInput/IMouseSimulator.cs +++ b/WindowsInput/IMouseSimulator.cs @@ -54,6 +54,26 @@ public interface IMouseSimulator /// IMouseSimulator LeftButtonDoubleClick(); + /// + /// Simulates a mouse middle button down gesture. + /// + IMouseSimulator MiddleButtonDown(); + + /// + /// Simulates a mouse middle button up gesture. + /// + IMouseSimulator MiddleButtonUp(); + + /// + /// Simulates a mouse middle button click gesture. + /// + IMouseSimulator MiddleButtonClick(); + + /// + /// Simulates a mouse middle button double-click gesture. + /// + IMouseSimulator MiddleButtonDoubleClick(); + /// /// Simulates a mouse right button down gesture. /// @@ -104,12 +124,24 @@ public interface IMouseSimulator /// The amount to scroll in clicks. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user. IMouseSimulator VerticalScroll(int scrollAmountInClicks); + /// + /// Simulates mouse vertical wheel scroll gesture. + /// + /// The absolute amount to scroll. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user. + IMouseSimulator VerticalScrollAbsolute(int scrollAmount); + /// /// Simulates a mouse horizontal wheel scroll gesture. Supported by Windows Vista and later. /// /// The amount to scroll in clicks. A positive value indicates that the wheel was rotated to the right; a negative value indicates that the wheel was rotated to the left. IMouseSimulator HorizontalScroll(int scrollAmountInClicks); + /// + /// Simulates a mouse horizontal wheel scroll gesture. Supported by Windows Vista and later. + /// + /// The absolute amount to scroll. A positive value indicates that the wheel was rotated to the right; a negative value indicates that the wheel was rotated to the left. + IMouseSimulator HorizontalScrollAbsolute(int scrollAmount); + /// /// Sleeps the executing thread to create a pause between simulated inputs. /// diff --git a/WindowsInput/MouseSimulator.cs b/WindowsInput/MouseSimulator.cs index 9873076..a7f209c 100644 --- a/WindowsInput/MouseSimulator.cs +++ b/WindowsInput/MouseSimulator.cs @@ -141,6 +141,46 @@ public IMouseSimulator LeftButtonDoubleClick() return this; } + /// + /// Simulates a mouse middle button down gesture. + /// + public IMouseSimulator MiddleButtonDown() + { + var inputList = new InputBuilder().AddMouseButtonDown(MouseButton.MiddleButton).ToArray(); + SendSimulatedInput(inputList); + return this; + } + + /// + /// Simulates a mouse middle button up gesture. + /// + public IMouseSimulator MiddleButtonUp() + { + var inputList = new InputBuilder().AddMouseButtonUp(MouseButton.MiddleButton).ToArray(); + SendSimulatedInput(inputList); + return this; + } + + /// + /// Simulates a mouse middle-click gesture. + /// + public IMouseSimulator MiddleButtonClick() + { + var inputList = new InputBuilder().AddMouseButtonClick(MouseButton.MiddleButton).ToArray(); + SendSimulatedInput(inputList); + return this; + } + + /// + /// Simulates a mouse middle button double-click gesture. + /// + public IMouseSimulator MiddleButtonDoubleClick() + { + var inputList = new InputBuilder().AddMouseButtonDoubleClick(MouseButton.MiddleButton).ToArray(); + SendSimulatedInput(inputList); + return this; + } + /// /// Simulates a mouse right button down gesture. /// @@ -231,7 +271,16 @@ public IMouseSimulator XButtonDoubleClick(int buttonId) /// The amount to scroll in clicks. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user. public IMouseSimulator VerticalScroll(int scrollAmountInClicks) { - var inputList = new InputBuilder().AddMouseVerticalWheelScroll(scrollAmountInClicks * MouseWheelClickSize).ToArray(); + return VerticalScrollAbsolute(scrollAmountInClicks * MouseWheelClickSize); + } + + /// + /// Simulates mouse vertical wheel scroll gesture. + /// + /// The absolute amount to scroll. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user. + public IMouseSimulator VerticalScrollAbsolute(int scrollAmount) + { + var inputList = new InputBuilder().AddMouseVerticalWheelScroll(scrollAmount).ToArray(); SendSimulatedInput(inputList); return this; } @@ -242,7 +291,16 @@ public IMouseSimulator VerticalScroll(int scrollAmountInClicks) /// The amount to scroll in clicks. A positive value indicates that the wheel was rotated to the right; a negative value indicates that the wheel was rotated to the left. public IMouseSimulator HorizontalScroll(int scrollAmountInClicks) { - var inputList = new InputBuilder().AddMouseHorizontalWheelScroll(scrollAmountInClicks * MouseWheelClickSize).ToArray(); + return HorizontalScrollAbsolute(scrollAmountInClicks * MouseWheelClickSize); + } + + /// + /// Simulates a mouse horizontal wheel scroll gesture. Supported by Windows Vista and later. + /// + /// The absolute amount to scroll. A positive value indicates that the wheel was rotated to the right; a negative value indicates that the wheel was rotated to the left. + public IMouseSimulator HorizontalScrollAbsolute(int scrollAmount) + { + var inputList = new InputBuilder().AddMouseHorizontalWheelScroll(scrollAmount).ToArray(); SendSimulatedInput(inputList); return this; } diff --git a/WindowsInput/Properties/AssemblyInfo.cs b/WindowsInput/Properties/AssemblyInfo.cs index 4871bf0..2b938ea 100644 --- a/WindowsInput/Properties/AssemblyInfo.cs +++ b/WindowsInput/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.2.0.0")] -[assembly: AssemblyFileVersion("0.2.0.0")] +[assembly: AssemblyVersion("1.0.4.1")] +[assembly: AssemblyFileVersion("1.0.4.1")]