gg: keep/update commonly used event state inside the gg.Context

This commit is contained in:
Delyan Angelov 2021-06-24 11:02:04 +03:00
parent 83eb9d5d07
commit cc91d9bee3
No known key found for this signature in database
GPG key ID: 66886C0F12D595ED
2 changed files with 147 additions and 63 deletions

View file

@ -2,6 +2,38 @@
// Use of this source code is governed by an MIT license that can be found in the LICENSE file.
module gg
pub enum MouseButton {
left = 0
right = 1
middle = 2
invalid = 256
}
// NB: unlike the MouseButton enum from above,
// the [flag]-ed enum here can have combined states,
// representing several pressed buttons at once.
[flag]
pub enum MouseButtons {
left
right
middle
}
[flag]
pub enum Modifier {
shift // (1<<0)
ctrl // (1<<1)
alt // (1<<2)
super // (1<<3)
}
pub enum PenLineType {
solid
dashed
dotted
}
pub enum KeyCode {
invalid = 0
space = 32
@ -126,9 +158,4 @@ pub enum KeyCode {
menu = 348
}
pub enum MouseButton {
left = 0
right = 1
middle = 2
invalid = 256
}
const key_code_max = 512