mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 15:45:38 +00:00
d2085ab7c5
They're only useful at the top-level event loop in combination with an app.Window. Signed-off-by: Elias Naur <mail@eliasnaur.com>
50 lines
1.1 KiB
Go
50 lines
1.1 KiB
Go
// SPDX-License-Identifier: Unlicense OR MIT
|
|
|
|
package app
|
|
|
|
// DestroyEvent is the last event sent through
|
|
// a window event channel.
|
|
type DestroyEvent struct {
|
|
// Err is nil for normal window closures. If a
|
|
// window is prematurely closed, Err is the cause.
|
|
Err error
|
|
}
|
|
|
|
// A StageEvent is generated whenever the stage of a
|
|
// Window changes.
|
|
type StageEvent struct {
|
|
Stage Stage
|
|
}
|
|
|
|
// Stage of a Window.
|
|
type Stage uint8
|
|
|
|
const (
|
|
// StagePaused is the stage for windows that have no on-screen representation.
|
|
// Paused windows don't receive frames.
|
|
StagePaused Stage = iota
|
|
// StageInactive is the stage for windows that are visible, but not active.
|
|
// Inactive windows receive frames.
|
|
StageInactive
|
|
// StageRunning is for active and visible Windows.
|
|
// Running windows receive frames.
|
|
StageRunning
|
|
)
|
|
|
|
// String implements fmt.Stringer.
|
|
func (l Stage) String() string {
|
|
switch l {
|
|
case StagePaused:
|
|
return "StagePaused"
|
|
case StageInactive:
|
|
return "StageInactive"
|
|
case StageRunning:
|
|
return "StageRunning"
|
|
default:
|
|
panic("unexpected Stage value")
|
|
}
|
|
}
|
|
|
|
func (StageEvent) ImplementsEvent() {}
|
|
func (DestroyEvent) ImplementsEvent() {}
|