Refactor inventorySelect to build it hierarchically
This commit is contained in:
@@ -15,10 +15,6 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
// These menu types don't need driving, so we can ignore them
|
||||
registerBuilder(menus.TypeMenu, nil) // Menus are just containers
|
||||
registerBuilder(menus.TypeDragMenu, nil) // Menus are just containers
|
||||
|
||||
// FIXME: these need implementing
|
||||
|
||||
// Needed for Keyboard.mnu (main -> options -> keyboard)
|
||||
@@ -79,6 +75,10 @@ func noChildren(f func(d *Driver, r *menus.Record) error) builderFunc {
|
||||
}
|
||||
}
|
||||
|
||||
func ownedByMenu(d *Driver, r *menus.Record) ([]*menus.Record, error) {
|
||||
return nil, fmt.Errorf("This record should be handled by a menu: %v:%v (%#+v)", r.Menu.Name, r.Path(), r)
|
||||
}
|
||||
|
||||
func registerBuilder(t menus.MenuType, f builderFunc) {
|
||||
if _, ok := widgetBuilders[t]; ok {
|
||||
panic(fmt.Sprintf("A builder for menu type %v already exists", t))
|
||||
|
Reference in New Issue
Block a user