2026-03-13 14:51:33 +00:00
|
|
|
package contextmenu
|
|
|
|
|
|
|
|
|
|
import "errors"
|
|
|
|
|
|
2026-03-31 05:13:43 +00:00
|
|
|
var ErrorMenuNotFound = errors.New("contextmenu: menu not found")
|
2026-03-13 14:51:33 +00:00
|
|
|
|
2026-03-31 12:18:41 +01:00
|
|
|
// QueryGet returns a named context menu definition. Result: *ContextMenuDef (nil if not found)
|
2026-03-13 14:51:33 +00:00
|
|
|
type QueryGet struct {
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-31 12:18:41 +01:00
|
|
|
// QueryList returns all registered context menus. Result: map[string]ContextMenuDef
|
2026-03-13 14:51:33 +00:00
|
|
|
type QueryList struct{}
|
|
|
|
|
|
2026-03-31 12:18:41 +01:00
|
|
|
// TaskAdd registers a named context menu. Replaces if already exists.
|
2026-03-13 14:51:33 +00:00
|
|
|
type TaskAdd struct {
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
Menu ContextMenuDef `json:"menu"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-31 12:18:41 +01:00
|
|
|
// TaskRemove unregisters a context menu by name. Error: ErrorMenuNotFound if missing.
|
2026-03-13 14:51:33 +00:00
|
|
|
type TaskRemove struct {
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-31 12:18:41 +01:00
|
|
|
// ActionItemClicked is broadcast when a context menu item is clicked.
|
2026-03-13 14:51:33 +00:00
|
|
|
type ActionItemClicked struct {
|
|
|
|
|
MenuName string `json:"menuName"`
|
|
|
|
|
ActionID string `json:"actionId"`
|
|
|
|
|
Data string `json:"data,omitempty"`
|
|
|
|
|
}
|