ui

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: GPL-3.0 Imports: 17 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ui holds the debugger's ebitenui styling and shared widget constructors. The debugger uses one fixed dark theme and a monospace face everywhere: every panel is addresses, hex, and values.

Index

Constants

This section is empty.

Variables

View Source
var (
	Background    = color.NRGBA{0x14, 0x14, 0x1a, 0xff}
	Surface       = color.NRGBA{0x20, 0x20, 0x2a, 0xff}
	Primary       = color.NRGBA{0x1e, 0x40, 0x7a, 0xff}
	PrimaryHover  = color.NRGBA{0x2a, 0x50, 0x8a, 0xff}
	Text          = color.NRGBA{0xe6, 0xe6, 0xe6, 0xff}
	TextSecondary = color.NRGBA{0x8a, 0x8a, 0x8a, 0xff}
	Bad           = color.NRGBA{0xe0, 0x50, 0x50, 0xff}
	Border        = color.NRGBA{0x30, 0x30, 0x3e, 0xff}
)

Theme colors.

Functions

func AltPressed

func AltPressed() bool

AltPressed reports whether either alt key is held.

func Button

func Button(label string, handler func(*widget.ButtonClickedEventArgs)) *widget.Button

Button creates a standard text button.

func ButtonImage

func ButtonImage() *widget.ButtonImage

ButtonImage is the standard button image set.

func ButtonTextColor

func ButtonTextColor() *widget.ButtonTextColor

ButtonTextColor is the standard button text color set.

func ClipboardWriteText

func ClipboardWriteText(s string) bool

ClipboardWriteText puts s on the system clipboard. It reports false when no clipboard is available.

func FontFace

func FontFace() *text.Face

FontFace returns the UI font face.

func HRow

func HRow(spacing int, children ...widget.PreferredSizeLocateableWidget) *widget.Container

HRow lays out children horizontally with the given spacing and centers each on the cross axis. Mixed-height children (buttons, text inputs, labels) stay visually aligned this way; a child with its own LayoutData keeps it.

func Label

func Label(text string, c color.Color) *widget.Text

Label creates a plain text label. The text centers vertically within the widget's rect: in packed rows the rect is the text's own height and this is a no-op, while in a stretched layout cell (grid columns, bar rows) it keeps the label on the row's centerline. GridLayoutData positioning cannot do this: the grid hands every child the full cell, so there is no smaller rect for it to position.

func LinkButton

func LinkButton(label string, c color.Color, handler func(*widget.ButtonClickedEventArgs)) *widget.Button

LinkButton creates a text-styled button for clickable list entries: transparent at rest so it reads as a plain row, highlighted on hover. c is the label color.

func ModPressed

func ModPressed() bool

ModPressed reports whether the platform's clipboard modifier is held: Cmd on macOS, Ctrl elsewhere.

func PrimaryButton

func PrimaryButton(label string, handler func(*widget.ButtonClickedEventArgs)) *widget.Button

PrimaryButton creates a prominent text button.

func PrimaryButtonImage

func PrimaryButtonImage() *widget.ButtonImage

PrimaryButtonImage is the prominent button image set.

func Px

func Px(logical int) int

Px converts a logical pixel value to physical pixels.

func SetDPIScale

func SetDPIScale(scale float64)

SetDPIScale sets the device scale factor and rebuilds the font face. The caller rebuilds its widget tree afterwards; existing widgets keep measurements from the old face.

func ShiftPressed

func ShiftPressed() bool

ShiftPressed reports whether either shift key is held.

func SliderButtonImage

func SliderButtonImage() *widget.ButtonImage

SliderButtonImage is the scrollbar handle image set.

func TextInput

func TextInput(placeholder string, minWidth int, opts ...widget.TextInputOpt) *widget.TextInput

TextInput creates a single-line text input.

func TextRowsHeight

func TextRowsHeight(n int) int

TextRowsHeight returns the pixel height of n text rows plus the standard cell padding. Ensures bottom text is not cut off for log view.

Types

type HexView

type HexView struct {

	// Rows is the number of visible rows. The host sizes its reads to
	// Rows * 16 bytes.
	Rows int
	// contains filtered or unexported fields
}

HexView renders a window of guest memory as a hex dump with an address gutter and an ASCII column. Bytes that changed between SetData calls at the same address are highlighted and fade back over heatFrames ticks. The widget draws its rows directly; ebitenui has no grid-of-text widget with per-cell color.

func NewHexView

func NewHexView(rows int, opts ...widget.WidgetOpt) *HexView

NewHexView creates a hex view showing rows rows.

func (*HexView) ClearSelection

func (h *HexView) ClearSelection()

ClearSelection drops the selection. The host calls it when the view jumps somewhere unrelated (region switch, goto).

func (*HexView) Dragging

func (h *HexView) Dragging() bool

Dragging reports whether a selection drag is in progress.

func (*HexView) GetWidget

func (h *HexView) GetWidget() *widget.Widget

GetWidget returns the underlying widget.

func (*HexView) HasSelection

func (h *HexView) HasSelection() bool

HasSelection reports whether a selection exists.

func (*HexView) PreferredSize

func (h *HexView) PreferredSize() (int, int)

PreferredSize reports the size of the full row grid. Cell metrics are fractional and rows draw at row*lineH in float space, so both dimensions ceil the full product rather than truncating per cell.

func (*HexView) Render

func (h *HexView) Render(screen *ebiten.Image)

Render draws the visible rows.

func (*HexView) SelectedDump

func (h *HexView) SelectedDump() string

SelectedDump renders the selection's visible bytes in the viewer's dump format: row-aligned address gutter, hex cells, and ASCII, with unselected positions blanked so columns stay aligned.

func (*HexView) SelectedHex

func (h *HexView) SelectedHex() string

SelectedHex renders the selection's visible bytes as one contiguous hex string.

func (*HexView) SetData

func (h *HexView) SetData(addr uint32, data []byte)

SetData replaces the displayed window. When the base address matches the previous window, differing bytes get change heat; any move or resize resets the heat so a scroll does not light the whole view.

func (*HexView) SetLocation

func (h *HexView) SetLocation(rect image.Rectangle)

SetLocation positions the view.

func (*HexView) Update

func (h *HexView) Update(updObj *widget.UpdateObject)

Update decays the change heat and tracks the selection drag.

func (*HexView) Validate

func (h *HexView) Validate()

Validate is part of the ebitenui widget contract.

type LogView

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

LogView renders a logbuf.Buffer with drag selection. It draws its lines directly (per-line highlight fill needs per-character geometry) and is designed to sit inside a ScrollView, which positions the full content rect and clips rendering to the viewport.

func NewLogView

func NewLogView(buf *logbuf.Buffer, opts ...widget.WidgetOpt) *LogView

NewLogView creates a view over buf.

func (*LogView) Dragging

func (v *LogView) Dragging() bool

Dragging reports whether a selection drag is in progress.

func (*LogView) GetWidget

func (v *LogView) GetWidget() *widget.Widget

GetWidget returns the underlying widget.

func (*LogView) PreferredSize

func (v *LogView) PreferredSize() (int, int)

PreferredSize reports the full content size. The face's line height is fractional, and rows draw at row*lineH in float space, so the height must ceil the full product: truncating per line under-reports tall content and the bottom rows spill past the reserved rect.

func (*LogView) Render

func (v *LogView) Render(screen *ebiten.Image)

Render draws the lines intersecting the clip viewport, with the selection filled behind the text.

func (*LogView) SetLocation

func (v *LogView) SetLocation(rect image.Rectangle)

SetLocation positions the content rect.

func (*LogView) Update

func (v *LogView) Update(updObj *widget.UpdateObject)

Update tracks the selection drag. Presses only register inside the visible viewport; drags keep updating wherever the cursor goes, clamped to the nearest character.

func (*LogView) Validate

func (v *LogView) 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

	// MinHeight and MaxHeight, when positive, bound the preferred
	// height: the view scrolls instead of growing its layout cell as
	// content is added, and holds its size when content is short.
	// Setting both to the same value fixes the view's design height.
	MinHeight int
	MaxHeight int
	// 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.

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 Scrollable

Scrollable wraps content in a ScrollView with a paired vertical scrollbar and mouse wheel support. It returns the view (for programmatic scrolling) and the wrapper to place in a layout.

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, bounded by MinHeight and MaxHeight when set.

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

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

TextInputGroup adds clipboard support to a set of text inputs. The host registers every input on the current screen and calls Update each frame; Ctrl/Cmd+A/C/V/X act on whichever registered input has focus. Rebuild the group alongside the widget tree so it never holds inputs from a torn-down screen.

func NewTextInputGroup

func NewTextInputGroup() *TextInputGroup

NewTextInputGroup creates an empty group.

func (*TextInputGroup) Add

func (g *TextInputGroup) Add(input *widget.TextInput)

Add registers a text input for clipboard handling.

func (*TextInputGroup) Focused

func (g *TextInputGroup) Focused() bool

Focused reports whether any registered input has focus, so other keyboard consumers can yield the clipboard shortcuts.

func (*TextInputGroup) Update

func (g *TextInputGroup) Update()

Update handles clipboard shortcuts for the focused input.

Directories

Path Synopsis
Package logbuf holds the log line store with its selection state.
Package logbuf holds the log line store with its selection state.

Jump to

Keyboard shortcuts

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