Documentation
¶
Index ¶
- func DispatchEvent(widget Widget, eventName string, args ...any)
- func RequestRebuild(widget Widget)
- func RequestRedraw(widget Widget)
- func Run(root Widget, options *RunOptions) error
- func RunWithCustomFunc(root Widget, options *RunOptions, ...) error
- func SetEventHandler(widget Widget, eventName string, handler any)
- type ChildAdder
- type ChildLayouter
- type ColorMode
- type Constraints
- type Context
- func (c *Context) AppBounds() image.Rectangle
- func (c *Context) AppScale() float64
- func (c *Context) AppendAppLocales(locales []language.Tag) []language.Tag
- func (c *Context) AppendLocales(locales []language.Tag) []language.Tag
- func (c *Context) ColorMode() ColorMode
- func (c *Context) DelegateFocus(from Widget, to Widget)
- func (c *Context) DeviceScale() float64
- func (c *Context) IsAutoColorModeUsed() bool
- func (c *Context) IsEnabled(widget Widget) bool
- func (c *Context) IsFocused(widget Widget) bool
- func (c *Context) IsFocusedOrHasFocusedChild(widget Widget) bool
- func (c *Context) IsVisible(widget Widget) bool
- func (c *Context) Model(widget Widget, key any) any
- func (c *Context) Opacity(widget Widget) float64
- func (c *Context) PassThrough(widget Widget) bool
- func (c *Context) Scale() float64
- func (c *Context) SetAppLocales(locales []language.Tag)
- func (c *Context) SetAppScale(scale float64)
- func (c *Context) SetColorMode(mode ColorMode)
- func (c *Context) SetContainer(widget Widget, container bool)
- func (c *Context) SetCustomDraw(widget Widget, customDraw CustomDrawFunc)
- func (c *Context) SetEnabled(widget Widget, enabled bool)
- func (c *Context) SetFloat(widget Widget, float bool)
- func (c *Context) SetFocused(widget Widget, focused bool)
- func (c *Context) SetOpacity(widget Widget, opacity float64)
- func (c *Context) SetPassThrough(widget Widget, passThrough bool)
- func (c *Context) SetVisible(widget Widget, visible bool)
- func (c *Context) SetWindowTitle(title string)
- func (c *Context) SetZDelta(widget Widget, zDelta int)
- func (c *Context) UseAutoColorMode()
- func (c *Context) ZDelta(widget Widget) int
- type CustomDrawFunc
- type DefaultWidget
- func (*DefaultWidget) Build(context *Context, adder *ChildAdder) error
- func (*DefaultWidget) CursorShape(context *Context, widgetBounds *WidgetBounds) (ebiten.CursorShapeType, bool)
- func (*DefaultWidget) Draw(context *Context, widgetBounds *WidgetBounds, dst *ebiten.Image)
- func (*DefaultWidget) HandleButtonInput(context *Context, widgetBounds *WidgetBounds) HandleInputResult
- func (*DefaultWidget) HandlePointingInput(context *Context, widgetBounds *WidgetBounds) HandleInputResult
- func (*DefaultWidget) Layout(context *Context, widgetBounds *WidgetBounds, layouter *ChildLayouter)
- func (d *DefaultWidget) Measure(context *Context, constraints Constraints) image.Point
- func (*DefaultWidget) Model(key any) any
- func (*DefaultWidget) OnFocusChanged(context *Context, focused bool)
- func (*DefaultWidget) Tick(context *Context, widgetBounds *WidgetBounds) error
- type HandleInputResult
- type Layout
- type LayoutDirection
- type LinearLayout
- func (l LinearLayout) AppendItemBounds(boundsArr []image.Rectangle, context *Context, bounds image.Rectangle) []image.Rectangle
- func (l LinearLayout) LayoutWidgets(context *Context, bounds image.Rectangle, layouter WidgetLayouter)
- func (l LinearLayout) Measure(context *Context, constraints Constraints) image.Point
- type LinearLayoutItem
- type Padding
- type RunOptions
- type Size
- type Widget
- type WidgetBounds
- type WidgetLayouter
- type WidgetWithPadding
- func (w *WidgetWithPadding[T]) Build(context *Context, adder *ChildAdder) error
- func (w *WidgetWithPadding[T]) Layout(context *Context, widgetBounds *WidgetBounds, layouter *ChildLayouter)
- func (w *WidgetWithPadding[T]) Measure(context *Context, constraints Constraints) image.Point
- func (w *WidgetWithPadding[T]) SetPadding(padding Padding)
- func (w *WidgetWithPadding[T]) Widget() T
- type WidgetWithSize
- func (w *WidgetWithSize[T]) Build(context *Context, adder *ChildAdder) error
- func (w *WidgetWithSize[T]) Layout(context *Context, widgetBounds *WidgetBounds, layouter *ChildLayouter)
- func (w *WidgetWithSize[T]) Measure(context *Context, constraints Constraints) image.Point
- func (w *WidgetWithSize[T]) SetFixedHeight(height int)
- func (w *WidgetWithSize[T]) SetFixedSize(size image.Point)
- func (w *WidgetWithSize[T]) SetFixedWidth(width int)
- func (w *WidgetWithSize[T]) SetIntrinsicSize()
- func (w *WidgetWithSize[T]) SetMeasureFunc(f func(context *Context, constraints Constraints) image.Point)
- func (w *WidgetWithSize[T]) Widget() T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DispatchEvent ¶
func RequestRebuild ¶
func RequestRebuild(widget Widget)
func RequestRedraw ¶
func RequestRedraw(widget Widget)
func Run ¶
func Run(root Widget, options *RunOptions) error
func RunWithCustomFunc ¶
func RunWithCustomFunc(root Widget, options *RunOptions, f func(game ebiten.Game, options *ebiten.RunGameOptions) error) error
func SetEventHandler ¶
Types ¶
type ChildAdder ¶
type ChildAdder struct {
// contains filtered or unexported fields
}
func (*ChildAdder) AddChild ¶
func (c *ChildAdder) AddChild(widget Widget)
TODO: Rename this to AddWidget.
type ChildLayouter ¶
type ChildLayouter struct {
}
func (*ChildLayouter) LayoutWidget ¶
func (c *ChildLayouter) LayoutWidget(widget Widget, bounds image.Rectangle)
type Constraints ¶
type Constraints struct {
// contains filtered or unexported fields
}
func FixedHeightConstraints ¶
func FixedHeightConstraints(h int) Constraints
func FixedWidthConstraints ¶
func FixedWidthConstraints(w int) Constraints
func (*Constraints) FixedHeight ¶
func (c *Constraints) FixedHeight() (int, bool)
func (*Constraints) FixedWidth ¶
func (c *Constraints) FixedWidth() (int, bool)
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func (*Context) AppendAppLocales ¶
func (*Context) AppendLocales ¶
func (*Context) DelegateFocus ¶
func (*Context) DeviceScale ¶
func (*Context) IsAutoColorModeUsed ¶
func (*Context) IsFocusedOrHasFocusedChild ¶
func (*Context) PassThrough ¶
func (*Context) SetAppLocales ¶
func (*Context) SetAppScale ¶
func (*Context) SetColorMode ¶
func (*Context) SetContainer ¶
func (*Context) SetCustomDraw ¶
func (c *Context) SetCustomDraw(widget Widget, customDraw CustomDrawFunc)
func (*Context) SetEnabled ¶
func (*Context) SetFocused ¶
func (*Context) SetOpacity ¶
func (*Context) SetPassThrough ¶
func (*Context) SetVisible ¶
func (*Context) SetWindowTitle ¶
func (*Context) UseAutoColorMode ¶
func (c *Context) UseAutoColorMode()
type CustomDrawFunc ¶
type CustomDrawFunc func(dst, widgetImage *ebiten.Image, op *ebiten.DrawImageOptions)
type DefaultWidget ¶
type DefaultWidget struct {
// contains filtered or unexported fields
}
func (*DefaultWidget) Build ¶
func (*DefaultWidget) Build(context *Context, adder *ChildAdder) error
func (*DefaultWidget) CursorShape ¶
func (*DefaultWidget) CursorShape(context *Context, widgetBounds *WidgetBounds) (ebiten.CursorShapeType, bool)
func (*DefaultWidget) Draw ¶
func (*DefaultWidget) Draw(context *Context, widgetBounds *WidgetBounds, dst *ebiten.Image)
func (*DefaultWidget) HandleButtonInput ¶
func (*DefaultWidget) HandleButtonInput(context *Context, widgetBounds *WidgetBounds) HandleInputResult
func (*DefaultWidget) HandlePointingInput ¶
func (*DefaultWidget) HandlePointingInput(context *Context, widgetBounds *WidgetBounds) HandleInputResult
func (*DefaultWidget) Layout ¶
func (*DefaultWidget) Layout(context *Context, widgetBounds *WidgetBounds, layouter *ChildLayouter)
func (*DefaultWidget) Measure ¶
func (d *DefaultWidget) Measure(context *Context, constraints Constraints) image.Point
func (*DefaultWidget) Model ¶
func (*DefaultWidget) Model(key any) any
func (*DefaultWidget) OnFocusChanged ¶
func (*DefaultWidget) OnFocusChanged(context *Context, focused bool)
func (*DefaultWidget) Tick ¶
func (*DefaultWidget) Tick(context *Context, widgetBounds *WidgetBounds) error
type HandleInputResult ¶
type HandleInputResult struct {
// contains filtered or unexported fields
}
func AbortHandlingInputByWidget ¶
func AbortHandlingInputByWidget(widget Widget) HandleInputResult
func HandleInputByWidget ¶
func HandleInputByWidget(widget Widget) HandleInputResult
type Layout ¶
type Layout interface {
LayoutWidgets(context *Context, bounds image.Rectangle, layouter WidgetLayouter)
Measure(context *Context, constraints Constraints) image.Point
}
type LayoutDirection ¶
type LayoutDirection int
const ( LayoutDirectionHorizontal LayoutDirection = iota LayoutDirectionVertical )
type LinearLayout ¶
type LinearLayout struct {
Direction LayoutDirection
Items []LinearLayoutItem
Gap int
Padding Padding
}
func (LinearLayout) AppendItemBounds ¶
func (LinearLayout) LayoutWidgets ¶
func (l LinearLayout) LayoutWidgets(context *Context, bounds image.Rectangle, layouter WidgetLayouter)
func (LinearLayout) Measure ¶
func (l LinearLayout) Measure(context *Context, constraints Constraints) image.Point
type LinearLayoutItem ¶
type RunOptions ¶
type Widget ¶
type Widget interface {
Model(key any) any
Build(context *Context, adder *ChildAdder) error
Layout(context *Context, widgetBounds *WidgetBounds, layouter *ChildLayouter)
HandlePointingInput(context *Context, widgetBounds *WidgetBounds) HandleInputResult
HandleButtonInput(context *Context, widgetBounds *WidgetBounds) HandleInputResult
Tick(context *Context, widgetBounds *WidgetBounds) error
CursorShape(context *Context, widgetBounds *WidgetBounds) (ebiten.CursorShapeType, bool)
Draw(context *Context, widgetBounds *WidgetBounds, dst *ebiten.Image)
Measure(context *Context, constraints Constraints) image.Point
// OnFocusChanged is called when the widget is focused or unfocused.
// OnFocusChanged can be called even when the widget is not in the tree.
OnFocusChanged(context *Context, focused bool)
// contains filtered or unexported methods
}
type WidgetBounds ¶
type WidgetBounds struct {
// contains filtered or unexported fields
}
func (*WidgetBounds) Bounds ¶
func (w *WidgetBounds) Bounds() image.Rectangle
func (*WidgetBounds) IsHitAtCursor ¶
func (w *WidgetBounds) IsHitAtCursor() bool
func (*WidgetBounds) VisibleBounds ¶
func (w *WidgetBounds) VisibleBounds() image.Rectangle
type WidgetLayouter ¶
type WidgetWithPadding ¶
type WidgetWithPadding[T Widget] struct { DefaultWidget // contains filtered or unexported fields }
func (*WidgetWithPadding[T]) Build ¶
func (w *WidgetWithPadding[T]) Build(context *Context, adder *ChildAdder) error
func (*WidgetWithPadding[T]) Layout ¶
func (w *WidgetWithPadding[T]) Layout(context *Context, widgetBounds *WidgetBounds, layouter *ChildLayouter)
func (*WidgetWithPadding[T]) Measure ¶
func (w *WidgetWithPadding[T]) Measure(context *Context, constraints Constraints) image.Point
func (*WidgetWithPadding[T]) SetPadding ¶
func (w *WidgetWithPadding[T]) SetPadding(padding Padding)
func (*WidgetWithPadding[T]) Widget ¶
func (w *WidgetWithPadding[T]) Widget() T
type WidgetWithSize ¶
type WidgetWithSize[T Widget] struct { DefaultWidget // contains filtered or unexported fields }
func (*WidgetWithSize[T]) Build ¶
func (w *WidgetWithSize[T]) Build(context *Context, adder *ChildAdder) error
func (*WidgetWithSize[T]) Layout ¶
func (w *WidgetWithSize[T]) Layout(context *Context, widgetBounds *WidgetBounds, layouter *ChildLayouter)
func (*WidgetWithSize[T]) Measure ¶
func (w *WidgetWithSize[T]) Measure(context *Context, constraints Constraints) image.Point
func (*WidgetWithSize[T]) SetFixedHeight ¶
func (w *WidgetWithSize[T]) SetFixedHeight(height int)
func (*WidgetWithSize[T]) SetFixedSize ¶
func (w *WidgetWithSize[T]) SetFixedSize(size image.Point)
func (*WidgetWithSize[T]) SetFixedWidth ¶
func (w *WidgetWithSize[T]) SetFixedWidth(width int)
func (*WidgetWithSize[T]) SetIntrinsicSize ¶
func (w *WidgetWithSize[T]) SetIntrinsicSize()
func (*WidgetWithSize[T]) SetMeasureFunc ¶
func (w *WidgetWithSize[T]) SetMeasureFunc(f func(context *Context, constraints Constraints) image.Point)
func (*WidgetWithSize[T]) Widget ¶
func (w *WidgetWithSize[T]) Widget() T
Source Files
¶
Click to show internal directories.
Click to hide internal directories.

