menumanager

package
v2.0.0-alpha.9 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2021 License: MIT Imports: 5 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)

func (*Manager) GetApplicationMenuJSON

func (m *Manager) GetApplicationMenuJSON() string

func (*Manager) GetContextMenus

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

func (*Manager) GetTrayMenus

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

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) 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) UpdateTrayMenu

func (m *Manager) UpdateTrayMenu(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
	// Role is a predefined menu type
	Role menu.Role `json:"Role,omitempty"`
	// Accelerator holds a representation of a key binding
	Accelerator *keys.Accelerator `json:"Accelerator,omitempty"`
	// Type of MenuItem, EG: Checkbox, Text, Separator, Radio, Submenu
	Type menu.Type
	// Disabled makes the item unselectable
	Disabled bool
	// Hidden ensures that the item is not shown in the menu
	Hidden bool
	// Checked indicates if the item is selected (used by Checkbox and Radio types only)
	Checked bool
	// Submenu contains a list of menu items that will be shown as a submenu
	//SubMenu []*MenuItem `json:"SubMenu,omitempty"`
	SubMenu *ProcessedMenu `json:"SubMenu,omitempty"`

	// Foreground colour in hex RGBA format EG: 0xFF0000FF = #FF0000FF = red
	Foreground int

	// Background colour
	Background int
}

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
	Icon  string

	ProcessedMenu *WailsMenu
	// 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