Documentation
¶
Overview ¶
Mnemonic: button.go Abstract: Support for an individual menu button. Date: 12 December 2018 Author: E. Scott Daniels
Mnemonic: menu.go Abstract: Struct and functions to manage a single set of menu buttons. Date: 12 December 2018 Author: E. Scott Daniels
Notes: Buttons are automatically drawn into the double buffer window before
the buffer is swapped. Subpage background colour is automatically set, and the sp cleared with each call to the page's show(). All visible menu subpages should be painted without special call to any function here.
Menu provides a sketch API based simple menu, button and mouse event event interface.
Mnemonic: prop_menu.go Abstract: A "property" and related menu manger. Properties are binary (true/false).
The user programme must establish and initialse the sketch xigo environment and supply the graphcs context at initialisation. The user programme is also expected to execute the Drive() function of the gc in order to drive the event manager.
Date: 16 December 2018 Author: E. Scott Daniels
Index ¶
- type Default_entry
- type Definition
- type Menu_mgr
- func (mm *Menu_mgr) Add_anchor(name string, label string, height float64, width float64, page_colour string, ...) (bid int)
- func (mm *Menu_mgr) Add_button(menu_name string, label string, colour string, txt_colour string, kind int, ...) (bid int)
- func (mm *Menu_mgr) Add_menu(name string, anchor_label string, height float64, width float64, ...) (start_bid int)
- func (mm *Menu_mgr) Add_nab_menu(name string, x float64, y float64, height float64, width float64, ...)
- func (mm *Menu_mgr) Display_menu(name string)
- func (mm *Menu_mgr) Hide_menu(name string)
- func (mm *Menu_mgr) Toggle_menu(name string)
- type Mevent
- type Prop_entry
- type Properties
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Default_entry ¶
Structs to bash json definition into
type Definition ¶
type Definition struct { Defaults Default_entry Entries []Prop_entry }
type Menu_mgr ¶
type Menu_mgr struct {
// contains filtered or unexported fields
}
Menu manager, manages a set of menus.
func Mk_menu_set ¶
func Mk_menu_set(gc sketch.Graphics_api, x float64, y float64, height float64, width float64, colour string, txt_colour string, align_vert bool) *Menu_mgr
Mk_menu_set will create a menu system for the currently active subpage in gc. User programme must first create an Xigo sketch graphics context (gc) which will also be used by the menus.
func (*Menu_mgr) Add_anchor ¶
func (mm *Menu_mgr) Add_anchor(name string, label string, height float64, width float64, page_colour string, uchan chan *Mevent) (bid int)
Add_anchor allows the user programme to add an anchored menu with out automatially adding any buttons to the menu. Buttons can be added later allowing each to be coloured differently, or to have different properties.
func (*Menu_mgr) Add_button ¶
func (mm *Menu_mgr) Add_button(menu_name string, label string, colour string, txt_colour string, kind int, pressed bool, uchan chan *Mevent) (bid int)
Add_button allows a single button to be added to a menu. The button ID is automatically assigned, but user control over colour and type is allowed. Button height and width are taken from the menu definition set when the anchor was created.
func (*Menu_mgr) Add_menu ¶
func (mm *Menu_mgr) Add_menu(name string, anchor_label string, height float64, width float64, bcolour string, txt_colour string, labels []string, uchan chan *Mevent) (start_bid int)
Add_menu provides a 'one stop shopping' experience allowing the user programme to add a complete menu to the mix. Menu button labels are expected as an array of strings, button IDs are sequentially assigned, and button colours are all the same. Further, all buttons created "point" at the same user menu event channel. In the end, the user has less control, but the overall code in the user programme is likely more simple.
func (*Menu_mgr) Add_nab_menu ¶
func (mm *Menu_mgr) Add_nab_menu(name string, x float64, y float64, height float64, width float64, page_colour string, uchan chan *Mevent)
Add_nab_menu adds a menu which has no anchor button. The user is responsible for causing the menu to be opened and closed. The x,y is used as the location to place the menu when displayed.
func (*Menu_mgr) Display_menu ¶
Display menu causes the named menu's display state to be turned on. If it is already visible, no change is made.
func (*Menu_mgr) Hide_menu ¶
Hide menu causes the named menu's display state to be turned off. If it is already hidden, no change is made.
func (*Menu_mgr) Toggle_menu ¶
Toggle menu causes the named menu's display state to be flipped.
type Mevent ¶
type Mevent struct { Bid int // button ID affected Is_in bool // button state - true if button is 'depressed' }
Menu event sent to to user on their channel.
type Prop_entry ¶
type Prop_entry struct { Colour string // button colour for this setting Kind string // button kind (should be sticky except for the close button) Name string // property name Used to lookup Label string // button label Action string // button action (set causes value toggle, close causes menu hide) Init_state bool // initial state (true == 'depressed') }
type Properties ¶
type Properties struct {
// contains filtered or unexported fields
}
Manage a set of properties.
func Mk_prop_menu ¶
func Mk_prop_menu(mm *Menu_mgr, name string, x float64, y float64, height float64, width float64, def string) (p *Properties)
Create a property menu. The menu is NOT anchored, and thus the user programme must cause it to be displayed directly (probably tied to a button click in an anchored menu).
func (*Properties) Is_set ¶
func (p *Properties) Is_set(pname string) bool
Is_set will return true of the named property is set.