vidar: Index | Files | Directories

package commander

import ""


Package Files

bindings.go commandbox.go commander.go executor.go generic_statuser.go menu.go

type BeforeExecutor Uses

type BeforeExecutor interface {

A BeforeExecutor is an Executor which has tasks to run prior to running Exec.

type Boundser Uses

type Boundser interface {
    Bounds() math.Rect

type ColorSetter Uses

type ColorSetter interface {
    // SetColor is called when a command element is displayed, so
    // that it matches the color theme of the commander.

ColorSetter is a type that can have its color set.

type Commander Uses

type Commander struct {
    // contains filtered or unexported fields

Commander is a gxui.LinearLayout that takes care of displaying the command utilities around a controller.

func New Uses

func New(driver gxui.Driver, theme *basic.Theme, root gxui.Window, controller Controller) *Commander

New creates and initializes a *Commander, then returns it.

func (*Commander) Bindable Uses

func (c *Commander) Bindable(name string) bind.Bindable

Bindable looks up a bind.Bindable by name

func (*Commander) Binding Uses

func (c *Commander) Binding(binding gxui.KeyboardEvent) bind.Command

Binding finds and returns the Command associated with bind.

func (*Commander) DesiredSize Uses

func (c *Commander) DesiredSize(_, max math.Size) math.Size

func (*Commander) Elements Uses

func (c *Commander) Elements() []interface{}

func (*Commander) Execute Uses

func (c *Commander) Execute(e bind.Bindable)

func (*Commander) InputHandler Uses

func (c *Commander) InputHandler() input.Handler

func (*Commander) KeyPress Uses

func (c *Commander) KeyPress(event gxui.KeyboardEvent) (consume bool)

KeyPress handles key bindings for c.

func (*Commander) KeyStroke Uses

func (c *Commander) KeyStroke(event gxui.KeyStrokeEvent) (consume bool)

func (*Commander) LayoutChildren Uses

func (c *Commander) LayoutChildren()

func (*Commander) Paint Uses

func (c *Commander) Paint(canvas gxui.Canvas)

func (*Commander) Pop Uses

func (c *Commander) Pop() []bind.Bindable

Pop pops the most recent call to Bind, restoring the previous bind.

func (*Commander) Push Uses

func (c *Commander) Push(bindables ...bind.Bindable)

Push binds all bindables to c, pushing the previous binding down in the stack.

type Completer Uses

type Completer interface {

    // Complete returns whether or not the event signals a completion
    // of the input.
    Complete(gxui.KeyboardEvent) bool

Completer is a type that may optionally be implemented by types returned from InputQueue.Next() to decide when they're complete. This allows them to consume enter events as newlines or trigger completeness off of key presses other than enter.

type Controllable Uses

type Controllable interface {
    Controller() *gxui.TextBoxController

type Controller Uses

type Controller interface {
    Editor() controller.MultiEditor

Controller is a type which is used by the Commander to control the main UI.

type Elementer Uses

type Elementer interface {
    Elements() []interface{}

Elementer is a type which contains elements of its own.

type InputQueue Uses

type InputQueue interface {

    // Next returns the next element for reading user input. By
    // default, this is called every time the commander receives a
    // gxui.KeyEnter event in KeyPress.  If there are situations where
    // this is not the desired behavior, the returned gxui.Focusable
    // can consume the gxui.KeyboardEvent.  If the input element has
    // other keyboard events that would trigger completion, it can
    // implement Completer, which will allow it to define when it
    // is complete.
    // Next will continue to be called until it returns nil, at which
    // point the command is assumed to be done.
    Next() gxui.Focusable

An InputQueue is a type of Command which needs to read user input.

type Starter Uses

type Starter interface {

    // Start starts the command.  The element that the command is
    // targeting will be passed in as target.  If the returned
    // status element is non-nil, it will be displayed as an
    // element to display the current status of the command to
    // the user.
    Start(target gxui.Control) (status gxui.Control)

A Starter is a type of Command which needs to initialize itself whenever the user wants to run it.

type Statuser Uses

type Statuser interface {

    // Status returns the element to display for the binding's status.
    // The element will be removed after some time.
    Status() gxui.Control

A Statuser is a Bindable that needs to display its status after being run. The bindings should use their discretion for status colors, but colors for some common message types are exported by this package to keep things consistent.


bindPackage bind contains some of the types that the commander package uses to identify types to bind to user input or other events.
controlPackage control contains types that the commander uses to identify as control flow types.

Package commander imports 15 packages (graph) and is imported by 2 packages. Updated 2018-11-13. Refresh now. Tools for package owners.