2026-03-13 14:51:33 +00:00
|
|
|
package contextmenu
|
|
|
|
|
|
2026-03-31 16:37:47 +01:00
|
|
|
import core "dappco.re/go/core"
|
2026-03-13 14:51:33 +00:00
|
|
|
|
2026-03-31 16:37:47 +01:00
|
|
|
var ErrorMenuNotFound = core.E("contextmenu", "menu not found", nil)
|
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 15:08:50 +01:00
|
|
|
// QueryGetAll returns all registered context menus. Equivalent to QueryList.
|
|
|
|
|
// Result: map[string]ContextMenuDef
|
|
|
|
|
type QueryGetAll 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 15:08:50 +01:00
|
|
|
// TaskUpdate replaces an existing context menu's definition. Error: ErrorMenuNotFound if missing.
|
|
|
|
|
type TaskUpdate struct {
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
Menu ContextMenuDef `json:"menu"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TaskDestroy removes a context menu and releases all associated resources.
|
|
|
|
|
// Error: ErrorMenuNotFound if missing.
|
|
|
|
|
type TaskDestroy 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"`
|
|
|
|
|
}
|