gui/pkg/contextmenu/messages.go
Claude f1f7fcfab9
Some checks failed
Security Scan / security (push) Failing after 28s
refactor: remove banned imports from display, window/layout, window/state
- display/events.go: encoding/json → core.JSONMarshal/JSONUnmarshal
- display/display.go: os, filepath → core.Env, core.JoinPath
- window/layout.go: encoding/json, os, filepath → core primitives
- window/state.go: encoding/json, os, filepath → core primitives

All 17 packages build and test clean.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 16:37:47 +01:00

47 lines
1.4 KiB
Go

package contextmenu
import core "dappco.re/go/core"
var ErrorMenuNotFound = core.E("contextmenu", "menu not found", nil)
// QueryGet returns a named context menu definition. Result: *ContextMenuDef (nil if not found)
type QueryGet struct {
Name string `json:"name"`
}
// QueryList returns all registered context menus. Result: map[string]ContextMenuDef
type QueryList struct{}
// QueryGetAll returns all registered context menus. Equivalent to QueryList.
// Result: map[string]ContextMenuDef
type QueryGetAll struct{}
// TaskAdd registers a named context menu. Replaces if already exists.
type TaskAdd struct {
Name string `json:"name"`
Menu ContextMenuDef `json:"menu"`
}
// TaskRemove unregisters a context menu by name. Error: ErrorMenuNotFound if missing.
type TaskRemove struct {
Name string `json:"name"`
}
// 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"`
}
// ActionItemClicked is broadcast when a context menu item is clicked.
type ActionItemClicked struct {
MenuName string `json:"menuName"`
ActionID string `json:"actionId"`
Data string `json:"data,omitempty"`
}