widget

package
Version: v0.0.0-...-ca1a302 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2021 License: MIT Imports: 15 Imported by: 5

Documentation

Overview

Package widget contains various widget implementations such as buttons, checkboxes, combo boxes, lists etc. It also provides several different layout mechanisms to automatically layout widgets according to different rules.

Index

Constants

View Source
const (
	// AnchorLayoutPositionStart is the anchoring position for "left" (in the horizontal direction) or "top" (in the vertical direction.)
	AnchorLayoutPositionStart = AnchorLayoutPosition(iota)

	// AnchorLayoutPositionCenter is the center anchoring position.
	AnchorLayoutPositionCenter

	// AnchorLayoutPositionEnd is the anchoring position for "right" (in the horizontal direction) or "bottom" (in the vertical direction.)
	AnchorLayoutPositionEnd
)
View Source
const (
	CheckboxUnchecked = CheckboxState(iota)
	CheckboxChecked
	CheckboxGreyed
)
View Source
const (
	// GridLayoutPositionStart is the anchoring position for "left" (in the horizontal direction) or "top" (in the vertical direction.)
	GridLayoutPositionStart = GridLayoutPosition(iota)

	// GridLayoutPositionStart is the center anchoring position.
	GridLayoutPositionCenter

	// GridLayoutPositionStart is the anchoring position for "right" (in the horizontal direction) or "bottom" (in the vertical direction.)
	GridLayoutPositionEnd
)
View Source
const (
	DirectionHorizontal = Direction(iota)
	DirectionVertical
)
View Source
const (
	// RowLayoutPositionStart is the anchoring position for "left" (in the horizontal direction) or "top" (in the vertical direction.)
	RowLayoutPositionStart = RowLayoutPosition(iota)

	// RowLayoutPositionCenter is the center anchoring position.
	RowLayoutPositionCenter

	// RowLayoutPositionEnd is the anchoring position for "right" (in the horizontal direction) or "bottom" (in the vertical direction.)
	RowLayoutPositionEnd
)
View Source
const (
	TextPositionStart = TextPosition(iota)
	TextPositionCenter
	TextPositionEnd
)

Variables

This section is empty.

Functions

func RenderWithDeferred

func RenderWithDeferred(screen *ebiten.Image, rs []Renderer)

RenderWithDeferred renders r to screen. This function should not be called directly.

func WidgetFireFocusEvent

func WidgetFireFocusEvent(w *Widget, focused bool)

Types

type AnchorLayout

type AnchorLayout struct {
	// contains filtered or unexported fields
}

AnchorLayout layouts a single widget anchored to either a corner or edge of a rectangle, optionally stretching it in one or both directions.

AnchorLayout will only layout the first widget in a container and ignore all other widgets.

Widget.LayoutData of widgets being layouted by AnchorLayout need to be of type AnchorLayoutData.

func NewAnchorLayout

func NewAnchorLayout(opts ...AnchorLayoutOpt) *AnchorLayout

NewAnchorLayout constructs a new AnchorLayout, configured by opts.

func (*AnchorLayout) Layout

func (a *AnchorLayout) Layout(widgets []PreferredSizeLocateableWidget, rect image.Rectangle)

Layout implements Layouter.

func (*AnchorLayout) PreferredSize

func (a *AnchorLayout) PreferredSize(widgets []PreferredSizeLocateableWidget) (int, int)

PreferredSize implements Layouter.

type AnchorLayoutData

type AnchorLayoutData struct {
	// HorizontalPosition specifies the horizontal anchoring position.
	HorizontalPosition AnchorLayoutPosition

	// VerticalPosition specifies the vertical anchoring position.
	VerticalPosition AnchorLayoutPosition

	// StretchHorizontal specifies whether to stretch in the horizontal direction.
	StretchHorizontal bool

	// StretchVertical specifies whether to stretch in the vertical direction.
	StretchVertical bool
}

AnchorLayoutData specifies layout settings for a widget.

type AnchorLayoutOpt

type AnchorLayoutOpt func(a *AnchorLayout)

AnchorLayoutOpt is a function that configures a.

type AnchorLayoutOptions

type AnchorLayoutOptions struct {
}
var AnchorLayoutOpts AnchorLayoutOptions

AnchorLayoutOpts contains functions that configure an AnchorLayout.

func (AnchorLayoutOptions) Padding

Padding configures an anchor layout to use padding i.

type AnchorLayoutPosition

type AnchorLayoutPosition int

AnchorLayoutPosition is the type used to specify an anchoring position.

type Button

type Button struct {
	Image             *ButtonImage
	KeepPressedOnExit bool
	GraphicImage      *ButtonImageImage
	TextColor         *ButtonTextColor

	PressedEvent  *event.Event
	ReleasedEvent *event.Event
	ClickedEvent  *event.Event
	// contains filtered or unexported fields
}

func NewButton

func NewButton(opts ...ButtonOpt) *Button

func (*Button) GetWidget

func (b *Button) GetWidget() *Widget

func (*Button) PreferredSize

func (b *Button) PreferredSize() (int, int)

func (*Button) Render

func (b *Button) Render(screen *ebiten.Image, def DeferredRenderFunc)

func (*Button) RequestRelayout

func (b *Button) RequestRelayout()

func (*Button) SetLocation

func (b *Button) SetLocation(rect img.Rectangle)

func (*Button) SetupInputLayer

func (b *Button) SetupInputLayer(def input.DeferredSetupInputLayerFunc)

func (*Button) Text

func (b *Button) Text() *Text

type ButtonClickedEventArgs

type ButtonClickedEventArgs struct {
	Button *Button
}

type ButtonClickedHandlerFunc

type ButtonClickedHandlerFunc func(args *ButtonClickedEventArgs)

type ButtonImage

type ButtonImage struct {
	Idle     *image.NineSlice
	Hover    *image.NineSlice
	Pressed  *image.NineSlice
	Disabled *image.NineSlice
}

type ButtonImageImage

type ButtonImageImage struct {
	Idle     *ebiten.Image
	Disabled *ebiten.Image
}

type ButtonOpt

type ButtonOpt func(b *Button)

type ButtonOptions

type ButtonOptions struct {
}
var ButtonOpts ButtonOptions

func (ButtonOptions) ClickedHandler

func (o ButtonOptions) ClickedHandler(f ButtonClickedHandlerFunc) ButtonOpt

func (ButtonOptions) Graphic

func (o ButtonOptions) Graphic(i *ebiten.Image) ButtonOpt

func (ButtonOptions) GraphicNineSlice

func (o ButtonOptions) GraphicNineSlice(i *image.NineSlice) ButtonOpt

func (ButtonOptions) GraphicPadding

func (o ButtonOptions) GraphicPadding(i Insets) ButtonOpt

func (ButtonOptions) Image

func (o ButtonOptions) Image(i *ButtonImage) ButtonOpt

func (ButtonOptions) KeepPressedOnExit

func (o ButtonOptions) KeepPressedOnExit() ButtonOpt

func (ButtonOptions) PressedHandler

func (o ButtonOptions) PressedHandler(f ButtonPressedHandlerFunc) ButtonOpt

func (ButtonOptions) ReleasedHandler

func (o ButtonOptions) ReleasedHandler(f ButtonReleasedHandlerFunc) ButtonOpt

func (ButtonOptions) Text

func (o ButtonOptions) Text(label string, face font.Face, color *ButtonTextColor) ButtonOpt

func (ButtonOptions) TextAndImage

func (o ButtonOptions) TextAndImage(label string, face font.Face, image *ButtonImageImage, color *ButtonTextColor) ButtonOpt

TODO: add parameter for image position (start/end)

func (ButtonOptions) TextPadding

func (o ButtonOptions) TextPadding(p Insets) ButtonOpt

func (ButtonOptions) TextSimpleLeft

func (o ButtonOptions) TextSimpleLeft(label string, face font.Face, color *ButtonTextColor, padding Insets) ButtonOpt

func (ButtonOptions) WidgetOpts

func (o ButtonOptions) WidgetOpts(opts ...WidgetOpt) ButtonOpt

type ButtonPressedEventArgs

type ButtonPressedEventArgs struct {
	Button  *Button
	OffsetX int
	OffsetY int
}

type ButtonPressedHandlerFunc

type ButtonPressedHandlerFunc func(args *ButtonPressedEventArgs)

type ButtonReleasedEventArgs

type ButtonReleasedEventArgs struct {
	Button  *Button
	Inside  bool
	OffsetX int
	OffsetY int
}

type ButtonReleasedHandlerFunc

type ButtonReleasedHandlerFunc func(args *ButtonReleasedEventArgs)

type ButtonTextColor

type ButtonTextColor struct {
	Idle     color.Color
	Disabled color.Color
}

type Caret

type Caret struct {
	Width int
	Color color.Color
	// contains filtered or unexported fields
}

func NewCaret

func NewCaret(opts ...CaretOpt) *Caret

func (*Caret) GetWidget

func (c *Caret) GetWidget() *Widget

func (*Caret) PreferredSize

func (c *Caret) PreferredSize() (int, int)

func (*Caret) Render

func (c *Caret) Render(screen *ebiten.Image, def DeferredRenderFunc)

func (*Caret) ResetBlinking

func (c *Caret) ResetBlinking()

func (*Caret) SetLocation

func (c *Caret) SetLocation(rect img.Rectangle)

type CaretOpt

type CaretOpt func(c *Caret)

type CaretOptions

type CaretOptions struct {
}
var CaretOpts CaretOptions

func (CaretOptions) Color

func (o CaretOptions) Color(c color.Color) CaretOpt

func (CaretOptions) Size

func (o CaretOptions) Size(face font.Face, width int) CaretOpt

type Checkbox

type Checkbox struct {
	ChangedEvent *event.Event
	// contains filtered or unexported fields
}

func NewCheckbox

func NewCheckbox(opts ...CheckboxOpt) *Checkbox

func (*Checkbox) GetWidget

func (c *Checkbox) GetWidget() *Widget

func (*Checkbox) PreferredSize

func (c *Checkbox) PreferredSize() (int, int)

func (*Checkbox) Render

func (c *Checkbox) Render(screen *ebiten.Image, def DeferredRenderFunc)

func (*Checkbox) SetLocation

func (c *Checkbox) SetLocation(rect image.Rectangle)

func (*Checkbox) SetState

func (c *Checkbox) SetState(s CheckboxState)

func (*Checkbox) SetupInputLayer

func (c *Checkbox) SetupInputLayer(def input.DeferredSetupInputLayerFunc)

func (*Checkbox) State

func (c *Checkbox) State() CheckboxState

type CheckboxChangedEventArgs

type CheckboxChangedEventArgs struct {
	Checkbox *Checkbox
	State    CheckboxState
}

type CheckboxChangedHandlerFunc

type CheckboxChangedHandlerFunc func(args *CheckboxChangedEventArgs)

type CheckboxGraphicImage

type CheckboxGraphicImage struct {
	Unchecked *ButtonImageImage
	Checked   *ButtonImageImage
	Greyed    *ButtonImageImage
}

type CheckboxOpt

type CheckboxOpt func(c *Checkbox)

type CheckboxOptions

type CheckboxOptions struct {
}
var CheckboxOpts CheckboxOptions

func (CheckboxOptions) ButtonOpts

func (o CheckboxOptions) ButtonOpts(opts ...ButtonOpt) CheckboxOpt

func (CheckboxOptions) ChangedHandler

func (CheckboxOptions) Image

func (CheckboxOptions) TriState

func (o CheckboxOptions) TriState() CheckboxOpt

type CheckboxState

type CheckboxState int

func (CheckboxState) Advance

func (s CheckboxState) Advance(triState bool) CheckboxState

type ComboButton

type ComboButton struct {
	ContentVisible bool
	// contains filtered or unexported fields
}

func NewComboButton

func NewComboButton(opts ...ComboButtonOpt) *ComboButton

func (*ComboButton) GetWidget

func (c *ComboButton) GetWidget() *Widget

func (*ComboButton) Label

func (c *ComboButton) Label() string

func (*ComboButton) PreferredSize

func (c *ComboButton) PreferredSize() (int, int)

func (*ComboButton) Render

func (c *ComboButton) Render(screen *ebiten.Image, def DeferredRenderFunc)

func (*ComboButton) SetLabel

func (c *ComboButton) SetLabel(l string)

func (*ComboButton) SetLocation

func (c *ComboButton) SetLocation(rect image.Rectangle)

func (*ComboButton) SetupInputLayer

func (c *ComboButton) SetupInputLayer(def input.DeferredSetupInputLayerFunc)

type ComboButtonOpt

type ComboButtonOpt func(c *ComboButton)

type ComboButtonOptions

type ComboButtonOptions struct {
}
var ComboButtonOpts ComboButtonOptions

func (ComboButtonOptions) ButtonOpts

func (o ComboButtonOptions) ButtonOpts(opts ...ButtonOpt) ComboButtonOpt

func (ComboButtonOptions) Content

func (ComboButtonOptions) MaxContentHeight

func (o ComboButtonOptions) MaxContentHeight(h int) ComboButtonOpt

type Container

type Container struct {
	BackgroundImage     *image.NineSlice
	AutoDisableChildren bool
	// contains filtered or unexported fields
}

func NewContainer

func NewContainer(opts ...ContainerOpt) *Container

func (*Container) AddChild

func (*Container) GetWidget

func (c *Container) GetWidget() *Widget

func (*Container) PreferredSize

func (c *Container) PreferredSize() (int, int)

func (*Container) Render

func (c *Container) Render(screen *ebiten.Image, def DeferredRenderFunc)

func (*Container) RequestRelayout

func (c *Container) RequestRelayout()

func (*Container) SetLocation

func (c *Container) SetLocation(rect img.Rectangle)

func (*Container) SetupInputLayer

func (c *Container) SetupInputLayer(def input.DeferredSetupInputLayerFunc)

func (*Container) WidgetAt

func (c *Container) WidgetAt(x int, y int) HasWidget

WidgetAt implements WidgetLocator.

type ContainerOpt

type ContainerOpt func(c *Container)

type ContainerOptions

type ContainerOptions struct {
}
var ContainerOpts ContainerOptions

func (ContainerOptions) AutoDisableChildren

func (o ContainerOptions) AutoDisableChildren() ContainerOpt

func (ContainerOptions) BackgroundImage

func (o ContainerOptions) BackgroundImage(i *image.NineSlice) ContainerOpt

func (ContainerOptions) Layout

func (o ContainerOptions) Layout(layout Layouter) ContainerOpt

func (ContainerOptions) WidgetOpts

func (o ContainerOptions) WidgetOpts(opts ...WidgetOpt) ContainerOpt

type DeferredRenderFunc

type DeferredRenderFunc func(r RenderFunc)

DeferredRenderFunc is a function that stores r for deferred execution.

type Direction

type Direction int

type DragAndDrop

type DragAndDrop struct {
	DroppedEvent *event.Event
	// contains filtered or unexported fields
}

func NewDragAndDrop

func NewDragAndDrop(opts ...DragAndDropOpt) *DragAndDrop

func (*DragAndDrop) Render

func (d *DragAndDrop) Render(screen *ebiten.Image, def DeferredRenderFunc)

func (*DragAndDrop) SetupInputLayer

func (d *DragAndDrop) SetupInputLayer(def input.DeferredSetupInputLayerFunc)

type DragAndDropDroppedEventArgs

type DragAndDropDroppedEventArgs struct {
	Source  HasWidget
	SourceX int
	SourceY int
	Target  HasWidget
	TargetX int
	TargetY int
	Data    interface{}
}

type DragAndDropDroppedHandlerFunc

type DragAndDropDroppedHandlerFunc func(args *DragAndDropDroppedEventArgs)

type DragAndDropOpt

type DragAndDropOpt func(d *DragAndDrop)

type DragAndDropOptions

type DragAndDropOptions struct {
}
var DragAndDropOpts DragAndDropOptions

func (DragAndDropOptions) Container

func (o DragAndDropOptions) Container(c Locater) DragAndDropOpt

func (DragAndDropOptions) ContentsCreater

func (DragAndDropOptions) DroppedHandler

func (DragAndDropOptions) MinDragStartDistance

func (o DragAndDropOptions) MinDragStartDistance(d int) DragAndDropOpt

type DragContentsCreater

type DragContentsCreater interface {
	Create(HasWidget, int, int) (DragWidget, interface{})
}

type DragContentsUpdater

type DragContentsUpdater interface {
	Update(HasWidget, int, int, interface{})
}

type DragWidget

type DragWidget interface {
	HasWidget
	PreferredSizer
	Locateable
	Renderer
}

type FlipBook

type FlipBook struct {
	// contains filtered or unexported fields
}

A FlipBook is a container that always renders exactly one child widget: the current page. The current page will be embedded in a AnchorLayout.

func NewFlipBook

func NewFlipBook(opts ...FlipBookOpt) *FlipBook

NewFlipBook constructs a new FlipBook configured with opts.

func (*FlipBook) GetWidget

func (f *FlipBook) GetWidget() *Widget

GetWidget implements HasWidget.

func (*FlipBook) PreferredSize

func (f *FlipBook) PreferredSize() (int, int)

PreferredSize implements PreferredSizer.

func (*FlipBook) Render

func (f *FlipBook) Render(screen *ebiten.Image, def DeferredRenderFunc)

Render implements Renderer.

func (*FlipBook) RequestRelayout

func (f *FlipBook) RequestRelayout()

RequestRelayout implements Relayoutable.

func (*FlipBook) SetLocation

func (f *FlipBook) SetLocation(rect img.Rectangle)

SetLocation implements Locateable.

func (*FlipBook) SetPage

func (f *FlipBook) SetPage(page PreferredSizeLocateableWidget)

SetPage sets the current page to be rendered to page. The previous page will no longer be rendered.

Note that when switching to a new page, it may be necessary to re-layout parent containers if the pages are of different sizes.

func (*FlipBook) SetupInputLayer

func (f *FlipBook) SetupInputLayer(def input.DeferredSetupInputLayerFunc)

SetupInputLayer implements InputLayerer.

func (*FlipBook) WidgetAt

func (f *FlipBook) WidgetAt(x int, y int) HasWidget

WidgetAt implements WidgetLocator.

type FlipBookOpt

type FlipBookOpt func(f *FlipBook)

FlipBookOpt is a function that configures f.

type FlipBookOptions

type FlipBookOptions struct {
}
var FlipBookOpts FlipBookOptions

FlipBookOpts contains functions that configure a FlipBook.

func (FlipBookOptions) ContainerOpts

func (o FlipBookOptions) ContainerOpts(opts ...ContainerOpt) FlipBookOpt

WithContainerOpts configures a FlipBook with opts.

func (FlipBookOptions) Padding

func (o FlipBookOptions) Padding(i Insets) FlipBookOpt

WithPadding configures a FlipBook with padding i.

type Focuser

type Focuser interface {
	Focus(focused bool)
}

type Graphic

type Graphic struct {
	Image          *ebiten.Image
	ImageNineSlice *image.NineSlice
	// contains filtered or unexported fields
}

func NewGraphic

func NewGraphic(opts ...GraphicOpt) *Graphic

func (*Graphic) GetWidget

func (g *Graphic) GetWidget() *Widget

func (*Graphic) PreferredSize

func (g *Graphic) PreferredSize() (int, int)

func (*Graphic) Render

func (g *Graphic) Render(screen *ebiten.Image, def DeferredRenderFunc)

func (*Graphic) SetLocation

func (g *Graphic) SetLocation(rect img.Rectangle)

type GraphicOpt

type GraphicOpt func(g *Graphic)

type GraphicOptions

type GraphicOptions struct {
}
var GraphicOpts GraphicOptions

func (GraphicOptions) Image

func (o GraphicOptions) Image(i *ebiten.Image) GraphicOpt

func (GraphicOptions) ImageNineSlice

func (o GraphicOptions) ImageNineSlice(i *image.NineSlice) GraphicOpt

func (GraphicOptions) WidgetOpts

func (o GraphicOptions) WidgetOpts(opts ...WidgetOpt) GraphicOpt

type GridLayout

type GridLayout struct {
	// contains filtered or unexported fields
}

GridLayout layouts widgets in a grid fashion, with columns or rows optionally being stretched.

Widget.LayoutData of widgets being layouted by GridLayout need to be of type GridLayoutData.

func NewGridLayout

func NewGridLayout(opts ...GridLayoutOpt) *GridLayout

NewGridLayout constructs a new GridLayout, configured by opts.

func (*GridLayout) Layout

func (g *GridLayout) Layout(widgets []PreferredSizeLocateableWidget, rect image.Rectangle)

Layout implements Layouter.

func (*GridLayout) PreferredSize

func (g *GridLayout) PreferredSize(widgets []PreferredSizeLocateableWidget) (int, int)

PreferredSize implements Layouter.

type GridLayoutData

type GridLayoutData struct {
	// MaxWidth specifies the maximum width.
	MaxWidth int

	// MaxHeight specifies the maximum height..
	MaxHeight int

	// HorizontalPosition specifies the horizontal anchoring position inside the grid cell.
	HorizontalPosition GridLayoutPosition

	// VerticalPosition specifies the vertical anchoring position inside the grid cell.
	VerticalPosition GridLayoutPosition
}

GridLayoutData specifies layout settings for a widget.

type GridLayoutOpt

type GridLayoutOpt func(g *GridLayout)

GridLayoutOpt is a function that configures g.

type GridLayoutOptions

type GridLayoutOptions struct {
}
var GridLayoutOpts GridLayoutOptions

GridLayoutOpts contains functions that configure a GridLayout.

func (GridLayoutOptions) Columns

func (o GridLayoutOptions) Columns(c int) GridLayoutOpt

Columns configures a grid layout to use c columns.

func (GridLayoutOptions) Padding

func (o GridLayoutOptions) Padding(i Insets) GridLayoutOpt

Padding configures a grid layout to use padding i.

func (GridLayoutOptions) Spacing

func (o GridLayoutOptions) Spacing(c int, r int) GridLayoutOpt

Spacing configures a grid layout to separate columns by spacing c and rows by spacing r.

func (GridLayoutOptions) Stretch

func (o GridLayoutOptions) Stretch(c []bool, r []bool) GridLayoutOpt

Stretch configures a grid layout to stretch columns according to c and rows according to r. The number of elements of c and r must correspond with the number of columns and rows in the layout.

type GridLayoutPosition

type GridLayoutPosition int

GridLayoutPosition is the type used to specify an anchoring position.

type HasWidget

type HasWidget interface {
	GetWidget() *Widget
}

HasWidget must be implemented by concrete widget types to get their Widget.

type Insets

type Insets struct {
	Top    int
	Left   int
	Right  int
	Bottom int
}

func NewInsetsSimple

func NewInsetsSimple(widthHeight int) Insets

func (Insets) Apply

func (i Insets) Apply(rect image.Rectangle) image.Rectangle

func (Insets) Dx

func (i Insets) Dx() int

func (Insets) Dy

func (i Insets) Dy() int

type Label

type Label struct {
	Label string
	// contains filtered or unexported fields
}

func NewLabel

func NewLabel(opts ...LabelOpt) *Label

func (*Label) GetWidget

func (l *Label) GetWidget() *Widget

func (*Label) PreferredSize

func (l *Label) PreferredSize() (int, int)

func (*Label) Render

func (l *Label) Render(screen *ebiten.Image, def DeferredRenderFunc)

func (*Label) SetLocation

func (l *Label) SetLocation(rect image.Rectangle)

type LabelColor

type LabelColor struct {
	Idle     color.Color
	Disabled color.Color
}

type LabelOpt

type LabelOpt func(l *Label)

type LabelOptions

type LabelOptions struct {
}
var LabelOpts LabelOptions

func (LabelOptions) Text

func (o LabelOptions) Text(label string, face font.Face, color *LabelColor) LabelOpt

func (LabelOptions) TextOpts

func (o LabelOptions) TextOpts(opts ...TextOpt) LabelOpt

type LabeledCheckbox

type LabeledCheckbox struct {
	// contains filtered or unexported fields
}

func NewLabeledCheckbox

func NewLabeledCheckbox(opts ...LabeledCheckboxOpt) *LabeledCheckbox

func (*LabeledCheckbox) Checkbox

func (l *LabeledCheckbox) Checkbox() *Checkbox

func (*LabeledCheckbox) GetWidget

func (l *LabeledCheckbox) GetWidget() *Widget

func (*LabeledCheckbox) Label

func (l *LabeledCheckbox) Label() *Label

func (*LabeledCheckbox) PreferredSize

func (l *LabeledCheckbox) PreferredSize() (int, int)

func (*LabeledCheckbox) Render

func (l *LabeledCheckbox) Render(screen *ebiten.Image, def DeferredRenderFunc)

func (*LabeledCheckbox) SetLocation

func (l *LabeledCheckbox) SetLocation(rect image.Rectangle)

func (*LabeledCheckbox) SetupInputLayer

func (l *LabeledCheckbox) SetupInputLayer(def input.DeferredSetupInputLayerFunc)

type LabeledCheckboxOpt

type LabeledCheckboxOpt func(l *LabeledCheckbox)

type LabeledCheckboxOptions

type LabeledCheckboxOptions struct {
}
var LabeledCheckboxOpts LabeledCheckboxOptions

func (LabeledCheckboxOptions) CheckboxOpts

func (o LabeledCheckboxOptions) CheckboxOpts(opts ...CheckboxOpt) LabeledCheckboxOpt

func (LabeledCheckboxOptions) LabelOpts

func (o LabeledCheckboxOptions) LabelOpts(opts ...LabelOpt) LabeledCheckboxOpt

func (LabeledCheckboxOptions) Spacing

type Layouter

type Layouter interface {
	PreferredSize(widgets []PreferredSizeLocateableWidget) (int, int)
	Layout(widgets []PreferredSizeLocateableWidget, rect image.Rectangle)
}

type List

type List struct {
	EntrySelectedEvent *event.Event
	// contains filtered or unexported fields
}

func NewList

func NewList(opts ...ListOpt) *List

func (*List) GetWidget

func (l *List) GetWidget() *Widget

func (*List) PreferredSize

func (l *List) PreferredSize() (int, int)

func (*List) Render

func (l *List) Render(screen *ebiten.Image, def DeferredRenderFunc)

func (*List) RequestRelayout

func (l *List) RequestRelayout()

func (*List) SelectedEntry

func (l *List) SelectedEntry() interface{}

func (*List) SetLocation

func (l *List) SetLocation(rect img.Rectangle)

func (*List) SetScrollLeft

func (l *List) SetScrollLeft(left float64)

func (*List) SetScrollTop

func (l *List) SetScrollTop(t float64)

func (*List) SetSelectedEntry

func (l *List) SetSelectedEntry(e interface{})

func (*List) SetupInputLayer

func (l *List) SetupInputLayer(def input.DeferredSetupInputLayerFunc)

type ListComboButton

type ListComboButton struct {
	EntrySelectedEvent *event.Event
	// contains filtered or unexported fields
}

func NewListComboButton

func NewListComboButton(opts ...ListComboButtonOpt) *ListComboButton

func (*ListComboButton) ContentVisible

func (l *ListComboButton) ContentVisible() bool

func (*ListComboButton) GetWidget

func (l *ListComboButton) GetWidget() *Widget

func (*ListComboButton) Label

func (l *ListComboButton) Label() string

func (*ListComboButton) PreferredSize

func (l *ListComboButton) PreferredSize() (int, int)

func (*ListComboButton) Render

func (l *ListComboButton) Render(screen *ebiten.Image, def DeferredRenderFunc)

func (*ListComboButton) SelectedEntry

func (l *ListComboButton) SelectedEntry() interface{}

func (*ListComboButton) SetContentVisible

func (l *ListComboButton) SetContentVisible(v bool)

func (*ListComboButton) SetLocation

func (l *ListComboButton) SetLocation(rect image.Rectangle)

func (*ListComboButton) SetSelectedEntry

func (l *ListComboButton) SetSelectedEntry(e interface{})

func (*ListComboButton) SetupInputLayer

func (l *ListComboButton) SetupInputLayer(def input.DeferredSetupInputLayerFunc)

type ListComboButtonEntrySelectedEventArgs

type ListComboButtonEntrySelectedEventArgs struct {
	Button        *ListComboButton
	Entry         interface{}
	PreviousEntry interface{}
}

type ListComboButtonEntrySelectedHandlerFunc

type ListComboButtonEntrySelectedHandlerFunc func(args *ListComboButtonEntrySelectedEventArgs)

type ListComboButtonOpt

type ListComboButtonOpt func(l *ListComboButton)

type ListComboButtonOptions

type ListComboButtonOptions struct {
}
var ListComboButtonOpts ListComboButtonOptions

func (ListComboButtonOptions) EntryLabelFunc

func (ListComboButtonOptions) EntrySelectedHandler

func (ListComboButtonOptions) ListOpts

func (ListComboButtonOptions) SelectComboButtonOpts

func (o ListComboButtonOptions) SelectComboButtonOpts(opts ...SelectComboButtonOpt) ListComboButtonOpt

func (ListComboButtonOptions) Text

type ListEntryColor

type ListEntryColor struct {
	Unselected                 color.Color
	Selected                   color.Color
	DisabledUnselected         color.Color
	DisabledSelected           color.Color
	SelectedBackground         color.Color
	DisabledSelectedBackground color.Color
}

type ListEntryLabelFunc

type ListEntryLabelFunc func(e interface{}) string

type ListEntrySelectedEventArgs

type ListEntrySelectedEventArgs struct {
	List          *List
	Entry         interface{}
	PreviousEntry interface{}
}

type ListEntrySelectedHandlerFunc

type ListEntrySelectedHandlerFunc func(args *ListEntrySelectedEventArgs)

type ListOpt

type ListOpt func(l *List)

type ListOptions

type ListOptions struct {
}
var ListOpts ListOptions

func (ListOptions) AllowReselect

func (o ListOptions) AllowReselect() ListOpt

func (ListOptions) ContainerOpts

func (o ListOptions) ContainerOpts(opts ...ContainerOpt) ListOpt

func (ListOptions) ControlWidgetSpacing

func (o ListOptions) ControlWidgetSpacing(s int) ListOpt

func (ListOptions) Entries

func (o ListOptions) Entries(e []interface{}) ListOpt

func (ListOptions) EntryColor

func (o ListOptions) EntryColor(c *ListEntryColor) ListOpt

func (ListOptions) EntryFontFace

func (o ListOptions) EntryFontFace(f font.Face) ListOpt

func (ListOptions) EntryLabelFunc

func (o ListOptions) EntryLabelFunc(f ListEntryLabelFunc) ListOpt

func (ListOptions) EntrySelectedHandler

func (o ListOptions) EntrySelectedHandler(f ListEntrySelectedHandlerFunc) ListOpt

func (ListOptions) EntryTextPadding

func (o ListOptions) EntryTextPadding(i Insets) ListOpt

func (ListOptions) HideHorizontalSlider

func (o ListOptions) HideHorizontalSlider() ListOpt

func (ListOptions) HideVerticalSlider

func (o ListOptions) HideVerticalSlider() ListOpt

func (ListOptions) ScrollContainerOpts

func (o ListOptions) ScrollContainerOpts(opts ...ScrollContainerOpt) ListOpt

func (ListOptions) SliderOpts

func (o ListOptions) SliderOpts(opts ...SliderOpt) ListOpt

type Locateable

type Locateable interface {
	SetLocation(rect image.Rectangle)
}

type Locater

type Locater interface {
	WidgetAt(x int, y int) HasWidget
}

type MultiOnce

type MultiOnce struct {
	// contains filtered or unexported fields
}

MultiOnce works like sync.Once, but can execute any number of functions.

func (*MultiOnce) Append

func (m *MultiOnce) Append(f func())

Append adds f to the list of functions to be executed. If Do has been called already, calling Append will do nothing.

func (*MultiOnce) Do

func (m *MultiOnce) Do()

Do executes all functions added using Append.

Do executes the list of functions exactly once. Calling Do a second time will do nothing.

type PreferredSizeLocateableWidget

type PreferredSizeLocateableWidget interface {
	HasWidget
	PreferredSizer
	Locateable
}

type PreferredSizer

type PreferredSizer interface {
	PreferredSize() (int, int)
}

PreferredSizer may be implemented by concrete widget types that can report a preferred size.

type RadioGroup

type RadioGroup struct {
	ChangedEvent *event.Event
	// contains filtered or unexported fields
}

func NewRadioGroup

func NewRadioGroup(opts ...RadioGroupOpt) *RadioGroup

func (*RadioGroup) Active

func (r *RadioGroup) Active() *Checkbox

func (*RadioGroup) SetActive

func (r *RadioGroup) SetActive(a *Checkbox)

type RadioGroupChangedEventArgs

type RadioGroupChangedEventArgs struct {
	Active *Checkbox
}

type RadioGroupChangedHandlerFunc

type RadioGroupChangedHandlerFunc func(args *RadioGroupChangedEventArgs)

type RadioGroupOpt

type RadioGroupOpt func(r *RadioGroup)

type RadioGroupOptions

type RadioGroupOptions struct {
}
var RadioGroupOpts RadioGroupOptions

func (RadioGroupOptions) ChangedHandler

func (RadioGroupOptions) Checkboxes

func (o RadioGroupOptions) Checkboxes(cb ...*Checkbox) RadioGroupOpt

type Relayoutable

type Relayoutable interface {
	RequestRelayout()
}

type RemoveChildFunc

type RemoveChildFunc func()

type RenderFunc

type RenderFunc func(screen *ebiten.Image, def DeferredRenderFunc)

RenderFunc is a function that renders a widget onto screen. def may be called to defer additional rendering.

type Renderer

type Renderer interface {
	// Render renders the widget onto screen. def may be called to defer additional rendering.
	Render(screen *ebiten.Image, def DeferredRenderFunc)
}

Renderer may be implemented by concrete widget types that can render onto the screen.

type RowLayout

type RowLayout struct {
	// contains filtered or unexported fields
}

RowLayout layouts widgets in either a single row or a single column, optionally stretching them in the other direction.

Widget.LayoutData of widgets being layouted by RowLayout need to be of type RowLayoutData.

func NewRowLayout

func NewRowLayout(opts ...RowLayoutOpt) *RowLayout

NewRowLayout constructs a new RowLayout, configured by opts.

func (*RowLayout) Layout

func (r *RowLayout) Layout(widgets []PreferredSizeLocateableWidget, rect image.Rectangle)

Layout implements Layouter.

func (*RowLayout) PreferredSize

func (r *RowLayout) PreferredSize(widgets []PreferredSizeLocateableWidget) (int, int)

PreferredSize implements Layouter.

type RowLayoutData

type RowLayoutData struct {
	// Position specifies the anchoring position for the direction that is not the primary direction of the layout.
	Position RowLayoutPosition

	// Stretch specifies whether to stretch in the direction that is not the primary direction of the layout.
	Stretch bool

	// MaxWidth specifies the maximum width.
	MaxWidth int

	// MaxHeight specifies the maximum height.
	MaxHeight int
}

RowLayoutData specifies layout settings for a widget.

type RowLayoutOpt

type RowLayoutOpt func(r *RowLayout)

RowLayoutOpt is a function that configures r.

type RowLayoutOptions

type RowLayoutOptions struct {
}
var RowLayoutOpts RowLayoutOptions

RowLayoutOpts contains functions that configure a RowLayout.

func (RowLayoutOptions) Direction

func (o RowLayoutOptions) Direction(d Direction) RowLayoutOpt

Direction configures a row layout to layout widgets in the primary direction d. This will also switch the meaning of any widget's RowLayoutData.Position and RowLayoutData.Stretch to the other direction.

func (RowLayoutOptions) Padding

func (o RowLayoutOptions) Padding(i Insets) RowLayoutOpt

Padding configures a row layout to use padding i.

func (RowLayoutOptions) Spacing

func (o RowLayoutOptions) Spacing(s int) RowLayoutOpt

Spacing configures a row layout to separate widgets by spacing s.

type RowLayoutPosition

type RowLayoutPosition int

RowLayoutPosition is the type used to specify an anchoring position.

type ScrollContainer

type ScrollContainer struct {
	ScrollLeft float64
	ScrollTop  float64
	// contains filtered or unexported fields
}

func NewScrollContainer

func NewScrollContainer(opts ...ScrollContainerOpt) *ScrollContainer

func (*ScrollContainer) ContentRect

func (s *ScrollContainer) ContentRect() img.Rectangle

func (*ScrollContainer) GetWidget

func (s *ScrollContainer) GetWidget() *Widget

func (*ScrollContainer) PreferredSize

func (s *ScrollContainer) PreferredSize() (int, int)

func (*ScrollContainer) Render

func (s *ScrollContainer) Render(screen *ebiten.Image, def DeferredRenderFunc)

func (*ScrollContainer) SetLocation

func (s *ScrollContainer) SetLocation(rect img.Rectangle)

func (*ScrollContainer) SetupInputLayer

func (s *ScrollContainer) SetupInputLayer(def input.DeferredSetupInputLayerFunc)

type ScrollContainerImage

type ScrollContainerImage struct {
	Idle     *image.NineSlice
	Disabled *image.NineSlice
	Mask     *image.NineSlice
}

type ScrollContainerOpt

type ScrollContainerOpt func(s *ScrollContainer)

type ScrollContainerOptions

type ScrollContainerOptions struct {
}
var ScrollContainerOpts ScrollContainerOptions

func (ScrollContainerOptions) Content

func (ScrollContainerOptions) Image

func (ScrollContainerOptions) Padding

func (ScrollContainerOptions) StretchContentWidth

func (o ScrollContainerOptions) StretchContentWidth() ScrollContainerOpt

func (ScrollContainerOptions) WidgetOpts

func (o ScrollContainerOptions) WidgetOpts(opts ...WidgetOpt) ScrollContainerOpt

type SelectComboButton

type SelectComboButton struct {
	EntrySelectedEvent *event.Event
	// contains filtered or unexported fields
}

func NewSelectComboButton

func NewSelectComboButton(opts ...SelectComboButtonOpt) *SelectComboButton

func (*SelectComboButton) ContentVisible

func (s *SelectComboButton) ContentVisible() bool

func (*SelectComboButton) GetWidget

func (s *SelectComboButton) GetWidget() *Widget

func (*SelectComboButton) Label

func (s *SelectComboButton) Label() string

func (*SelectComboButton) PreferredSize

func (s *SelectComboButton) PreferredSize() (int, int)

func (*SelectComboButton) Render

func (s *SelectComboButton) Render(screen *ebiten.Image, def DeferredRenderFunc)

func (*SelectComboButton) SelectedEntry

func (s *SelectComboButton) SelectedEntry() interface{}

func (*SelectComboButton) SetContentVisible

func (s *SelectComboButton) SetContentVisible(v bool)

func (*SelectComboButton) SetLabel

func (s *SelectComboButton) SetLabel(l string)

func (*SelectComboButton) SetLocation

func (s *SelectComboButton) SetLocation(rect image.Rectangle)

func (*SelectComboButton) SetSelectedEntry

func (s *SelectComboButton) SetSelectedEntry(e interface{})

func (*SelectComboButton) SetupInputLayer

func (s *SelectComboButton) SetupInputLayer(def input.DeferredSetupInputLayerFunc)

type SelectComboButtonEntryLabelFunc

type SelectComboButtonEntryLabelFunc func(e interface{}) string

type SelectComboButtonEntrySelectedEventArgs

type SelectComboButtonEntrySelectedEventArgs struct {
	Button        *SelectComboButton
	Entry         interface{}
	PreviousEntry interface{}
}

type SelectComboButtonEntrySelectedHandlerFunc

type SelectComboButtonEntrySelectedHandlerFunc func(args *SelectComboButtonEntrySelectedEventArgs)

type SelectComboButtonOpt

type SelectComboButtonOpt func(s *SelectComboButton)

type SelectComboButtonOptions

type SelectComboButtonOptions struct {
}
var SelectComboButtonOpts SelectComboButtonOptions

func (SelectComboButtonOptions) ComboButtonOpts

func (SelectComboButtonOptions) EntryLabelFunc

type Slider

type Slider struct {
	Min               int
	Max               int
	Current           int
	DrawTrackDisabled bool

	ChangedEvent *event.Event
	// contains filtered or unexported fields
}

func NewSlider

func NewSlider(opts ...SliderOpt) *Slider

func (*Slider) GetWidget

func (s *Slider) GetWidget() *Widget

func (*Slider) PreferredSize

func (s *Slider) PreferredSize() (int, int)

func (*Slider) Render

func (s *Slider) Render(screen *ebiten.Image, def DeferredRenderFunc)

func (*Slider) SetLocation

func (s *Slider) SetLocation(rect img.Rectangle)

func (*Slider) SetupInputLayer

func (s *Slider) SetupInputLayer(def input.DeferredSetupInputLayerFunc)

type SliderChangedEventArgs

type SliderChangedEventArgs struct {
	Slider   *Slider
	Current  int
	Dragging bool
}

type SliderChangedHandlerFunc

type SliderChangedHandlerFunc func(args *SliderChangedEventArgs)

type SliderOpt

type SliderOpt func(s *Slider)

type SliderOptions

type SliderOptions struct {
}
var SliderOpts SliderOptions

func (SliderOptions) ChangedHandler

func (o SliderOptions) ChangedHandler(f SliderChangedHandlerFunc) SliderOpt

func (SliderOptions) Direction

func (o SliderOptions) Direction(d Direction) SliderOpt

func (SliderOptions) HandleSize

func (o SliderOptions) HandleSize(s int) SliderOpt

func (SliderOptions) Images

func (o SliderOptions) Images(track *SliderTrackImage, handle *ButtonImage) SliderOpt

func (SliderOptions) MinMax

func (o SliderOptions) MinMax(min int, max int) SliderOpt

func (SliderOptions) PageSizeFunc

func (o SliderOptions) PageSizeFunc(f SliderPageSizeFunc) SliderOpt

func (SliderOptions) TrackPadding

func (o SliderOptions) TrackPadding(i Insets) SliderOpt

func (SliderOptions) WidgetOpts

func (o SliderOptions) WidgetOpts(opts ...WidgetOpt) SliderOpt

type SliderPageSizeFunc

type SliderPageSizeFunc func() int

type SliderTrackImage

type SliderTrackImage struct {
	Idle     *image.NineSlice
	Hover    *image.NineSlice
	Disabled *image.NineSlice
}

type StateButton

type StateButton struct {
	// TODO: changing this should fire an event
	State interface{}
	// contains filtered or unexported fields
}

func NewStateButton

func NewStateButton(opts ...StateButtonOpt) *StateButton

func (*StateButton) GetWidget

func (s *StateButton) GetWidget() *Widget

func (*StateButton) PreferredSize

func (s *StateButton) PreferredSize() (int, int)

func (*StateButton) Render

func (s *StateButton) Render(screen *ebiten.Image, def DeferredRenderFunc)

func (*StateButton) RequestRelayout

func (s *StateButton) RequestRelayout()

func (*StateButton) SetLocation

func (s *StateButton) SetLocation(rect image.Rectangle)

func (*StateButton) SetupInputLayer

func (s *StateButton) SetupInputLayer(def input.DeferredSetupInputLayerFunc)

type StateButtonOpt

type StateButtonOpt func(s *StateButton)

type StateButtonOptions

type StateButtonOptions struct {
}
var StateButtonOpts StateButtonOptions

func (StateButtonOptions) ButtonOpts

func (o StateButtonOptions) ButtonOpts(opts ...ButtonOpt) StateButtonOpt

func (StateButtonOptions) StateImages

func (o StateButtonOptions) StateImages(states map[interface{}]*ButtonImage) StateButtonOpt

type TabBook

type TabBook struct {
	TabSelectedEvent *event.Event
	// contains filtered or unexported fields
}

func NewTabBook

func NewTabBook(opts ...TabBookOpt) *TabBook

func (*TabBook) GetWidget

func (t *TabBook) GetWidget() *Widget

func (*TabBook) PreferredSize

func (t *TabBook) PreferredSize() (int, int)

func (*TabBook) Render

func (t *TabBook) Render(screen *ebiten.Image, def DeferredRenderFunc)

func (*TabBook) RequestRelayout

func (t *TabBook) RequestRelayout()

func (*TabBook) SetLocation

func (t *TabBook) SetLocation(rect image.Rectangle)

func (*TabBook) SetTab

func (t *TabBook) SetTab(tab *TabBookTab)

func (*TabBook) SetupInputLayer

func (t *TabBook) SetupInputLayer(def input.DeferredSetupInputLayerFunc)

func (*TabBook) Tab

func (t *TabBook) Tab() *TabBookTab

type TabBookOpt

type TabBookOpt func(t *TabBook)

type TabBookOptions

type TabBookOptions struct {
}
var TabBookOpts TabBookOptions

func (TabBookOptions) ContainerOpts

func (o TabBookOptions) ContainerOpts(opts ...ContainerOpt) TabBookOpt

func (TabBookOptions) FlipBookOpts

func (o TabBookOptions) FlipBookOpts(opts ...FlipBookOpt) TabBookOpt

func (TabBookOptions) Spacing

func (o TabBookOptions) Spacing(s int) TabBookOpt

func (TabBookOptions) TabButtonImage

func (o TabBookOptions) TabButtonImage(idle *ButtonImage, selected *ButtonImage) TabBookOpt

func (TabBookOptions) TabButtonOpts

func (o TabBookOptions) TabButtonOpts(opts ...StateButtonOpt) TabBookOpt

func (TabBookOptions) TabButtonSpacing

func (o TabBookOptions) TabButtonSpacing(s int) TabBookOpt

func (TabBookOptions) TabButtonText

func (o TabBookOptions) TabButtonText(face font.Face, color *ButtonTextColor) TabBookOpt

func (TabBookOptions) TabSelectedHandler

func (TabBookOptions) Tabs

func (o TabBookOptions) Tabs(tabs ...*TabBookTab) TabBookOpt

type TabBookTab

type TabBookTab struct {
	Disabled bool
	// contains filtered or unexported fields
}

func NewTabBookTab

func NewTabBookTab(label string, widget PreferredSizeLocateableWidget) *TabBookTab

type TabBookTabSelectedEventArgs

type TabBookTabSelectedEventArgs struct {
	TabBook     *TabBook
	Tab         *TabBookTab
	PreviousTab *TabBookTab
}

type TabBookTabSelectedHandlerFunc

type TabBookTabSelectedHandlerFunc func(args *TabBookTabSelectedEventArgs)

type Text

type Text struct {
	Label string
	Face  font.Face
	Color color.Color
	// contains filtered or unexported fields
}

func NewText

func NewText(opts ...TextOpt) *Text

func (*Text) GetWidget

func (t *Text) GetWidget() *Widget

func (*Text) PreferredSize

func (t *Text) PreferredSize() (int, int)

func (*Text) Render

func (t *Text) Render(screen *ebiten.Image, def DeferredRenderFunc)

func (*Text) SetLocation

func (t *Text) SetLocation(rect image.Rectangle)

type TextInput

type TextInput struct {
	ChangedEvent *event.Event

	InputText string
	// contains filtered or unexported fields
}

func NewTextInput

func NewTextInput(opts ...TextInputOpt) *TextInput

func (*TextInput) Focus

func (t *TextInput) Focus(focused bool)

func (*TextInput) GetWidget

func (t *TextInput) GetWidget() *Widget

func (*TextInput) PreferredSize

func (t *TextInput) PreferredSize() (int, int)

func (*TextInput) Render

func (t *TextInput) Render(screen *ebiten.Image, def DeferredRenderFunc)

func (*TextInput) SetLocation

func (t *TextInput) SetLocation(rect img.Rectangle)

type TextInputChangedEventArgs

type TextInputChangedEventArgs struct {
	TextInput *TextInput
	InputText string
}

type TextInputChangedHandlerFunc

type TextInputChangedHandlerFunc func(args *TextInputChangedEventArgs)

type TextInputColor

type TextInputColor struct {
	Idle          color.Color
	Disabled      color.Color
	Caret         color.Color
	DisabledCaret color.Color
}

type TextInputImage

type TextInputImage struct {
	Idle     *image.NineSlice
	Disabled *image.NineSlice
}

type TextInputOpt

type TextInputOpt func(t *TextInput)

type TextInputOptions

type TextInputOptions struct {
}
var TextInputOpts TextInputOptions

func (TextInputOptions) CaretOpts

func (o TextInputOptions) CaretOpts(opts ...CaretOpt) TextInputOpt

func (TextInputOptions) ChangedHandler

func (TextInputOptions) Color

func (TextInputOptions) Face

func (TextInputOptions) Image

func (TextInputOptions) Padding

func (o TextInputOptions) Padding(i Insets) TextInputOpt

func (TextInputOptions) Placeholder

func (o TextInputOptions) Placeholder(s string) TextInputOpt

func (TextInputOptions) RepeatInterval

func (o TextInputOptions) RepeatInterval(i time.Duration) TextInputOpt

func (TextInputOptions) Secure

func (o TextInputOptions) Secure(b bool) TextInputOpt

func (TextInputOptions) Validation

func (TextInputOptions) WidgetOpts

func (o TextInputOptions) WidgetOpts(opts ...WidgetOpt) TextInputOpt

type TextInputValidationFunc

type TextInputValidationFunc func(newInputText string) bool

type TextOpt

type TextOpt func(t *Text)

type TextOptions

type TextOptions struct {
}
var TextOpts TextOptions

func (TextOptions) Position

func (o TextOptions) Position(h TextPosition, v TextPosition) TextOpt

func (TextOptions) Text

func (o TextOptions) Text(label string, face font.Face, color color.Color) TextOpt

func (TextOptions) WidgetOpts

func (o TextOptions) WidgetOpts(opts ...WidgetOpt) TextOpt

type TextPosition

type TextPosition int

type TextToolTip

type TextToolTip struct {
	Label string
	// contains filtered or unexported fields
}

func NewTextToolTip

func NewTextToolTip(opts ...TextToolTipOpt) *TextToolTip

func (*TextToolTip) GetWidget

func (t *TextToolTip) GetWidget() *Widget

func (*TextToolTip) PreferredSize

func (t *TextToolTip) PreferredSize() (int, int)

func (*TextToolTip) Render

func (t *TextToolTip) Render(screen *ebiten.Image, def DeferredRenderFunc)

func (*TextToolTip) RequestRelayout

func (t *TextToolTip) RequestRelayout()

func (*TextToolTip) SetLocation

func (t *TextToolTip) SetLocation(rect img.Rectangle)

type TextToolTipOpt

type TextToolTipOpt func(t *TextToolTip)

type TextToolTipOptions

type TextToolTipOptions struct {
}
var TextToolTipOpts TextToolTipOptions

func (TextToolTipOptions) ContainerOpts

func (o TextToolTipOptions) ContainerOpts(opts ...ContainerOpt) TextToolTipOpt

func (TextToolTipOptions) Padding

func (TextToolTipOptions) TextOpts

func (o TextToolTipOptions) TextOpts(opts ...TextOpt) TextToolTipOpt

type ToolTip

type ToolTip struct {
	Sticky bool
	Delay  time.Duration
	// contains filtered or unexported fields
}

func NewToolTip

func NewToolTip(opts ...ToolTipOpt) *ToolTip

func (*ToolTip) Render

func (t *ToolTip) Render(screen *ebiten.Image, def DeferredRenderFunc)

type ToolTipContentsCreater

type ToolTipContentsCreater interface {
	Create(HasWidget) ToolTipWidget
}

type ToolTipContentsUpdater

type ToolTipContentsUpdater interface {
	Update(HasWidget)
}

type ToolTipOpt

type ToolTipOpt func(t *ToolTip)

type ToolTipOptions

type ToolTipOptions struct {
}
var ToolTipOpts ToolTipOptions

func (ToolTipOptions) Container

func (o ToolTipOptions) Container(c Locater) ToolTipOpt

func (ToolTipOptions) ContentsCreater

func (o ToolTipOptions) ContentsCreater(c ToolTipContentsCreater) ToolTipOpt

func (ToolTipOptions) Delay

func (ToolTipOptions) Offset

func (o ToolTipOptions) Offset(off img.Point) ToolTipOpt

func (ToolTipOptions) Sticky

func (o ToolTipOptions) Sticky() ToolTipOpt

type ToolTipWidget

type ToolTipWidget interface {
	PreferredSizer
	Locateable
	Renderer
}

type Widget

type Widget struct {
	// Rect specifies the widget's position on screen. It is usually not set directly, but a Layouter is
	// used to set the position in relation to other widgets or the space available.
	Rect image.Rectangle

	// LayoutData specifies additional optional data for a Layouter that is used to layout this widget's
	// parent container. The exact type depends on the layout being used, for example, GridLayout requires
	// GridLayoutData to be used.
	LayoutData interface{}

	// Disabled specifies whether the widget is disabled, whatever that means. Disabled widgets should
	// usually render in some sort of "greyed out" visual state, and not react to user input.
	//
	// Not reacting to user input depends on the actual implementation. For example, List will not allow
	// entry selection via clicking, but the scrollbars will still be usable. The reasoning is that from
	// the user's perspective, scrolling does not change state, but only the display of that state.
	Disabled bool

	// CursorEnterEvent fires an event with *WidgetCursorEnterEventArgs when the cursor enters the widget's Rect.
	CursorEnterEvent *event.Event

	// CursorExitEvent fires an event with *WidgetCursorExitEventArgs when the cursor exits the widget's Rect.
	CursorExitEvent *event.Event

	// MouseButtonPressedEvent fires an event with *WidgetMouseButtonPressedEventArgs when a mouse button is pressed
	// while the cursor is inside the widget's Rect.
	MouseButtonPressedEvent *event.Event

	// MouseButtonReleasedEvent fires an event with *WidgetMouseButtonReleasedEventArgs when a mouse button is released
	// while the cursor is inside the widget's Rect.
	MouseButtonReleasedEvent *event.Event

	// ScrolledEvent fires an event with *WidgetScrolledEventArgs when the mouse wheel is scrolled while
	// the cursor is inside the widget's Rect.
	ScrolledEvent *event.Event

	FocusEvent *event.Event
	// contains filtered or unexported fields
}

A Widget is an abstraction of a user interface widget, such as a button. Actual widget implementations "have" a Widget in their internal structure.

func NewWidget

func NewWidget(opts ...WidgetOpt) *Widget

NewWidget constructs a new Widget configured with opts.

func (*Widget) EffectiveInputLayer

func (w *Widget) EffectiveInputLayer() *input.Layer

EffectiveInputLayer returns w's effective input layer. If w does not have an input layer, or if the input layer is no longer valid, it returns w's parent widget's effective input layer. If w does not have a parent widget, it returns input.DefaultLayer.

func (*Widget) ElevateToNewInputLayer

func (w *Widget) ElevateToNewInputLayer(l *input.Layer)

ElevateToNewInputLayer adds l to the top of the input layer stack, then sets w's input layer to l.

func (*Widget) Parent

func (w *Widget) Parent() *Widget

func (*Widget) Render

func (w *Widget) Render(screen *ebiten.Image, def DeferredRenderFunc)

Render renders w onto screen. Since Widget is only an abstraction, it does not actually draw anything, but it is still responsible for firing events. Concrete widget implementations should always call this method first before rendering themselves.

func (*Widget) SetLocation

func (w *Widget) SetLocation(rect image.Rectangle)

SetLocation sets w's position to rect. This is usually not called directly, but by a layout.

type WidgetCursorEnterEventArgs

type WidgetCursorEnterEventArgs struct {
	Widget *Widget
}

WidgetCursorEnterEventArgs are the arguments for cursor enter events.

type WidgetCursorEnterHandlerFunc

type WidgetCursorEnterHandlerFunc func(args *WidgetCursorEnterEventArgs) //nolint:golint

WidgetCursorEnterHandlerFunc is a function that handles cursor enter events.

type WidgetCursorExitEventArgs

type WidgetCursorExitEventArgs struct {
	Widget *Widget
}

WidgetCursorExitEventArgs are the arguments for cursor exit events.

type WidgetCursorExitHandlerFunc

type WidgetCursorExitHandlerFunc func(args *WidgetCursorExitEventArgs) //nolint:golint

WidgetCursorExitHandlerFunc is a function that handles cursor exit events.

type WidgetFocusEventArgs

type WidgetFocusEventArgs struct {
	Widget  *Widget
	Focused bool
}

type WidgetMouseButtonPressedEventArgs

type WidgetMouseButtonPressedEventArgs struct {
	Widget *Widget
	Button ebiten.MouseButton

	// OffsetX is the x offset relative to the widget's Rect.
	OffsetX int

	// OffsetY is the y offset relative to the widget's Rect.
	OffsetY int
}

WidgetMouseButtonPressedEventArgs are the arguments for mouse button press events.

type WidgetMouseButtonPressedHandlerFunc

type WidgetMouseButtonPressedHandlerFunc func(args *WidgetMouseButtonPressedEventArgs) //nolint:golint

WidgetMouseButtonPressedHandlerFunc is a function that handles mouse button press events.

type WidgetMouseButtonReleasedEventArgs

type WidgetMouseButtonReleasedEventArgs struct {
	Widget *Widget
	Button ebiten.MouseButton

	// Inside specifies whether the button has been released inside the widget's Rect.
	Inside bool

	// OffsetX is the x offset relative to the widget's Rect.
	OffsetX int

	// OffsetY is the y offset relative to the widget's Rect.
	OffsetY int
}

WidgetMouseButtonReleasedEventArgs are the arguments for mouse button release events.

type WidgetMouseButtonReleasedHandlerFunc

type WidgetMouseButtonReleasedHandlerFunc func(args *WidgetMouseButtonReleasedEventArgs) //nolint:golint

WidgetMouseButtonReleasedHandlerFunc is a function that handles mouse button release events.

type WidgetOpt

type WidgetOpt func(w *Widget) //nolint:golint

WidgetOpt is a function that configures w.

type WidgetOptions

type WidgetOptions struct {
}
var WidgetOpts WidgetOptions

WidgetOpts contains functions that configure a Widget.

func (WidgetOptions) CursorEnterHandler

func (o WidgetOptions) CursorEnterHandler(f WidgetCursorEnterHandlerFunc) WidgetOpt

WithCursorEnterHandler configures a Widget with cursor enter event handler f.

func (WidgetOptions) CursorExitHandler

func (o WidgetOptions) CursorExitHandler(f WidgetCursorExitHandlerFunc) WidgetOpt

WithCursorExitHandler configures a Widget with cursor exit event handler f.

func (WidgetOptions) LayoutData

func (o WidgetOptions) LayoutData(ld interface{}) WidgetOpt

WithLayoutData configures a Widget with layout data ld.

func (WidgetOptions) MouseButtonPressedHandler

func (o WidgetOptions) MouseButtonPressedHandler(f WidgetMouseButtonPressedHandlerFunc) WidgetOpt

WithMouseButtonPressedHandler configures a Widget with mouse button press event handler f.

func (WidgetOptions) MouseButtonReleasedHandler

func (o WidgetOptions) MouseButtonReleasedHandler(f WidgetMouseButtonReleasedHandlerFunc) WidgetOpt

WithMouseButtonReleasedHandler configures a Widget with mouse button release event handler f.

func (WidgetOptions) ScrolledHandler

func (o WidgetOptions) ScrolledHandler(f WidgetScrolledHandlerFunc) WidgetOpt

WithScrolledHandler configures a Widget with mouse wheel scroll event handler f.

type WidgetScrolledEventArgs

type WidgetScrolledEventArgs struct {
	Widget *Widget
	X      float64
	Y      float64
}

WidgetScrolledEventArgs are the arguments for mouse wheel scroll events.

type WidgetScrolledHandlerFunc

type WidgetScrolledHandlerFunc func(args *WidgetScrolledEventArgs) //nolint:golint

WidgetScrolledHandlerFunc is a function that handles mouse wheel scroll events.

type Window

type Window struct {
	Modal bool
	// contains filtered or unexported fields
}

func NewWindow

func NewWindow(opts ...WindowOpt) *Window

func (*Window) Render

func (w *Window) Render(screen *ebiten.Image, def DeferredRenderFunc)

func (*Window) RequestRelayout

func (w *Window) RequestRelayout()

func (*Window) SetLocation

func (w *Window) SetLocation(rect image.Rectangle)

func (*Window) SetupInputLayer

func (w *Window) SetupInputLayer(def input.DeferredSetupInputLayerFunc)

type WindowOpt

type WindowOpt func(w *Window)

type WindowOptions

type WindowOptions struct {
}
var WindowOpts WindowOptions

func (WindowOptions) Contents

func (o WindowOptions) Contents(c *Container) WindowOpt

func (WindowOptions) Modal

func (o WindowOptions) Modal() WindowOpt

Jump to

Keyboard shortcuts

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