Documentation
¶
Index ¶
- func ActionRow(buttons ...*widget.Button) *widget.Container
- func AlternatingRowColor(index int) color.Color
- func ButtonRow() *widget.Container
- func ButtonWidth(label string) int
- func CenteredContainer(spacing int) *widget.Container
- func ClipboardRead() (string, bool)
- func ClipboardWrite(s string) bool
- func CycleButton(label string, current, count, minWidth int, handler func(next int)) *widget.Button
- func EmptyState(title, subtitle string, button *widget.Button) *widget.Container
- func EnabledTextButton(text string, padding int, enabled bool, ...) *widget.Button
- func FillContainer() *widget.Container
- func LabeledText(label, subtext string) *widget.Container
- func NoticeText(text string) *widget.Text
- func OnOffButton(on bool, handler func(*widget.ButtonClickedEventArgs)) *widget.Button
- func OnOffButtonWidth() int
- func PageRowWidth(contentWidth int) int
- func PrimaryTextButton(text string, padding int, handler func(*widget.ButtonClickedEventArgs)) *widget.Button
- func RowLabelWidth(rowWidth, padding int, controlWidths ...int) int
- func ScreenContainer() *widget.Container
- func ScreenContentContainer(rowStretch []bool) *widget.Container
- func ScrollSlider(scrollContainer *ScrollView, needsScroll func() bool) *widget.Slider
- func SectionHeader(title string) *widget.Container
- func SettingsRow(columns int) *widget.Container
- func SettingsRowLabelWidth(rowWidth int, controlWidths ...int) int
- func SetupScrollHandler(scrollContainer *ScrollView, vSlider *widget.Slider, needsScroll func() bool)
- func ShortcutModifierPressed() bool
- func SidebarFitWidth(labels []string) int
- func StyledTextInput(placeholder string, secure bool, minWidth int, opts ...widget.TextInputOpt) *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 Carousel
- type CarouselOptions
- type ConfirmDelete
- type FitGraphic
- type IconGraphic
- type MultiLineInput
- func (m *MultiLineInput) AddFocus(direction widget.FocusDirection, focus widget.Focuser)
- func (m *MultiLineInput) Focus(focused bool)
- func (m *MultiLineInput) GetFocus(direction widget.FocusDirection) widget.Focuser
- func (m *MultiLineInput) GetWidget() *widget.Widget
- func (m *MultiLineInput) IsFocused() bool
- func (m *MultiLineInput) MoveCaretDown() bool
- func (m *MultiLineInput) MoveCaretLeft()
- func (m *MultiLineInput) MoveCaretRight()
- func (m *MultiLineInput) MoveCaretUp() bool
- func (m *MultiLineInput) PreferredSize() (int, int)
- func (m *MultiLineInput) Render(screen *ebiten.Image)
- func (m *MultiLineInput) SetLocation(rect img.Rectangle)
- func (m *MultiLineInput) SetText(s string)
- func (m *MultiLineInput) TabOrder() int
- func (m *MultiLineInput) Text() string
- func (m *MultiLineInput) Update(updObj *widget.UpdateObject)
- func (m *MultiLineInput) Validate()
- type ScrollView
- func (s *ScrollView) Contains(w *widget.Widget) bool
- 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) ScrollRectToCenter(rect img.Rectangle)
- func (s *ScrollView) ScrollRectToTop(rect img.Rectangle)
- func (s *ScrollView) ScrollStep(dir int) bool
- 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 ShrinkFirstLayout
- type Sidebar
- type TextInputGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActionRow ¶ added in v0.7.0
ActionRow creates the action button row of a form or sub-view: the buttons right-aligned in the order given. Put the confirming action first, as a primary button, and Cancel or Done last. The returned container has RowLayoutData{Stretch: true} for use in row layouts.
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 ButtonWidth ¶ added in v0.7.0
ButtonWidth returns the width of a button with the given label and style.ButtonPaddingSmall text padding
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 ClipboardRead ¶ added in v0.7.0
ClipboardRead returns the clipboard text. ok is false when no clipboard is available or it holds no text.
func ClipboardWrite ¶ added in v0.7.0
ClipboardWrite puts s on the system clipboard. It reports false when no clipboard is available or the write fails.
func CycleButton ¶ added in v0.7.0
CycleButton creates a settings row button that steps through count values, showing label for the current one. Pressing it calls handler with the index after current, wrapping to the first; a current of -1, a value not in the list, steps to the first. With no values pressing it does nothing. It is at least minWidth wide and vertically centered in its grid cell.
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 EnabledTextButton ¶ added in v0.7.0
func EnabledTextButton(text string, padding int, enabled bool, handler func(*widget.ButtonClickedEventArgs)) *widget.Button
EnabledTextButton creates a text button in the normal style, or in the disabled style when not enabled. The handler runs only when enabled.
func FillContainer ¶ added in v0.7.0
FillContainer creates a single cell container whose child is stretched to fill it. Use as the outer container of a sidebar section's content so scrollable content can stretch to the content area.
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 NoticeText ¶ added in v0.7.0
NoticeText creates a line of secondary text for notes and hints
func OnOffButton ¶ added in v0.7.0
func OnOffButton(on bool, handler func(*widget.ButtonClickedEventArgs)) *widget.Button
OnOffButton creates a settings row toggle labeled "On" or "Off", in the active style when on, vertically centered in its grid cell
func OnOffButtonWidth ¶ added in v0.7.0
func OnOffButtonWidth() int
OnOffButtonWidth returns the width an OnOffButton takes in either state
func PageRowWidth ¶ added in v0.7.0
PageRowWidth returns the width of a row in a page's scrollable content when the page content is contentWidth wide. See PageScrollOpts.
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 RowLabelWidth ¶ added in v0.7.0
RowLabelWidth returns the width left for the label column of a row grid that is rowWidth wide with the given padding and style.DefaultSpacing between columns, after each control column. It is never below minRowLabelWidth.
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 SectionHeader ¶ added in v0.7.0
SectionHeader creates a header row with the title in the accent color. The returned container has RowLayoutData{Stretch: true} for use in row layouts.
func SettingsRow ¶
SettingsRow creates a standard settings row container with style.Surface background, N-column grid layout, and RowLayoutData stretch.
func SettingsRowLabelWidth ¶ added in v0.7.0
SettingsRowLabelWidth returns the width left for the label column of a SettingsRow that is rowWidth wide. See RowLabelWidth.
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 ShortcutModifierPressed ¶ added in v0.7.0
func ShortcutModifierPressed() bool
ShortcutModifierPressed reports whether the platform's shortcut modifier is held: Cmd on macOS, Ctrl elsewhere.
func SidebarFitWidth ¶ added in v0.7.0
SidebarFitWidth returns the width a sidebar needs to fit the longest of labels, including button and sidebar padding, at the current font size.
func StyledTextInput ¶
func StyledTextInput(placeholder string, secure bool, minWidth int, opts ...widget.TextInputOpt) *widget.TextInput
StyledTextInput creates a text input with consistent styling. Additional options, such as change and submit handlers, are applied after the 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 Carousel ¶ added in v0.8.0
type Carousel struct {
// contains filtered or unexported fields
}
Carousel shows one image of a row at a time, captioned and as large as its rect allows, with a slice of the images beside it at the same height, dimmed, at the edges of its rect. Each visible slice is a button that moves the row one image its way. The row does not wrap.
The carousel holds no position of its own. The owner keeps the index, creates a new Carousel after each move, and passes the index moved from and when, so a slide in progress continues across rebuilds.
func NewCarousel ¶ added in v0.8.0
func NewCarousel(o CarouselOptions) *Carousel
NewCarousel creates a Carousel. The index is clamped to the row.
func (*Carousel) Container ¶ added in v0.8.0
Container returns the widget to add to a page. It fills the cell it is placed in.
type CarouselOptions ¶ added in v0.8.0
type CarouselOptions struct {
Images []*ebiten.Image // the row, all non-nil
Labels []string // a caption per image
Index int // image shown
From int // image the last move started at; Index when none
Start time.Time // when the last move started
Now func() time.Time
Gap int // pixels between images
Peek int // least pixel width of a visible slice beside the image shown
// Move is called with -1 or 1 when the slice on that side is
// pressed
Move func(dir int)
}
CarouselOptions configures a Carousel
type ConfirmDelete ¶ added in v0.7.0
type ConfirmDelete struct {
// contains filtered or unexported fields
}
ConfirmDelete builds Delete buttons that take two presses. The first press arms the button, which the next build shows as Confirm Delete in the primary style; the second press deletes. Focus leaving the armed button disarms it. At most one delete is armed, named by the key it was built with. The zero value has nothing armed.
func (*ConfirmDelete) Button ¶ added in v0.7.0
func (d *ConfirmDelete) Button(key string, padding int, focus pendingFocuser, rebuild, onConfirm func()) *widget.Button
Button creates the Delete button for key, which must not be empty and is unique among the buttons sharing d. key is also the button's focus key. Pressing it unarmed arms key, sets focus to it, and calls rebuild; a mouse click does not focus a button, and focus leaving the button is what disarms it. Pressing it armed disarms and calls onConfirm. Focus leaving it while armed disarms and calls rebuild.
func (*ConfirmDelete) Disarm ¶ added in v0.7.0
func (d *ConfirmDelete) Disarm() bool
Disarm cancels an armed delete, reporting whether there was one
func (*ConfirmDelete) Label ¶ added in v0.7.0
func (d *ConfirmDelete) Label(key string) string
Label returns the text of key's button: Confirm Delete when armed, otherwise Delete
type FitGraphic ¶ added in v0.7.0
FitGraphic draws one texture scaled to fit its rect, centered, keeping the aspect ratio. It reports no preferred size, so the layout cell it is stretched into decides how large the image is drawn. This lets a large texture be shown at whatever size the window allows without rescaling it on the CPU.
Image is set directly by the owner, matching the public-field style of ebitenui's own Graphic.
func NewFitGraphic ¶ added in v0.7.0
func NewFitGraphic(img *ebiten.Image, opts ...widget.WidgetOpt) *FitGraphic
NewFitGraphic creates a FitGraphic for img. opts are applied to the underlying widget.
func (*FitGraphic) GetWidget ¶ added in v0.7.0
func (g *FitGraphic) GetWidget() *widget.Widget
GetWidget returns the underlying widget.
func (*FitGraphic) PreferredSize ¶ added in v0.7.0
func (g *FitGraphic) PreferredSize() (int, int)
PreferredSize reports no size of its own; the layout decides.
func (*FitGraphic) Render ¶ added in v0.7.0
func (g *FitGraphic) Render(screen *ebiten.Image)
Render draws the texture scaled to fit the widget rect and centered in it.
func (*FitGraphic) SetLocation ¶ added in v0.7.0
func (g *FitGraphic) SetLocation(rect goimage.Rectangle)
SetLocation positions the widget.
func (*FitGraphic) Validate ¶ added in v0.7.0
func (g *FitGraphic) Validate()
Validate satisfies the widget interface; nothing to validate.
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 MultiLineInput ¶ added in v0.7.0
type MultiLineInput struct {
// contains filtered or unexported fields
}
MultiLineInput is an editable multi-line text field. It shows a fixed number of lines and scrolls in both directions to keep the caret in view, with a scrollbar on each axis while the text overflows it.
The field handles typing, Enter, Backspace, Delete, Home, End, the Ctrl/Cmd+A/C/X/V clipboard shortcuts, and mouse selection itself. Arrow keys and gamepad directions are applied by the owner through MoveCaret, so they share the UI navigation repeat and can move focus out of the field at its edges.
func NewMultiLineInput ¶ added in v0.7.0
func NewMultiLineInput(rows, minWidth, maxRunes, maxLines int, changed func(text string), opts ...widget.WidgetOpt) *MultiLineInput
NewMultiLineInput creates a field showing rows lines, at least minWidth wide. maxRunes and maxLines limit the text as in textedit.New. changed, when not nil, is called after each edit with the new text.
func (*MultiLineInput) AddFocus ¶ added in v0.7.0
func (m *MultiLineInput) AddFocus(direction widget.FocusDirection, focus widget.Focuser)
AddFocus is part of widget.Focuser
func (*MultiLineInput) Focus ¶ added in v0.7.0
func (m *MultiLineInput) Focus(focused bool)
Focus sets whether the field has keyboard focus and tells the UI
func (*MultiLineInput) GetFocus ¶ added in v0.7.0
func (m *MultiLineInput) GetFocus(direction widget.FocusDirection) widget.Focuser
GetFocus is part of widget.Focuser
func (*MultiLineInput) GetWidget ¶ added in v0.7.0
func (m *MultiLineInput) GetWidget() *widget.Widget
GetWidget returns the underlying widget
func (*MultiLineInput) IsFocused ¶ added in v0.7.0
func (m *MultiLineInput) IsFocused() bool
IsFocused reports whether the field has keyboard focus
func (*MultiLineInput) MoveCaretDown ¶ added in v0.7.0
func (m *MultiLineInput) MoveCaretDown() bool
MoveCaretDown moves the caret down one line like MoveCaretUp. It reports false on the last line.
func (*MultiLineInput) MoveCaretLeft ¶ added in v0.7.0
func (m *MultiLineInput) MoveCaretLeft()
MoveCaretLeft moves the caret left one character, extending the selection while Shift is held
func (*MultiLineInput) MoveCaretRight ¶ added in v0.7.0
func (m *MultiLineInput) MoveCaretRight()
MoveCaretRight moves the caret right one character, extending the selection while Shift is held
func (*MultiLineInput) MoveCaretUp ¶ added in v0.7.0
func (m *MultiLineInput) MoveCaretUp() bool
MoveCaretUp moves the caret up one line, extending the selection while Shift is held. It reports false on the first line, where focus should leave the field instead.
func (*MultiLineInput) PreferredSize ¶ added in v0.7.0
func (m *MultiLineInput) PreferredSize() (int, int)
PreferredSize returns minWidth by the height of the visible rows plus padding
func (*MultiLineInput) Render ¶ added in v0.7.0
func (m *MultiLineInput) Render(screen *ebiten.Image)
Render draws the background, the visible text with its selection, the caret, and the scrollbars
func (*MultiLineInput) SetLocation ¶ added in v0.7.0
func (m *MultiLineInput) SetLocation(rect img.Rectangle)
SetLocation sets the field's rectangle
func (*MultiLineInput) SetText ¶ added in v0.7.0
func (m *MultiLineInput) SetText(s string)
SetText replaces the text without calling the changed handler
func (*MultiLineInput) TabOrder ¶ added in v0.7.0
func (m *MultiLineInput) TabOrder() int
TabOrder is part of widget.Focuser
func (*MultiLineInput) Text ¶ added in v0.7.0
func (m *MultiLineInput) Text() string
Text returns the field's text, lines joined by "\n"
func (*MultiLineInput) Update ¶ added in v0.7.0
func (m *MultiLineInput) Update(updObj *widget.UpdateObject)
Update handles mouse dragging and, while focused, editing keys
func (*MultiLineInput) Validate ¶ added in v0.7.0
func (m *MultiLineInput) Validate()
Validate is part of the ebitenui widget contract
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) Contains ¶ added in v0.8.0
func (s *ScrollView) Contains(w *widget.Widget) bool
Contains reports whether w is the view's content or inside it
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) ScrollRectToCenter ¶ added in v0.8.0
func (s *ScrollView) ScrollRectToCenter(rect img.Rectangle)
ScrollRectToCenter scrolls so rect (in screen coordinates) is vertically centered in the viewport, clamped to the scroll range. 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) ScrollStep ¶ added in v0.8.0
func (s *ScrollView) ScrollStep(dir int) bool
ScrollStep scrolls one step, a quarter of the viewport height, down for a positive dir and up for a negative one, clamped to the scroll range. It reports whether the view moved: false at the end in that direction and 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.
func PageScrollOpts ¶ added in v0.7.0
func PageScrollOpts(content *widget.Container) ScrollableOpts
PageScrollOpts returns the options of the scrollable container that holds the content of a sidebar page, such as a settings section or a detail page
func (ScrollableOpts) ContentWidth ¶ added in v0.7.0
func (opts ScrollableOpts) ContentWidth(width int) int
ContentWidth returns the width of the scrolled content in a scrollable container that is width wide: less the wrapper padding, the slider, and the spacing between them
type ShrinkFirstLayout ¶ added in v0.7.0
type ShrinkFirstLayout struct {
// contains filtered or unexported fields
}
ShrinkFirstLayout stacks its widgets top to bottom at the container width, each at its preferred height, directly under one another. When the stack is taller than the container, only the first widget shrinks, so the ones below it stay in place and are never pushed out. It lays out a column whose head adapts to the height left by its tail, such as box art over a sidebar.
func NewShrinkFirstLayout ¶ added in v0.7.0
func NewShrinkFirstLayout(spacing int) *ShrinkFirstLayout
NewShrinkFirstLayout creates a ShrinkFirstLayout with spacing pixels between widgets.
func (*ShrinkFirstLayout) Layout ¶ added in v0.7.0
func (l *ShrinkFirstLayout) Layout(widgets []widget.PreferredSizeLocateableWidget, rect goimage.Rectangle)
Layout places the widgets in rect.
func (*ShrinkFirstLayout) PreferredSize ¶ added in v0.7.0
func (l *ShrinkFirstLayout) PreferredSize(widgets []widget.PreferredSizeLocateableWidget) (int, int)
PreferredSize reports the widest widget and the height of the stack.
type Sidebar ¶ added in v0.7.0
Sidebar is a vertical list of navigation items on a surface panel. Focus registration is left to the owning screen, which knows its keys.
func NewSidebar ¶ added in v0.7.0
NewSidebar creates an empty sidebar. minWidth is the minimum width; the sidebar still grows when a label needs more room.
func (*Sidebar) AddButton ¶ added in v0.7.0
AddButton appends a button stretched to the sidebar width. active selects the highlighted style used for the current selection.
func (*Sidebar) AddDisabledItem ¶ added in v0.7.0
AddDisabledItem appends a non-focusable item for future or unavailable entries. It uses the button padding so it matches the button height.
func (*Sidebar) AddDivider ¶ added in v0.7.0
func (s *Sidebar) AddDivider()
AddDivider appends a 1px separator line between groups of items.
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.