-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add keyboard handling code and refactor input handlers
Canvas gets the keyboard handler (top level) CanvasObjects can now be clickable Buttons refactored to be 'tappable' as the high level API should not care about event types
- Loading branch information
1 parent
5853f6b
commit f78d89c
Showing
6 changed files
with
52 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package ui | ||
|
||
import "github.com/fyne-io/fyne/ui/input" | ||
|
||
// KeyEvent describes a keyboard input event. | ||
type KeyEvent struct { | ||
String string | ||
|
||
Name string | ||
Code input.KeyCode | ||
Modifiers input.Modifier | ||
} | ||
|
||
// MouseEvent describes a pointer input event. The position is relative to the top-left | ||
// of the CanvasObject this is triggered on. | ||
type MouseEvent struct { | ||
Position Position // The position of the event | ||
Button input.MouseButton // The mouse button which caused the event | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package input | ||
|
||
// KeyCode represents the numeric code of a key pressed without modifiers | ||
type KeyCode int | ||
|
||
// Modifier captures any key modifiers (shift etc) pressed during this key event | ||
type Modifier int | ||
|
||
const ( | ||
ShiftModifier Modifier = 1 << iota | ||
ControlModifier | ||
AltModifier | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters