menumanager

package
v2.9.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextMenu

type ContextMenu struct {
	ID            string
	ProcessedMenu *WailsMenu
	// contains filtered or unexported fields
}

func NewContextMenu

func NewContextMenu(contextMenu *menu.ContextMenu) *ContextMenu

func (*ContextMenu) AsJSON

func (t *ContextMenu) AsJSON() (string, error)

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager() *Manager

func (*Manager) AddContextMenu

func (m *Manager) AddContextMenu(contextMenu *menu.ContextMenu)

func (*Manager) AddTrayMenu

func (m *Manager) AddTrayMenu(trayMenu *menu.TrayMenu) (string, error)

func (*Manager) GetApplicationMenuJSON

func (m *Manager) GetApplicationMenuJSON() string

func (*Manager) GetContextMenus

func (m *Manager) GetContextMenus() ([]string, error)

func (*Manager) GetProcessedApplicationMenu

func (m *Manager) GetProcessedApplicationMenu() *WailsMenu

func (*Manager) GetTrayID

func (m *Manager) GetTrayID(trayMenu *menu.TrayMenu) (string, error)

func (*Manager) GetTrayMenus

func (m *Manager) GetTrayMenus() ([]string, error)

func (*Manager) OnTrayMenuClose

func (m *Manager) OnTrayMenuClose(id string)

func (*Manager) OnTrayMenuOpen

func (m *Manager) OnTrayMenuOpen(id string)

func (*Manager) ProcessClick

func (m *Manager) ProcessClick(menuID string, data string, menuType string, parentID string) error

func (*Manager) SetApplicationMenu

func (m *Manager) SetApplicationMenu(applicationMenu *menu.Menu) error

func (*Manager) SetTrayMenu

func (m *Manager) SetTrayMenu(trayMenu *menu.TrayMenu) (string, error)

SetTrayMenu updates or creates a menu

func (*Manager) UpdateApplicationMenu

func (m *Manager) UpdateApplicationMenu() (string, error)

UpdateApplicationMenu reprocesses the application menu to pick up structure changes etc Returns the JSON representation of the updated menu

func (*Manager) UpdateContextMenu

func (m *Manager) UpdateContextMenu(contextMenu *menu.ContextMenu) (string, error)

func (*Manager) UpdateTrayMenuLabel

func (m *Manager) UpdateTrayMenuLabel(trayMenu *menu.TrayMenu) (string, error)
type MenuItemMap struct {
	// contains filtered or unexported fields
}

MenuItemMap holds a mapping between menuIDs and menu items

func NewMenuItemMap

func NewMenuItemMap() *MenuItemMap
func (m *MenuItemMap) AddMenu(menu *menu.Menu)
func (m *MenuItemMap) Dump()

type ProcessedMenu

type ProcessedMenu struct {
	Items []*ProcessedMenuItem
}

func NewProcessedMenu

func NewProcessedMenu(menuItemMap *MenuItemMap, menu *menu.Menu) *ProcessedMenu

type ProcessedMenuItem

type ProcessedMenuItem struct {
	ID string
	// Label is what appears as the menu text
	Label string `json:",omitempty"`
	// Role is a predefined menu type
	// Role menu.Role `json:",omitempty"`
	// Accelerator holds a representation of a key binding
	Accelerator *keys.Accelerator `json:",omitempty"`
	// Type of MenuItem, EG: Checkbox, Text, Separator, Radio, Submenu
	Type menu.Type
	// Disabled makes the item unselectable
	Disabled bool `json:",omitempty"`
	// Hidden ensures that the item is not shown in the menu
	Hidden bool `json:",omitempty"`
	// Checked indicates if the item is selected (used by Checkbox and Radio types only)
	Checked bool `json:",omitempty"`
	// Submenu contains a list of menu items that will be shown as a submenu
	// SubMenu []*MenuItem `json:"SubMenu,omitempty"`
	SubMenu *ProcessedMenu `json:",omitempty"`
}

func NewProcessedMenuItem

func NewProcessedMenuItem(menuItemMap *MenuItemMap, menuItem *menu.MenuItem) *ProcessedMenuItem

type RadioGroup

type RadioGroup struct {
	Members []string
	Length  int
}

RadioGroup holds all the members of the same radio group

type TrayMenu

type TrayMenu struct {
	ID               string
	Label            string
	FontSize         int
	FontName         string
	Disabled         bool
	Tooltip          string `json:",omitempty"`
	Image            string
	MacTemplateImage bool
	RGBA             string

	ProcessedMenu *WailsMenu

	StyledLabel []*ansi.StyledText `json:",omitempty"`
	// contains filtered or unexported fields
}

func NewTrayMenu

func NewTrayMenu(trayMenu *menu.TrayMenu) *TrayMenu

func (*TrayMenu) AsJSON

func (t *TrayMenu) AsJSON() (string, error)

type WailsMenu

type WailsMenu struct {
	Menu        *ProcessedMenu
	RadioGroups []*RadioGroup
	// contains filtered or unexported fields
}

WailsMenu is the original menu with the addition of radio groups extracted from the menu data

func NewWailsMenu

func NewWailsMenu(menuItemMap *MenuItemMap, menu *menu.Menu) *WailsMenu

func (*WailsMenu) AsJSON

func (w *WailsMenu) AsJSON() (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL