Documentation
¶
Index ¶
- Variables
- func GenerateID() uint64
- type Alignment
- type BaseComponent
- func (b *BaseComponent) Contains(x, y float64) bool
- func (b *BaseComponent) Disable()
- func (b *BaseComponent) Draw(screen *ebiten.Image)
- func (b *BaseComponent) Enable()
- func (b *BaseComponent) GetAbsolutePosition() Position
- func (b *BaseComponent) GetBackground() color.Color
- func (b *BaseComponent) GetID() uint64
- func (b *BaseComponent) GetPadding() Padding
- func (b *BaseComponent) GetParent() Container
- func (b *BaseComponent) GetPosition() Position
- func (b *BaseComponent) GetSize() Size
- func (b *BaseComponent) Hide()
- func (b *BaseComponent) IsDisabled() bool
- func (b *BaseComponent) IsHidden() bool
- func (b *BaseComponent) SetBackground(color color.Color)
- func (b *BaseComponent) SetPadding(padding Padding)
- func (b *BaseComponent) SetParent(parent Container)
- func (b *BaseComponent) SetPosition(pos Position)
- func (b *BaseComponent) SetSize(size Size)
- func (b *BaseComponent) Show()
- func (b *BaseComponent) Update() error
- type BaseContainer
- type BaseFocusable
- type BaseInteractive
- type BaseTooltipable
- type Button
- type ButtonColors
- type ButtonContainer
- type Component
- type ComponentOpt
- func WithBackground(color color.Color) ComponentOpt
- func WithBackgroundColor(col color.Color) ComponentOpt
- func WithBorderColor(col color.Color) ComponentOpt
- func WithButtonColors(colors ButtonColors) ComponentOpt
- func WithChangeHandler(handler func(string)) ComponentOpt
- func WithClickHandler(handler func()) ComponentOpt
- func WithColor(color color.Color) ComponentOpt
- func WithFont(font font.Face) ComponentOpt
- func WithHidden() ComponentOpt
- func WithInitialText(text string) ComponentOpt
- func WithJustify(justify Justify) ComponentOpt
- func WithLabelColor(color color.Color) ComponentOpt
- func WithLabelText(text string) ComponentOpt
- func WithLayout(layout Layout) ComponentOpt
- func WithLineSpacing(spacing int) ComponentOpt
- func WithMaxValue(max float64) ComponentOpt
- func WithMinValue(min float64) ComponentOpt
- func WithOnChangeHandler(handler func(value float64)) ComponentOpt
- func WithPadding(top, right, bottom, left float64) ComponentOpt
- func WithPasswordMasking() ComponentOpt
- func WithPosition(pos Position) ComponentOpt
- func WithScrollableColors(colors ScrollableColors) ComponentOpt
- func WithShowValue() ComponentOpt
- func WithSize(width, height float64) ComponentOpt
- func WithSliderColors(colors SliderColors) ComponentOpt
- func WithStepSize(step float64) ComponentOpt
- func WithSubmitHandler(handler func(string)) ComponentOpt
- func WithTabIndex(index int) ComponentOpt
- func WithTextInputColors(colors TextInputColors) ComponentOpt
- func WithTextWrap() ComponentOpt
- func WithThumbSize(width, height float64) ComponentOpt
- func WithTooltipColors(colors TooltipColors) ComponentOpt
- func WithTooltipOffset(x, y float64) ComponentOpt
- func WithTooltipPosition(position TooltipPosition) ComponentOpt
- func WithTrackHeight(height float64) ComponentOpt
- func WithTransitionSpeed(speed float64) ComponentOpt
- func WithValue(value float64) ComponentOpt
- func WithValueSuffix(suffix string) ComponentOpt
- type Container
- type EbitenLifecycle
- type Event
- type EventBoundary
- type EventDispatcher
- type EventHandler
- type EventPhase
- type EventType
- type FocusManager
- func (fm *FocusManager) Disable()
- func (fm *FocusManager) Enable()
- func (fm *FocusManager) GetCurrentFocus() FocusableComponent
- func (fm *FocusManager) HandleTab(shiftPressed bool)
- func (fm *FocusManager) IsEnabled() bool
- func (fm *FocusManager) RefreshFocusableComponents(root Component)
- func (fm *FocusManager) SetFocus(component FocusableComponent)
- type FocusableComponent
- type HandlerEntry
- type HandlerID
- type Identifiable
- type ImageCache
- type InputManager
- type InputManagerOpt
- type Interactive
- type InteractiveComponent
- type Justify
- type Label
- func (b *Label) Draw(screen *ebiten.Image)
- func (b *Label) GetColor() color.Color
- func (b *Label) GetLineHeight() int
- func (b *Label) GetNumberOfLines() int
- func (b *Label) GetText() string
- func (b *Label) GetTextHeight() int
- func (b *Label) SetColor(color color.Color)
- func (b *Label) SetText(text string)
- type Layout
- type LayoutContainer
- type Manager
- type ManagerOpt
- type Padding
- type Position
- type Scrollable
- type ScrollableColors
- type ScrollableContainer
- func (sc *ScrollableContainer) AddChild(child Component)
- func (sc *ScrollableContainer) Contains(x, y float64) bool
- func (sc *ScrollableContainer) Draw(screen *ebiten.Image)
- func (sc *ScrollableContainer) GetScrollOffset() Position
- func (sc *ScrollableContainer) HideScrollBar()
- func (sc *ScrollableContainer) IsScrollBarHidden() bool
- func (sc *ScrollableContainer) IsScrolledToBottom() bool
- func (sc *ScrollableContainer) IsScrolledToTop() bool
- func (sc *ScrollableContainer) IsWithinBounds(x, y float64) bool
- func (sc *ScrollableContainer) RemoveChild(child Component)
- func (sc *ScrollableContainer) ScrollToBottom()
- func (sc *ScrollableContainer) ScrollToTop()
- func (sc *ScrollableContainer) SetScrollOffset(offset Position)
- func (sc *ScrollableContainer) ShowScrollBar()
- func (sc *ScrollableContainer) Update() error
- type Size
- type Slider
- type SliderColors
- type SliderOpt
- type StackConfig
- type StackContainer
- type StackLayout
- type StackLayoutOpt
- type TextInput
- func (t *TextInput) Blur()
- func (t *TextInput) ClearSelection()
- func (t *TextInput) Draw(screen *ebiten.Image)
- func (t *TextInput) Focus()
- func (t *TextInput) GetText() string
- func (t *TextInput) IsFocused() bool
- func (t *TextInput) Select(start, end int)
- func (t *TextInput) SetFont(font font.Face)
- func (t *TextInput) SetText(text string)
- func (t *TextInput) Update() error
- type TextInputColors
- type Tooltip
- func (t *Tooltip) Draw(screen *ebiten.Image)
- func (t *Tooltip) GetMousePosition() (float64, float64)
- func (t *Tooltip) GetOffset() (float64, float64)
- func (t *Tooltip) GetTarget() Component
- func (t *Tooltip) GetTooltipPosition() TooltipPosition
- func (t *Tooltip) SetContent(content Component)
- func (t *Tooltip) SetTarget(target Component)
- func (t *Tooltip) UpdateMousePosition(x, y float64)
- type TooltipColors
- type TooltipHandlers
- type TooltipManager
- func (tm *TooltipManager) Disable()
- func (tm *TooltipManager) Enable()
- func (tm *TooltipManager) HandleMouseMove(mouseX, mouseY float64)
- func (tm *TooltipManager) HandleTargetHover(component Component, mouseX, mouseY float64)
- func (tm *TooltipManager) HandleTargetLeave(component Component)
- func (tm *TooltipManager) HideTooltip()
- func (tm *TooltipManager) IsDisabled() bool
- func (tm *TooltipManager) RegisterTooltip(component TooltipableComponent, tooltip *Tooltip)
- func (tm *TooltipManager) ShowTooltip(tooltip *Tooltip)
- func (tm *TooltipManager) UnregisterTooltip(component TooltipableComponent)
- func (tm *TooltipManager) Update() error
- type TooltipPosition
- type Tooltipable
- type TooltipableComponent
- type Window
- func (w *Window) AddChild(child Component)
- func (w *Window) Draw(screen *ebiten.Image)
- func (w *Window) Hide()
- func (w *Window) IsVisible() bool
- func (w *Window) RemoveChild(child Component)
- func (w *Window) SetSize(size Size)
- func (w *Window) SetTitle(title string)
- func (w *Window) Show()
- func (w *Window) Toggle()
- type WindowColors
- type WindowManager
- type WindowOpt
- func WithBorderWidth(width float64) WindowOpt
- func WithCloseButtonSize(size Size) WindowOpt
- func WithCloseCallback(callback func()) WindowOpt
- func WithHeaderHeight(height float64) WindowOpt
- func WithStatic() WindowOpt
- func WithWindowColors(colors WindowColors) WindowOpt
- func WithWindowPosition(x, y float64) WindowOpt
- func WithWindowTitle(title string) WindowOpt
- type WindowState
- type ZIndexedContainer
Constants ¶
This section is empty.
Variables ¶
var (
Debug = false
)
Functions ¶
func GenerateID ¶
func GenerateID() uint64
Types ¶
type BaseComponent ¶
type BaseComponent struct {
*BaseTooltipable
// contains filtered or unexported fields
}
BaseComponent provides common functionality for all components
func NewBaseComponent ¶
func NewBaseComponent(opts ...ComponentOpt) *BaseComponent
func (*BaseComponent) Contains ¶
func (b *BaseComponent) Contains(x, y float64) bool
func (*BaseComponent) Disable ¶ added in v0.0.4
func (b *BaseComponent) Disable()
func (*BaseComponent) Draw ¶
func (b *BaseComponent) Draw(screen *ebiten.Image)
func (*BaseComponent) Enable ¶ added in v0.0.4
func (b *BaseComponent) Enable()
func (*BaseComponent) GetAbsolutePosition ¶
func (b *BaseComponent) GetAbsolutePosition() Position
func (*BaseComponent) GetBackground ¶
func (b *BaseComponent) GetBackground() color.Color
func (*BaseComponent) GetID ¶
func (b *BaseComponent) GetID() uint64
func (*BaseComponent) GetPadding ¶
func (b *BaseComponent) GetPadding() Padding
func (*BaseComponent) GetParent ¶
func (b *BaseComponent) GetParent() Container
func (*BaseComponent) GetPosition ¶
func (b *BaseComponent) GetPosition() Position
func (*BaseComponent) GetSize ¶
func (b *BaseComponent) GetSize() Size
func (*BaseComponent) Hide ¶ added in v0.0.15
func (b *BaseComponent) Hide()
func (*BaseComponent) IsDisabled ¶ added in v0.0.4
func (b *BaseComponent) IsDisabled() bool
func (*BaseComponent) IsHidden ¶ added in v0.0.15
func (b *BaseComponent) IsHidden() bool
func (*BaseComponent) SetBackground ¶
func (b *BaseComponent) SetBackground(color color.Color)
func (*BaseComponent) SetPadding ¶
func (b *BaseComponent) SetPadding(padding Padding)
func (*BaseComponent) SetParent ¶
func (b *BaseComponent) SetParent(parent Container)
func (*BaseComponent) SetPosition ¶
func (b *BaseComponent) SetPosition(pos Position)
func (*BaseComponent) SetSize ¶
func (b *BaseComponent) SetSize(size Size)
func (*BaseComponent) Show ¶ added in v0.0.15
func (b *BaseComponent) Show()
func (*BaseComponent) Update ¶
func (b *BaseComponent) Update() error
type BaseContainer ¶
type BaseContainer struct {
*BaseComponent
// contains filtered or unexported fields
}
func NewBaseContainer ¶
func NewBaseContainer(opts ...ComponentOpt) *BaseContainer
func (*BaseContainer) AddChild ¶
func (c *BaseContainer) AddChild(child Component)
func (*BaseContainer) ClearChildren ¶ added in v0.0.29
func (c *BaseContainer) ClearChildren()
func (*BaseContainer) Draw ¶
func (c *BaseContainer) Draw(screen *ebiten.Image)
func (*BaseContainer) GetChildren ¶
func (c *BaseContainer) GetChildren() []Component
func (*BaseContainer) RemoveChild ¶
func (c *BaseContainer) RemoveChild(child Component)
func (*BaseContainer) Update ¶
func (c *BaseContainer) Update() error
type BaseFocusable ¶
type BaseFocusable struct {
*BaseInteractive
// contains filtered or unexported fields
}
func NewBaseFocusable ¶
func NewBaseFocusable() *BaseFocusable
func (*BaseFocusable) GetTabIndex ¶
func (b *BaseFocusable) GetTabIndex() int
func (*BaseFocusable) IsFocusable ¶
func (b *BaseFocusable) IsFocusable() bool
func (*BaseFocusable) SetFocusable ¶
func (b *BaseFocusable) SetFocusable(focusable bool)
func (*BaseFocusable) SetTabIndex ¶
func (b *BaseFocusable) SetTabIndex(index int)
type BaseInteractive ¶
type BaseInteractive struct {
// contains filtered or unexported fields
}
BaseInteractive is a base struct that implements the Interactive interface
func NewBaseInteractive ¶
func NewBaseInteractive() *BaseInteractive
func (*BaseInteractive) AddEventListener ¶
func (bi *BaseInteractive) AddEventListener(eventType EventType, handler EventHandler) HandlerID
func (*BaseInteractive) HandleEvent ¶
func (bi *BaseInteractive) HandleEvent(event *Event)
func (*BaseInteractive) RemoveEventListener ¶ added in v0.2.1
func (bi *BaseInteractive) RemoveEventListener(eventType EventType, handlerID HandlerID)
type BaseTooltipable ¶ added in v0.2.0
type BaseTooltipable struct {
// contains filtered or unexported fields
}
BaseTooltipable is a base struct that implements the Tooltipable interface
func NewBaseTooltipable ¶ added in v0.2.0
func NewBaseTooltipable() *BaseTooltipable
NewBaseTooltipable creates a new base for tooltipable components
func (*BaseTooltipable) ClearTooltip ¶ added in v0.2.0
func (b *BaseTooltipable) ClearTooltip()
ClearTooltip clears the tooltip for the component
func (*BaseTooltipable) GetTooltip ¶ added in v0.2.0
func (b *BaseTooltipable) GetTooltip() *Tooltip
GetTooltip returns the tooltip for the component
func (*BaseTooltipable) SetTooltip ¶ added in v0.2.0
func (b *BaseTooltipable) SetTooltip(tooltip *Tooltip)
SetTooltip sets the tooltip for the component
type Button ¶
type Button struct {
*ButtonContainer
// contains filtered or unexported fields
}
func NewButton ¶
func NewButton(opts ...ComponentOpt) *Button
type ButtonColors ¶
type ButtonColors struct {
Default color.Color
Hovered color.Color
Pressed color.Color
FocusBorder color.Color
}
func DefaultButtonColors ¶ added in v0.0.6
func DefaultButtonColors() ButtonColors
type ButtonContainer ¶ added in v0.0.19
type ButtonContainer struct {
*LayoutContainer
*BaseFocusable
// contains filtered or unexported fields
}
func NewButtonContainer ¶ added in v0.0.19
func NewButtonContainer(opts ...ComponentOpt) *ButtonContainer
func (*ButtonContainer) Draw ¶ added in v0.0.19
func (b *ButtonContainer) Draw(screen *ebiten.Image)
func (*ButtonContainer) SetClickHandler ¶ added in v0.0.19
func (b *ButtonContainer) SetClickHandler(handler func())
func (*ButtonContainer) Update ¶ added in v0.0.19
func (b *ButtonContainer) Update() error
type Component ¶
type Component interface {
Identifiable
EbitenLifecycle
SetPosition(pos Position)
GetPosition() Position
SetSize(size Size)
GetSize() Size
SetParent(parent Container)
GetParent() Container
SetPadding(padding Padding)
GetPadding() Padding
Contains(x, y float64) bool
GetAbsolutePosition() Position
Disable()
Enable()
IsDisabled() bool
Hide()
Show()
IsHidden() bool
}
Component is the base interface that all UI elements must implement
type ComponentOpt ¶
type ComponentOpt func(c Component)
func WithBackground ¶
func WithBackground(color color.Color) ComponentOpt
func WithBackgroundColor ¶ added in v0.2.0
func WithBackgroundColor(col color.Color) ComponentOpt
func WithBorderColor ¶ added in v0.2.0
func WithBorderColor(col color.Color) ComponentOpt
func WithButtonColors ¶
func WithButtonColors(colors ButtonColors) ComponentOpt
func WithChangeHandler ¶
func WithChangeHandler(handler func(string)) ComponentOpt
func WithClickHandler ¶
func WithClickHandler(handler func()) ComponentOpt
func WithColor ¶
func WithColor(color color.Color) ComponentOpt
func WithFont ¶
func WithFont(font font.Face) ComponentOpt
func WithHidden ¶ added in v0.0.15
func WithHidden() ComponentOpt
func WithInitialText ¶
func WithInitialText(text string) ComponentOpt
func WithJustify ¶
func WithJustify(justify Justify) ComponentOpt
func WithLabelColor ¶ added in v0.0.7
func WithLabelColor(color color.Color) ComponentOpt
func WithLabelText ¶
func WithLabelText(text string) ComponentOpt
func WithLayout ¶
func WithLayout(layout Layout) ComponentOpt
func WithLineSpacing ¶ added in v0.0.28
func WithLineSpacing(spacing int) ComponentOpt
func WithMaxValue ¶ added in v0.0.18
func WithMaxValue(max float64) ComponentOpt
WithMaxValue sets the maximum value for the slider
func WithMinValue ¶ added in v0.0.18
func WithMinValue(min float64) ComponentOpt
WithMinValue sets the minimum value for the slider
func WithOnChangeHandler ¶ added in v0.0.18
func WithOnChangeHandler(handler func(value float64)) ComponentOpt
WithOnChangeHandler sets the handler for value changes
func WithPadding ¶
func WithPadding(top, right, bottom, left float64) ComponentOpt
func WithPasswordMasking ¶
func WithPasswordMasking() ComponentOpt
func WithPosition ¶
func WithPosition(pos Position) ComponentOpt
func WithScrollableColors ¶ added in v0.0.11
func WithScrollableColors(colors ScrollableColors) ComponentOpt
func WithShowValue ¶ added in v0.0.18
func WithShowValue() ComponentOpt
WithShowValue makes the slider display its current value
func WithSize ¶
func WithSize(width, height float64) ComponentOpt
func WithSliderColors ¶ added in v0.0.18
func WithSliderColors(colors SliderColors) ComponentOpt
WithSliderColors sets the colors for the slider
func WithStepSize ¶ added in v0.0.18
func WithStepSize(step float64) ComponentOpt
WithStepSize sets the step size for the slider
func WithSubmitHandler ¶
func WithSubmitHandler(handler func(string)) ComponentOpt
func WithTabIndex ¶
func WithTabIndex(index int) ComponentOpt
func WithTextInputColors ¶
func WithTextInputColors(colors TextInputColors) ComponentOpt
func WithTextWrap ¶ added in v0.0.6
func WithTextWrap() ComponentOpt
func WithThumbSize ¶ added in v0.0.18
func WithThumbSize(width, height float64) ComponentOpt
WithThumbSize sets the size of the slider thumb
func WithTooltipColors ¶ added in v0.2.0
func WithTooltipColors(colors TooltipColors) ComponentOpt
func WithTooltipOffset ¶ added in v0.2.0
func WithTooltipOffset(x, y float64) ComponentOpt
func WithTooltipPosition ¶ added in v0.2.0
func WithTooltipPosition(position TooltipPosition) ComponentOpt
func WithTrackHeight ¶ added in v0.0.18
func WithTrackHeight(height float64) ComponentOpt
WithTrackHeight sets the height of the slider track
func WithTransitionSpeed ¶ added in v0.0.17
func WithTransitionSpeed(speed float64) ComponentOpt
func WithValue ¶ added in v0.0.18
func WithValue(value float64) ComponentOpt
WithValue sets the initial value for the slider
func WithValueSuffix ¶ added in v0.0.18
func WithValueSuffix(suffix string) ComponentOpt
WithValueSuffix sets a suffix for the displayed value (e.g., "%", "px")
type EbitenLifecycle ¶
type Event ¶
type Event struct {
Type EventType
Target InteractiveComponent
CurrentTarget InteractiveComponent
RelatedTarget InteractiveComponent
MouseX, MouseY float64
MouseDeltaX, MouseDeltaY float64
WheelDeltaX, WheelDeltaY float64
MouseButton ebiten.MouseButton
Timestamp int64
Bubbles bool
Phase EventPhase
Path []InteractiveComponent
}
type EventBoundary ¶
EventBoundary represents a component that controls event propagation
type EventDispatcher ¶
type EventDispatcher struct {
// contains filtered or unexported fields
}
EventDispatcher manages event subscriptions and dispatching
func NewEventDispatcher ¶
func NewEventDispatcher() *EventDispatcher
func (*EventDispatcher) AddEventListener ¶
func (ed *EventDispatcher) AddEventListener(eventType EventType, handler EventHandler) HandlerID
func (*EventDispatcher) DispatchEvent ¶
func (ed *EventDispatcher) DispatchEvent(event *Event)
func (*EventDispatcher) RemoveEventListener ¶
func (ed *EventDispatcher) RemoveEventListener(eventType EventType, handlerID HandlerID)
type EventHandler ¶
type EventHandler func(event *Event)
EventHandler is a function that handles events
type EventPhase ¶
type EventPhase int
const ( PhaseNone EventPhase = 0 PhaseCapture EventPhase = 1 PhaseTarget EventPhase = 2 PhaseBubble EventPhase = 3 )
type EventType ¶
type EventType string
const ( MouseDown EventType = "mousedown" MouseUp EventType = "mouseup" MouseMove EventType = "mousemove" MouseEnter EventType = "mouseenter" MouseLeave EventType = "mouseleave" Wheel EventType = "wheel" DragStart EventType = "dragstart" Drag EventType = "drag" DragOver EventType = "dragover" DragEnd EventType = "dragend" Drop EventType = "drop" Focus EventType = "focus" Blur EventType = "blur" )
type FocusManager ¶
type FocusManager struct {
// contains filtered or unexported fields
}
func NewFocusManager ¶
func NewFocusManager() *FocusManager
func (*FocusManager) Disable ¶ added in v0.0.27
func (fm *FocusManager) Disable()
Disable turns off focus management
func (*FocusManager) Enable ¶ added in v0.0.27
func (fm *FocusManager) Enable()
Enable turns on focus management
func (*FocusManager) GetCurrentFocus ¶
func (fm *FocusManager) GetCurrentFocus() FocusableComponent
func (*FocusManager) HandleTab ¶
func (fm *FocusManager) HandleTab(shiftPressed bool)
func (*FocusManager) IsEnabled ¶ added in v0.0.27
func (fm *FocusManager) IsEnabled() bool
IsEnabled returns whether focus management is enabled
func (*FocusManager) RefreshFocusableComponents ¶
func (fm *FocusManager) RefreshFocusableComponents(root Component)
RefreshFocusableComponents finds all focusable components in the component tree
func (*FocusManager) SetFocus ¶
func (fm *FocusManager) SetFocus(component FocusableComponent)
type FocusableComponent ¶
type FocusableComponent interface {
InteractiveComponent
IsFocusable() bool
SetFocusable(focusable bool)
GetTabIndex() int
SetTabIndex(index int)
}
type HandlerEntry ¶ added in v0.2.1
type HandlerEntry struct {
ID HandlerID
Handler EventHandler
}
HandlerEntry represents an event handler with its ID
type HandlerID ¶ added in v0.2.1
type HandlerID string
HandlerID is a unique identifier for event handlers
type Identifiable ¶
type Identifiable interface {
GetID() uint64
}
type ImageCache ¶ added in v0.0.3
type ImageCache struct {
// contains filtered or unexported fields
}
ImageCache provides a global cache for commonly used images
func GetCache ¶ added in v0.0.3
func GetCache() *ImageCache
GetCache returns the global image cache instance
func (*ImageCache) BorderImageWithColor ¶ added in v0.0.8
BorderImageWithColor returns a cached border image of the specified size and color
func (*ImageCache) ImageWithColor ¶ added in v0.0.3
ImageWithColor returns a cached image of the specified size and color
type InputManager ¶
type InputManager struct {
// contains filtered or unexported fields
}
func NewInputManager ¶
func NewInputManager(opts ...InputManagerOpt) *InputManager
func (*InputManager) DisableFocusManagement ¶ added in v0.0.27
func (im *InputManager) DisableFocusManagement()
DisableFocusManagement disables the focus manager
func (*InputManager) EnableFocusManagement ¶ added in v0.0.27
func (im *InputManager) EnableFocusManagement()
EnableFocusManagement enables the focus manager
func (*InputManager) IsFocusManagementEnabled ¶ added in v0.0.27
func (im *InputManager) IsFocusManagementEnabled() bool
IsFocusManagementEnabled returns whether focus management is enabled
func (*InputManager) Update ¶
func (im *InputManager) Update(root Component)
Update processes input events and dispatches them to the appropriate components. It handles mouse button events, mouse movement, wheel events, and drag events. The root component is used as the starting point for event propagation.
type InputManagerOpt ¶ added in v0.0.24
type InputManagerOpt func(im *InputManager)
func WithFocusManager ¶ added in v0.0.24
func WithFocusManager(fm *FocusManager) InputManagerOpt
WithFocusManager sets the focus manager for the input manager
type Interactive ¶
type Interactive interface {
HandleEvent(event *Event)
AddEventListener(eventType EventType, handler EventHandler) HandlerID
RemoveEventListener(eventType EventType, handlerID HandlerID)
}
Interactive is an interface that can receive input events
type InteractiveComponent ¶
type InteractiveComponent interface {
Component
Interactive
}
InteractiveComponent is an interface that combines the Component and Interactive interfaces
type Label ¶
type Label struct {
*BaseComponent
// contains filtered or unexported fields
}
func NewLabel ¶
func NewLabel(text string, opts ...ComponentOpt) *Label
func (*Label) GetLineHeight ¶ added in v0.0.28
func (*Label) GetNumberOfLines ¶ added in v0.0.28
func (*Label) GetTextHeight ¶ added in v0.0.28
type LayoutContainer ¶
type LayoutContainer struct {
*BaseContainer
// contains filtered or unexported fields
}
func NewLayoutContainer ¶
func NewLayoutContainer(opts ...ComponentOpt) *LayoutContainer
func (*LayoutContainer) AddChild ¶ added in v0.0.2
func (c *LayoutContainer) AddChild(child Component)
func (*LayoutContainer) ArrangeChildren ¶ added in v0.0.25
func (c *LayoutContainer) ArrangeChildren()
func (*LayoutContainer) RemoveChild ¶ added in v0.0.2
func (c *LayoutContainer) RemoveChild(child Component)
func (*LayoutContainer) Update ¶
func (c *LayoutContainer) Update() error
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(root Container, opts ...ManagerOpt) *Manager
NewManager creates a new UI Manager with the given root container.
func (*Manager) DisableFocus ¶ added in v0.0.27
func (u *Manager) DisableFocus()
DisableFocus disables focus management for the UI.
func (*Manager) EnableFocus ¶ added in v0.0.27
func (u *Manager) EnableFocus()
EnableFocus enables focus management for the UI.
func (*Manager) IsFocusEnabled ¶ added in v0.0.27
IsFocusEnabled returns whether focus management is enabled.
type ManagerOpt ¶ added in v0.0.24
type ManagerOpt func(m *Manager)
func WithInputManager ¶ added in v0.0.24
func WithInputManager(im *InputManager) ManagerOpt
type Padding ¶
type Padding struct {
Top, Right, Bottom, Left float64
}
Padding represents padding around a component
type Scrollable ¶
type Scrollable interface {
Container
Interactive
EventBoundary
GetScrollOffset() Position
SetScrollOffset(offset Position)
HideScrollBar()
ShowScrollBar()
IsScrollBarHidden() bool
ScrollToTop()
ScrollToBottom()
}
type ScrollableColors ¶ added in v0.0.11
func DefaultScrollableColors ¶ added in v0.0.11
func DefaultScrollableColors() ScrollableColors
type ScrollableContainer ¶
type ScrollableContainer struct {
*BaseFocusable
*LayoutContainer
// contains filtered or unexported fields
}
func NewScrollableContainer ¶
func NewScrollableContainer(opts ...ComponentOpt) *ScrollableContainer
func (*ScrollableContainer) AddChild ¶
func (sc *ScrollableContainer) AddChild(child Component)
func (*ScrollableContainer) Contains ¶
func (sc *ScrollableContainer) Contains(x, y float64) bool
func (*ScrollableContainer) Draw ¶
func (sc *ScrollableContainer) Draw(screen *ebiten.Image)
func (*ScrollableContainer) GetScrollOffset ¶
func (sc *ScrollableContainer) GetScrollOffset() Position
func (*ScrollableContainer) HideScrollBar ¶ added in v0.0.25
func (sc *ScrollableContainer) HideScrollBar()
func (*ScrollableContainer) IsScrollBarHidden ¶ added in v0.0.25
func (sc *ScrollableContainer) IsScrollBarHidden() bool
func (*ScrollableContainer) IsScrolledToBottom ¶ added in v0.0.27
func (sc *ScrollableContainer) IsScrolledToBottom() bool
func (*ScrollableContainer) IsScrolledToTop ¶ added in v0.0.27
func (sc *ScrollableContainer) IsScrolledToTop() bool
func (*ScrollableContainer) IsWithinBounds ¶
func (sc *ScrollableContainer) IsWithinBounds(x, y float64) bool
func (*ScrollableContainer) RemoveChild ¶
func (sc *ScrollableContainer) RemoveChild(child Component)
func (*ScrollableContainer) ScrollToBottom ¶ added in v0.0.24
func (sc *ScrollableContainer) ScrollToBottom()
func (*ScrollableContainer) ScrollToTop ¶ added in v0.0.24
func (sc *ScrollableContainer) ScrollToTop()
func (*ScrollableContainer) SetScrollOffset ¶
func (sc *ScrollableContainer) SetScrollOffset(offset Position)
func (*ScrollableContainer) ShowScrollBar ¶ added in v0.0.25
func (sc *ScrollableContainer) ShowScrollBar()
func (*ScrollableContainer) Update ¶
func (sc *ScrollableContainer) Update() error
type Size ¶
type Size struct {
Width, Height float64
}
Size represents the dimensions of a component
func (Size) IsDrawable ¶
type Slider ¶ added in v0.0.18
type Slider struct {
*BaseFocusable
*LayoutContainer
// contains filtered or unexported fields
}
Slider is a component that allows selecting a value within a range
func NewSlider ¶ added in v0.0.18
func NewSlider(opts ...ComponentOpt) *Slider
NewSlider creates a new slider component
func (*Slider) SetColors ¶ added in v0.0.18
func (s *Slider) SetColors(colors SliderColors)
SetColors sets the color scheme for the slider
func (*Slider) SetOnChange ¶ added in v0.0.18
SetOnChange sets the handler for value changes
type SliderColors ¶ added in v0.0.18
type SliderColors struct {
Track color.Color
TrackFilled color.Color
Thumb color.Color
ThumbHovered color.Color
ThumbDragged color.Color
FocusBorder color.Color
}
SliderColors represents the color scheme for a slider
func DefaultSliderColors ¶ added in v0.0.18
func DefaultSliderColors() SliderColors
DefaultSliderColors returns a default color scheme for sliders
type SliderOpt ¶ added in v0.0.18
type SliderOpt func(s *Slider)
SliderOpt is a function that configures a Slider
type StackConfig ¶
StackConfig holds configuration for stack layouts
type StackContainer ¶ added in v0.0.17
type StackContainer struct {
*BaseContainer
// contains filtered or unexported fields
}
StackContainer manages a stack of views/screens with transitions
func NewStackContainer ¶ added in v0.0.17
func NewStackContainer(opts ...ComponentOpt) *StackContainer
func (*StackContainer) Clear ¶ added in v0.0.17
func (sc *StackContainer) Clear()
Clear removes all views from the stack except the root view
func (*StackContainer) Draw ¶ added in v0.0.20
func (sc *StackContainer) Draw(screen *ebiten.Image)
Draw overrides the BaseContainer.Draw method to implement clipping
func (*StackContainer) GetActiveView ¶ added in v0.0.17
func (sc *StackContainer) GetActiveView() Component
GetActiveView returns the currently active view
func (*StackContainer) Pop ¶ added in v0.0.17
func (sc *StackContainer) Pop()
Pop removes the top view from the stack with a transition
func (*StackContainer) Push ¶ added in v0.0.17
func (sc *StackContainer) Push(view Container)
Push adds a new view to the stack with a transition
func (*StackContainer) Update ¶ added in v0.0.17
func (sc *StackContainer) Update() error
Update handles the transition animation
type StackLayout ¶
type StackLayout struct {
Horizontal bool
Config StackConfig
}
StackLayout implements vertical or horizontal stacking of components
func NewHorizontalStackLayout ¶
func NewHorizontalStackLayout(spacing float64, align Alignment) *StackLayout
NewHorizontalStackLayout is a helper function to create a horizontal stack layout
func NewStackLayout ¶
func NewStackLayout(opts ...StackLayoutOpt) *StackLayout
func NewVerticalStackLayout ¶
func NewVerticalStackLayout(spacing float64, align Alignment) *StackLayout
NewVerticalStackLayout is a helper function to create a vertical stack layout
func (*StackLayout) ArrangeChildren ¶
func (l *StackLayout) ArrangeChildren(container Container)
ArrangeChildren positions all children in a vertical or horizontal stack
func (*StackLayout) GetMinSize ¶
func (l *StackLayout) GetMinSize(container Container) Size
GetMinSize returns the minimum size required to fit all children
type StackLayoutOpt ¶
type StackLayoutOpt func(l *StackLayout)
func WithAlignment ¶
func WithAlignment(align Alignment) StackLayoutOpt
func WithHorizontal ¶
func WithHorizontal() StackLayoutOpt
func WithSpacing ¶
func WithSpacing(spacing float64) StackLayoutOpt
type TextInput ¶
type TextInput struct {
*BaseFocusable
*BaseContainer
// contains filtered or unexported fields
}
func NewTextInput ¶
func NewTextInput(opts ...ComponentOpt) *TextInput
func (*TextInput) ClearSelection ¶
func (t *TextInput) ClearSelection()
type TextInputColors ¶
type TextInputColors struct {
Text color.Color
Background color.Color
Cursor color.Color
Selection color.Color
FocusBorder color.Color
}
func DefaultTextInputColors ¶
func DefaultTextInputColors() TextInputColors
type Tooltip ¶ added in v0.2.0
type Tooltip struct {
*LayoutContainer
// contains filtered or unexported fields
}
Tooltip represents a tooltip component that can be attached to other components
func NewTooltip ¶ added in v0.2.0
func NewTooltip(opts ...ComponentOpt) *Tooltip
NewTooltip creates a new tooltip component
func (*Tooltip) GetMousePosition ¶ added in v0.2.0
GetMousePosition returns the current mouse position
func (*Tooltip) GetTarget ¶ added in v0.2.0
GetTarget returns the target component this tooltip belongs to
func (*Tooltip) GetTooltipPosition ¶ added in v0.2.0
func (t *Tooltip) GetTooltipPosition() TooltipPosition
GetTooltipPosition returns the tooltip's preferred position
func (*Tooltip) SetContent ¶ added in v0.2.0
SetContent sets the content of the tooltip
func (*Tooltip) SetTarget ¶ added in v0.2.0
SetTarget sets the target component this tooltip belongs to
func (*Tooltip) UpdateMousePosition ¶ added in v0.2.0
UpdateMousePosition updates the current mouse position for the tooltip
type TooltipColors ¶ added in v0.2.0
TooltipColors contains all the colors used by a tooltip
func DefaultTooltipColors ¶ added in v0.2.0
func DefaultTooltipColors() TooltipColors
DefaultTooltipColors returns the default color scheme for tooltips
type TooltipHandlers ¶ added in v0.2.1
type TooltipHandlers struct {
// contains filtered or unexported fields
}
TooltipHandlers stores the event handler IDs for a registered tooltip
type TooltipManager ¶ added in v0.2.0
type TooltipManager struct {
*ZIndexedContainer
// contains filtered or unexported fields
}
TooltipManager handles the display and positioning of tooltips
func NewTooltipManager ¶ added in v0.2.0
func NewTooltipManager(opts ...ComponentOpt) *TooltipManager
NewTooltipManager creates a new TooltipManager
func (*TooltipManager) Disable ¶ added in v0.2.0
func (tm *TooltipManager) Disable()
Disable disables the tooltip manager and hides any active tooltips
func (*TooltipManager) Enable ¶ added in v0.2.0
func (tm *TooltipManager) Enable()
Enable enables the tooltip manager
func (*TooltipManager) HandleMouseMove ¶ added in v0.2.0
func (tm *TooltipManager) HandleMouseMove(mouseX, mouseY float64)
HandleMouseMove handles mouse movement to update tooltip position
func (*TooltipManager) HandleTargetHover ¶ added in v0.2.0
func (tm *TooltipManager) HandleTargetHover(component Component, mouseX, mouseY float64)
HandleTargetHover handles when a component with a tooltip is hovered
func (*TooltipManager) HandleTargetLeave ¶ added in v0.2.0
func (tm *TooltipManager) HandleTargetLeave(component Component)
HandleTargetLeave handles when the mouse leaves a component with a tooltip
func (*TooltipManager) HideTooltip ¶ added in v0.2.0
func (tm *TooltipManager) HideTooltip()
HideTooltip hides the currently visible tooltip
func (*TooltipManager) IsDisabled ¶ added in v0.2.0
func (tm *TooltipManager) IsDisabled() bool
IsDisabled returns whether the tooltip manager is disabled
func (*TooltipManager) RegisterTooltip ¶ added in v0.2.0
func (tm *TooltipManager) RegisterTooltip(component TooltipableComponent, tooltip *Tooltip)
RegisterTooltip registers a component to show tooltips It adds event listeners for mouse enter, leave, and move events to manage tooltip visibility and positioning
func (*TooltipManager) ShowTooltip ¶ added in v0.2.0
func (tm *TooltipManager) ShowTooltip(tooltip *Tooltip)
ShowTooltip displays a tooltip at the appropriate position
func (*TooltipManager) UnregisterTooltip ¶ added in v0.2.1
func (tm *TooltipManager) UnregisterTooltip(component TooltipableComponent)
UnregisterTooltip removes a tooltip from a component and cleans up its event listeners Other unrelated event listeners on the component will remain intact
func (*TooltipManager) Update ¶ added in v0.2.0
func (tm *TooltipManager) Update() error
Update updates the tooltip manager state
type TooltipPosition ¶ added in v0.2.0
type TooltipPosition int
TooltipPosition defines the preferred position of a tooltip relative to the mouse cursor
const ( // Tooltip positions TooltipPositionAuto TooltipPosition = iota // Automatically determine best position TooltipPositionTop // Above the cursor TooltipPositionRight // To the right of the cursor TooltipPositionBottom // Below the cursor TooltipPositionLeft // To the left of the cursor TooltipPositionTopLeft // Above and to the left of the cursor TooltipPositionTopRight // Above and to the right of the cursor TooltipPositionBottomLeft // Below and to the left of the cursor TooltipPositionBottomRight // Below and to the right of the cursor )
type Tooltipable ¶ added in v0.2.0
Tooltipable is an interface for components that can have tooltips attached
type TooltipableComponent ¶ added in v0.2.0
type TooltipableComponent interface {
InteractiveComponent
Tooltipable
}
type Window ¶
type Window struct {
*BaseFocusable
*LayoutContainer
// contains filtered or unexported fields
}
func (*Window) RemoveChild ¶
type WindowColors ¶
type WindowColors struct {
Background color.Color
Header color.Color
HeaderText color.Color
Border color.Color
// Close button colors (optional, will be derived from header color if nil)
CloseButton color.Color
CloseHovered color.Color
ClosePressed color.Color
CloseCross color.Color
}
WindowColors represents the color scheme for a window
func DefaultWindowColors ¶
func DefaultWindowColors() WindowColors
DefaultWindowColors returns a default color scheme for windows
type WindowManager ¶
type WindowManager struct {
*ZIndexedContainer
// contains filtered or unexported fields
}
func NewWindowManager ¶
func NewWindowManager(opts ...ComponentOpt) *WindowManager
func (*WindowManager) CreateWindow ¶
func (wm *WindowManager) CreateWindow(width, height float64, opts ...WindowOpt) *Window
func (*WindowManager) SetActiveWindow ¶
func (wm *WindowManager) SetActiveWindow(window *Window)
type WindowOpt ¶
type WindowOpt func(w *Window)
func WithBorderWidth ¶
WithBorderWidth sets the width of the window border
func WithCloseButtonSize ¶ added in v0.1.0
WithCloseButtonSize sets the size of the close button
func WithCloseCallback ¶
func WithCloseCallback(callback func()) WindowOpt
WithCloseCallback sets the callback for when the window is closed
func WithHeaderHeight ¶
WithHeaderHeight sets the height of the window header
func WithStatic ¶ added in v0.0.6
func WithStatic() WindowOpt
WithStatic makes the window non-draggable
func WithWindowColors ¶
func WithWindowColors(colors WindowColors) WindowOpt
WithWindowColors sets custom colors for the window
func WithWindowPosition ¶
WithPosition sets the window position
func WithWindowTitle ¶
WithWindowTitle sets the window title
type WindowState ¶
type WindowState int
const ( WindowStateHidden WindowState = iota WindowStateNormal )
type ZIndexedContainer ¶
type ZIndexedContainer struct {
*BaseContainer
}
func NewZIndexedContainer ¶
func NewZIndexedContainer(opts ...ComponentOpt) *ZIndexedContainer
func (*ZIndexedContainer) Draw ¶
func (z *ZIndexedContainer) Draw(screen *ebiten.Image)
func (*ZIndexedContainer) GetChildren ¶
func (z *ZIndexedContainer) GetChildren() []Component
GetChildren returns the children of the container sorted by ZIndex.
func (*ZIndexedContainer) Update ¶
func (z *ZIndexedContainer) Update() error