Documentation
¶
Index ¶
- Constants
- Variables
- func NotifyEnablers(listeners []interface{}, enabled bool)
- func ToBool(raw interface{}) (bool, bool)
- func ToFloat(raw interface{}) (float64, bool)
- func ToInt(raw interface{}) (int, bool)
- func ToString(raw interface{}) (string, bool)
- func ToStringArray(raw interface{}) ([]string, bool)
- type BaseButton
- type Button
- type ButtonContext
- type ButtonFactory
- type Device
- type Enabler
- type FlashingButton
- type GC
- func (gc *GC) DrawDoubleLineToggleTextButton(text1, text2 string, activeLine int) image.Image
- func (gc *GC) DrawIconButton(icon image.Image) image.Image
- func (gc *GC) DrawIconLabelButton(icon image.Image, label string) image.Image
- func (gc *GC) DrawNoButton() image.Image
- func (gc *GC) DrawSingleLineTextButton(text string) image.Image
- func (gc *GC) LoadFontAsset(name string, points float64) font.Face
- func (gc *GC) LoadFontFaceFromReader(r io.Reader, points float64) (font.Face, error)
- func (gc *GC) LoadIconAsset(name string) image.Image
- func (gc *GC) LoadIconFromFile(filename string) (image.Image, error)
- func (gc *GC) LoadIconFromReader(r io.Reader) (image.Image, error)
- func (gc *GC) Pixels() int
- func (gc *GC) Reset()
- func (gc *GC) SetBackground(background color.Color)
- func (gc *GC) SetFont(filename string)
- func (gc *GC) SetFontSize(points float64)
- func (gc *GC) SetForeground(foreground color.Color)
- func (gc *GC) SwapColors()
- type GraphicContext
- type HamDeck
- func (d *HamDeck) Attach(index int, button Button)
- func (d *HamDeck) CloseUnusedFactories()
- func (d *HamDeck) Detach(index int)
- func (d *HamDeck) ReadConfig(r io.Reader) error
- func (d *HamDeck) Redraw(index int, redrawImages bool)
- func (d *HamDeck) RedrawAll(redrawImages bool)
- func (d *HamDeck) RegisterFactory(factory ButtonFactory)
- func (d *HamDeck) Run(stop <-chan struct{}) error
- type Key
- type LongpressHandler
Constants ¶
View Source
const ( ConfigDefaultFilename = "hamdeck.json" ConfigMainKey = "hamdeck" ConfigButtons = "buttons" ConfigType = "type" ConfigIndex = "index" )
View Source
const FlashingInterval = 500 * time.Millisecond
View Source
const LongpressDuration = 1 * time.Second
Variables ¶
View Source
var ( Black = color.Black White = color.White DisabledGray = color.RGBA{54, 60, 62, 255} Red = color.RGBA{255, 0, 0, 255} Green = color.RGBA{0, 255, 0, 255} Blue = color.RGBA{0, 0, 255, 255} Yellow = color.RGBA{255, 255, 0, 255} Magenta = color.RGBA{255, 0, 255, 255} Cyan = color.RGBA{0, 255, 255, 255} DarkGreen = color.RGBA{0, 150, 0, 255} Orange = color.RGBA{255, 165, 0, 255} )
View Source
var ( DefaultBackground = Black DefaultForeground = White DefaultFont = "DejaVuSans.ttf" DefaultFontSize = 24.0 )
Functions ¶
func NotifyEnablers ¶
func NotifyEnablers(listeners []interface{}, enabled bool)
func ToStringArray ¶
Types ¶
type BaseButton ¶
type BaseButton struct {
// contains filtered or unexported fields
}
func (*BaseButton) Attached ¶
func (b *BaseButton) Attached(ctx ButtonContext)
func (*BaseButton) Detached ¶
func (b *BaseButton) Detached()
func (*BaseButton) Invalidate ¶
func (b *BaseButton) Invalidate(redrawImages bool)
type Button ¶
type Button interface {
Image(GraphicContext, bool) image.Image
Pressed()
Released()
Attached(ButtonContext)
Detached()
}
type ButtonContext ¶
type ButtonContext interface {
Invalidate(bool)
}
type ButtonFactory ¶
type FlashingButton ¶
type FlashingButton interface {
Flash(on bool)
}
type GC ¶
type GC struct {
// contains filtered or unexported fields
}
func (*GC) DrawDoubleLineToggleTextButton ¶
func (*GC) DrawIconLabelButton ¶
func (*GC) DrawNoButton ¶
func (*GC) DrawSingleLineTextButton ¶
func (*GC) LoadFontFaceFromReader ¶
func (*GC) SetBackground ¶
func (*GC) SetFontSize ¶
func (*GC) SetForeground ¶
func (*GC) SwapColors ¶
func (gc *GC) SwapColors()
type GraphicContext ¶
type GraphicContext interface {
Pixels() int
Reset()
SetBackground(background color.Color)
SetForeground(foreground color.Color)
SwapColors()
SetFont(filename string)
SetFontSize(points float64)
DrawNoButton() image.Image
DrawSingleLineTextButton(text string) image.Image
DrawDoubleLineToggleTextButton(text1, text2 string, activeLine int) image.Image
LoadIconFromFile(filename string) (image.Image, error)
LoadIconFromReader(r io.Reader) (image.Image, error)
LoadIconAsset(name string) image.Image
DrawIconButton(icon image.Image) image.Image
DrawIconLabelButton(icon image.Image, label string) image.Image
}
func NewGraphicContext ¶
func NewGraphicContext(pixels int) GraphicContext
type HamDeck ¶
type HamDeck struct {
// contains filtered or unexported fields
}
func (*HamDeck) CloseUnusedFactories ¶ added in v0.3.0
func (d *HamDeck) CloseUnusedFactories()
func (*HamDeck) RegisterFactory ¶
func (d *HamDeck) RegisterFactory(factory ButtonFactory)
type LongpressHandler ¶
type LongpressHandler struct {
// contains filtered or unexported fields
}
func NewLongpressHandler ¶
func NewLongpressHandler(callback func()) *LongpressHandler
func (*LongpressHandler) Pressed ¶
func (h *LongpressHandler) Pressed()
func (*LongpressHandler) Released ¶
func (h *LongpressHandler) Released()
Click to show internal directories.
Click to hide internal directories.