-
Notifications
You must be signed in to change notification settings - Fork 23
/
interface.go
33 lines (30 loc) · 1.33 KB
/
interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package load
import (
"gioui.org/io/key"
)
// AppSettingsChangeHandler defines a method that can be implemented by pages and
// modals to watch for real-time changes to the dark mode setting and modify
// widget appearance accordingly.
type AppSettingsChangeHandler interface {
// OnDarkModeChanged is triggered whenever the dark mode setting is changed
// to enable restyling UI elements where necessary.
OnDarkModeChanged(bool)
// OnCurrencyChanged is triggered whenever the currency setting is changed
// to enable app refresh where necessary especially on the main page.
OnCurrencyChanged()
// OnLanguageChanged is triggered whenever the language setting is changed
// to enable UI language update where necessary especially on page Nav
OnLanguageChanged()
}
// KeyEventHandler is implemented by pages and modals that require key event
// notifications.
type KeyEventHandler interface {
// KeysToHandle returns an expression that describes a set of key
// combinations that the implementer of this interface wishes to capture.
// The HandleKeyPress() method will only be called when any of these key
// combinations is pressed.
KeysToHandle() key.Set
// HandleKeyPress is called when one or more keys are pressed on the current
// window that match any of the key combinations returned by KeysToHandle().
HandleKeyPress(*key.Event)
}