widget

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: MIT Imports: 19 Imported by: 44

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 (
	// 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 (
	WidgetUnchecked = WidgetState(iota)
	WidgetChecked
	WidgetGreyed
)
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
)
View Source
const COLOR_CLOSE = "/color]"
View Source
const COLOR_OPEN = "color="

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.

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
	ToggleMode        bool
	GraphicImage      *ButtonImageImage
	TextColor         *ButtonTextColor

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

func NewButton

func NewButton(opts ...ButtonOpt) *Button

func (*Button) Configure

func (b *Button) Configure(opts ...ButtonOpt)

func (*Button) Focus added in v0.3.0

func (b *Button) Focus(focused bool)

func (*Button) GetWidget

func (b *Button) GetWidget() *Widget

func (*Button) IsFocused added in v0.5.3

func (b *Button) IsFocused() bool

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) SetState

func (tw *Button) SetState(state WidgetState)

func (*Button) SetupInputLayer

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

func (*Button) State

func (tw *Button) State() WidgetState

func (*Button) TabOrder added in v0.3.0

func (b *Button) TabOrder() int

func (*Button) Text

func (b *Button) Text() *Text

type ButtonChangedEventArgs

type ButtonChangedEventArgs struct {
	Button *Button
	State  WidgetState
}

type ButtonChangedHandlerFunc

type ButtonChangedHandlerFunc func(args *ButtonChangedEventArgs)

type ButtonClickedEventArgs

type ButtonClickedEventArgs struct {
	Button *Button
}

type ButtonClickedHandlerFunc

type ButtonClickedHandlerFunc func(args *ButtonClickedEventArgs)

type ButtonCursorHoverHandlerFunc

type ButtonCursorHoverHandlerFunc func(args *ButtonHoverEventArgs)

type ButtonHoverEventArgs

type ButtonHoverEventArgs struct {
	Button  *Button
	Entered bool
}

type ButtonImage

type ButtonImage struct {
	Idle         *image.NineSlice
	Hover        *image.NineSlice
	Pressed      *image.NineSlice
	PressedHover *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) CursorEnteredHandler

func (o ButtonOptions) CursorEnteredHandler(f ButtonCursorHoverHandlerFunc) ButtonOpt

func (ButtonOptions) CursorExitedHandler

func (o ButtonOptions) CursorExitedHandler(f ButtonCursorHoverHandlerFunc) 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) StateChangedHandler

func (o ButtonOptions) StateChangedHandler(f ButtonChangedHandlerFunc) ButtonOpt

func (ButtonOptions) TabOrder added in v0.3.0

func (o ButtonOptions) TabOrder(tabOrder int) 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) ToggleMode

func (o ButtonOptions) ToggleMode() 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 CanDropFunc added in v0.4.0

type CanDropFunc func(args *DragAndDropDroppedEventArgs) bool

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 {
	StateChangedEvent *event.Event
	// contains filtered or unexported fields
}

func NewCheckbox

func NewCheckbox(opts ...CheckboxOpt) *Checkbox

func (*Checkbox) Focus added in v0.3.0

func (c *Checkbox) Focus(focused bool)

func (*Checkbox) GetWidget

func (c *Checkbox) GetWidget() *Widget

func (*Checkbox) IsFocused added in v0.5.3

func (c *Checkbox) IsFocused() bool

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 (tw *Checkbox) SetState(state WidgetState)

func (*Checkbox) SetupInputLayer

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

func (*Checkbox) State

func (tw *Checkbox) State() WidgetState

func (*Checkbox) TabOrder added in v0.3.0

func (c *Checkbox) TabOrder() int

type CheckboxChangedEventArgs

type CheckboxChangedEventArgs struct {
	Active *Checkbox
	State  WidgetState
}

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) Image

func (CheckboxOptions) StateChangedHandler

func (o CheckboxOptions) StateChangedHandler(f CheckboxChangedHandlerFunc) CheckboxOpt

func (CheckboxOptions) TabOrder added in v0.3.0

func (o CheckboxOptions) TabOrder(tabOrder int) CheckboxOpt

func (CheckboxOptions) TriState

func (o CheckboxOptions) TriState() CheckboxOpt

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) Children added in v0.3.0

func (c *Container) Children() []PreferredSizeLocateableWidget

func (*Container) GetDropTargets added in v0.4.0

func (c *Container) GetDropTargets() []HasWidget

func (*Container) GetFocusers added in v0.3.0

func (c *Container) GetFocusers() []Focuser

func (*Container) GetWidget

func (c *Container) GetWidget() *Widget

func (*Container) PreferredSize

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

func (*Container) RemoveChild

func (c *Container) RemoveChild(child PreferredSizeLocateableWidget)

func (*Container) RemoveChildren

func (c *Container) RemoveChildren()

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 {
	ContentsOriginVertical   DragAndDropAnchor
	ContentsOriginHorizontal DragAndDropAnchor
	Offset                   image.Point

	AvailableDropTargets []HasWidget
	// contains filtered or unexported fields
}

func NewDragAndDrop

func NewDragAndDrop(opts ...DragAndDropOpt) *DragAndDrop

func (*DragAndDrop) Render

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

func (*DragAndDrop) SetupInputLayer

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

func (*DragAndDrop) StartDrag added in v0.4.0

func (d *DragAndDrop) StartDrag()

To avoid conflicting with dragging, if you trigger it on left click you should put the trigger in the button released event

func (*DragAndDrop) StopDrag added in v0.4.0

func (d *DragAndDrop) StopDrag()

type DragAndDropAnchor added in v0.4.0

type DragAndDropAnchor int
const (
	// Anchor at the start of the element
	DND_ANCHOR_START DragAndDropAnchor = iota
	// Anchor in the middle of the element
	DND_ANCHOR_MIDDLE
	// Anchor at the end of the element
	DND_ANCHOR_END
)

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) ContentsCreater

func (DragAndDropOptions) ContentsOriginHorizontal added in v0.4.0

func (o DragAndDropOptions) ContentsOriginHorizontal(contentsOriginHorizontal DragAndDropAnchor) DragAndDropOpt

The horizontal position of the anchor on the tooltip.

Optional - Defaults to DND_ANCHOR_MIDDLE

func (DragAndDropOptions) ContentsOriginVertical added in v0.4.0

func (o DragAndDropOptions) ContentsOriginVertical(contentsOriginVertical DragAndDropAnchor) DragAndDropOpt

The vertical position of the anchor on the tooltip.

Optional - Defaults to DND_ANCHOR_MIDDLE

func (DragAndDropOptions) DisableDrag added in v0.4.0

func (o DragAndDropOptions) DisableDrag() DragAndDropOpt

Disable Drag to start Drag and Drop. You may use the "StartDrag()" method on this object or the to begin the drag operation.

Expected use-case: click to pick up, click to drop.

func (DragAndDropOptions) MinDragStartDistance

func (o DragAndDropOptions) MinDragStartDistance(d int) DragAndDropOpt

The minimum distance in pixels a user must drag their cursor to display the dragged element.

Optional - Defaults to 15 pixels

func (DragAndDropOptions) Offset added in v0.4.0

The X/Y offsets from the Tooltip anchor point

type DragContentsCreater

type DragContentsCreater interface {
	Create(HasWidget) (*Container, interface{})
}

type DragContentsEnder added in v0.4.3

type DragContentsEnder interface {
	// arg1 - Drop was successful
	// arg2 - Source Widget
	// arg3 - DragData
	EndDrag(bool, HasWidget, interface{})
}

type DragContentsUpdater

type DragContentsUpdater interface {
	// arg1 - isDroppable
	// arg2 - HasWidget if droppable
	// arg3 - DragData
	Update(bool, HasWidget, interface{})
}

type DropFunc added in v0.4.0

type DropFunc func(args *DragAndDropDroppedEventArgs)

type Dropper added in v0.4.3

type Dropper interface {
	GetDropTargets() []HasWidget
}

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) GetDropTargets added in v0.4.0

func (f *FlipBook) GetDropTargets() []HasWidget

func (*FlipBook) GetFocusers added in v0.3.0

func (f *FlipBook) GetFocusers() []Focuser

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)
	IsFocused() bool
	TabOrder() int
}

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 LabelOrder added in v0.4.1

type LabelOrder int
const (
	CHECKBOX_FIRST LabelOrder = iota
	LABEL_FIRST
)

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) Focus added in v0.3.0

func (l *LabeledCheckbox) Focus(focused bool)

func (*LabeledCheckbox) GetWidget

func (l *LabeledCheckbox) GetWidget() *Widget

func (*LabeledCheckbox) IsFocused added in v0.5.3

func (l *LabeledCheckbox) IsFocused() bool

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) SetState added in v0.4.1

func (l *LabeledCheckbox) SetState(state WidgetState)

func (*LabeledCheckbox) SetupInputLayer

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

func (*LabeledCheckbox) TabOrder added in v0.3.0

func (l *LabeledCheckbox) TabOrder() int

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) LabelFirst added in v0.4.1

func (LabeledCheckboxOptions) LabelOpts

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

func (LabeledCheckboxOptions) Spacing

func (LabeledCheckboxOptions) WidgetOpts added in v0.4.1

func (o LabeledCheckboxOptions) WidgetOpts(opts ...WidgetOpt) LabeledCheckboxOpt

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) Focus added in v0.3.0

func (l *List) Focus(focused bool)

func (*List) GetWidget

func (l *List) GetWidget() *Widget

func (*List) IsFocused added in v0.5.3

func (l *List) IsFocused() bool

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) SetSelectedEntry

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

func (*List) SetupInputLayer

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

func (*List) TabOrder added in v0.3.0

func (l *List) TabOrder() int

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) Focus added in v0.3.0

func (l *ListComboButton) Focus(focused bool)

func (*ListComboButton) GetWidget

func (l *ListComboButton) GetWidget() *Widget

func (*ListComboButton) IsFocused added in v0.5.3

func (l *ListComboButton) IsFocused() bool

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)

func (*ListComboButton) TabOrder added in v0.3.0

func (l *ListComboButton) TabOrder() int

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) DisableDefaultKeys added in v0.3.3

func (o ListComboButtonOptions) DisableDefaultKeys(val bool) ListComboButtonOpt

func (ListComboButtonOptions) EntryLabelFunc

func (ListComboButtonOptions) EntrySelectedHandler

func (ListComboButtonOptions) ListOpts

func (ListComboButtonOptions) SelectComboButtonOpts

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

func (ListComboButtonOptions) TabOrder added in v0.3.0

func (o ListComboButtonOptions) TabOrder(tabOrder int) ListComboButtonOpt

func (ListComboButtonOptions) Text

type ListEntryColor

type ListEntryColor struct {
	Unselected                 color.Color
	Selected                   color.Color
	DisabledUnselected         color.Color
	DisabledSelected           color.Color
	SelectedBackground         color.Color
	FocusedBackground          color.Color
	SelectedFocusedBackground  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) DisableDefaultKeys added in v0.3.3

func (o ListOptions) DisableDefaultKeys(val bool) 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

func (ListOptions) TabOrder added in v0.3.0

func (o ListOptions) TabOrder(tabOrder int) 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 ProgressBar

type ProgressBar struct {
	Min int
	Max int
	// contains filtered or unexported fields
}

func NewProgressBar

func NewProgressBar(opts ...ProgressBarOpt) *ProgressBar

func (*ProgressBar) Configure

func (s *ProgressBar) Configure(opts ...ProgressBarOpt)

func (*ProgressBar) GetCurrent

func (s *ProgressBar) GetCurrent() int

func (*ProgressBar) GetWidget

func (s *ProgressBar) GetWidget() *Widget

func (*ProgressBar) PreferredSize

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

func (*ProgressBar) Render

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

func (*ProgressBar) SetCurrent

func (s *ProgressBar) SetCurrent(value int) bool

func (*ProgressBar) SetLocation

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

type ProgressBarImage

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

type ProgressBarOpt

type ProgressBarOpt func(s *ProgressBar)

type ProgressBarOptions

type ProgressBarOptions struct {
}
var ProgressBarOpts ProgressBarOptions

func (ProgressBarOptions) Images

func (ProgressBarOptions) TrackPadding

func (o ProgressBarOptions) TrackPadding(i Insets) ProgressBarOpt

func (ProgressBarOptions) Values

func (o ProgressBarOptions) Values(min int, max int, current int) ProgressBarOpt

func (ProgressBarOptions) WidgetOpts

func (o ProgressBarOptions) WidgetOpts(opts ...WidgetOpt) ProgressBarOpt

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() RadioGroupElement

func (*RadioGroup) SetActive

func (r *RadioGroup) SetActive(a RadioGroupElement)

type RadioGroupChangedEventArgs

type RadioGroupChangedEventArgs struct {
	Active RadioGroupElement
}

type RadioGroupChangedHandlerFunc

type RadioGroupChangedHandlerFunc func(args *RadioGroupChangedEventArgs)

type RadioGroupElement

type RadioGroupElement interface {
	SetState(state WidgetState)
	// contains filtered or unexported methods
}

type RadioGroupOpt

type RadioGroupOpt func(r *RadioGroup)

type RadioGroupOptions

type RadioGroupOptions struct {
}
var RadioGroupOpts RadioGroupOptions

func (RadioGroupOptions) ChangedHandler

func (RadioGroupOptions) Elements

type Relayoutable

type Relayoutable interface {
	RequestRelayout()
}

type RemoveChildFunc

type RemoveChildFunc func()

type RemoveWindowFunc

type RemoveWindowFunc 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) GetDropTargets added in v0.4.0

func (s *ScrollContainer) GetDropTargets() []HasWidget

func (*ScrollContainer) GetFocusers added in v0.3.0

func (s *ScrollContainer) GetFocusers() []Focuser

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 ScrollMode added in v0.2.7

type ScrollMode int
const (
	// Default. Scrolling is not automatically handled
	None ScrollMode = iota

	// The TextArea is automatically scrolled to the beginning on change
	ScrollBeginning

	// The TextArea is automatically scrolled to the end on change
	ScrollEnd

	// The TextArea will initially position the text at the end of the scroll area
	PositionAtEnd
)

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) Focus added in v0.3.0

func (s *Slider) Focus(focused bool)

func (*Slider) GetWidget

func (s *Slider) GetWidget() *Widget

func (*Slider) IsFocused added in v0.5.3

func (s *Slider) IsFocused() bool

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)

func (*Slider) TabOrder added in v0.3.0

func (s *Slider) TabOrder() int

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) DisableDefaultKeys added in v0.3.3

func (o SliderOptions) DisableDefaultKeys(val bool) SliderOpt

func (SliderOptions) FixedHandleSize

func (o SliderOptions) FixedHandleSize(s int) SliderOpt

func (SliderOptions) Images

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

func (SliderOptions) MinHandleSize

func (o SliderOptions) MinHandleSize(s int) 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) TabOrder added in v0.3.0

func (o SliderOptions) TabOrder(tabOrder int) SliderOpt

func (SliderOptions) TrackOffset

func (o SliderOptions) TrackOffset(i int) 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 StackedLayout added in v0.2.4

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

StackedLayout lays out multiple widgets stacked on top of each other in the order they are added as children Each child will have the dimensions equal to the max size of all the StackedLayout's children

Note: Events will propogate to each layer. e.g. if you have overlapping buttons, a click event over both will trigger both events.

Widget.LayoutData of widgets being layed out by StackedLayout should be left empty.

func NewStackedLayout added in v0.2.4

func NewStackedLayout(opts ...StackedLayoutOpt) *StackedLayout

NewStackedLayout constructs a new StackedLayout, configured by opts.

func (*StackedLayout) Layout added in v0.2.4

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

Layout implements Layouter.

func (*StackedLayout) PreferredSize added in v0.2.4

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

PreferredSize implements Layouter.

type StackedLayoutData added in v0.2.4

type StackedLayoutData struct {
}

StackedLayoutData specifies layout settings for a widget.

type StackedLayoutOpt added in v0.2.4

type StackedLayoutOpt func(a *StackedLayout)

StackedLayoutOpt is a function that configures a.

type StackedLayoutOptions added in v0.2.4

type StackedLayoutOptions struct {
}
var StackedLayoutOpts StackedLayoutOptions

StackedLayoutOpts contains functions that configure an StackedLayout.

func (StackedLayoutOptions) Padding added in v0.2.4

Padding configures an Stacked layout to use padding i.

type TabBook

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

func NewTabBook

func NewTabBook(opts ...TabBookOpt) *TabBook

func (*TabBook) GetDropTargets added in v0.4.3

func (t *TabBook) GetDropTargets() []HasWidget

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(buttonImages *ButtonImage) TabBookOpt

func (TabBookOptions) TabButtonOpts

func (o TabBookOptions) TabButtonOpts(opts ...ButtonOpt) 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 {
	Container
	Disabled bool
	// contains filtered or unexported fields
}

func NewTabBookTab

func NewTabBookTab(label string, opts ...ContainerOpt) *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
	MaxWidth float64
	Inset    Insets
	// 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 TextArea

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

func NewTextArea

func NewTextArea(opts ...TextAreaOpt) *TextArea

func (*TextArea) AppendText

func (l *TextArea) AppendText(value string)

func (*TextArea) GetFocusers added in v0.3.0

func (l *TextArea) GetFocusers() []Focuser

func (*TextArea) GetText

func (l *TextArea) GetText() string

func (*TextArea) GetWidget

func (l *TextArea) GetWidget() *Widget

func (*TextArea) PreferredSize

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

func (*TextArea) PrependText

func (l *TextArea) PrependText(value string)

func (*TextArea) Render

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

func (*TextArea) RequestRelayout

func (l *TextArea) RequestRelayout()

func (*TextArea) SetLocation

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

func (*TextArea) SetText

func (l *TextArea) SetText(value string)

func (*TextArea) SetupInputLayer

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

type TextAreaEntrySelectedEventArgs

type TextAreaEntrySelectedEventArgs struct {
	TextArea      *TextArea
	Entry         interface{}
	PreviousEntry interface{}
}

type TextAreaEntrySelectedHandlerFunc

type TextAreaEntrySelectedHandlerFunc func(args *TextAreaEntrySelectedEventArgs)

type TextAreaOpt

type TextAreaOpt func(l *TextArea)

type TextAreaOptions

type TextAreaOptions struct {
}
var TextAreaOpts TextAreaOptions

func (TextAreaOptions) ContainerOpts

func (o TextAreaOptions) ContainerOpts(opts ...ContainerOpt) TextAreaOpt

Specify the Container options for the text area

func (TextAreaOptions) ControlWidgetSpacing

func (o TextAreaOptions) ControlWidgetSpacing(s int) TextAreaOpt

Specify spacing between the text container and scrollbars

func (TextAreaOptions) FontColor

func (o TextAreaOptions) FontColor(color color.Color) TextAreaOpt

Set the default color for the text area

func (TextAreaOptions) FontFace

func (o TextAreaOptions) FontFace(f font.Face) TextAreaOpt

Set the font face for this text area

func (TextAreaOptions) HorizontalScrollMode added in v0.2.7

func (o TextAreaOptions) HorizontalScrollMode(scrollMode ScrollMode) TextAreaOpt

Set how horizontal scrolling should be handled

func (TextAreaOptions) ProcessBBCode added in v0.2.7

func (o TextAreaOptions) ProcessBBCode(processBBCode bool) TextAreaOpt

Set whether or not the text area should process BBCodes. e.g. [color=FF0000]red[/color]

func (TextAreaOptions) ScrollContainerOpts

func (o TextAreaOptions) ScrollContainerOpts(opts ...ScrollContainerOpt) TextAreaOpt

Specify the options for the scroll container

func (TextAreaOptions) ShowHorizontalScrollbar added in v0.2.7

func (o TextAreaOptions) ShowHorizontalScrollbar() TextAreaOpt

Show the horizontal scrollbar.

func (TextAreaOptions) ShowVerticalScrollbar added in v0.2.7

func (o TextAreaOptions) ShowVerticalScrollbar() TextAreaOpt

Show the vertical scrollbar.

func (TextAreaOptions) SliderOpts

func (o TextAreaOptions) SliderOpts(opts ...SliderOpt) TextAreaOpt

Specify the options for the scroll bars

func (TextAreaOptions) Text

func (o TextAreaOptions) Text(initialText string) TextAreaOpt

Set the initial Text for the text area

func (TextAreaOptions) TextPadding

func (o TextAreaOptions) TextPadding(i Insets) TextAreaOpt

Set how far from the edges of the textarea the text should be set

func (TextAreaOptions) VerticalScrollMode added in v0.2.7

func (o TextAreaOptions) VerticalScrollMode(scrollMode ScrollMode) TextAreaOpt

Set how vertical scrolling should be handled

type TextInput

type TextInput struct {
	ChangedEvent *event.Event
	SubmitEvent  *event.Event

	InputText string
	// contains filtered or unexported fields
}

func NewTextInput

func NewTextInput(opts ...TextInputOpt) *TextInput

func (*TextInput) Backspace added in v0.5.4

func (t *TextInput) Backspace()

func (*TextInput) CursorMoveEnd added in v0.5.4

func (t *TextInput) CursorMoveEnd()

func (*TextInput) CursorMoveLeft added in v0.5.4

func (t *TextInput) CursorMoveLeft()

func (*TextInput) CursorMoveRight added in v0.5.4

func (t *TextInput) CursorMoveRight()

func (*TextInput) CursorMoveStart added in v0.5.4

func (t *TextInput) CursorMoveStart()

func (*TextInput) Delete added in v0.5.4

func (t *TextInput) Delete()

func (*TextInput) Focus

func (t *TextInput) Focus(focused bool)

func (*TextInput) GetWidget

func (t *TextInput) GetWidget() *Widget

func (*TextInput) Insert added in v0.5.4

func (t *TextInput) Insert(c []rune)

func (*TextInput) IsFocused added in v0.5.3

func (t *TextInput) IsFocused() bool

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)

func (*TextInput) Submit added in v0.5.4

func (t *TextInput) Submit()

func (*TextInput) TabOrder added in v0.3.0

func (t *TextInput) TabOrder() int

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) AllowDuplicateSubmit added in v0.2.1

func (o TextInputOptions) AllowDuplicateSubmit(allowDuplicateSubmit bool) TextInputOpt

func (TextInputOptions) CaretOpts

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

func (TextInputOptions) ChangedHandler

func (TextInputOptions) ClearOnSubmit added in v0.2.1

func (o TextInputOptions) ClearOnSubmit(clearOnSubmit bool) TextInputOpt

func (TextInputOptions) Color

func (TextInputOptions) Face

func (TextInputOptions) IgnoreEmptySubmit added in v0.2.1

func (o TextInputOptions) IgnoreEmptySubmit(ignoreEmptySubmit bool) TextInputOpt

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) SubmitHandler added in v0.2.1

func (TextInputOptions) TabOrder added in v0.3.0

func (o TextInputOptions) TabOrder(to int) TextInputOpt

func (TextInputOptions) Validation

func (TextInputOptions) WidgetOpts

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

type TextInputValidationFunc

type TextInputValidationFunc func(newInputText string) (bool, *string)

type TextOpt

type TextOpt func(t *Text)

type TextOptions

type TextOptions struct {
}
var TextOpts TextOptions

func (TextOptions) Insets

func (o TextOptions) Insets(inset Insets) TextOpt

func (TextOptions) MaxWidth added in v0.5.4

func (o TextOptions) MaxWidth(maxWidth float64) TextOpt

This sets the max width the text will allow before wrapping to the next line

func (TextOptions) Position

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

func (TextOptions) ProcessBBCode added in v0.2.7

func (o TextOptions) ProcessBBCode(processBBCode bool) 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 ToolTip

type ToolTip struct {
	Position                ToolTipPosition
	WidgetOriginVertical    ToolTipAnchor
	WidgetOriginHorizontal  ToolTipAnchor
	ContentOriginVertical   ToolTipAnchor
	ContentOriginHorizontal ToolTipAnchor
	Delay                   time.Duration
	Offset                  image.Point

	ToolTipUpdater ToolTipUpdater
	// contains filtered or unexported fields
}

func NewTextToolTip

func NewTextToolTip(label string, face font.Face, color color.Color, background *e_image.NineSlice) *ToolTip

Create a new Text Tooltip with the following defaults:

  • ProcessBBCode = true
  • Padding = Top/Bottom: 5px Left/Right: 10px
  • Delay = 800ms
  • Offset = 0, 20
  • ContentOriginHorizontal = TOOLTIP_ANCHOR_END
  • ContentOriginVertical = TOOLTIP_ANCHOR_START

func NewToolTip

func NewToolTip(opts ...ToolTipOpt) *ToolTip

Create a new Tooltip. This method allows you to specify every aspect of the displayed tooltip's content.

func (*ToolTip) Render

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

type ToolTipAnchor added in v0.3.0

type ToolTipAnchor int
const (
	// Anchor at the start of the element
	TOOLTIP_ANCHOR_START ToolTipAnchor = iota
	// Anchor in the middle of the element
	TOOLTIP_ANCHOR_MIDDLE
	// Anchor at the end of the element
	TOOLTIP_ANCHOR_END
)

type ToolTipDirection added in v0.3.0

type ToolTipDirection int

type ToolTipOpt

type ToolTipOpt func(t *ToolTip)

type ToolTipOptions

type ToolTipOptions struct {
}
var ToolTipOpts ToolTipOptions

func (ToolTipOptions) Content added in v0.3.0

func (o ToolTipOptions) Content(c *Container) ToolTipOpt

The container to be displayed

func (ToolTipOptions) ContentOriginHorizontal added in v0.3.0

func (o ToolTipOptions) ContentOriginHorizontal(contentOriginHorizontal ToolTipAnchor) ToolTipOpt

The horizontal position of the anchor on the tooltip.

func (ToolTipOptions) ContentOriginVertical added in v0.3.0

func (o ToolTipOptions) ContentOriginVertical(contentOriginVertical ToolTipAnchor) ToolTipOpt

The vertical position of the anchor on the tooltip.

func (ToolTipOptions) Delay

How long to wait before displaying the tooltip

func (ToolTipOptions) Offset

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

The X/Y offsets from the Tooltip anchor point

func (ToolTipOptions) Position added in v0.3.0

func (o ToolTipOptions) Position(position ToolTipPosition) ToolTipOpt

Where to display the tooltip

func (ToolTipOptions) ToolTipUpdater added in v0.3.0

func (o ToolTipOptions) ToolTipUpdater(toolTipUpdater ToolTipUpdater) ToolTipOpt

A method that is called every draw call that the tooltip is visible. This allows you to hook into the draw loop to update the tooltip if necessary

func (ToolTipOptions) WidgetOriginHorizontal added in v0.3.0

func (o ToolTipOptions) WidgetOriginHorizontal(widgetOriginHorizontal ToolTipAnchor) ToolTipOpt

The horizontal position of the anchor on the widget. Only used when Postion = WIDGET

func (ToolTipOptions) WidgetOriginVertical added in v0.3.0

func (o ToolTipOptions) WidgetOriginVertical(widgetOriginVertical ToolTipAnchor) ToolTipOpt

The vertical position of the anchor on the widget. Only used when Postion = WIDGET

type ToolTipPosition added in v0.3.0

type ToolTipPosition int
const (
	// The tooltip will follow the cursor around while visible
	TOOLTIP_POS_CURSOR_FOLLOW ToolTipPosition = iota
	// The tooltip will stick to where the cursor was when the tooltip was made visible
	TOOLTIP_POS_CURSOR_STICKY
	// The tooltip will display based on the Widget and Content anchor settings.
	// It defaults to opening right aligned and directly under the widget.
	TOOLTIP_POS_WIDGET
)

type ToolTipUpdater added in v0.3.0

type ToolTipUpdater func(*Container)

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{}

	//The minimum width for this Widget
	MinWidth int

	//The minimum height for this Widget
	MinHeight int

	// 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

	ContextMenuEvent *event.Event

	ToolTipEvent *event.Event

	DragAndDropEvent *event.Event

	//Custom Data is a field to allow users to attach data to any widget
	CustomData interface{}

	ContextMenu          *Container
	ContextMenuWindow    *Window
	ContextMenuCloseMode WindowCloseMode

	ToolTip *ToolTip

	DragAndDrop *DragAndDrop

	CursorHovered string
	CursorPressed string
	// 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) FireContextMenuEvent added in v0.2.10

func (widget *Widget) FireContextMenuEvent(w *Widget, l image.Point)

func (*Widget) FireDragAndDropEvent added in v0.4.0

func (widget *Widget) FireDragAndDropEvent(w *Window, show bool, dnd *DragAndDrop)

func (*Widget) FireFocusEvent added in v0.3.0

func (widget *Widget) FireFocusEvent(w HasWidget, focused bool, location image.Point)

func (*Widget) FireToolTipEvent added in v0.3.0

func (widget *Widget) FireToolTipEvent(w *Window, show bool)

func (*Widget) Parent

func (w *Widget) Parent() *Widget

func (*Widget) Render

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

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 WidgetContextMenuEventArgs added in v0.2.10

type WidgetContextMenuEventArgs struct {
	Widget   *Widget
	Location image.Point
}

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 WidgetDragAndDropEventArgs added in v0.4.0

type WidgetDragAndDropEventArgs struct {
	Window *Window
	Show   bool
	DnD    *DragAndDrop
}

type WidgetFocusEventArgs

type WidgetFocusEventArgs struct {
	Widget   HasWidget
	Focused  bool
	Location image.Point
}

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) CanDrop added in v0.4.0

func (o WidgetOptions) CanDrop(candropFunc CanDropFunc) WidgetOpt

This sets the widget as a target of a Drag and Drop action

The Drop function must return true if it accepts this drop and false if it does not accept the drop

func (WidgetOptions) ContextMenu added in v0.2.10

func (o WidgetOptions) ContextMenu(contextMenu *Container) WidgetOpt

func (WidgetOptions) ContextMenuCloseMode added in v0.2.10

func (o WidgetOptions) ContextMenuCloseMode(contextMenuCloseMode WindowCloseMode) WidgetOpt

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) CursorHovered added in v0.5.0

func (o WidgetOptions) CursorHovered(cursorHovered string) WidgetOpt

func (WidgetOptions) CursorPressed added in v0.5.0

func (o WidgetOptions) CursorPressed(cursorPressed string) WidgetOpt

func (WidgetOptions) CustomData

func (o WidgetOptions) CustomData(cd interface{}) WidgetOpt

WithCustomData configures a Widget with custom data cd.

func (WidgetOptions) Dropped added in v0.4.0

func (o WidgetOptions) Dropped(dropFunc DropFunc) WidgetOpt

This is the function that is run if an item is dropped on this widget

func (WidgetOptions) EnableDragAndDrop added in v0.4.0

func (o WidgetOptions) EnableDragAndDrop(d *DragAndDrop) WidgetOpt

This sets the source of a Drag and Drop action

func (WidgetOptions) LayoutData

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

WithLayoutData configures a Widget with layout data ld.

func (WidgetOptions) MinSize

func (o WidgetOptions) MinSize(minWidth int, minHeight int) WidgetOpt

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.

func (WidgetOptions) ToolTip added in v0.3.0

func (o WidgetOptions) ToolTip(toolTip *ToolTip) WidgetOpt

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 WidgetState

type WidgetState int

func (WidgetState) Advance

func (s WidgetState) Advance(triState bool) WidgetState

type WidgetToolTipEventArgs added in v0.3.0

type WidgetToolTipEventArgs struct {
	Window *Window
	Show   bool
}

type Window

type Window struct {
	ResizeEvent *event.Event
	MoveEvent   *event.Event

	Modal      bool
	Contents   *Container
	TitleBar   *Container
	Draggable  bool
	Resizeable bool
	MinSize    *image.Point
	MaxSize    *image.Point
	DrawLayer  int
	//Used to indicate this window should close if other windows close.
	Ephemeral bool
	// contains filtered or unexported fields
}

func NewWindow

func NewWindow(opts ...WindowOpt) *Window

func (*Window) Close

func (w *Window) Close()

This method is used to be able to close the window

func (*Window) GetContainer added in v0.2.10

func (w *Window) GetContainer() *Container

Typically used internally.

Returns the root container that holds the provided titlebar and contents

func (*Window) Render

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

Typically used internally

func (*Window) RequestRelayout

func (w *Window) RequestRelayout()

Typically used internally

func (*Window) SetCloseFunction

func (w *Window) SetCloseFunction(close RemoveWindowFunc)

Typically used internally.

func (*Window) SetLocation

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

This method will set the size and location of this window. This method will account for specified MinSize and MaxSize values.

func (*Window) SetupInputLayer

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

Typically used internally

type WindowChangedEventArgs added in v0.2.3

type WindowChangedEventArgs struct {
	Window *Window
	Rect   image.Rectangle
}

type WindowChangedHandlerFunc added in v0.2.3

type WindowChangedHandlerFunc func(args *WindowChangedEventArgs)

type WindowCloseMode added in v0.2.10

type WindowCloseMode int
const (
	// The window will not automatically close
	NONE WindowCloseMode = iota
	// The window will close when you click anywhere
	CLICK
	// The window will close when you click outside the window
	CLICK_OUT
)

type WindowOpt

type WindowOpt func(w *Window)

type WindowOptions

type WindowOptions struct {
}
var WindowOpts WindowOptions

func (WindowOptions) CloseMode added in v0.2.10

func (o WindowOptions) CloseMode(mode WindowCloseMode) WindowOpt

Set the way this window should close

func (WindowOptions) Contents

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

This is the container with the body of this window

func (WindowOptions) Draggable added in v0.2.3

func (o WindowOptions) Draggable() WindowOpt

Sets the window to be draggable. The handle for this is the titleBar. If you haven't provided a titleBar this option is ignored

func (WindowOptions) DrawLayer added in v0.3.2

func (o WindowOptions) DrawLayer(layer int) WindowOpt

This option sets order the window will be drawn

  • < 0 will have the window drawn before the container
  • >= 0 will have the window drawn after the container

func (WindowOptions) Location added in v0.2.7

func (o WindowOptions) Location(rect image.Rectangle) WindowOpt

This option sets the size and location of the window. This method will account for specified MinSize and MaxSize values.

func (WindowOptions) MaxSize added in v0.2.3

func (o WindowOptions) MaxSize(width int, height int) WindowOpt

Set the maximum size that the window can be resized to

func (WindowOptions) MinSize added in v0.2.3

func (o WindowOptions) MinSize(width int, height int) WindowOpt

Sets the minimum size that the window can be reszied to

func (WindowOptions) Modal

func (o WindowOptions) Modal() WindowOpt

Sets the window to be modal. Blocking UI interactions on anything else.

func (WindowOptions) MoveHandler added in v0.2.3

This handler is triggered when a move event is completed

func (WindowOptions) ResizeHandler added in v0.2.3

This handler is triggered when a resize event is completed

func (WindowOptions) Resizeable added in v0.2.3

func (o WindowOptions) Resizeable() WindowOpt

Sets the window to be resizeable

func (WindowOptions) TitleBar added in v0.2.3

func (o WindowOptions) TitleBar(tb *Container, height int) WindowOpt

Sets the container for the TitleBar and its fixed height

Jump to

Keyboard shortcuts

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