2025-02-03 15:41:15 +00:00
|
|
|
package shared
|
2025-02-03 07:22:01 +00:00
|
|
|
|
|
|
|
import (
|
2025-02-03 15:41:15 +00:00
|
|
|
"sync"
|
|
|
|
|
2025-02-03 07:22:01 +00:00
|
|
|
"gioui.org/io/event"
|
|
|
|
)
|
|
|
|
|
|
|
|
type WindowState interface {
|
|
|
|
Run(globalState *GlobalState, event event.Event) NewState
|
2025-02-03 15:41:15 +00:00
|
|
|
Exit(globalState *GlobalState, wg *sync.WaitGroup)
|
2025-02-03 07:22:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type NewState struct {
|
|
|
|
// If null, keep current state
|
|
|
|
NextState WindowState
|
|
|
|
Error error
|
2025-02-03 15:41:15 +00:00
|
|
|
ExitCode error
|
2025-02-03 07:22:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func EmptyEvent() NewState {
|
|
|
|
return NewState{}
|
|
|
|
}
|