soumya92/barista

View on GitHub
base/click/buttons.go

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
// Copyright 2018 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Code generated by buttons.rb; DO NOT EDIT.

package click

import "barista.run/bar"

// Left creates a click handler that invokes the given function
// when a ButtonLeft event is received.
func Left(do func()) func(bar.Event) {
    return LeftE(DiscardEvent(do))
}

// LeftE wraps the click handler so that it is only triggered by a
// ButtonLeft event.
func LeftE(handler func(bar.Event)) func(bar.Event) {
    return ButtonE(handler, bar.ButtonLeft)
}

// Right creates a click handler that invokes the given function
// when a ButtonRight event is received.
func Right(do func()) func(bar.Event) {
    return RightE(DiscardEvent(do))
}

// RightE wraps the click handler so that it is only triggered by a
// ButtonRight event.
func RightE(handler func(bar.Event)) func(bar.Event) {
    return ButtonE(handler, bar.ButtonRight)
}

// Middle creates a click handler that invokes the given function
// when a ButtonMiddle event is received.
func Middle(do func()) func(bar.Event) {
    return MiddleE(DiscardEvent(do))
}

// MiddleE wraps the click handler so that it is only triggered by a
// ButtonMiddle event.
func MiddleE(handler func(bar.Event)) func(bar.Event) {
    return ButtonE(handler, bar.ButtonMiddle)
}

// Back creates a click handler that invokes the given function
// when a ButtonBack event is received.
func Back(do func()) func(bar.Event) {
    return BackE(DiscardEvent(do))
}

// BackE wraps the click handler so that it is only triggered by a
// ButtonBack event.
func BackE(handler func(bar.Event)) func(bar.Event) {
    return ButtonE(handler, bar.ButtonBack)
}

// Forward creates a click handler that invokes the given function
// when a ButtonForward event is received.
func Forward(do func()) func(bar.Event) {
    return ForwardE(DiscardEvent(do))
}

// ForwardE wraps the click handler so that it is only triggered by a
// ButtonForward event.
func ForwardE(handler func(bar.Event)) func(bar.Event) {
    return ButtonE(handler, bar.ButtonForward)
}

// ScrollLeft creates a click handler that invokes the given function
// when a ScrollLeft event is received.
func ScrollLeft(do func()) func(bar.Event) {
    return ScrollLeftE(DiscardEvent(do))
}

// ScrollLeftE wraps the click handler so that it is only triggered by a
// ScrollLeft event.
func ScrollLeftE(handler func(bar.Event)) func(bar.Event) {
    return ButtonE(handler, bar.ScrollLeft)
}

// ScrollRight creates a click handler that invokes the given function
// when a ScrollRight event is received.
func ScrollRight(do func()) func(bar.Event) {
    return ScrollRightE(DiscardEvent(do))
}

// ScrollRightE wraps the click handler so that it is only triggered by a
// ScrollRight event.
func ScrollRightE(handler func(bar.Event)) func(bar.Event) {
    return ButtonE(handler, bar.ScrollRight)
}

// ScrollUp creates a click handler that invokes the given function
// when a ScrollUp event is received.
func ScrollUp(do func()) func(bar.Event) {
    return ScrollUpE(DiscardEvent(do))
}

// ScrollUpE wraps the click handler so that it is only triggered by a
// ScrollUp event.
func ScrollUpE(handler func(bar.Event)) func(bar.Event) {
    return ButtonE(handler, bar.ScrollUp)
}

// ScrollDown creates a click handler that invokes the given function
// when a ScrollDown event is received.
func ScrollDown(do func()) func(bar.Event) {
    return ScrollDownE(DiscardEvent(do))
}

// ScrollDownE wraps the click handler so that it is only triggered by a
// ScrollDown event.
func ScrollDownE(handler func(bar.Event)) func(bar.Event) {
    return ButtonE(handler, bar.ScrollDown)
}

// Left invokes the given function on ButtonLeft events.
func (m Map) Left(do func()) Map {
    return m.LeftE(DiscardEvent(do))
}

// LeftE sets the click handler for ButtonLeft events.
func (m Map) LeftE(handler func(bar.Event)) Map {
    return m.Set(bar.ButtonLeft, handler)
}

// Right invokes the given function on ButtonRight events.
func (m Map) Right(do func()) Map {
    return m.RightE(DiscardEvent(do))
}

// RightE sets the click handler for ButtonRight events.
func (m Map) RightE(handler func(bar.Event)) Map {
    return m.Set(bar.ButtonRight, handler)
}

// Middle invokes the given function on ButtonMiddle events.
func (m Map) Middle(do func()) Map {
    return m.MiddleE(DiscardEvent(do))
}

// MiddleE sets the click handler for ButtonMiddle events.
func (m Map) MiddleE(handler func(bar.Event)) Map {
    return m.Set(bar.ButtonMiddle, handler)
}

// Back invokes the given function on ButtonBack events.
func (m Map) Back(do func()) Map {
    return m.BackE(DiscardEvent(do))
}

// BackE sets the click handler for ButtonBack events.
func (m Map) BackE(handler func(bar.Event)) Map {
    return m.Set(bar.ButtonBack, handler)
}

// Forward invokes the given function on ButtonForward events.
func (m Map) Forward(do func()) Map {
    return m.ForwardE(DiscardEvent(do))
}

// ForwardE sets the click handler for ButtonForward events.
func (m Map) ForwardE(handler func(bar.Event)) Map {
    return m.Set(bar.ButtonForward, handler)
}

// ScrollLeft invokes the given function on ScrollLeft events.
func (m Map) ScrollLeft(do func()) Map {
    return m.ScrollLeftE(DiscardEvent(do))
}

// ScrollLeftE sets the click handler for ScrollLeft events.
func (m Map) ScrollLeftE(handler func(bar.Event)) Map {
    return m.Set(bar.ScrollLeft, handler)
}

// ScrollRight invokes the given function on ScrollRight events.
func (m Map) ScrollRight(do func()) Map {
    return m.ScrollRightE(DiscardEvent(do))
}

// ScrollRightE sets the click handler for ScrollRight events.
func (m Map) ScrollRightE(handler func(bar.Event)) Map {
    return m.Set(bar.ScrollRight, handler)
}

// ScrollUp invokes the given function on ScrollUp events.
func (m Map) ScrollUp(do func()) Map {
    return m.ScrollUpE(DiscardEvent(do))
}

// ScrollUpE sets the click handler for ScrollUp events.
func (m Map) ScrollUpE(handler func(bar.Event)) Map {
    return m.Set(bar.ScrollUp, handler)
}

// ScrollDown invokes the given function on ScrollDown events.
func (m Map) ScrollDown(do func()) Map {
    return m.ScrollDownE(DiscardEvent(do))
}

// ScrollDownE sets the click handler for ScrollDown events.
func (m Map) ScrollDownE(handler func(bar.Event)) Map {
    return m.Set(bar.ScrollDown, handler)
}