diff options
author | Pierre Krieger <pierre.krieger1708@gmail.com> | 2014-07-27 17:06:03 +0200 |
---|---|---|
committer | Pierre Krieger <pierre.krieger1708@gmail.com> | 2014-07-27 17:06:03 +0200 |
commit | 24baf4d10405129d1631efe82ae2f7a0cf18132b (patch) | |
tree | 451f62193a0cab5056a6ac2a966abf5fff822b81 | |
parent | 758fd069c689efbe862302265feb02ccbe399462 (diff) | |
download | glutin-24baf4d10405129d1631efe82ae2f7a0cf18132b.tar.gz glutin-24baf4d10405129d1631efe82ae2f7a0cf18132b.zip |
Add some events
-rw-r--r-- | src/events.rs | 178 | ||||
-rw-r--r-- | src/lib.rs | 2 |
2 files changed, 179 insertions, 1 deletions
diff --git a/src/events.rs b/src/events.rs index f66e6a2..de30895 100644 --- a/src/events.rs +++ b/src/events.rs @@ -10,6 +10,9 @@ pub enum Event { /// The window has been closed. Closed, + /// The window received a unicode character. + ReceivedCharacter(char), + /// The cursor has moved on the window. /// /// The parameter are the (x,y) coords in pixels relative to the top-left corner of the window. @@ -30,4 +33,179 @@ pub enum Event { /// The size of the framebuffer of the window has changed. FramebufferSizeChanged(uint, uint), + + /// An element has been pressed. + Pressed(Element), + + /// An element has been released. + Released(Element), +} + +#[deriving(Show, Clone)] +pub enum Element { + Slider0, + Slider1, + Slider2, + Slider3, + Button0, + Button1, + Button2, + Button3, + Button4, + Button5, + Button6, + Button7, + Button8, + Button9, + Button10, + Button11, + Button12, + Button13, + Button14, + Button15, + Key0, + Key1, + Key2, + Key3, + Key4, + Key5, + Key6, + Key7, + Key8, + Key9, + A, + AbntC1, + AbntC2, + Add, + Apostrophe, + Apps, + At, + Ax, + B, + Back, + Backslash, + C, + Calculator, + Capital, + Colon, + Comma, + Convert, + D, + Decimal, + Delete, + Divide, + Down, + E, + End, + Equals, + Escape, + F, + F1, + F2, + F3, + F4, + F5, + F6, + F7, + F8, + F9, + F10, + F11, + F12, + F13, + F14, + F15, + G, + Grave, + H, + Home, + I, + Insert, + J, + K, + Kana, + Kanji, + L, + LCracket, + LControl, + Left, + LMenu, + LShift, + LWin, + M, + Mail, + MediaSelect, + MediaStop, + Minus, + Multiply, + Mute, + MyComputer, + N, + Next, + NextTrack, + NoConvert, + Numlock, + Numpad0, + Numpad1, + Numpad2, + Numpad3, + Numpad4, + Numpad5, + Numpad6, + Numpad7, + Numpad8, + Numpad9, + NumpadComma, + NumpadEnter, + NumpadEquals, + O, + OEM102, + P, + Pause, + Period, + Playpause, + Power, + Prevtrack, + Prior, + Q, + R, + RBracket, + RControl, + Return, + Right, + RMenu, + RShift, + RWin, + S, + Scroll, + Semicolon, + Slash, + Sleep, + Snapshot, + Space, + Stop, + Subtract, + Sysrq, + T, + Tab, + U, + Underline, + Unlabeled, + Up, + V, + VolumeDown, + VolumeUp, + W, + Wake, + Webback, + WebFavorites, + WebForward, + WebHome, + WebRefresh, + WebSearch, + WebStop, + X, + Y, + Yen, + Z } @@ -2,7 +2,7 @@ extern crate libc; -pub use events::{Event, PositionChanged, SizeChanged, Closed, CursorPositionChanged, Focused}; +pub use events::{Event, Element, PositionChanged, SizeChanged, Closed, CursorPositionChanged, Focused}; pub use events::{Iconified, NeedRefresh, FramebufferSizeChanged}; pub use hints::{Hints, ClientAPI, Profile}; |