Documentation
¶
Overview ¶
Package menu implements vigo's top-of-screen menu bar and bottom-of-screen status line. v0.1 paints the bars with a fixed list of items; activation and pull-down menus arrive in v0.2.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultHints = []Hint{ {Key: "F1", Action: "Help", Cmd: event.CmdHelp}, {Key: "F10", Action: "Menu", Cmd: event.CmdMenu}, {Key: "Alt-X", Action: "Exit", Cmd: event.CmdQuit}, }
DefaultHints is the v0.1 status line: F1 Help, F10 Menu, Alt-X Exit.
var DefaultItems = []Item{
{Title: "≡", Hotkey: -1},
{Title: "File", Hotkey: 0},
{Title: "Edit", Hotkey: 0},
{Title: "Search", Hotkey: 0},
{Title: "Run", Hotkey: 0},
{Title: "Compile", Hotkey: 0},
{Title: "Debug", Hotkey: 0},
{Title: "Project", Hotkey: 0},
{Title: "Options", Hotkey: 0},
{Title: "Window", Hotkey: 0},
{Title: "Help", Hotkey: 0},
}
DefaultItems is the Turbo Vision IDE menu list: the system menu marker, followed by the nine top-level menus.
Functions ¶
This section is empty.
Types ¶
type Bar ¶
Bar is the horizontal strip of menu titles painted at the top of the screen. v0.1 only renders it; clicking and pull-downs come in v0.2.
func NewBar ¶
NewBar returns a one-row menu bar pinned to the top of an owner of width w, populated with the supplied items. Pass DefaultItems for the IDE list.
func (*Bar) Draw ¶
Draw paints the bar background and each item separated by spaces. The hotkey character is drawn in the menu-shortcut palette color.
func (*Bar) HandleEvent ¶
HandleEvent is a no-op for v0.1.
type Hint ¶
Hint is a single label on the status line: a key indicator (e.g. "F1") and the action it triggers ("Help"). The Cmd field is the command broadcast when the key is pressed; v0.1 paints the labels but does not fire commands yet (that ships with menu activation in v0.2).
type Item ¶
Item is a single label on the menu bar. Hotkey is the index of the highlighted character within Title, or -1 for none.
type Line ¶
Line is the one-row status bar pinned to the bottom of the screen.
func NewLine ¶
NewLine returns a status line of width w, anchored at row y, with the supplied hints. Pass DefaultHints for the IDE defaults.
func (*Line) HandleEvent ¶
HandleEvent is a no-op for v0.1; the demo binary handles Alt-X directly.