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 ¶
- Variables
- func AltPressed() bool
- func Button(label string, handler func(*widget.ButtonClickedEventArgs)) *widget.Button
- func ButtonImage() *widget.ButtonImage
- func ButtonTextColor() *widget.ButtonTextColor
- func ClipboardWriteText(s string) bool
- func FontFace() *text.Face
- func HRow(spacing int, children ...widget.PreferredSizeLocateableWidget) *widget.Container
- func Label(text string, c color.Color) *widget.Text
- func LinkButton(label string, c color.Color, handler func(*widget.ButtonClickedEventArgs)) *widget.Button
- func ModPressed() bool
- func PrimaryButton(label string, handler func(*widget.ButtonClickedEventArgs)) *widget.Button
- func PrimaryButtonImage() *widget.ButtonImage
- func Px(logical int) int
- func SetDPIScale(scale float64)
- func ShiftPressed() bool
- func SliderButtonImage() *widget.ButtonImage
- func TextInput(placeholder string, minWidth int, opts ...widget.TextInputOpt) *widget.TextInput
- func TextRowsHeight(n int) int
- type HexView
- func (h *HexView) ClearSelection()
- func (h *HexView) Dragging() bool
- func (h *HexView) GetWidget() *widget.Widget
- func (h *HexView) HasSelection() bool
- func (h *HexView) PreferredSize() (int, int)
- func (h *HexView) Render(screen *ebiten.Image)
- func (h *HexView) SelectedDump() string
- func (h *HexView) SelectedHex() string
- func (h *HexView) SetData(addr uint32, data []byte)
- func (h *HexView) SetLocation(rect image.Rectangle)
- func (h *HexView) Update(updObj *widget.UpdateObject)
- func (h *HexView) Validate()
- type LogView
- func (v *LogView) Dragging() bool
- func (v *LogView) GetWidget() *widget.Widget
- func (v *LogView) PreferredSize() (int, int)
- func (v *LogView) Render(screen *ebiten.Image)
- func (v *LogView) SetLocation(rect image.Rectangle)
- func (v *LogView) Update(updObj *widget.UpdateObject)
- func (v *LogView) Validate()
- 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) 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 TextInputGroup
Constants ¶
This section is empty.
Variables ¶
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 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 ¶
ClipboardWriteText puts s on the system clipboard. It reports false when no clipboard is available or the write fails.
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 ¶
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 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 SliderButtonImage ¶
func SliderButtonImage() *widget.ButtonImage
SliderButtonImage is the scrollbar handle image set.
func TextRowsHeight ¶
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 ¶
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) HasSelection ¶
HasSelection reports whether a selection exists.
func (*HexView) PreferredSize ¶
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) SelectedDump ¶
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 ¶
SelectedHex renders the selection's visible bytes as one contiguous hex string.
func (*HexView) SetData ¶
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 ¶
SetLocation positions the view.
func (*HexView) Update ¶
func (h *HexView) Update(updObj *widget.UpdateObject)
Update decays the change heat and tracks the selection drag.
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 ¶
NewLogView creates a view over buf.
func (*LogView) PreferredSize ¶
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 ¶
Render draws the lines intersecting the clip viewport, with the selection filled behind the text.
func (*LogView) SetLocation ¶
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.
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 ¶
func Scrollable(content widget.PreferredSizeLocateableWidget, bg color.Color) (*ScrollView, widget.PreferredSizeLocateableWidget)
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.