barista.run: barista.run/base/click Index | Files

package click

import "barista.run/base/click"

Package click provides methods to compose click handlers.

Index

Package Files

buttons.go click.go

func Back Uses

func Back(do func()) func(bar.Event)

Back creates a click handler that invokes the given function when a ButtonBack event is received.

func BackE Uses

func BackE(handler func(bar.Event)) func(bar.Event)

BackE wraps the click handler so that it is only triggered by a ButtonBack event.

func Button Uses

func Button(do func(bar.Button), btns ...bar.Button) func(bar.Event)

Button invokes the given function when any of the specified buttons trigger the event handler. It passes only the button to the function. To get the complete event, see ButtonE.

func ButtonE Uses

func ButtonE(handler func(bar.Event), btns ...bar.Button) func(bar.Event)

ButtonE filters out events triggered by buttons not listed in btns before invoking the given click handler.

func Click Uses

func Click(do func(), includeBackAndForward ...bool) func(bar.Event)

Click invokes the given function on button clicks only (ignoring scroll). includeBackAndForward controls whether the back and forward buttons also trigger the handler. (Only the first value is used, but varargs provide an "optional" argument here.). Defaults to false.

func DiscardEvent Uses

func DiscardEvent(fn func()) func(bar.Event)

DiscardEvent wraps a function with no arguments in a function that takes a bar.Event, allowing a func() to be used as a click handler.

func Forward Uses

func Forward(do func()) func(bar.Event)

Forward creates a click handler that invokes the given function when a ButtonForward event is received.

func ForwardE Uses

func ForwardE(handler func(bar.Event)) func(bar.Event)

ForwardE wraps the click handler so that it is only triggered by a ButtonForward event.

func Left Uses

func Left(do func()) func(bar.Event)

Left creates a click handler that invokes the given function when a ButtonLeft event is received.

func LeftE Uses

func LeftE(handler func(bar.Event)) func(bar.Event)

LeftE wraps the click handler so that it is only triggered by a ButtonLeft event.

func Middle Uses

func Middle(do func()) func(bar.Event)

Middle creates a click handler that invokes the given function when a ButtonMiddle event is received.

func MiddleE Uses

func MiddleE(handler func(bar.Event)) func(bar.Event)

MiddleE wraps the click handler so that it is only triggered by a ButtonMiddle event.

func Right(do func()) func(bar.Event)

Right creates a click handler that invokes the given function when a ButtonRight event is received.

func RightE Uses

func RightE(handler func(bar.Event)) func(bar.Event)

RightE wraps the click handler so that it is only triggered by a ButtonRight event.

func RunLeft Uses

func RunLeft(cmd string, args ...string) func(bar.Event)

RunLeft executes the given command on a left-click. This is a shortcut for click.Left(func(){exec.Command(cmd).Run()}).

func Scroll Uses

func Scroll(do func(bar.Button)) func(bar.Event)

Scroll invokes the given function on all scroll events, and passes in the button (e.g. bar.ScrollUp).

func ScrollDown Uses

func ScrollDown(do func()) func(bar.Event)

ScrollDown creates a click handler that invokes the given function when a ScrollDown event is received.

func ScrollDownE Uses

func ScrollDownE(handler func(bar.Event)) func(bar.Event)

ScrollDownE wraps the click handler so that it is only triggered by a ScrollDown event.

func ScrollLeft Uses

func ScrollLeft(do func()) func(bar.Event)

ScrollLeft creates a click handler that invokes the given function when a ScrollLeft event is received.

func ScrollLeftE Uses

func ScrollLeftE(handler func(bar.Event)) func(bar.Event)

ScrollLeftE wraps the click handler so that it is only triggered by a ScrollLeft event.

func ScrollRight Uses

func ScrollRight(do func()) func(bar.Event)

ScrollRight creates a click handler that invokes the given function when a ScrollRight event is received.

func ScrollRightE Uses

func ScrollRightE(handler func(bar.Event)) func(bar.Event)

ScrollRightE wraps the click handler so that it is only triggered by a ScrollRight event.

func ScrollUp Uses

func ScrollUp(do func()) func(bar.Event)

ScrollUp creates a click handler that invokes the given function when a ScrollUp event is received.

func ScrollUpE Uses

func ScrollUpE(handler func(bar.Event)) func(bar.Event)

ScrollUpE wraps the click handler so that it is only triggered by a ScrollUp event.

type Map Uses

type Map map[bar.Button]func(bar.Event)

Map stores a mapping of button to event handler.

func (Map) Back Uses

func (m Map) Back(do func()) Map

Back invokes the given function on ButtonBack events.

func (Map) BackE Uses

func (m Map) BackE(handler func(bar.Event)) Map

BackE sets the click handler for ButtonBack events.

func (Map) Else Uses

func (m Map) Else(handler func(bar.Event)) Map

Else sets the click handler for all buttons that don't already have one.

func (Map) Forward Uses

func (m Map) Forward(do func()) Map

Forward invokes the given function on ButtonForward events.

func (Map) ForwardE Uses

func (m Map) ForwardE(handler func(bar.Event)) Map

ForwardE sets the click handler for ButtonForward events.

func (Map) Handle Uses

func (m Map) Handle(e bar.Event)

Handle handles an event and invokes the appropriate handler from the map.

func (Map) Left Uses

func (m Map) Left(do func()) Map

Left invokes the given function on ButtonLeft events.

func (Map) LeftE Uses

func (m Map) LeftE(handler func(bar.Event)) Map

LeftE sets the click handler for ButtonLeft events.

func (Map) Middle Uses

func (m Map) Middle(do func()) Map

Middle invokes the given function on ButtonMiddle events.

func (Map) MiddleE Uses

func (m Map) MiddleE(handler func(bar.Event)) Map

MiddleE sets the click handler for ButtonMiddle events.

func (Map) Right Uses

func (m Map) Right(do func()) Map

Right invokes the given function on ButtonRight events.

func (Map) RightE Uses

func (m Map) RightE(handler func(bar.Event)) Map

RightE sets the click handler for ButtonRight events.

func (Map) ScrollDown Uses

func (m Map) ScrollDown(do func()) Map

ScrollDown invokes the given function on ScrollDown events.

func (Map) ScrollDownE Uses

func (m Map) ScrollDownE(handler func(bar.Event)) Map

ScrollDownE sets the click handler for ScrollDown events.

func (Map) ScrollLeft Uses

func (m Map) ScrollLeft(do func()) Map

ScrollLeft invokes the given function on ScrollLeft events.

func (Map) ScrollLeftE Uses

func (m Map) ScrollLeftE(handler func(bar.Event)) Map

ScrollLeftE sets the click handler for ScrollLeft events.

func (Map) ScrollRight Uses

func (m Map) ScrollRight(do func()) Map

ScrollRight invokes the given function on ScrollRight events.

func (Map) ScrollRightE Uses

func (m Map) ScrollRightE(handler func(bar.Event)) Map

ScrollRightE sets the click handler for ScrollRight events.

func (Map) ScrollUp Uses

func (m Map) ScrollUp(do func()) Map

ScrollUp invokes the given function on ScrollUp events.

func (Map) ScrollUpE Uses

func (m Map) ScrollUpE(handler func(bar.Event)) Map

ScrollUpE sets the click handler for ScrollUp events.

func (Map) Set Uses

func (m Map) Set(btn bar.Button, handler func(bar.Event)) Map

Set sets the click handler for a button, and returns the map for chaining.

Package click imports 2 packages (graph) and is imported by 6 packages. Updated 2019-03-09. Refresh now. Tools for package owners.