pub struct ButtonState { /* private fields */ }
Expand description

The status of the mouse buttons. The least significant bit corresponds to the leftmost mouse button. The next least significant bit corresponds to the rightmost mouse button. The next bit indicates the next-to-leftmost mouse button. The bits then correspond left to right to the mouse buttons. A bit is 1 if the button was pressed.

The state can be one of the following:

Release = 0x0000,
/// The leftmost mouse button.
FromLeft1stButtonPressed = 0x0001,
/// The second button from the left.
FromLeft2ndButtonPressed = 0x0004,
/// The third button from the left.
FromLeft3rdButtonPressed = 0x0008,
/// The fourth button from the left.
FromLeft4thButtonPressed = 0x0010,
/// The rightmost mouse button.
RightmostButtonPressed = 0x0002,
/// This button state is not recognized.
Unknown = 0x0021,
/// The wheel was rotated backward, toward the user; this will only be activated for `MOUSE_WHEELED ` from `dwEventFlags`
Negative = 0x0020,

Ms Docs

Implementations§

source§

impl ButtonState

source

pub fn release_button(&self) -> bool

Get whether no buttons are being pressed.

source

pub fn left_button(&self) -> bool

Returns whether the left button was pressed.

source

pub fn right_button(&self) -> bool

Returns whether the right button was pressed.

source

pub fn middle_button(&self) -> bool

Returns whether the right button was pressed.

source

pub fn scroll_down(&self) -> bool

Returns whether there is a down scroll.

source

pub fn scroll_up(&self) -> bool

Returns whether there is a up scroll.

source

pub fn scroll_right(&self) -> bool

Returns whether there is a horizontal scroll to the right.

source

pub fn scroll_left(&self) -> bool

Returns whether there is a horizontal scroll to the left.

source

pub fn state(&self) -> i32

Returns the raw state.

Trait Implementations§

source§

impl Clone for ButtonState

source§

fn clone(&self) -> ButtonState

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ButtonState

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<u32> for ButtonState

source§

fn from(event: DWORD) -> Self

Converts to this type from the input type.
source§

impl PartialEq<ButtonState> for ButtonState

source§

fn eq(&self, other: &ButtonState) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for ButtonState

source§

impl Eq for ButtonState

source§

impl StructuralEq for ButtonState

source§

impl StructuralPartialEq for ButtonState

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.