-
-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathmodule.go
More file actions
90 lines (76 loc) · 2.91 KB
/
Copy pathmodule.go
File metadata and controls
90 lines (76 loc) · 2.91 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package tyde
import "fyne.io/fyne/v2"
// ModuleMetadata is the information required to describe a module in Tyde.
type ModuleMetadata struct {
Name string
NewInstance func() Module
}
// KeyBindModule marks a module that provides key bindings.
// This is optional but can be enabled for any module by implementing the interface.
type KeyBindModule interface {
Shortcuts() map[*Shortcut]func()
}
// Module marks the required methods of a pluggable module in Tyde.
type Module interface {
Metadata() ModuleMetadata
Destroy()
}
// LaunchSuggestion represents an item that can appear in the app launcher and be actioned on tap
type LaunchSuggestion interface {
Icon() fyne.Resource
Title() string
Launch()
}
// LaunchSuggestionModule is a module that can provide suggestions for the app launcher
type LaunchSuggestionModule interface {
Module
LaunchSuggestions(string) []LaunchSuggestion
}
// StatusAreaModule describes a module that can add items to the status area
// (the bottom of the widget panel)
type StatusAreaModule interface {
Module
StatusAreaWidget() fyne.CanvasObject
}
// ScreenAreaModule describes a module that can draw on the whole screen -
// these items will appear over the background image.
type ScreenAreaModule interface {
Module
ScreenAreaWidget() fyne.CanvasObject
}
// OverlayAreaModule describes a module that can draw over the whole screen
// ABOVE application windows (but below the bar, widget panel, menus and the
// mouse cursor). The returned content must be visual-only (non-interactive)
// so that it does not capture pointer input destined for the windows beneath
// it - decorative overlays such as desktop pets are the intended use.
type OverlayAreaModule interface {
Module
OverlayAreaWidget() fyne.CanvasObject
}
// WindowAccessory is a decorative canvas object drawn at the z-level of a
// particular window, so it is occluded by windows stacked above that one. A nil
// Window means the object is drawn above all windows. The module owns the object
// (it positions and animates it); the compositor only manages its stacking.
type WindowAccessory struct {
Object fyne.CanvasObject
Window Window
}
// WindowAccessoryModule contributes WindowAccessory items that the compositor
// interleaves among the window images - e.g. a desktop pet that walks along a
// window's title bar and disappears behind windows above it. Call
// Desktop.RefreshWindowAccessories when the set or stacking of accessories
// changes so the compositor re-assembles them.
type WindowAccessoryModule interface {
Module
WindowAccessories() []WindowAccessory
}
var modules []ModuleMetadata
// AvailableModules lists all the Tyde modules that were found at runtime.
func AvailableModules() []ModuleMetadata {
return modules
}
// RegisterModule adds a module to the list of available modules.
// New module packages should probably call this in their init().
func RegisterModule(m ModuleMetadata) {
modules = append(modules, m)
}