Documentation
¶
Index ¶
- func AlternatingRowColor(index int) color.Color
- func ButtonRow() *widget.Container
- func CenteredContainer(spacing int) *widget.Container
- func DisabledSidebarItem(label string) *widget.Container
- func EmptyState(title, subtitle string, button *widget.Button) *widget.Container
- func LabeledText(label, subtext string) *widget.Container
- func PrimaryTextButton(text string, padding int, handler func(*widget.ButtonClickedEventArgs)) *widget.Button
- func ScreenContainer() *widget.Container
- func ScreenContentContainer(rowStretch []bool) *widget.Container
- func ScrollSlider(scrollContainer *ScrollView, needsScroll func() bool) *widget.Slider
- func SettingsRow(columns int) *widget.Container
- func SetupScrollHandler(scrollContainer *ScrollView, vSlider *widget.Slider, needsScroll func() bool)
- func StyledTextInput(placeholder string, secure bool, minWidth int) *widget.TextInput
- func TableCell(text string, width, height int, textColor color.Color) *widget.Container
- func TableHeaderCell(text string, width, height int) *widget.Container
- func TextButton(text string, padding int, handler func(*widget.ButtonClickedEventArgs)) *widget.Button
- func ToggleButton(text string, active bool, handler func(*widget.ButtonClickedEventArgs)) *widget.Button
- func TooltipContent(text string) *widget.Container
- type IconGraphic
- type ScrollView
- func (s *ScrollView) ContentRect() img.Rectangle
- func (s *ScrollView) GetWidget() *widget.Widget
- func (s *ScrollView) PreferredSize() (int, int)
- func (s *ScrollView) Render(screen *ebiten.Image)
- func (s *ScrollView) ScrollRectIntoView(rect img.Rectangle)
- func (s *ScrollView) ScrollRectToTop(rect img.Rectangle)
- func (s *ScrollView) SetLocation(rect img.Rectangle)
- func (s *ScrollView) SetScrollTop(frac float64)
- func (s *ScrollView) SetSlider(slider *widget.Slider)
- func (s *ScrollView) SetupInputLayer(def input.DeferredSetupInputLayerFunc)
- func (s *ScrollView) Update(updObj *widget.UpdateObject)
- func (s *ScrollView) Validate()
- func (s *ScrollView) ViewRect() img.Rectangle
- type ScrollableOpts
- type TextInputGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AlternatingRowColor ¶
AlternatingRowColor returns the appropriate background color for alternating rows. Even indices (0, 2, 4...) return style.Background, odd indices return style.Surface.
func CenteredContainer ¶
CenteredContainer creates a container with vertical layout, centered in its parent. Use for modal dialogs, status screens, and centered content. The spacing parameter controls vertical spacing between children.
func DisabledSidebarItem ¶
DisabledSidebarItem creates a non-focusable sidebar item with the given label. Used for future/coming-soon menu items.
func EmptyState ¶
EmptyState creates a centered empty state display with title, optional subtitle, and optional button. The returned container has RowLayoutData{Stretch: true} for use in row layouts. Pass empty string for subtitle to omit it. Pass nil for button to omit it.
func LabeledText ¶
LabeledText creates a vertical container with a primary label and optional secondary subtext. style.Text is vertically centered within the grid cell.
func PrimaryTextButton ¶
func PrimaryTextButton(text string, padding int, handler func(*widget.ButtonClickedEventArgs)) *widget.Button
PrimaryTextButton creates a prominent text button with primary styling. Use for main actions like "Play", "Save", "Scan Library".
func ScreenContainer ¶
ScreenContainer creates a full-screen root container with background. The container uses AnchorLayout so children can stretch to fill.
func ScreenContentContainer ¶
ScreenContentContainer creates an inner container for screen content. Uses a single-column GridLayout with default padding and spacing. The stretch parameter controls which rows stretch vertically.
func ScrollSlider ¶
func ScrollSlider(scrollContainer *ScrollView, needsScroll func() bool) *widget.Slider
ScrollSlider creates a vertical scroll slider bound to a scroll container. The needsScroll function should return true when content exceeds view height. Returns the slider widget.
func SettingsRow ¶
SettingsRow creates a standard settings row container with style.Surface background, N-column grid layout, and RowLayoutData stretch.
func SetupScrollHandler ¶
func SetupScrollHandler(scrollContainer *ScrollView, vSlider *widget.Slider, needsScroll func() bool)
SetupScrollHandler adds mouse wheel scroll support to a scroll container. The slider's Current value is kept in sync with scroll position.
func StyledTextInput ¶
StyledTextInput creates a text input with consistent styling.
func TableCell ¶
TableCell creates a table cell with text content. Use for data cells in list/table views.
func TableHeaderCell ¶
TableHeaderCell creates a table header cell with secondary text color. Use for column headers in list/table views.
func TextButton ¶
func TextButton(text string, padding int, handler func(*widget.ButtonClickedEventArgs)) *widget.Button
TextButton creates a standard text button with consistent styling. Use for regular actions like "Back", "Cancel", "Settings".
func ToggleButton ¶
func ToggleButton(text string, active bool, handler func(*widget.ButtonClickedEventArgs)) *widget.Button
ToggleButton creates a button that visually indicates an active/inactive state. Use for view mode toggles, filters, and other binary state buttons.
func TooltipContent ¶
TooltipContent creates a tooltip container with consistent styling. Use for showing full text when content is truncated.
Types ¶
type IconGraphic ¶
type IconGraphic struct {
Image *ebiten.Image
Focused bool
// contains filtered or unexported fields
}
IconGraphic draws a single artwork texture centered in its rect for the library icon view. When unfocused it renders the texture scaled down and dimmed; when focused it renders at full size and full brightness. This produces the zoom effect from one texture per game instead of caching a second pre-scaled, pre-dimmed copy.
Image and Focused are set directly by the owner to swap artwork and toggle the zoom state, matching the public-field style of ebitenui's own Graphic.
func NewIconGraphic ¶
func NewIconGraphic(img *ebiten.Image, scale float64, dim float32, opts ...widget.WidgetOpt) *IconGraphic
NewIconGraphic creates an IconGraphic for img. scale and dim control the unfocused appearance. opts are applied to the underlying widget.
func (*IconGraphic) GetWidget ¶
func (g *IconGraphic) GetWidget() *widget.Widget
GetWidget returns the underlying widget.
func (*IconGraphic) PreferredSize ¶
func (g *IconGraphic) PreferredSize() (int, int)
PreferredSize reports the texture size, matching the stock graphic widget.
func (*IconGraphic) Render ¶
func (g *IconGraphic) Render(screen *ebiten.Image)
Render draws the texture centered in the widget rect. Unfocused cards are scaled down and dimmed; focused cards draw at native size and brightness.
func (*IconGraphic) SetLocation ¶
func (g *IconGraphic) SetLocation(rect goimage.Rectangle)
SetLocation positions the widget.
func (*IconGraphic) Validate ¶
func (g *IconGraphic) Validate()
Validate satisfies the widget interface; nothing to validate.
type ScrollView ¶
type ScrollView struct {
// ScrollTop is the vertical scroll position as a fraction in [0, 1].
ScrollTop float64
// contains filtered or unexported fields
}
ScrollView is a vertical scroll container that clips its content with an ebiten SubImage instead of an allocated mask buffer. ebitenui's ScrollContainer renders its content through a screen-sized MaskedRenderBuffer; ebiten promotes those buffers onto large texture-atlas pages that stay mostly empty and accumulate across UI rebuilds. A SubImage is only a bounded view of the destination, so clipping allocates nothing.
Only vertical scrolling is supported; the screens that scroll never scroll horizontally. ScrollTop, ViewRect and ContentRect mirror the subset of the ebitenui ScrollContainer API the screens rely on.
func NewScrollView ¶
func NewScrollView(content widget.PreferredSizeLocateableWidget, bg color.Color, stretchContentWidth bool, opts ...widget.WidgetOpt) *ScrollView
NewScrollView creates a ScrollView wrapping content. bg fills the viewport behind the content. When stretchContentWidth is true, content narrower than the viewport is widened to fill it.
func ScrollableContainer ¶
func ScrollableContainer(opts ScrollableOpts) (*ScrollView, *widget.Slider, widget.PreferredSizeLocateableWidget)
ScrollableContainer creates a scrollable container with a vertical slider. Returns the scroll container, slider, and wrapper widget for embedding in layouts. The scroll container and slider references can be used for scroll position preservation.
func (*ScrollView) ContentRect ¶
func (s *ScrollView) ContentRect() img.Rectangle
ContentRect returns the content's full rect at its current scrolled position.
func (*ScrollView) GetWidget ¶
func (s *ScrollView) GetWidget() *widget.Widget
GetWidget returns the underlying widget.
func (*ScrollView) PreferredSize ¶
func (s *ScrollView) PreferredSize() (int, int)
PreferredSize reports the content's preferred size.
func (*ScrollView) Render ¶
func (s *ScrollView) Render(screen *ebiten.Image)
Render draws the background and the content, clipping the content to the viewport with a SubImage.
func (*ScrollView) ScrollRectIntoView ¶
func (s *ScrollView) ScrollRectIntoView(rect img.Rectangle)
ScrollRectIntoView scrolls the minimum amount so rect (in screen coordinates) is visible: aligning its top to the viewport top when above, or its bottom to the viewport bottom when below. Does nothing when the content fits.
func (*ScrollView) ScrollRectToTop ¶
func (s *ScrollView) ScrollRectToTop(rect img.Rectangle)
ScrollRectToTop scrolls so the top of rect (in screen coordinates) aligns with the top of the viewport, clamped to the scroll range. Does nothing when the content fits.
func (*ScrollView) SetLocation ¶
func (s *ScrollView) SetLocation(rect img.Rectangle)
SetLocation positions the viewport.
func (*ScrollView) SetScrollTop ¶
func (s *ScrollView) SetScrollTop(frac float64)
SetScrollTop clamps the fraction, applies it, and syncs the paired slider.
func (*ScrollView) SetSlider ¶
func (s *ScrollView) SetSlider(slider *widget.Slider)
SetSlider pairs a slider with the view so programmatic scroll changes keep it in sync.
func (*ScrollView) SetupInputLayer ¶
func (s *ScrollView) SetupInputLayer(def input.DeferredSetupInputLayerFunc)
SetupInputLayer elevates the content onto an input layer clipped to the viewport, so content scrolled out of view does not receive pointer events. Wheel events are excluded so they fall through to the ScrollView's own widget, which fires ScrolledEvent.
func (*ScrollView) Update ¶
func (s *ScrollView) Update(updObj *widget.UpdateObject)
Update updates the content subtree.
func (*ScrollView) Validate ¶
func (s *ScrollView) Validate()
Validate validates the content subtree.
func (*ScrollView) ViewRect ¶
func (s *ScrollView) ViewRect() img.Rectangle
ViewRect returns the visible viewport in screen coordinates.
type ScrollableOpts ¶
type ScrollableOpts struct {
Content *widget.Container // Required: content to scroll
BgColor color.Color // style.Background color for scroll area (default: style.Background)
BorderColor color.Color // style.Border color for wrapper (nil = no border)
Spacing int // Spacing between scroll area and slider (default: 4)
Padding int // Padding inside wrapper, used with BorderColor (default: 0)
}
ScrollableOpts configures a scrollable container.
type TextInputGroup ¶
type TextInputGroup struct {
// contains filtered or unexported fields
}
TextInputGroup manages a group of text inputs with clipboard support. Call Update() each frame to handle Ctrl/Cmd+A/C/V/X shortcuts.
func NewTextInputGroup ¶
func NewTextInputGroup() *TextInputGroup
NewTextInputGroup creates a new text input group for clipboard handling.
func (*TextInputGroup) Add ¶
func (g *TextInputGroup) Add(input *widget.TextInput)
Add registers a text input with the group for clipboard handling.
func (*TextInputGroup) Update ¶
func (g *TextInputGroup) Update()
Update handles clipboard shortcuts (Ctrl/Cmd+A/C/V/X) for the focused input. Call this each frame from your screen's Update method.