click

package
v0.0.0-...-c936f35 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 2 Imported by: 24

Documentation

Overview

Package click provides methods to compose click handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Back

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Types

type Map

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

Map stores a mapping of button to event handler.

func (Map) Back

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

Back invokes the given function on ButtonBack events.

func (Map) BackE

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

BackE sets the click handler for ButtonBack events.

func (Map) Else

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

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

Forward invokes the given function on ButtonForward events.

func (Map) ForwardE

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

ForwardE sets the click handler for ButtonForward events.

func (Map) Handle

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

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

func (Map) Left

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

Left invokes the given function on ButtonLeft events.

func (Map) LeftE

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

LeftE sets the click handler for ButtonLeft events.

func (Map) Middle

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

Middle invokes the given function on ButtonMiddle events.

func (Map) MiddleE

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

MiddleE sets the click handler for ButtonMiddle events.

func (Map) Right

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

Right invokes the given function on ButtonRight events.

func (Map) RightE

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

RightE sets the click handler for ButtonRight events.

func (Map) ScrollDown

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

ScrollDown invokes the given function on ScrollDown events.

func (Map) ScrollDownE

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

ScrollDownE sets the click handler for ScrollDown events.

func (Map) ScrollLeft

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

ScrollLeft invokes the given function on ScrollLeft events.

func (Map) ScrollLeftE

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

ScrollLeftE sets the click handler for ScrollLeft events.

func (Map) ScrollRight

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

ScrollRight invokes the given function on ScrollRight events.

func (Map) ScrollRightE

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

ScrollRightE sets the click handler for ScrollRight events.

func (Map) ScrollUp

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

ScrollUp invokes the given function on ScrollUp events.

func (Map) ScrollUpE

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

ScrollUpE sets the click handler for ScrollUp events.

func (Map) Set

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL