menu

package
v0.0.0-...-af996ba Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2019 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AppBar returns the menu bar for the given window id. On some platforms, the menu bar is a
	// global entity and the same value will be returned for all window ids.
	AppBar func(id uint64) Bar
	// Global returns true if the menu bar is global.
	Global func() bool
)
View Source
var (
	// NewItem creates a new item with no key accelerator.
	NewItem func(title string, handler event.Handler) Item
	// NewItemWithKey creates a new item with a key accelerator using the platform-default modifiers.
	NewItemWithKey func(title string, keyCode int, handler event.Handler) Item
	// NewItemWithKeyAndModifiers creates a new item.
	NewItemWithKeyAndModifiers func(title string, keyCode int, modifiers keys.Modifiers, handler event.Handler) Item
	// NewSeparator creates a new separator item.
	NewSeparator func() Item
)
View Source
var (
	// NewMenu creates a new menu.
	NewMenu func(title string) Menu
)

Functions

This section is empty.

Types

type Bar

type Bar interface {
	// AppendMenu appends a menu at the end of this bar.
	AppendMenu(menu Menu)
	// InsertMenu inserts a menu at the specified item index within this bar. Pass in a negative
	// index to append to the end.
	InsertMenu(menu Menu, index int)
	// Remove the menu at the specified index from this bar.
	Remove(index int)
	// Count of menus in this bar.
	Count() int
	// Menu at the specified index, or nil.
	Menu(index int) Menu
	// SpecialMenu returns the specified special menu, or nil if it has not been setup.
	SpecialMenu(which SpecialMenuType) Menu
	// SetupSpecialMenu sets up the specified special menu, which must have already been installed
	// into the menu bar.
	SetupSpecialMenu(which SpecialMenuType, menu Menu)
	// ProcessKeyDown is called to process KeyDown events prior to anything else receiving them.
	ProcessKeyDown(evt *event.KeyDown)
}

Bar represents a set of menus.

type Item

type Item interface {
	event.Target
	// Title returns this item's title.
	Title() string
	// KeyCode returns the key code that can be used to trigger this item. A value of 0 indicates no
	// key is attached.
	KeyCode() int
	// KeyModifiers returns the key modifiers that are required to trigger this item.
	KeyModifiers() keys.Modifiers
	// SubMenu returns a sub-menu attached to this item or nil.
	SubMenu() Menu
	// Enabled returns true if this item is enabled.
	Enabled() bool
	// Dispose releases any operating system resources associated with this item.
	Dispose()
}

Item represents individual actions that can be issued from a menu.

type Menu interface {
	// AppendItem appends an item at the end of this menu.
	AppendItem(item Item)
	// InsertItem inserts an item at the specified item index within this menu. Pass in a negative
	// index to append to the end.
	InsertItem(item Item, index int)
	// AppendMenu appends an item with a sub-menu at the end of this menu.
	AppendMenu(menu Menu)
	// InsertMenu inserts an item with a sub-menu at the specified item index within this menu. Pass
	// in a negative index to append to the end.
	InsertMenu(menu Menu, index int)
	// Remove the item at the specified index from this menu.
	Remove(index int)
	// Title returns the title of this menu.
	Title() string
	// Count of items in this menu.
	Count() int
	// Item at the specified index, or nil.
	Item(index int) Item
	// Popup displays the menu within the window. An attempt will be made to position the 'item'
	// at 'where' within the window. 'width' is a hint at how wide the menu item should be. It may
	// be ignored and will not be used to make the menu smaller than it otherwise would be.
	Popup(windowID uint64, where geom.Point, width float64, item Item)
	// Dispose releases any operating system resources associated with this menu. It will also
	// call Dispose() on all menu items it contains.
	Dispose()
}

Menu represents a set of menu items.

type SpecialMenuType

type SpecialMenuType int

SpecialMenuType identifies which special menu is being referred to.

const (
	ServicesMenu SpecialMenuType = iota
	WindowMenu
	HelpMenu
)

Special menu ids.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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