56 lines
1.6 KiB
Go
56 lines
1.6 KiB
Go
package ui
|
|
|
|
import "fyne.io/fyne/v2"
|
|
|
|
// WindowEventName defines common names for event occurring in the gui system
|
|
type WindowEventName string
|
|
|
|
const (
|
|
LoadScreen WindowEventName = "LoadScreen"
|
|
Initialize WindowEventName = "Initialize"
|
|
Refresh WindowEventName = "Refresh"
|
|
OnShow WindowEventName = "OnShow"
|
|
OnHide WindowEventName = "OnHide"
|
|
OnClose WindowEventName = "OnClose"
|
|
OnTabSelected WindowEventName = "OnTabSelected"
|
|
OnTabUnselected WindowEventName = "OnTabUnselected"
|
|
)
|
|
|
|
// View interface represents a generic gui view.
|
|
// This can be:
|
|
// - A full main view
|
|
// - A subview of another view
|
|
// - A dialog
|
|
type View interface {
|
|
// ID of the view
|
|
// Each view implementation should create a unique ID automatically
|
|
ID() string
|
|
|
|
// SetID allows the user to specify the ID of the view
|
|
SetID(string)
|
|
|
|
// Checs equality of two views by comparing their id.
|
|
Equals(View) bool
|
|
|
|
// Title returns the title of the view
|
|
// The title is displayed in the main bar for root views, or in the tabs of
|
|
// views that are childeren of a tabview
|
|
Title() string
|
|
|
|
// Initializes the view
|
|
// An implementation should completely configure the view including the UI,
|
|
// controller state etc.
|
|
Initialize() fyne.CanvasObject
|
|
|
|
// Refresh is called when the view needs a full update
|
|
// The implementation should decide what to refresh on the view and wether
|
|
// it nees to refresh the controller or not
|
|
Refresh()
|
|
|
|
// OnShow is called when the view becomes visible on the screen
|
|
OnShow()
|
|
|
|
// OnHide is called when the view is removed from the screen
|
|
OnHide()
|
|
}
|