Enum winput::Vk[][src]

#[repr(u8)]
pub enum Vk {
Show variants MouseLeft, MouseRight, Cancel, MouseMiddle, MouseX1, MouseX2, Backspace, Tab, Clear, Enter, Shift, Control, Alt, Pause, CapsLock, Kana, ImeOn, Junja, Final, Kanji, ImeOff, Escape, Convert, NonConvert, Accept, ModeChange, Space, PageUp, PageDown, End, Home, LeftArrow, UpArrow, RightArrow, DownArrow, Select, Print, Execute, PrintScreen, Insert, Delete, Help, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, LeftWin, RightWin, Apps, Sleep, Numpad0, Numpad1, Numpad2, Numpad3, Numpad4, Numpad5, Numpad6, Numpad7, Numpad8, Numpad9, Multiply, Add, Separator, Subtract, Decimal, Divide, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, Numlock, Scroll, LeftShift, RightShift, LeftControl, RightControl, LeftMenu, RightMenu, BrowserBack, BrowserForward, BrowserRefresh, BrowserStop, BrowserSearch, BrowserFavorites, BrowserHome, VolumeMute, VolumeDown, VolumeUp, NextTrack, PrevTrack, MediaStop, MediaPlayPause, StartMail, SelectMedia, StartApp1, StartApp2, Oem1, Plus, Comma, Minus, Period, Oem2, Oem3, Oem4, Oem5, Oem6, Oem7, Oem8, Oem102, ImeProcess, Attn, CrSel, ExSel, EraseEof, Play, Zoom, Pa1, OemClear,
}
Expand description

A list of all available Virtual-Key Codes.

The official definition can be found here.

Variants

MouseLeft

Left mouse button

VK_LBUTTON = 0x01

MouseRight

Right mouse button

VK_RBUTTON = 0x02

Cancel

Control-break processing

CANCEL = 0x03

MouseMiddle

Middle mouse button (three-button mouse)

VK_MBUTTON = 0x04

MouseX1

X1 mouse button

VK_XBUTTON1 = 0x05

MouseX2

X2 mouse button

VK_XBUTTON1 = 0x06

Backspace

BACKSPACE key

VK_BACK = 0x08

Tab

TAB key

VK_TAB = 0x09

Clear

CLEAR key

VK_CLEAR = 0x0c

Enter

ENTER key

VK_RETURN = 0x0d

Shift

SHIFT key

VK_SHIFT = 0x10

Control

CTRL key

VK_CONTROL = 0x11

Alt

ALT key

VK_MENU = 0x12

Pause

PAUSE key

VK_PAUSE = 0x13

CapsLock

CAPS LOCK key

VK_CAPITAL = 0x14

Kana

IME Kana mode & IME Hangul mode

VK_KANA = VK_HANGUL = 0x15

ImeOn

IME On

VK_IME_ON = 0x16

Junja

IME Junja mode

VK_JUNJA = 0x17

Final

IME final mode

VK_FINAL = 0x18

Kanji

IME Kanji mode & IME Hanja mode

VK_KANJI = VK_HANJA = 0x19

ImeOff

IME Off

VK_Ime = 0x1a

Escape

ESC key

VK_ESCAPE = 0x1b

Convert

IME convert

VK_CONVERT = 0x1c

NonConvert

IME nonconvert

VK_NONCONVERT = 0x1d

Accept

IME accept

VK_ACCEPT = 0x1e

ModeChange

IME mode change request

VK_MODECHANGE = 0x1f

Space

SPACEBAR

VK_SPACE = 0x20

PageUp

PAGE UP key

VK_PRIOR = 0x21

PageDown

PAGE DOWN key

VK_NEXT = 0x22

End

END key

VK_END = 0x23

Home

HOME key

VK_HOME = 0x24

LeftArrow

LEFT ARROW key

VK_LEFT = 0x25,

UpArrow

UP ARROW key

VK_UP = 0x26

RightArrow

RIGHT ARROW key

VK_RIGHT = 0x27

DownArrow

DOWN ARROW key

VK_DOWN = 0x28

Select

SELECT key

VK_SELECT = 0x29

Print

PRINT key

VK_PRINT = 0x2a

Execute

EXECUTE key

VK_EXECUTE = 0x2b

PrintScreen

PRINT SCREEN key

VK_SNAPSHOT = 0x2c

Insert

INS key

VK_INSERT = 0x2d

Delete

DEL key

VK_DELETE = 0x2e

Help

HELP key

VK_HELP = 0x2f,

_0

0 key

_1

1 key

_2

2 key

_3

3 key

_4

4 key

_5

5 key

_6

6 key

_7

7 key

_8

8 key

_9

9 key

A

A key

B

B key

C

C key

D

D key

E

E key

F

F key

G

G key

H

H key

I

I key

J

J key

K

K key

L

L key

M

M key

N

N key

O

O key

P

P key

Q

Q key

R

R key

S

S key

T

T key

U

U key

V

V key

W

W key

X

X key

Y

Y key

Z

Z key

LeftWin

Left Windows key (Natural keyboard)

VK_LWIN = 0x5b,

RightWin

Right Windows key (Natural keyboard)

VK_RWIN = 0x5c

Apps

Applications key (Natural keyboard)

VK_APPS = 0x5d

Sleep

Computer Sleep key

VK_SLEEP = 0x5f

Numpad0

Numeric keypad 0 key

VK_NUMPAD0 = 0x60

Numpad1

Numeric keypad 1 key

VK_NUMPAD1 = 0x61

Numpad2

Numeric keypad 2 key

VK_NUMPAD2 = 0x62

Numpad3

Numeric keypad 3 key

VK_NUMPAD3 = 0x63

Numpad4

Numeric keypad 4 key

VK_NUMPAD4 = 0x64

Numpad5

Numeric keypad 5 key

VK_NUMPAD5 = 0x65

Numpad6

Numeric keypad 6 key

VK_NUMPAD6 = 0x66

Numpad7

Numeric keypad 7 key

VK_NUMPAD7 = 0x67

Numpad8

Numeric keyapd 8 key

VK_NUMPAD8 = 0x68

Numpad9

Numeric keypad 9 key

VK_NUMPAD9 = 0x69

Multiply

Multiply key

VK_MULTIPLY = 0x6a

Add

Add key

VK_ADD = 0x6b,

Separator

Separator key

VK_SEPARATOR = 0x6c,

Subtract

Subtract key

VK_SUBTRACT = 0x6d

Decimal

Decimal key

VK_DECIMAL = 0x6e

Divide

Divide key

VK_DIVIDE = 0x6f

F1

F1 key

VK_F1 = 0x70

F2

F2 key

VK_F2 = 0x71

F3

F3 key

VK_F3 = 0x72

F4

F4 key

VK_F4 = 0x73

F5

F5 key

VK_F5 = 0x74

F6

F6 key

VK_F6 = 0x75

F7

F7 key

VK_F7 = 0x76

F8

F8 key

VK_F8 = 0x77,

F9

F9 key

VK_F9 = 0x78,

F10

F10 key

VK_F10 = 0x79,

F11

F11 key

VK_F11 = 0x7a

F12

F12 key

VK_F12 = 0x7b

F13

F13 key

VK_F13 = 0x7c

F14

F14 key

VK_F14 = 0x7d

F15

F15 key

VK_F15 = 0x7e

F16

F16 key

VK_F16 = 0x7f

F17

F17 key

VK_F17 = 0x80

F18

F18 key

VK_F18 = 0x81,

F19

F19 key

VK_F19 = 0x82,

F20

F20 key

VK_F20 = 0x83,

F21

F21 key

VK_F21 = 0x84,

F22

F22 key

VK_F22 = 0x85,

F23

F23 key

VK_F23 = 0x86,

F24

F24 key

VK_F24 = 0x87,

Numlock

NUM LOCK key

VK_NUMLOCK = 0x90

Scroll

SCROLL LOCK key

VK_SCROLL = 0x91

LeftShift

Left SHIFT key

VK_LSHIFT = 0xa0

RightShift

Right SHIFT key

VK_RSHIFT = 0xa1

LeftControl

Left CONTROL key

VK_LCONTROL = 0xa2

RightControl

Right CONTROL key

VK_RCONTROL = 0xa3

LeftMenu

Left MENU key

VK_LMENU = 0xa4

RightMenu

Right MENU key

VK_RMENU = 0xa5

BrowserBack

Browser Back key

VK_BROWSER_BACK = 0xa6

BrowserForward

Browser Forward key

VK_BROWSER_FORWARD = 0xa7

BrowserRefresh

Browser Refresh key

VK_BROWSER_REFRESH = 0xa8

BrowserStop

Browser Stop key

VK_BROWSER_STOP = 0xa9

BrowserSearch

Browser Search key

VK_BROWSER_SEARCH = 0xaa

BrowserFavorites

Browser Favorites key

VK_BROWSER_FAVORITES = 0xab

BrowserHome

Browser Start and Home key

VK_BROWSER_HOME = 0xac

VolumeMute

Volume Mute key

VK_VOLUME_MUTE = 0xad

VolumeDown

Volume Down key

VK_VOLUME_DOWN = 0xae

VolumeUp

Volume Up key

VK_VOLUME_UP = 0xaf

NextTrack

Next Track key

VK_MEDIA_NEXT_TRACK = 0xb0

PrevTrack

Prev Track key

VK_MEDIA_PREV_TRACK = 0xb1

MediaStop

Stop Media key

VK_MEDIA_STOP = 0xb2

MediaPlayPause

Play/Pause Media key

VK_MEDIA_PLAY_PAUSE = 0xb3

StartMail

Start Mail key

VK_LAUNCH_MAIL = 0xb4

SelectMedia

Select Media key

VK_LAUNCH_MEDIA_SELECT = 0xb5

StartApp1

Start Application 1 key

VK_LAUNCH_APP1 = 0xb6

StartApp2

Start Application 2 key

VK_LAUNCH_APP2 = 0xb7

Oem1

Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the ;: key.

VK_OEM_1 = 0xba

Plus

For any country/region, the + key.

VK_OEM_PLUS = 0xbb

Comma

For any country/region, the , key.

VK_OEM_COMMA = 0xbc

Minus

For any country/region, the - key.

VK_OEM_MINUS = 0xbd

Period

For any country/region, the . key.

VK_OEM_PERIOD = 0xbe

Oem2

Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the \? key.

VK_OEM_2 = 0xbf

Oem3

Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the ``~` key.

VK_OEM_3 = 0xc0

Oem4

Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the [{ key.

VK_OEM_4 = 0xdb

Oem5

Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the \| key.

VK_OEM_5 = 0xdc

Oem6

Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the ]} key.

VK_OEM_6 = 0xdd

Oem7

Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '" key.

VK_OEM_7 = 0xde

Oem8

Used for miscellaneous characters; it can vary by keyboard.

VK_OEM_8 = 0xdd

Oem102

Either the angle bracket key or the backslash key on the RT 102-key keyboard.

VK_OEM_102 = 0xe2

ImeProcess

IME PROCESS key

VK_PROCESSKEY = 0xe5

Attn

Attn key

VK_ATTN = 0xf6

CrSel

CrSel key

VK_CRSEL = 0xf7

ExSel

ExSel key

VK_EXSEL = 0xf8

EraseEof

Erase EOF key

VK_EREOR = 0xf9

Play

Play key

VK_PLAY = 0xfa

Zoom

Zoom key

VK_ZOOM = 0xfb

Pa1

PA1 key

VK_PA1 = 0xfd

OemClear

Clear key

VK_OEM_CLEAR = 0xfe

Implementations

Creates a Virtual-Key Code from the given u8.

Safety

This function is safe as long as the given number n is a valid Virtual-Key Code. Providing a invalid number is undefined behaviour.

Example

use winput::Vk;

// SAFETY: `0x0d` is a valid Virtual-Key Code.
let vk = unsafe { Vk::from_u8(0x0d) };
assert_eq!(vk, Vk::Enter);

A safe way to use this function is to convert a Virtual-Key Code into a number.

use winput::Vk;

let n = Vk::Escape.into_u8();

// SAFETY: `n` is a valid Virtual-Key Code.
let vk = unsafe { Vk::from_u8(n) };
assert_eq!(vk, Vk::Escape);

Converts this Virtual-Key Code into a u8.

Example

use winput::Vk;

let value = Vk::Enter.into_u8();
assert_eq!(value, 0x0d);

Checks if this Virtual-Key Code is currently being pressed.

Example

use winput::Vk;

if Vk::Z.is_down() {
    println!("The Z key is down!");
} else {
    println!("The Z key is not down :(");
}

Checks if the given key is currently toggled.

For example, the Vk::CapsLock can be either on or off (appart from being down or up).

Example

use winput::Vk;

if Vk::CapsLock.is_toggled() {
    println!("Do you like writing in all caps?");
} else {
    println!("I knew it! No one ever uses this key!");
}

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

Produces an Input that causes the given action to be taken on self. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.