widgets

package
v0.5.43 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 42 Imported by: ? modules, 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

Index

Constants

View Source
const (
	// BottomSheetMaxWidth is the widest a sheet gets. Beyond it the sheet stops growing and
	// the margin does the work.
	BottomSheetMaxWidth = float32(640)
	// BottomSheetSideMargin is the minimum gap on each side once the width cap applies.
	BottomSheetSideMargin = float32(56)
	// BottomSheetTopMargin is how much of the screen a sheet must leave uncovered, so the
	// content behind it stays visible enough to explain what the sheet is about.
	BottomSheetTopMargin = float32(72)
)

The published metrics, in density-independent pixels. They are constants rather than theme tokens because M3 states them as numbers, and a sheet whose width cap drifted per preset would no longer be the control the guidance describes.

View Source
const (
	ColorFieldHeight      = float32(28)
	ColorFieldButtonWidth = float32(34)
)

ColorField geometry. The panel is sized for the picker: its SV square is min(width-30, height), so 250x210 leaves a full-height square plus the hue bar.

View Source
const (
	DatePickerHeight      = float32(28)
	DatePickerButtonWidth = float32(28)
)

DatePicker geometry. The panel is sized for a calendar: seven columns, a 30px header and six week rows (see Calendar.Paint).

View Source
const (
	DialogMaxWidth   = float32(560)
	DialogSideMargin = float32(24)
	DialogTopMargin  = float32(48)
	DialogPad        = float32(24)
	DialogActionH    = float32(40)
	DialogActionPadX = float32(12)
	DialogActionGap  = float32(8)
)

The dialog's metrics. DialogMaxWidth is M3's own cap for a dialog; the rest are the spacing the guidance describes, in density-independent pixels.

View Source
const (
	WrapNoWrap   = "noWrap"
	WrapWordWrap = "wordWrap"
	WrapEllipsis = "ellipsis"
)
View Source
const (
	ListItemIconSize = float32(24)
	ListItemPad      = float32(16)
	// ListItemSlot is the leading/trailing slot's width: an icon plus its padding on both sides.
	ListItemSlot = ListItemIconSize + 2*ListItemPad
)

ListItem metrics. The slot is a 24px icon inside 16px of padding, and never under the touch floor; the text is inset by the slot on the side it is on.

View Source
const (
	// PullThreshold is how far the content must be pulled before releasing refreshes.
	PullThreshold = float32(64)
	// PullMax is how far the content follows the finger. Past it the pull stops moving, so the
	// gesture has a visible end instead of dragging the content off the screen.
	PullMax = float32(112)
)

PullToRefresh metrics.

View Source
const (
	Horizontal = iota
	Vertical
)
View Source
const (
	SearchViewHeaderH = float32(56)
	SearchViewRowH    = float32(56)
	SearchViewPad     = float32(16)
)

SearchView metrics. The header is a search app bar; the two drawn controls reach the touch floor through controlSize, and the rows are two-line list items.

View Source
const (
	TabHorizontal = iota
	TabVertical
)
View Source
const (
	TimePickerHeight      = float32(28)
	TimePickerButtonWidth = float32(28)
)

TimePicker geometry, and the panel's grid.

View Source
const (
	FrameBarHeight = float32(28)
	FrameBtnWidth  = float32(34)
	FrameEdgeSize  = float32(6) // resize border thickness (sync: mobilegles.EdgeZone)
)

Frame metrics.

View Source
const (
	EdgeNone  = 0
	EdgeTop   = 1 << 0
	EdgeBot   = 1 << 1
	EdgeLeft  = 1 << 2
	EdgeRight = 1 << 3
)

Edge zones (window-relative).

View Source
const (

	// ActionSheetMaxItems is the guidance's cap. It is enforced by the AUDIT rather than by
	// refusing items — an app with five choices is better served by a warning in review than by a
	// sheet that silently drops the fifth.
	ActionSheetMaxItems = 4
)

The action sheet's own metrics. The rows reach the touch floor through rowHeight.

View Source
const DefaultSnackbarDuration = 4 * time.Second

DefaultSnackbarDuration is how long a snackbar stays up. Four seconds is the short end of the platform's range and is deliberate: a message that outlives its relevance is just something in the way, and an app with something longer to say wants a dialog.

View Source
const (

	// SwipeFullFraction is how much of the ROW a swipe must cover to run the first action outright
	// on release, which is the platform's "swipe all the way to delete".
	SwipeFullFraction = float32(0.5)
)

SwipeActionRow metrics.

Variables

View Source
var (
	GlobalEditorTheme    = DefaultEditorTheme()
	GlobalSyntaxTheme    = DefaultSyntaxTheme()
	GlobalEditorSettings = DefaultEditorSettings()
)

Global shared instances — widgets point to these so theme changes apply immediately.

View Source
var FenceResolver func(name string, params map[string]any, body string) (w MarkdownWidget, summary string, ok bool)

FenceResolver is the seam between the renderer and the widget registry.

The registry lives in the meui-markdown module, so `meui` must not import it and the module must not be reimplemented inside the toolkit. This is the one call: the renderer asks whether a fence's info string names an embeddable widget, and gets back a widget, a summary line for the disclosure header, or nothing — which means the fence is a code block after all.

A nil resolver is the normal case, and the renderer is then exactly what it was.

Functions

func ApplyEditorScheme

func ApplyEditorScheme(s *theme.EditorScheme)

ApplyEditorScheme applies a parsed IntelliJ editor scheme to the global EditorTheme and SyntaxTheme pointers. Call after theme.SetDefaultTheme().

func CellLess

func CellLess(a, b string, t DataColType, asc bool) bool

CellLess is the comparator a sort.Slice* call needs, and within one direction it is a STRICT WEAK ORDERING: CellLess(x, x, t, asc) is false, and the order is consistent.

Writing the descending case as an inverted "less" is not the same thing, and is how a descending sort of equal cells comes to claim each preceded the other — a broken contract, which leaves the order of equal rows to the sort's internals. Compare first, then choose a side.

Two rules, and they are deliberately not symmetric:

  • A numeric cell with no number is MISSING and sinks below every real value in BOTH directions. A descending sort of a P&L column must not lead with the rows that have no number to show, and a symbol table holds "-" in every momentum cell until the first tick arrives.
  • Among real values (and among text cells), descending is the exact converse of ascending.

func ColorChannels

func ColorChannels(color graphics.Color) (r, g, b, a uint8)

ColorChannels splits a colour into its channels, for the picker and the swatch.

func CompareCells

func CompareCells(a, b string, t DataColType) int

CompareCells orders two cell texts for a column of the given type: -1 when a belongs before b in the ASCENDING order, +1 when after, 0 when the two are equivalent.

In a numeric column a cell with no number is missing and compares greater than any real value, so ascending puts it last. Two missing cells fall back to text so their order is still defined.

This is the raw ordering. A sort should call CellLess, which keeps a missing value at the bottom when the direction flips.

func DrawCheckBox

func DrawCheckBox(canvas *graphics.Canvas, x, y, size float32, checked, enabled bool)

DrawCheckBox draws a checkbox box + optional checkmark at (x, y) with the given size. Uses theme.DefaultCheckBoxTheme for colors unless overridden.

func DrawText

func DrawText(canvas *graphics.Canvas, text string, x, y float32, font graphics.Font, paint *graphics.Paint)

func EdgeZone

func EdgeZone(x, y, w, h float32) uint32

EdgeZone classifies a point against the window's resize border. Returns an Edge* bitmask (0 = not on an edge).

func FormatHexColor

func FormatHexColor(color graphics.Color) string

FormatHexColor renders a colour as "#RRGGBB", or "#RRGGBBAA" when it is translucent — the usual web order, and the exact inverse of ParseHexColor for every colour ParseHexColor can produce.

func LangIDForFile

func LangIDForFile(path string) string

func OpenDirectory

func OpenDirectory(title string) (platform.FileRef, bool)

OpenDirectory asks for a directory.

func OpenFile

func OpenFile(title string) (platform.FileRef, bool)

OpenFile asks for one file.

func OpenFiles

func OpenFiles(title string) ([]platform.FileRef, bool)

OpenFiles asks for any number of files.

func ParseCellNumber

func ParseCellNumber(text string) (float64, bool)

ParseCellNumber reads the number a cell displays, and reports whether it found one.

It tolerates the formatting a table puts in cells: a currency prefix ("$1,234.56"), a percent suffix ("1.5%"), thousands separators, a leading "+", surrounding spaces and the unicode minus sign. ok is false for the placeholders ("", "-", "—") and for anything else that is not a finite number — so a column can tell "no value" from "zero", which are different facts.

func ParseFenceInfo

func ParseFenceInfo(info string) (name string, params map[string]any, isWidget bool, err error)

ParseFenceInfo splits a fence's info string into a widget name and its JSON parameters.

A `{` in the info string is what makes a fence a WIDGET ATTEMPT rather than a language tag, and that is the whole discriminator: ```go stays a code block, and ```tool-call {"id":"read"} is a widget. It has to be unambiguous in both directions, because the failure is silent in the dangerous one — a widget attempt that fell through to the code renderer would look like a document that simply contained a code block, and nobody would notice until the embed stopped appearing.

The parser is NOT the decider, though: it only says whether the author wrote a widget attempt. A fence with no brace is still offered to FenceResolver, because a widget with no parameters is legitimate and only the registry knows the name. What the parser guarantees is the error direction — a brace means the author is embedding, so a missing registration or a malformed object is reported rather than rendered as a code block.

func ParseHexColor

func ParseHexColor(text string, current graphics.Color) (graphics.Color, error)

ParseHexColor reads "#RRGGBB" or "#RRGGBBAA" (the '#' is optional). A six-digit value keeps the alpha of current: a user typing a new RGB means that RGB, not "and also reset the transparency", and the colour they were editing already has the alpha they want.

func SaveFile

func SaveFile(title string) (platform.FileRef, bool)

SaveFile asks where to save one file.

func ServerForLanguage

func ServerForLanguage(langID string) string

func TSFindFoldRanges

func TSFindFoldRanges(lines []string, lang string) map[int]int

TSFindFoldRanges returns fold ranges using tree-sitter AST

Types

type ActionSheet

type ActionSheet struct {
	*BottomSheet

	// OnChoose fires with the chosen item's ID, AFTER the sheet is dismissed, so the callback is
	// free to open something else.
	OnChoose func(id string)
	// contains filtered or unexported fields
}

ActionSheet is a choice presented from the bottom of the screen: iOS's action sheet, and the phone's answer to "pick one of these". It IS a BottomSheet — it inherits the drag handle, the width cap, the modal hosting and every dismissal path — with a list of actions and a Cancel below them.

Two rules from the guidance are structural rather than advisory:

  • **It does not scroll.** The sheet sizes itself to its content, so an action sheet that would need to scroll is one with too many choices — the guidance caps it at four buttons including Cancel, and a scrolling action sheet is a menu wearing its clothes.
  • **Cancel is a separate block**, below a gap, with its own rounded corners, because the way out must not look like one of the choices.

func NewActionSheet

func NewActionSheet() *ActionSheet

NewActionSheet builds an empty modal action sheet.

func (*ActionSheet) CancelLabel

func (a *ActionSheet) CancelLabel() string

func (*ActionSheet) CancelRect

func (a *ActionSheet) CancelRect(bounds graphics.Rect) (graphics.Rect, bool)

CancelRect is the Cancel block: pinned to the bottom of the panel, so it is the last thing under the thumb and does not move when the number of choices changes above it.

func (*ActionSheet) ContentHeight

func (a *ActionSheet) ContentHeight() float32

ContentHeight is what the sheet has to be to show everything: the padding, the header, one row per action and the Cancel block. The sheet sizes to it, which is what keeps the thing from needing to scroll.

func (*ActionSheet) HeaderHeight

func (a *ActionSheet) HeaderHeight() float32

HeaderHeight is the title/message block's height, zero when there is neither.

func (*ActionSheet) HoverAt

func (a *ActionSheet) HoverAt(x, y float32)

HoverAt implements HoverTarget, so the sheet is told when the pointer leaves it.

func (*ActionSheet) ItemAt

func (a *ActionSheet) ItemAt(x, y float32) int

ItemAt reports which action holds a point, or -1. It does NOT include Cancel: the two are different things and the callers treat them differently.

func (*ActionSheet) ItemRect

func (a *ActionSheet) ItemRect(i int, bounds graphics.Rect) (graphics.Rect, bool)

ItemRect is one action's rect, in the sheet's own coordinates.

func (*ActionSheet) Items

func (a *ActionSheet) Items() []ActionSheetItem

func (*ActionSheet) OnMouseDown

func (a *ActionSheet) OnMouseDown(x, y float32, button int) bool

func (*ActionSheet) OnMouseMove

func (a *ActionSheet) OnMouseMove(x, y float32)

func (*ActionSheet) OnMouseUp

func (a *ActionSheet) OnMouseUp(x, y float32, button int) bool

func (*ActionSheet) Paint

func (a *ActionSheet) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*ActionSheet) PreferredDimensions

func (a *ActionSheet) PreferredDimensions(target interface{}, w, h float32) (float32, float32)

func (*ActionSheet) RowHeight

func (a *ActionSheet) RowHeight() float32

RowHeight is one action's height: at least the touch floor, because every row is a target.

func (*ActionSheet) SetBoundProperty

func (a *ActionSheet) SetBoundProperty(name string, value interface{})

SetBoundProperty implements the QML binding hook.

func (*ActionSheet) SetCancel

func (a *ActionSheet) SetCancel(label string) *ActionSheet

SetCancel sets the cancel label. An empty label removes the Cancel block, which is what a sheet of pure choices with no way out wants.

func (*ActionSheet) SetHeader

func (a *ActionSheet) SetHeader(title, message string) *ActionSheet

SetHeader sets an optional title and message above the actions. Either may be empty.

func (*ActionSheet) SetItems

func (a *ActionSheet) SetItems(items []ActionSheetItem) *ActionSheet

type ActionSheetItem

type ActionSheetItem struct {
	// ID is what OnChoose reports.
	ID string
	// Label is the choice's text.
	Label string
	// Destructive draws it in the error ink: the choice that deletes something. It is a
	// COLOUR and not a confirmation dialog — an action sheet is where the platform puts
	// "Delete", and the confirmation belongs after it, not instead of it.
	Destructive bool
	// Disabled draws it dimmed and refuses to choose it.
	Disabled bool
}

ActionSheetItem is one choice in an ActionSheet.

type AdaptiveTable

type AdaptiveTable struct {
	meui.BaseContainer
	*theme.TableTheme

	// SelectedRow is the selected row in either presentation.
	SelectedRow int

	// OnRowSelected fires when a row is selected in either presentation, so an app has one thing to
	// wire rather than two.
	OnRowSelected func(row int)
	// OnCellActivated fires when a cell is clicked in the TABLE presentation. A phone has no cells
	// to click, so its rows report through OnRowSelected; this is the table's extra affordance.
	OnCellActivated func(row, col int)
	// contains filtered or unexported fields
}

AdaptiveTable is ONE table with two presentations, chosen by the surface's size class: the real `DataTable` when there is room for columns, and a list of `ListItem`s on a phone.

It exists because a table on a phone is not a table. Columns either shrink until every value is truncated or the user scrolls sideways to compare two cells that should be on one line — and the plan's own rule is that a `DataTable` becomes a list on a phone. The wide presentation is the EXISTING widget rather than a second implementation: it keeps sorting, column resizing, selection and its scrollbar, and this widget only decides which of the two the surface gets.

func NewAdaptiveTable

func NewAdaptiveTable() *AdaptiveTable

NewAdaptiveTable builds an empty table with both presentations ready.

func (*AdaptiveTable) Columns

func (t *AdaptiveTable) Columns() []DataColumn

func (*AdaptiveTable) Items

func (t *AdaptiveTable) Items() []*ListItem

Items exposes the phone presentation's rows, in order.

func (*AdaptiveTable) List

func (t *AdaptiveTable) List(bounds graphics.Rect) bool

List reports whether this surface gets the LIST presentation.

The SURFACE decides, not the widget's own rect, and that is deliberate: the adaptive dialog and the pickers already resolve their presentation from the surface's size class, and a toolkit where two widgets answer "is this a phone?" differently is a toolkit an app has to learn twice. It is also what the plan says — a `DataTable` becomes a list on a phone — and it makes the phone layout testable on a desk, because a narrow desktop window is a phone by the same rule.

Without a window (a unit test, or a widget not yet in a tree) it falls back to the rect it is handed, which is the only size available.

func (*AdaptiveTable) ListAt

func (t *AdaptiveTable) ListAt(x, y float32) int

ListAt reports which list row holds a point, or -1. It is the phone presentation's hit test, which the container's own dispatch does not do for it (the items are painted, not added as children).

func (*AdaptiveTable) Paint

func (t *AdaptiveTable) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*AdaptiveTable) PanelAt

func (t *AdaptiveTable) PanelAt(x, y float32) meui.Widget

PanelAt routes a press to the active presentation: the table when there is room, and the list row under the point on a phone.

func (*AdaptiveTable) PreferredDimensions

func (t *AdaptiveTable) PreferredDimensions(target interface{}, w, h float32) (float32, float32)

func (*AdaptiveTable) Rows

func (t *AdaptiveTable) Rows() []DataRow

func (*AdaptiveTable) SetColumns

func (t *AdaptiveTable) SetColumns(cols []DataColumn) *AdaptiveTable

func (*AdaptiveTable) SetRows

func (t *AdaptiveTable) SetRows(rows []DataRow) *AdaptiveTable

func (*AdaptiveTable) SetSelectedRow

func (t *AdaptiveTable) SetSelectedRow(row int) *AdaptiveTable

SetSelectedRow selects a row in both presentations.

func (*AdaptiveTable) Table

func (t *AdaptiveTable) Table() *DataTable

Table exposes the wide presentation, for an app that wants its sorting or column resizing.

func (*AdaptiveTable) ValidateLayout

func (t *AdaptiveTable) ValidateLayout()

type AlertDialog

type AlertDialog struct {
	meui.BaseWidget
	*theme.PopupTheme

	// OnAction fires with the action's ID, AFTER the dialog is dismissed, so the callback is free
	// to open something else.
	OnAction func(id string)
	// OnDismissed fires when the dialog goes away, however it went away.
	OnDismissed func()
	// contains filtered or unexported fields
}

AlertDialog is the phone-and-tablet alert: a title, a message, and one to three actions. Its ONE variable is the presentation — centred on a surface with room, a bottom sheet on a phone — so an app writes one dialog and gets the platform's own placement.

It is not a BottomSheet with a flag. The two share the metrics (the 640 cap, the 72 top margin) and the dismissal contract, but the centred form has its own geometry and rounds all four corners, and pretending otherwise would mean a widget that is a sheet everywhere and looks centred only by accident.

func NewAlertDialog

func NewAlertDialog() *AlertDialog

NewDialog builds an empty auto-presented dialog.

func (*AlertDialog) ActionAt

func (d *AlertDialog) ActionAt(x, y float32) int

ActionAt reports which action holds a point, or -1.

func (*AlertDialog) ActionRect

func (d *AlertDialog) ActionRect(i int, bounds graphics.Rect) (graphics.Rect, bool)

ActionRect is the i-th action's rect. The actions are laid out from the RIGHT, LAST first, because M3 puts the confirming action last — and "last" means rightmost.

func (*AlertDialog) Actions

func (d *AlertDialog) Actions() []DialogAction

func (*AlertDialog) Dismiss

func (d *AlertDialog) Dismiss()

Dismiss takes the dialog down, modal layer included.

func (*AlertDialog) HoverAt

func (d *AlertDialog) HoverAt(x, y float32)

HoverAt implements HoverTarget.

func (*AlertDialog) Message

func (d *AlertDialog) Message() string

func (*AlertDialog) MessageHeight

func (d *AlertDialog) MessageHeight(inner float32) float32

MessageHeight is the wrapped message's height at a given inner width. It asks the Label's OWN wrapText, which is the one wrap implementation (AGENTS.md) — Label.PreferredDimensions cannot answer it, because it measures a single unwrapped line.

func (*AlertDialog) OnMouseDown

func (d *AlertDialog) OnMouseDown(x, y float32, button int) bool

func (*AlertDialog) OnMouseMove

func (d *AlertDialog) OnMouseMove(x, y float32)

func (*AlertDialog) OnMouseUp

func (d *AlertDialog) OnMouseUp(x, y float32, button int) bool

func (*AlertDialog) Paint

func (d *AlertDialog) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*AlertDialog) PanelRect

func (d *AlertDialog) PanelRect(bounds graphics.Rect) graphics.Rect

PanelRect is the dialog's box within the area it was given: centred, or anchored to the bottom as a sheet. It is capped, and it never grows past the top margin, so the content behind it stays visible enough to explain what it is about.

func (*AlertDialog) PreferredDimensions

func (d *AlertDialog) PreferredDimensions(target interface{}, w, h float32) (float32, float32)

func (*AlertDialog) Presentation

func (d *AlertDialog) Presentation() DialogPresentation

func (*AlertDialog) SetActions

func (d *AlertDialog) SetActions(actions []DialogAction) *AlertDialog

func (*AlertDialog) SetBoundProperty

func (d *AlertDialog) SetBoundProperty(name string, value interface{})

SetBoundProperty implements the QML binding hook.

func (*AlertDialog) SetContent

func (d *AlertDialog) SetContent(w meui.Widget) *AlertDialog

SetContent installs a widget in place of the message, for a dialog that is not just words.

func (*AlertDialog) SetMessage

func (d *AlertDialog) SetMessage(message string) *AlertDialog

SetMessage sets the body text, which wraps to the panel's width.

func (*AlertDialog) SetPresentation

func (d *AlertDialog) SetPresentation(p DialogPresentation) *AlertDialog

func (*AlertDialog) SetTitle

func (d *AlertDialog) SetTitle(title string) *AlertDialog

func (*AlertDialog) SetWindow

func (d *AlertDialog) SetWindow(w *meui.Window)

SetWindow is how a widget hosted in the window's modal layer learns its window.

func (*AlertDialog) Sheet

func (d *AlertDialog) Sheet(bounds graphics.Rect) bool

Sheet reports whether this dialog takes the bottom-sheet form ON THIS SURFACE. Auto resolves it from the size class, so resizing the window changes the presentation rather than needing the app to know the platform.

func (*AlertDialog) Title

func (d *AlertDialog) Title() string

type BottomSheet

type BottomSheet struct {
	meui.BaseWidget
	*theme.PopupTheme

	// OnDismissed fires when the sheet goes away, however it went away.
	OnDismissed func()
	// contains filtered or unexported fields
}

BottomSheet is a surface anchored to the bottom of the screen: the phone's dialog, menu and picker host. It is deliberately a SURFACE and not a dialog with fixed buttons — the app puts whatever it needs inside, and the widget owns the geometry, the drag handle and the dismissal.

Two presentations, and the difference is behaviour, not looks: a MODAL sheet is shown through the window's modal layer (Window.ShowModal) with the window's scrim behind it and dismisses on a tap outside or a drag down; a STANDARD sheet is placed in the shell and stays.

Its rect is the area it may use, not the panel: the panel is anchored to the BOTTOM of that rect and is `SheetHeight` tall, so the same widget serves a window-sized modal host and an in-flow strip that is already exactly the panel's size.

func NewBottomSheet

func NewBottomSheet() *BottomSheet

NewBottomSheet builds a modal sheet with no title and no content.

func (*BottomSheet) Content

func (s *BottomSheet) Content() meui.Widget

func (*BottomSheet) ContentRect

func (s *BottomSheet) ContentRect(bounds graphics.Rect) graphics.Rect

ContentRect is what is left of the panel for the content, below the title.

func (*BottomSheet) Dismiss

func (s *BottomSheet) Dismiss()

Dismiss takes the sheet down. A MODAL sheet also takes its modal layer down, which is why the widget keeps the window it was hosted by; a standard one is the app's to hide.

func (*BottomSheet) DismissThreshold

func (s *BottomSheet) DismissThreshold(bounds graphics.Rect) float32

DismissThreshold is how far the panel must be dragged down before releasing dismisses it: a third of its own height, so a small accidental drag springs back instead of losing the sheet. It is a fraction of the SHEET, not of the screen, because a short sheet would otherwise be impossible to dismiss by dragging.

func (*BottomSheet) HandleRect

func (s *BottomSheet) HandleRect(bounds graphics.Rect) graphics.Rect

HandleRect is the drag handle, centred at the top of the panel.

func (*BottomSheet) Modal

func (s *BottomSheet) Modal() bool

func (*BottomSheet) OnMouseDown

func (s *BottomSheet) OnMouseDown(x, y float32, button int) bool

func (*BottomSheet) OnMouseMove

func (s *BottomSheet) OnMouseMove(x, y float32)

func (*BottomSheet) OnMouseUp

func (s *BottomSheet) OnMouseUp(x, y float32, button int) bool

func (*BottomSheet) Paint

func (s *BottomSheet) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*BottomSheet) PanelHeight

func (s *BottomSheet) PanelHeight(bounds graphics.Rect) float32

PanelHeight is the panel's height: the requested one, else half the area, and never more than the area minus BottomSheetTopMargin.

func (*BottomSheet) PanelRect

func (s *BottomSheet) PanelRect(bounds graphics.Rect) graphics.Rect

PanelRect is the sheet's panel within the area the widget was given: centred, capped at BottomSheetMaxWidth with a BottomSheetSideMargin gap each side, and anchored to the bottom. The drag offset is included, so a drag moves the panel as it is painted.

The margin applies only once the CAP is in play: a compact window gets a full-width sheet (M3's own rule — the 56dp margin is what a large window uses to keep a capped sheet off its edges), so a phone does not get a sheet inset by 56 on each side.

func (*BottomSheet) PreferredDimensions

func (s *BottomSheet) PreferredDimensions(target interface{}, w, h float32) (float32, float32)

PreferredDimensions is how the layout learns a STANDARD sheet's height. A modal one is hosted by the window, which sets the frame itself.

func (*BottomSheet) PreferredSize

func (s *BottomSheet) PreferredSize() (float32, float32)

func (*BottomSheet) Presentation

func (s *BottomSheet) Presentation() BottomSheetPresentation

func (*BottomSheet) SetBoundProperty

func (s *BottomSheet) SetBoundProperty(name string, value interface{})

SetBoundProperty implements the QML binding hook.

func (*BottomSheet) SetContent

func (s *BottomSheet) SetContent(w meui.Widget) *BottomSheet

SetContent installs the widget the sheet hosts, which is laid out inside the panel below the title. A nil content is allowed: a sheet may be nothing but a title.

func (*BottomSheet) SetModal

func (s *BottomSheet) SetModal(on bool) *BottomSheet

SetModal is the boolean spelling, for QML and for an app that thinks in one flag.

func (*BottomSheet) SetPresentation

func (s *BottomSheet) SetPresentation(p BottomSheetPresentation) *BottomSheet

SetPresentation selects the modal or the standard construction.

func (*BottomSheet) SetSheetHeight

func (s *BottomSheet) SetSheetHeight(h float32) *BottomSheet

SetSheetHeight sets the panel's height. Zero lets the sheet size itself: half of the area it was given, which is the common modal proportion and always leaves the top margin.

func (*BottomSheet) SetTitle

func (s *BottomSheet) SetTitle(title string) *BottomSheet

func (*BottomSheet) SetWindow

func (s *BottomSheet) SetWindow(w *meui.Window)

SetWindow is how a widget hosted in the window's modal layer learns its window, so that Dismiss can take the modal down. The window's own popup path calls it.

func (*BottomSheet) SheetHeight

func (s *BottomSheet) SheetHeight() float32

func (*BottomSheet) Title

func (s *BottomSheet) Title() string

func (*BottomSheet) TitleRect

func (s *BottomSheet) TitleRect(bounds graphics.Rect) graphics.Rect

TitleRect is where the title is drawn: below the handle, inset from the panel's edges.

type BottomSheetPresentation

type BottomSheetPresentation uint8

BottomSheetPresentation selects the two constructions M3 defines, because they differ in BEHAVIOUR and not only in paint.

const (
	// BottomSheetModal has a scrim, blocks the content behind it, and dismisses on a tap
	// outside the panel or a downward drag. It is the phone's answer to a dialog.
	BottomSheetModal BottomSheetPresentation = iota
	// BottomSheetStandard is part of the layout: the content behind stays interactive and
	// there is nothing to dismiss by tapping away. It is the persistent form.
	BottomSheetStandard
)

type Button

type Button struct {
	meui.BaseWidget
	*theme.ButtonTheme
	Text       string
	Icon       string
	ButtonType string // "square", "round", "" (default)
	Pressed    bool
	Checkable  bool // clicking toggles Toggled instead of acting like a momentary press
	Toggled    bool // current state when Checkable
	Shortcut   rune // optional activation key (letters/digits); fires OnClicked

	OnClicked      func()
	OnRightClicked func()
	OnToggled      func(toggled bool)
	Selectable
	// contains filtered or unexported fields
}

func NewButton

func NewButton() *Button

func (*Button) AccessibilityNode added in v0.5.8

func (b *Button) AccessibilityNode() platform.AccessibilityNode

func (*Button) Dispose

func (b *Button) Dispose()

func (*Button) Focusable

func (b *Button) Focusable() bool

func (*Button) GetSelectable

func (b *Button) GetSelectable() *Selectable

func (*Button) IsCheckable

func (b *Button) IsCheckable() bool

func (*Button) IsToggled

func (b *Button) IsToggled() bool

func (*Button) MinimumDimensions

func (b *Button) MinimumDimensions() (float32, float32)

func (*Button) OnKeyDown

func (b *Button) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool

func (*Button) OnKeyUp

func (b *Button) OnKeyUp(keyCode platform.KeyCode, mod platform.Modifiers) bool

func (*Button) OnMouseDown

func (b *Button) OnMouseDown(x, y float32, button int) bool

func (*Button) OnMouseMove

func (b *Button) OnMouseMove(x, y float32)

func (*Button) OnMouseUp

func (b *Button) OnMouseUp(x, y float32, button int) bool

func (*Button) Paint

func (b *Button) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*Button) PerformAccessibilityAction added in v0.5.12

func (b *Button) PerformAccessibilityAction(action platform.AccessibilityAction) bool

func (*Button) PreferredDimensions

func (b *Button) PreferredDimensions(target interface{}, w, h float32) (float32, float32)

func (*Button) SetBoundProperty

func (b *Button) SetBoundProperty(propName string, value interface{})

func (*Button) SetCheckable

func (b *Button) SetCheckable(checkable bool) *Button

SetCheckable makes the button a toggle: clicking flips its Toggled state (like QToolButton.setCheckable). The OnClicked handler still fires.

func (*Button) SetGroupID

func (b *Button) SetGroupID(id string) *Button

func (*Button) SetIcon

func (b *Button) SetIcon(icon string) *Button

func (*Button) SetOnClicked

func (b *Button) SetOnClicked(handler func()) *Button

func (*Button) SetOnToggled

func (b *Button) SetOnToggled(handler func(toggled bool)) *Button

func (*Button) SetSelected

func (b *Button) SetSelected(selected bool) *Button

func (*Button) SetShortcut

func (b *Button) SetShortcut(key rune) *Button

SetShortcut sets an activation key (letter or digit). When pressed the button fires OnClicked as if clicked.

func (*Button) SetText

func (b *Button) SetText(text string) *Button

func (*Button) SetToggled

func (b *Button) SetToggled(toggled bool) *Button

SetToggled sets the checkable button's state without firing OnToggled.

func (*Button) SetTooltip

func (b *Button) SetTooltip(text string) *Button

type ButtonGroup

type ButtonGroup struct {
	ID             string
	Exclusive      bool
	SelectedWidget meui.Widget
	Widgets        []meui.Widget
	// contains filtered or unexported fields
}

ButtonGroup manages exclusive selection for a group of selectable widgets.

func GetGroup

func GetGroup(id string) *ButtonGroup

GetGroup returns a group by ID, or nil if not found.

func GetOrCreateGroup

func GetOrCreateGroup(id string, exclusive bool) *ButtonGroup

GetOrCreateGroup returns an existing group or creates a new one.

type Calendar

type Calendar struct {
	meui.BaseWidget
	*theme.CalendarTheme
	Year           int
	Month          int
	SelectedDay    int
	HoveredDay     int
	Today          int
	OnDateSelected func(year, month, day int)
	// contains filtered or unexported fields
}

func NewCalendar

func NewCalendar() *Calendar

func (*Calendar) Focusable

func (c *Calendar) Focusable() bool

func (*Calendar) GetSelectedDate

func (c *Calendar) GetSelectedDate() (year, month, day int)

GetSelectedDate returns the currently selected (year, month, day).

func (*Calendar) NextMonth

func (c *Calendar) NextMonth()

func (*Calendar) OnKeyDown

func (c *Calendar) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool

func (*Calendar) OnMouseDown

func (c *Calendar) OnMouseDown(x, y float32, button int) bool

func (*Calendar) OnMouseMove

func (c *Calendar) OnMouseMove(x, y float32)

func (*Calendar) Paint

func (c *Calendar) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*Calendar) PrevMonth

func (c *Calendar) PrevMonth()

func (*Calendar) SetBoundProperty

func (c *Calendar) SetBoundProperty(propName string, value interface{})

func (*Calendar) SetDate

func (c *Calendar) SetDate(year, month, day int) *Calendar

func (*Calendar) SetOnDateSelected

func (c *Calendar) SetOnDateSelected(handler func(year, month, day int)) *Calendar

SetOnDateSelected registers the date-picked callback.

type CellUpdate

type CellUpdate struct {
	Row, Col int
	Text     string
	Color    string
	BgColor  string
}

type CheckBox

type CheckBox struct {
	meui.BaseWidget
	*theme.CheckBoxTheme
	Text      string
	Checked   bool
	Pressed   bool
	OnChanged func(bool)
	// contains filtered or unexported fields
}

func NewCheckBox

func NewCheckBox() *CheckBox

func (*CheckBox) AccessibilityNode added in v0.5.8

func (c *CheckBox) AccessibilityNode() platform.AccessibilityNode

func (*CheckBox) Focusable

func (c *CheckBox) Focusable() bool

func (*CheckBox) OnKeyDown

func (c *CheckBox) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool

func (*CheckBox) OnMouseDown

func (c *CheckBox) OnMouseDown(x, y float32, button int) bool

func (*CheckBox) OnMouseMove

func (c *CheckBox) OnMouseMove(x, y float32)

func (*CheckBox) OnMouseUp

func (c *CheckBox) OnMouseUp(x, y float32, button int) bool

func (*CheckBox) Paint

func (c *CheckBox) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*CheckBox) PerformAccessibilityAction added in v0.5.12

func (c *CheckBox) PerformAccessibilityAction(action platform.AccessibilityAction) bool

func (*CheckBox) PreferredDimensions

func (c *CheckBox) PreferredDimensions(target interface{}, w, h float32) (float32, float32)

PreferredDimensions reports the box + spacing + text width so stack layouts assign a frame wide enough for the label (a bare minimum frame clipped the text under the next widget).

func (*CheckBox) SetBoundProperty

func (c *CheckBox) SetBoundProperty(propName string, value interface{})

func (*CheckBox) SetChecked

func (c *CheckBox) SetChecked(checked bool) *CheckBox

func (*CheckBox) SetOnCheckChanged

func (c *CheckBox) SetOnCheckChanged(handler func(checked bool)) *CheckBox

SetOnCheckChanged registers the toggled callback (stateChanged in Qt).

func (*CheckBox) SetText

func (c *CheckBox) SetText(text string) *CheckBox

type ChromeTarget

type ChromeTarget interface {
	Title() string
	Close()
	Minimize()
	ToggleMaximize()
}

ChromeTarget is the window operations the chrome drives. It is deliberately narrow — the chrome needs a title and three verbs — so that a window type, a test double, or a preview host can satisfy it without implementing the whole platform seam.

type ClientCapabilities

type ClientCapabilities struct {
	TextDocument TextDocumentClientCapabilities `json:"textDocument"`
	Workspace    WorkspaceClientCapabilities    `json:"workspace"`
	Window       WindowClientCapabilities       `json:"window"`
}

type CodeActionParams

type CodeActionParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
	Range        Range                  `json:"range"`
	Context      struct {
		Diagnostics []Diagnostic `json:"diagnostics"`
	} `json:"context"`
}

type CodeEditor

type CodeEditor struct {
	meui.BaseWidget
	*EditorTheme
	*EditorSettings

	Lines []string

	CursorLine int
	CursorCol  int

	SelectStart int
	SelectEnd   int

	ScrollX       float32
	ScrollY       float32
	Focused       bool
	CursorVisible bool
	CursorTimer   *time.Timer

	OnTextChanged   func(string)
	OnCursorChanged func(line, col int)
	OnSave          func()
	OnFormat        func(text string) (string, error)
	FilePath        string
	Language        string
	Modified        bool
	ReadOnly        bool
	SyntaxTheme     *SyntaxTheme

	VScroll *ScrollBar
	HScroll *ScrollBar

	ShowMinimap bool

	BracketColorization bool

	OnCompletionRequest func(prefix string) []CompletionItem
	OnCompletionSelect  func(item CompletionItem)
	OnGoToDefinition    func(line, col int)
	OnFindReferences    func(line, col int)
	OnHover             func(line, col int) string
	OnContextMenu       func(line, col int, selectedText string) []MenuItem
	// contains filtered or unexported fields
}

func NewCodeEditor

func NewCodeEditor() *CodeEditor

func (*CodeEditor) Backspace

func (e *CodeEditor) Backspace()

func (*CodeEditor) BackspaceWord

func (e *CodeEditor) BackspaceWord()

BackspaceWord / DeleteWord delete by word, the keyboard gesture every code editor has.

func (*CodeEditor) Copy

func (e *CodeEditor) Copy()

func (*CodeEditor) CursorAt

func (e *CodeEditor) CursorAt(x, y float32) *platform.Cursor

CursorAt reports the I-beam over the text area. The gutter (breakpoint, bookmark and fold lanes) and the scrollbars keep the default arrow.

func (*CodeEditor) CursorOffset

func (e *CodeEditor) CursorOffset() int

func (*CodeEditor) Cut

func (e *CodeEditor) Cut()

func (*CodeEditor) Delete

func (e *CodeEditor) Delete()

func (*CodeEditor) DeleteWord

func (e *CodeEditor) DeleteWord()

func (*CodeEditor) Dispose

func (e *CodeEditor) Dispose()

func (*CodeEditor) EnsureCursorVisible

func (e *CodeEditor) EnsureCursorVisible()

func (*CodeEditor) Find

func (e *CodeEditor) Find(text string)

func (*CodeEditor) FindNext

func (e *CodeEditor) FindNext()

func (*CodeEditor) FindPrev

func (e *CodeEditor) FindPrev()

func (*CodeEditor) Focusable

func (e *CodeEditor) Focusable() bool

func (*CodeEditor) FoldAll

func (e *CodeEditor) FoldAll()

func (*CodeEditor) GetLine

func (e *CodeEditor) GetLine(line int) string

func (*CodeEditor) GoToLine

func (e *CodeEditor) GoToLine(line int)

func (*CodeEditor) HideCompletion

func (e *CodeEditor) HideCompletion()

func (*CodeEditor) HideHover

func (e *CodeEditor) HideHover()

func (*CodeEditor) HideParameterHints

func (e *CodeEditor) HideParameterHints()

func (*CodeEditor) Indent

func (e *CodeEditor) Indent()

func (*CodeEditor) InsertNewline

func (e *CodeEditor) InsertNewline()

func (*CodeEditor) InsertText

func (e *CodeEditor) InsertText(text string)

func (*CodeEditor) LineCount

func (e *CodeEditor) LineCount() int

func (*CodeEditor) MoveCursorDown

func (e *CodeEditor) MoveCursorDown(selectMode bool)

func (*CodeEditor) MoveCursorEnd

func (e *CodeEditor) MoveCursorEnd(selectMode bool)

func (*CodeEditor) MoveCursorHome

func (e *CodeEditor) MoveCursorHome(selectMode bool)

func (*CodeEditor) MoveCursorLeft

func (e *CodeEditor) MoveCursorLeft(selectMode bool)

func (*CodeEditor) MoveCursorPageDown

func (e *CodeEditor) MoveCursorPageDown(selectMode bool)

func (*CodeEditor) MoveCursorPageUp

func (e *CodeEditor) MoveCursorPageUp(selectMode bool)

func (*CodeEditor) MoveCursorRight

func (e *CodeEditor) MoveCursorRight(selectMode bool)

func (*CodeEditor) MoveCursorUp

func (e *CodeEditor) MoveCursorUp(selectMode bool)

func (*CodeEditor) MoveCursorWordLeft

func (e *CodeEditor) MoveCursorWordLeft(selectMode bool)

func (*CodeEditor) MoveCursorWordRight

func (e *CodeEditor) MoveCursorWordRight(selectMode bool)

func (*CodeEditor) OnBlur

func (e *CodeEditor) OnBlur()

func (*CodeEditor) OnCharacter

func (e *CodeEditor) OnCharacter(ch rune)

func (*CodeEditor) OnComposition

func (e *CodeEditor) OnComposition(text string, start, length int) bool

OnComposition shows the IME's in-progress text at the caret, replacing the previous preedit. It is not undoable and does not fire OnTextChanged; the committed characters arrive through OnCharacter.

func (*CodeEditor) OnFocus

func (e *CodeEditor) OnFocus()

func (*CodeEditor) OnKeyDown

func (e *CodeEditor) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool

func (*CodeEditor) OnKeyRepeat

func (e *CodeEditor) OnKeyRepeat(keyCode platform.KeyCode, mod platform.Modifiers) bool

OnKeyRepeat is a key the user is HOLDING — Backspace over a word, an arrow along a row, a scrub. The window classifies an OS auto-repeat as a repeat rather than a fresh press (a widget without this method is asked once, deliberately), so this is what makes a held key work here.

func (*CodeEditor) OnMouseDown

func (e *CodeEditor) OnMouseDown(x, y float32, button int) bool

func (*CodeEditor) OnMouseMove

func (e *CodeEditor) OnMouseMove(x, y float32)

func (*CodeEditor) OnMouseUp

func (e *CodeEditor) OnMouseUp(x, y float32, button int) bool

func (*CodeEditor) OnMouseWheel

func (e *CodeEditor) OnMouseWheel(x, y float32, dx, dy float32) bool

func (*CodeEditor) Outdent

func (e *CodeEditor) Outdent()

func (*CodeEditor) Paint

func (e *CodeEditor) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*CodeEditor) Paste

func (e *CodeEditor) Paste()

func (*CodeEditor) Redo

func (e *CodeEditor) Redo() bool

func (*CodeEditor) Replace

func (e *CodeEditor) Replace(text string)

func (*CodeEditor) ReplaceAll

func (e *CodeEditor) ReplaceAll()

func (*CodeEditor) ReplaceCurrent

func (e *CodeEditor) ReplaceCurrent()

func (*CodeEditor) SelectAll

func (e *CodeEditor) SelectAll()

func (*CodeEditor) SetBoundProperty

func (e *CodeEditor) SetBoundProperty(propName string, value interface{})

func (*CodeEditor) SetDiagnostics

func (e *CodeEditor) SetDiagnostics(diags []Diagnostic)

func (*CodeEditor) SetDiffMarkers

func (e *CodeEditor) SetDiffMarkers(added, modified, deleted map[int]bool)

func (*CodeEditor) SetFilePath

func (e *CodeEditor) SetFilePath(path string)

func (*CodeEditor) SetLanguage

func (e *CodeEditor) SetLanguage(lang string)

func (*CodeEditor) SetSyntaxTheme

func (e *CodeEditor) SetSyntaxTheme(st *SyntaxTheme)

func (*CodeEditor) SetText

func (e *CodeEditor) SetText(text string)

func (*CodeEditor) ShowCompletion

func (e *CodeEditor) ShowCompletion(items []CompletionItem, prefix string, x, y float32)

func (*CodeEditor) ShowHover

func (e *CodeEditor) ShowHover(text string, x, y float32)

func (*CodeEditor) ShowParameterHints

func (e *CodeEditor) ShowParameterHints(hints []ParameterHint)

func (*CodeEditor) TabComplete

func (e *CodeEditor) TabComplete()

func (*CodeEditor) Text

func (e *CodeEditor) Text() string

func (*CodeEditor) ToggleBookmark

func (e *CodeEditor) ToggleBookmark(line int)

func (*CodeEditor) ToggleBreakpoint

func (e *CodeEditor) ToggleBreakpoint(line int)

func (*CodeEditor) ToggleFold

func (e *CodeEditor) ToggleFold(line int)

func (*CodeEditor) ToggleLineComment

func (e *CodeEditor) ToggleLineComment()

func (*CodeEditor) Undo

func (e *CodeEditor) Undo() bool

func (*CodeEditor) UnfoldAll

func (e *CodeEditor) UnfoldAll()

type Collapsible

type Collapsible struct {
	meui.BaseWidget
	*theme.GroupBoxTheme

	// OnToggle fires when the header is used, so an app can persist the state or record
	// that the user opened it.
	OnToggle func(collapsed bool)
	// contains filtered or unexported fields
}

Collapsible is a header over one child, where the header shows and the child does not.

WHY IT EXISTS SEPARATELY FROM GroupBox. A GroupBox is a BORDERED, titled section: it says "these controls belong together" and it looks like a panel. A transcript row says something different — "there is more here, and it is currently folded" — and it wants no border, no inset and a chevron. Forcing one widget to be both means every use turns off half of it, which is how a GroupBox ends up with ShowBorder false and a title that is really a header.

The collapse arithmetic is GroupBox's, and it is not re-implemented here: a container whose collapsed height is a SUM is easy to get subtly wrong in two places at once, and the contract that matters is the same for both. see groupBoxOverhead / groupBoxTitleHeight.

func NewCollapsible

func NewCollapsible() *Collapsible

NewCollapsible builds an EXPANDED collapsible. Expanded is the default because a widget that arrives with its content hidden reads as empty, and a transcript that starts folded is a transcript that looks broken.

func (*Collapsible) Body

func (c *Collapsible) Body() *meui.Panel

Body returns the content container, for AddChild.

func (*Collapsible) Children

func (c *Collapsible) Children() []meui.Widget

func (*Collapsible) ChildrenI

func (c *Collapsible) ChildrenI() []interface{}

func (*Collapsible) Collapsed

func (c *Collapsible) Collapsed() bool

func (*Collapsible) HeaderHeight

func (c *Collapsible) HeaderHeight() float32

HeaderHeight is the header's height. It comes from the theme rather than from measuring the label, because AGENTS.md is explicit that a size depending on text must not be measured before the font loads — a header that is short at construction opens already showing its overflow.

func (*Collapsible) HoverAt

func (c *Collapsible) HoverAt(x, y float32)

HoverAt implements HoverTarget.

func (*Collapsible) Label

func (c *Collapsible) Label() string

func (*Collapsible) OnMouseDown

func (c *Collapsible) OnMouseDown(x, y float32, button int) bool

OnMouseDown toggles on a press INSIDE THE HEADER only, so a press in the body — which selects text, or presses a button — is not swallowed by the disclosure. A toggle on press is right for a header and wrong for the whole row.

func (*Collapsible) OnMouseMove

func (c *Collapsible) OnMouseMove(x, y float32)

func (*Collapsible) Paint

func (c *Collapsible) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*Collapsible) PanelAt

func (c *Collapsible) PanelAt(x, y float32) meui.Widget

func (*Collapsible) PreferredDimensions

func (c *Collapsible) PreferredDimensions(target interface{}, width, height float32) (float32, float32)

PreferredDimensions reports the header alone when collapsed — the whole point, and the reason a list of a thousand collapsed rows can be placed in one pass. AGENTS.md: the layout consults PreferredDimensions, not PreferredSize, so this is the seam that works.

func (*Collapsible) RestoreState added in v0.5.35

func (c *Collapsible) RestoreState(v any) bool

func (*Collapsible) SaveState added in v0.5.35

func (c *Collapsible) SaveState() any

func (*Collapsible) SetAccent

func (c *Collapsible) SetAccent(on bool) *Collapsible

SetAccent marks the row as the current one.

func (*Collapsible) SetBody

func (c *Collapsible) SetBody(w meui.Widget) *Collapsible

SetBody replaces the content.

func (*Collapsible) SetBoundProperty

func (c *Collapsible) SetBoundProperty(name string, value interface{})

SetBoundProperty implements the QML binding hook for label, detail, trailing and collapsed.

WITHOUT IT the widget satisfies nothing the property dispatch looks for, so every QML property on it is silently dropped — which is exactly what happened: a Collapsible in a QML scene rendered with no label and the wrong collapsed state, and nothing said so. The symptom looks like a layout bug and is not one.

func (*Collapsible) SetBusy

func (c *Collapsible) SetBusy(on bool) *Collapsible

SetBusy draws the trailing text in the accent ink: a running step against a finished one.

func (*Collapsible) SetCollapsed

func (c *Collapsible) SetCollapsed(v bool) *Collapsible

func (*Collapsible) SetDetail

func (c *Collapsible) SetDetail(detail string) *Collapsible

SetDetail sets the one-line summary beside the label.

func (*Collapsible) SetLabel

func (c *Collapsible) SetLabel(label string) *Collapsible

func (*Collapsible) SetTrailing

func (c *Collapsible) SetTrailing(trailing string) *Collapsible

SetTrailing sets the right-hand text — a duration, a count, a state.

func (*Collapsible) Toggle

func (c *Collapsible) Toggle()

func (*Collapsible) ValidateLayout

func (c *Collapsible) ValidateLayout()

ValidateLayout sizes the body panel to the space below the header.

IT IS NOT A NO-OP, and that is a correction of an earlier version of this widget — the same mistake GroupBox carried, found the same way: with ValidateLayout doing nothing, the body is never given a frame, so a child that asks to FILL keeps the default widget size and its text wraps into a column about ninety pixels wide. It reads as the body failing to render rather than as a container that never laid it out.

type ColorField

type ColorField struct {
	meui.BaseContainer
	// contains filtered or unexported fields
}

ColorField is a colour entry: a hex text box with a swatch button that opens a colour picker under it. The text and the swatch always show the same colour, typing a valid hex updates the swatch (and the picker, and OnColorChanged) immediately, and text that is not a colour yet leaves the current colour alone rather than clearing it.

The picker is the toolkit's ColorPicker, shown in an anchored dropdown panel (see dropdownPanel); a click anywhere outside closes it. Picking is live: the colour changes as the pointer moves in the picker, with no OK/Cancel step.

func NewColorField

func NewColorField() *ColorField

NewColorField returns a field showing white.

func (*ColorField) Color

func (c *ColorField) Color() graphics.Color

Color returns the current colour.

func (*ColorField) CursorAt

func (c *ColorField) CursorAt(x, y float32) *platform.Cursor

CursorAt returns nil: over the field the text cursor comes from the field itself, over the button the arrow stays the default.

func (*ColorField) Expanded

func (c *ColorField) Expanded() bool

Expanded reports whether the picker panel is open.

func (*ColorField) HandleMouseDown

func (c *ColorField) HandleMouseDown(lx, ly float32, button int) bool

HandleMouseDown receives clicks while the panel is open (the layer is modal): inside the panel the picker gets the press, anywhere else closes it.

func (*ColorField) HandleMouseMove

func (c *ColorField) HandleMouseMove(lx, ly float32) bool

HandleMouseMove drives the picker's drag, which is also what makes picking live: the picker fires OnColorChanged from here.

func (*ColorField) HandleMouseUp

func (c *ColorField) HandleMouseUp(lx, ly float32, button int) bool

func (*ColorField) Hex

func (c *ColorField) Hex() string

Hex returns the current colour in the field's own text form.

func (*ColorField) OnMouseDown

func (c *ColorField) OnMouseDown(x, y float32, button int) bool

OnMouseDown, OnMouseUp and OnMouseMove forward to the field or the button under the point. A container dispatches by containment — a modal popup hands the press to its content's children, not to the deepest hit — so the composite must route the event itself; relying on the window's PanelAt delivery alone left every field inside a modal dead (the owner's "the colour picker does not pop up" in the Settings popup).

func (*ColorField) OnMouseMove

func (c *ColorField) OnMouseMove(x, y float32)

func (*ColorField) OnMouseUp

func (c *ColorField) OnMouseUp(x, y float32, button int) bool

func (*ColorField) Paint

func (c *ColorField) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*ColorField) PanelAt

func (c *ColorField) PanelAt(x, y float32) meui.Widget

PanelAt routes a point to the field or the swatch button.

func (*ColorField) Picker

func (c *ColorField) Picker() *ColorPicker

Picker returns the popup's colour picker, for the caller that wants to configure it (its theme, say). It is the same widget the panel paints; the field gives it its rect when the panel opens.

func (*ColorField) SetBoundProperty

func (c *ColorField) SetBoundProperty(propName string, value interface{})

SetBoundProperty applies a QML property to the field. The loader routes every property without a handler of its own here (see qml.HandleProperty), so this is what makes `placeholder` and `color` work in QML.

func (*ColorField) SetColor

func (c *ColorField) SetColor(color graphics.Color) *ColorField

SetColor sets the colour (and the field and picker) without firing OnColorChanged: a programmatic set is not a user edit.

func (*ColorField) SetEnabled

func (c *ColorField) SetEnabled(enabled bool) *ColorField

SetEnabled enables or disables the field and its button together.

func (*ColorField) SetExpanded

func (c *ColorField) SetExpanded(expanded bool) *ColorField

SetExpanded opens or closes the picker panel.

func (*ColorField) SetFrameRect

func (c *ColorField) SetFrameRect(rect graphics.Rect)

func (*ColorField) SetOnColorChanged

func (c *ColorField) SetOnColorChanged(handler func(color graphics.Color)) *ColorField

SetOnColorChanged registers the callback fired whenever the user changes the colour (typing a valid hex or moving in the picker).

func (*ColorField) SetPlaceholder

func (c *ColorField) SetPlaceholder(text string) *ColorField

SetPlaceholder sets the text shown while the field is empty.

func (*ColorField) SetText

func (c *ColorField) SetText(text string) *ColorField

SetText sets the field from text — the QML `text` property. A value that is not a colour is shown as typed and leaves the current colour in place.

func (*ColorField) Text

func (c *ColorField) Text() string

Text returns the field's text, exactly as shown.

func (*ColorField) ValidateLayout

func (c *ColorField) ValidateLayout()

ValidateLayout places the field and the swatch button inside the frame.

type ColorPicker

type ColorPicker struct {
	meui.BaseWidget
	*theme.ColorPickerTheme
	Hue        float32
	Saturation float32
	Value      float32
	Alpha      float32
	Red        uint8
	Green      uint8
	Blue       uint8

	OnColorChanged func(r, g, b, a uint8)
	// contains filtered or unexported fields
}

func NewColorPicker

func NewColorPicker() *ColorPicker

func (*ColorPicker) GetColor

func (c *ColorPicker) GetColor() (r, g, b, a uint8)

GetColor returns the currently selected color components.

func (*ColorPicker) OnMouseDown

func (c *ColorPicker) OnMouseDown(x, y float32, button int) bool

func (*ColorPicker) OnMouseMove

func (c *ColorPicker) OnMouseMove(x, y float32)

func (*ColorPicker) OnMouseUp

func (c *ColorPicker) OnMouseUp(x, y float32, button int) bool

func (*ColorPicker) OnMouseWheel

func (c *ColorPicker) OnMouseWheel(x, y float32, dx, dy float32) bool

func (*ColorPicker) Paint

func (c *ColorPicker) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*ColorPicker) SetBoundProperty

func (c *ColorPicker) SetBoundProperty(propName string, value interface{})

func (*ColorPicker) SetColor

func (c *ColorPicker) SetColor(r, g, b, a uint8) *ColorPicker

func (*ColorPicker) SetHue

func (c *ColorPicker) SetHue(h float32) *ColorPicker

func (*ColorPicker) SetOnColorChanged

func (c *ColorPicker) SetOnColorChanged(handler func(r, g, b, a uint8)) *ColorPicker

SetOnColorChanged registers the live color-changed callback.

func (*ColorPicker) UpdateHSV

func (c *ColorPicker) UpdateHSV()

func (*ColorPicker) UpdateRGB

func (c *ColorPicker) UpdateRGB()

type ComboBox

type ComboBox struct {
	meui.BaseWidget
	*theme.ComboBoxTheme
	Options       []string
	SelectedIndex int
	Expanded      bool
	HoveredIndex  int
	OnSelected    func(int, string)

	Editable          bool
	FilterText        string
	PlaceholderText   string
	MaxDropdownHeight float32
	// contains filtered or unexported fields
}

func NewComboBox

func NewComboBox() *ComboBox

func (*ComboBox) AccessibilityNode added in v0.5.27

func (c *ComboBox) AccessibilityNode() platform.AccessibilityNode

func (*ComboBox) AddItem

func (c *ComboBox) AddItem(item string) *ComboBox

AddItem appends an option (like QComboBox.addItem).

func (*ComboBox) ClearItems

func (c *ComboBox) ClearItems() *ComboBox

ClearItems removes all options and the selection (like QComboBox.clear).

func (*ComboBox) ClearSelection

func (c *ComboBox) ClearSelection() *ComboBox

ClearSelection deselects (SelectedIndex = -1).

func (*ComboBox) Focusable

func (c *ComboBox) Focusable() bool

func (*ComboBox) GetSelectedText

func (c *ComboBox) GetSelectedText() string

GetSelectedText returns the currently selected option, or "".

func (*ComboBox) HandleMouseDown

func (c *ComboBox) HandleMouseDown(x, y float32, button int) bool

func (*ComboBox) HandleMouseMove

func (c *ComboBox) HandleMouseMove(x, y float32) bool

func (*ComboBox) ItemCount

func (c *ComboBox) ItemCount() int

ItemCount returns the number of options.

func (*ComboBox) OnBlur

func (c *ComboBox) OnBlur()

func (*ComboBox) OnCharacter

func (c *ComboBox) OnCharacter(ch rune)

func (*ComboBox) OnClosed

func (c *ComboBox) OnClosed()

OnClosed is how the window tells a list that its layer is gone: Escape closes the topmost layer, and the combo has to forget it is expanded — otherwise it reopens on the next click believing the list is still up, or paints one that does not exist.

func (*ComboBox) OnFocus

func (c *ComboBox) OnFocus()

func (*ComboBox) OnKeyDown

func (c *ComboBox) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool

func (*ComboBox) OnKeyRepeat

func (c *ComboBox) OnKeyRepeat(keyCode platform.KeyCode, mod platform.Modifiers) bool

OnKeyRepeat is a key the user is HOLDING — Backspace over a word, an arrow along a row, a scrub. The window classifies an OS auto-repeat as a repeat rather than a fresh press (a widget without this method is asked once, deliberately), so this is what makes a held key work here.

func (*ComboBox) OnMouseDown

func (c *ComboBox) OnMouseDown(x, y float32, button int) bool

func (*ComboBox) OnMouseMove

func (c *ComboBox) OnMouseMove(x, y float32)

func (*ComboBox) OnMouseWheel

func (c *ComboBox) OnMouseWheel(x, y float32, dx, dy float32) bool

func (*ComboBox) Paint

func (c *ComboBox) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*ComboBox) PerformAccessibilityAction added in v0.5.27

func (c *ComboBox) PerformAccessibilityAction(action platform.AccessibilityAction) bool

func (*ComboBox) PreferredDimensions

func (c *ComboBox) PreferredDimensions(target interface{}, width, height float32) (float32, float32)

func (*ComboBox) RemoveItem

func (c *ComboBox) RemoveItem(index int) *ComboBox

RemoveItem removes the option at index (like QComboBox.removeItem).

func (*ComboBox) RestoreState added in v0.5.34

func (c *ComboBox) RestoreState(v any) bool

func (*ComboBox) SaveState added in v0.5.34

func (c *ComboBox) SaveState() any

func (*ComboBox) SetBoundProperty

func (c *ComboBox) SetBoundProperty(propName string, value interface{})

func (*ComboBox) SetEditable

func (c *ComboBox) SetEditable(editable bool) *ComboBox

SetEditable enables the editable + filter mode at runtime.

func (*ComboBox) SetExpanded

func (c *ComboBox) SetExpanded(expanded bool)

func (*ComboBox) SetMaxDropdownHeight

func (c *ComboBox) SetMaxDropdownHeight(height float32) *ComboBox

SetMaxDropdownHeight caps the dropdown popup height (0 = theme default).

func (*ComboBox) SetOnSelected

func (c *ComboBox) SetOnSelected(handler func(int, string)) *ComboBox

func (*ComboBox) SetOptions

func (c *ComboBox) SetOptions(options []string) *ComboBox

func (*ComboBox) SetPlaceholder

func (c *ComboBox) SetPlaceholder(text string) *ComboBox

SetPlaceholder sets the text shown when nothing is selected (editable mode shows it as the filter hint).

func (*ComboBox) SetSelectedIndex

func (c *ComboBox) SetSelectedIndex(index int) *ComboBox

type CompletionItem

type CompletionItem struct {
	Label      string
	Kind       int
	Detail     string
	InsertText string
}

type CompletionParams

type CompletionParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
	Position     Position               `json:"position"`
	Context      *struct {
		TriggerKind int `json:"triggerKind"`
	} `json:"context,omitempty"`
}

type ContextMenu

type ContextMenu struct {
	meui.BaseWidget
	*theme.ContextMenuTheme

	OnItemSelected func(int, *MenuItem)
	// contains filtered or unexported fields
}

func NewContextMenu

func NewContextMenu() *ContextMenu

func (*ContextMenu) AccessibilityNode added in v0.5.32

func (m *ContextMenu) AccessibilityNode() platform.AccessibilityNode

func (*ContextMenu) AccessibilityVirtualChildren added in v0.5.32

func (m *ContextMenu) AccessibilityVirtualChildren() []meui.AccessibilityVirtualChild

func (*ContextMenu) AddCheckItem

func (m *ContextMenu) AddCheckItem(label string, checked bool, action func()) *ContextMenu

func (*ContextMenu) AddItem

func (m *ContextMenu) AddItem(label string, action func()) *ContextMenu

func (*ContextMenu) AddSeparator

func (m *ContextMenu) AddSeparator() *ContextMenu

func (*ContextMenu) AddSubMenu

func (m *ContextMenu) AddSubMenu(label string, items []MenuItem) *ContextMenu

func (*ContextMenu) ContainsPoint

func (m *ContextMenu) ContainsPoint(x, y float32) bool

func (*ContextMenu) ItemCount

func (m *ContextMenu) ItemCount() int

func (*ContextMenu) OnExternalDismiss

func (m *ContextMenu) OnExternalDismiss()

func (*ContextMenu) OnKeyDown

func (m *ContextMenu) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool

func (*ContextMenu) OnMouseDown

func (m *ContextMenu) OnMouseDown(x, y float32, button int) bool

func (*ContextMenu) OnMouseMove

func (m *ContextMenu) OnMouseMove(x, y float32)

func (*ContextMenu) Paint

func (m *ContextMenu) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*ContextMenu) PreferredSize

func (m *ContextMenu) PreferredSize() (float32, float32)

func (*ContextMenu) SetItems

func (m *ContextMenu) SetItems(items []MenuItem) *ContextMenu

func (*ContextMenu) SetOnDismiss

func (m *ContextMenu) SetOnDismiss(fn func())

type ContextMenuOverlay

type ContextMenuOverlay struct {
	Items      []MenuItem
	X, Y       float32
	Hover      int
	Visible    bool
	NoAutoHide bool // if true, HandleClick won't auto-hide after firing an action
	// contains filtered or unexported fields
}

ContextMenuOverlay is a reusable helper for showing a popup context menu within a widget's own canvas. Embed this in any widget that needs a right-click context menu, then call Show/Draw/HandleClick/HitTest.

Usage:

type MyWidget struct {
    meui.BaseWidget
    menu widgets.ContextMenuOverlay
    ...
}

// Right-click → show:
m.menu.Show(x, y, items)

// In Paint:
m.menu.Draw(canvas, m.Width(), m.Height(), font)

// In OnMouseDown before other handling:
if m.menu.HandleClick(x, y, button) { return true }

// In OnMouseMove before other handling:
m.menu.HandleHover(x, y, m.Width(), m.Height(), font)
if m.menu.Visible { m.MarkForRedraw(); return }

func (*ContextMenuOverlay) Draw

func (m *ContextMenuOverlay) Draw(canvas *graphics.Canvas, widgetW, widgetH float32, font graphics.Font)

Draw renders the context menu on the canvas. widgetW, widgetH are the dimensions of the parent widget for bounds clamping.

func (*ContextMenuOverlay) HandleClick

func (m *ContextMenuOverlay) HandleClick(x, y, button int) bool

HandleClick processes a click and returns true if the menu was hit.

func (*ContextMenuOverlay) Hide

func (m *ContextMenuOverlay) Hide()

Hide closes the context menu.

func (*ContextMenuOverlay) HitTest

func (m *ContextMenuOverlay) HitTest(x, y, widgetW, widgetH float32, font graphics.Font) int

HitTest returns the hover index of a point, or -1 if outside the menu.

func (*ContextMenuOverlay) Show

func (m *ContextMenuOverlay) Show(x, y float32, items []MenuItem)

Show opens the context menu at (x,y) with the given items.

type DataCell

type DataCell struct {
	Text    string
	Color   string
	BgColor string
	Widget  meui.Widget // interactive widget embedded in this cell
	// contains filtered or unexported fields
}

type DataColType

type DataColType int
const (
	ColText DataColType = iota
	ColNumber
	ColPercent
)

type DataColumn

type DataColumn struct {
	Label string
	Type  DataColType
	Width float32
}

type DataRow

type DataRow struct {
	Cells []DataCell
}

type DataTable

type DataTable struct {
	meui.BaseWidget
	*theme.TableTheme

	Columns       []DataColumn
	Rows          []DataRow
	ScrollOffset  float32
	ScrollOffsetX float32
	VScroll       *ScrollBar
	HScroll       *ScrollBar

	RowHeight       float32
	HeaderHeight    float32
	AlternatingRows bool
	ShowHeader      bool
	ShowGrid        bool
	ShowRowNumbers  bool
	RowNumberStart  int
	RowNumberWidth  float32

	SelectedRow int
	HoveredRow  int

	OnCellSelected      func(row, col int)
	OnCellClicked       func(row, col int, cell *DataCell)
	OnCellDoubleClicked func(row, col int, cell *DataCell)
	OnCellRightClicked  func(row, col int, x, y float32)
	OnHeaderClick       func(col int)
	OnCellRender        func(c *graphics.Canvas, rect graphics.Rect, row, col int, cell *DataCell)
	OnSortChanged       func(col int, asc bool)
	OnColumnsReordered  func()
	OnDelete            func(row int, mod platform.Modifiers) // Delete key on a selected row
	OnDuplicate         func(row int)                         // Shift+Enter on a selected row
	// contains filtered or unexported fields
}

DataTable is a scrollable table with sortable, resizable and REORDERABLE columns.

Reordering is a VIEW, and the split matters to every caller:

  • Columns is in DISPLAY order — the order the operator dragged the headings into. Widths and the drop indicator follow it.
  • DataRow.Cells is in LOGICAL order — the order the caller declared its columns in, and the order it re-supplies on every refresh, because that is the only order it knows.
  • Every cell API and every callback that carries a column index (Cell, UpdateCell, UpdateCells, OnCellClicked, OnCellSelected, OnCellRender, OnSortChanged, SortCol, ColumnLess) uses the LOGICAL index.

colOrder maps one to the other. Keeping the rows logical is what lets an arrangement survive SetRows; permuting them instead made the next refresh put the data back in declared order under moved headings.

A cell's text is CACHED as a rendered graphics.Text and rebuilt when the theme version moves or the cache is dropped. UpdateCell/UpdateCells drop it even when the text already matches, because a caller that projects rows from its own store may share the cell slice and write the cell before telling the table. A projection should still give each visible row its OWN cells: sharing them means the table is never told a value changed, and it is enough for the slice to be appended once for that to happen.

func NewDataTable

func NewDataTable() *DataTable

func (*DataTable) AddRow

func (dt *DataTable) AddRow(cells []DataCell)

func (*DataTable) Cell

func (dt *DataTable) Cell(row, col int) *DataCell

func (*DataTable) Clear

func (dt *DataTable) Clear()

func (*DataTable) ColumnLess

func (dt *DataTable) ColumnLess(col int, a, b string, asc bool) bool

ColumnLess compares two cell texts for column col, reading the type off that column.

It is what a table's OnSortChanged handler should call: the type cannot be taken from the wrong column, and a column index past the end is never a sort (it returns false, which leaves the pair ordered as it was). The caller still checks the index once before the sort, so an out-of-range column does no work at all.

func (*DataTable) CursorAt

func (dt *DataTable) CursorAt(x, y float32) *platform.Cursor

func (*DataTable) Focusable

func (dt *DataTable) Focusable() bool

func (*DataTable) OnKeyDown

func (dt *DataTable) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool

func (*DataTable) OnKeyRepeat

func (dt *DataTable) OnKeyRepeat(keyCode platform.KeyCode, mod platform.Modifiers) bool

OnKeyRepeat is a key the user is HOLDING — Backspace over a word, an arrow along a row, a scrub. The window classifies an OS auto-repeat as a repeat rather than a fresh press (a widget without this method is asked once, deliberately), so this is what makes a held key work here.

func (*DataTable) OnMouseDown

func (dt *DataTable) OnMouseDown(x, y float32, button int) bool

func (*DataTable) OnMouseMove

func (dt *DataTable) OnMouseMove(x, y float32)

func (*DataTable) OnMouseUp

func (dt *DataTable) OnMouseUp(x, y float32, button int) bool

func (*DataTable) OnMouseWheel

func (dt *DataTable) OnMouseWheel(x, y float32, dx, dy float32) bool

func (*DataTable) Paint

func (dt *DataTable) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*DataTable) RemoveRow

func (dt *DataTable) RemoveRow(idx int)

func (*DataTable) SetBoundProperty

func (dt *DataTable) SetBoundProperty(propName string, value interface{})

func (*DataTable) SetColumns

func (dt *DataTable) SetColumns(cols []DataColumn)

func (*DataTable) SetRows

func (dt *DataTable) SetRows(rows []DataRow)

func (*DataTable) SortAsc

func (dt *DataTable) SortAsc() bool

func (*DataTable) SortCol

func (dt *DataTable) SortCol() int

func (*DataTable) UpdateCell

func (dt *DataTable) UpdateCell(row, col int, text string)

func (*DataTable) UpdateCells

func (dt *DataTable) UpdateCells(updates []CellUpdate)

type DatePicker

type DatePicker struct {
	meui.BaseContainer
	// contains filtered or unexported fields
}

DatePicker is a date field: an editable text box in ISO form with a button that opens a calendar under it. The text is parsed leniently — 2026-9-5, 2026/09/05 and 2026.9.5 all mean the same day — and normalised to YYYY-MM-DD on commit, so typing a date is not a fight with the format. Text that is not a date (yet) leaves the last good date in place; the field is only rewritten when the user finishes (Enter) or picks a day.

The button opens the panel as an anchored dropdown in the window's layer space (see dropdownPanel): a click anywhere outside closes it.

func NewDatePicker

func NewDatePicker() *DatePicker

NewDatePicker returns a picker showing today.

func (*DatePicker) Calendar

func (d *DatePicker) Calendar() *Calendar

Calendar returns the popup's calendar, for the caller that wants to configure it. It is the same widget the panel paints; the field gives it its rect when the panel opens.

func (*DatePicker) Clear

func (d *DatePicker) Clear() *DatePicker

Clear unsets the picker: the field empties (showing its placeholder) and HasDate goes false, without firing OnDateChanged. The calendar keeps the date it had, so opening it lands on something sensible.

func (*DatePicker) CursorAt

func (d *DatePicker) CursorAt(x, y float32) *platform.Cursor

CursorAt returns nil: the deepest hit under the pointer is the field, whose own CursorAt reports the text cursor, or the button, which keeps the arrow.

func (*DatePicker) Date

func (d *DatePicker) Date() (year, month, day int)

Date returns the current year, month and day. HasDate says whether there is one: after Clear the field is empty and the returned value is the last date the picker had, which is where its calendar would open.

func (*DatePicker) Expanded

func (d *DatePicker) Expanded() bool

Expanded reports whether the calendar panel is open.

func (*DatePicker) HandleMouseDown

func (d *DatePicker) HandleMouseDown(lx, ly float32, button int) bool

HandleMouseDown receives clicks while the panel is open (the layer is modal): inside the panel the calendar gets the click, anywhere else closes it.

func (*DatePicker) HandleMouseMove

func (d *DatePicker) HandleMouseMove(lx, ly float32) bool

func (*DatePicker) HandleMouseUp

func (d *DatePicker) HandleMouseUp(lx, ly float32, button int) bool

func (*DatePicker) HasDate

func (d *DatePicker) HasDate() bool

HasDate reports whether the picker holds a date. An unset picker is the empty field an optional "from/to" filter wants.

func (*DatePicker) OnMouseDown

func (d *DatePicker) OnMouseDown(x, y float32, button int) bool

OnMouseDown, OnMouseUp and OnMouseMove forward to the field or the button under the point. A container dispatches by containment — a modal popup hands the press to its content's children, not to the deepest hit — so the composite must route the event itself; relying on the window's PanelAt delivery alone left every field inside a modal dead (the owner's "the colour picker does not pop up" in the Settings popup).

func (*DatePicker) OnMouseMove

func (d *DatePicker) OnMouseMove(x, y float32)

func (*DatePicker) OnMouseUp

func (d *DatePicker) OnMouseUp(x, y float32, button int) bool

func (*DatePicker) Paint

func (d *DatePicker) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*DatePicker) PanelAt

func (d *DatePicker) PanelAt(x, y float32) meui.Widget

PanelAt routes a point to the field or the button, so the window's hit test finds them: the field owns text editing, the button owns the click that opens the calendar. The calendar itself lives in the layer, which the window routes back here through HandleMouseDown/Move/Up.

func (*DatePicker) PanelRect

func (d *DatePicker) PanelRect() graphics.Rect

PanelRect is the open panel's rect in the window's content space, or the zero rect when it is closed. It exists so a caller — and a test — can ask WHERE the panel landed without reaching into the layer.

func (*DatePicker) Presentation

func (d *DatePicker) Presentation() PickerPresentation

func (*DatePicker) SetBoundProperty

func (d *DatePicker) SetBoundProperty(propName string, value interface{})

SetBoundProperty applies a QML property to the picker. The loader routes every property without a handler of its own here (see qml.HandleProperty), so this is what makes `placeholder`, `year`, `month` and `day` work in QML.

func (*DatePicker) SetDate

func (d *DatePicker) SetDate(year, month, day int) *DatePicker

SetDate sets the value (and the field) without firing OnDateChanged: a programmatic set is not a user edit.

func (*DatePicker) SetEnabled

func (d *DatePicker) SetEnabled(enabled bool) *DatePicker

SetEnabled enables or disables the field and its button together, so a disabled picker cannot still open its calendar.

func (*DatePicker) SetExpanded

func (d *DatePicker) SetExpanded(expanded bool) *DatePicker

SetExpanded opens or closes the calendar panel.

func (*DatePicker) SetFrameRect

func (d *DatePicker) SetFrameRect(rect graphics.Rect)

func (*DatePicker) SetOnDateChanged

func (d *DatePicker) SetOnDateChanged(handler func(year, month, day int)) *DatePicker

SetOnDateChanged registers the callback fired when the user commits a date — by picking a day or by pressing Enter on a valid one.

func (*DatePicker) SetPlaceholder

func (d *DatePicker) SetPlaceholder(text string) *DatePicker

SetPlaceholder sets the text shown while the field is empty.

func (*DatePicker) SetPresentation

func (d *DatePicker) SetPresentation(p PickerPresentation) *DatePicker

SetPresentation selects where the calendar panel appears. Auto — the default — follows the surface's size class: anchored under the field on a surface with room, a bottom sheet on a phone.

func (*DatePicker) SetText

func (d *DatePicker) SetText(text string) *DatePicker

SetText sets the field from text — the QML `text` property. A value that is not a date is shown as typed and leaves the current date in place.

func (*DatePicker) Text

func (d *DatePicker) Text() string

Text returns the field's text, exactly as shown.

func (*DatePicker) ValidateLayout

func (d *DatePicker) ValidateLayout()

ValidateLayout places the field and the button inside the frame.

type Diagnostic

type Diagnostic struct {
	Line     int
	Col      int
	EndLine  int
	EndCol   int
	Severity int
	Message  string
	Source   string
}

type DialogAction

type DialogAction struct {
	// ID is what OnAction reports.
	ID string
	// Label is the button's text.
	Label string
	// Primary draws it in the accent ink: the confirming action. M3 puts it last, on the right.
	Primary bool
	// Destructive draws it in the error ink.
	Destructive bool
	Disabled    bool
}

DialogAction is one button in a Dialog.

type DialogPresentation

type DialogPresentation uint8

DialogPresentation selects WHERE a dialog appears, which is the one thing that changes between a tablet and a phone. It is a behaviour axis, so it follows the SURFACE's size class (FormFactor) rather than the OS name — a narrow desktop window is a phone by the same rule.

const (
	// DialogAuto is the M3 rule and the reason both forms exist: a CENTRED dialog on a surface
	// with room, and a BOTTOM SHEET on a phone, where a centred box would be under the keyboard
	// and out of thumb reach.
	DialogAuto DialogPresentation = iota
	// DialogCentred forces the centred form.
	DialogCentred
	// DialogSheet forces the bottom-sheet form.
	DialogSheet
)

type DidChangeTextDocumentParams

type DidChangeTextDocumentParams struct {
	TextDocument   VersionedTextDocumentIdentifier `json:"textDocument"`
	ContentChanges []struct {
		Text string `json:"text"`
	} `json:"contentChanges"`
}

type DidCloseTextDocumentParams

type DidCloseTextDocumentParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
}

type DidOpenTextDocumentParams

type DidOpenTextDocumentParams struct {
	TextDocument TextDocumentItem `json:"textDocument"`
}

type DockEdge

type DockEdge = DockPosition

DockEdge is the type for dock edge positions (kept for backward compatibility).

type DockPanel

type DockPanel struct {
	meui.BaseContainer
	Left   []meui.Widget
	Right  []meui.Widget
	Top    []meui.Widget
	Bottom []meui.Widget
	Center meui.Widget
	// Sizes for docked areas
	LeftSize   float32
	RightSize  float32
	TopSize    float32
	BottomSize float32
}

DockPanel is a container that manages docked child panels. Each child is wrapped in a title bar and can be dragged to re-dock or undock.

func NewDockPanel

func NewDockPanel() *DockPanel

func (*DockPanel) AddToEdge

func (dp *DockPanel) AddToEdge(edge DockEdge, title string, w meui.Widget)

func (*DockPanel) Paint

func (dp *DockPanel) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*DockPanel) SetCenter

func (dp *DockPanel) SetCenter(w meui.Widget)

func (*DockPanel) ValidateLayout

func (dp *DockPanel) ValidateLayout()

type DockPosition

type DockPosition int

DockPosition indicates where a window is docked.

const (
	DockCenter DockPosition = iota
	DockLeft
	DockRight
	DockTop
	DockBottom
)

type DocumentSymbolParams

type DocumentSymbolParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
}

type DropZoneInfo

type DropZoneInfo struct {
	Type     DropZoneType
	DockPos  DockPosition  // for DropDock
	Target   meui.Widget   // target widget for DropMerge (MdiWindow or TabPanel)
	Stack    *StackPanel   // StackPanel to insert into
	StackIdx int           // index within StackPanel
	ZoneRect graphics.Rect // zone rect in MdiContainer-local coords (for highlight)
}

DropZoneInfo describes where a dragged window should land.

type DropZoneType

type DropZoneType int

DropZoneType categorizes drop zones.

const (
	DropDock  DropZoneType = iota // Dock to edge zone
	DropMerge                     // Merge into existing TabPanel or MdiWindow
	DropFloat                     // Drop as floating window (no-op)
)

type EditAction

type EditAction int
const (
	ActionInsertText EditAction = iota
	ActionDeleteText
	ActionReplaceText
	ActionInsertNewline
	ActionIndent
	ActionOutdent
)

type EditorSettings

type EditorSettings struct {
	FontSize float32
}

EditorSettings holds user-configurable settings independent of the color theme.

func DefaultEditorSettings

func DefaultEditorSettings() *EditorSettings

DefaultEditorSettings returns sensible defaults for editor settings.

type EditorTheme

type EditorTheme struct {
	Background         graphics.Color
	GutterBackground   graphics.Color
	GutterBorder       graphics.Color
	GutterText         graphics.Color
	LineNumberActive   graphics.Color
	CurrentLine        graphics.Color
	SelectionBg        graphics.Color
	SelectionFg        graphics.Color
	Cursor             graphics.Color
	CursorLineBg       graphics.Color
	SearchMatchBg      graphics.Color
	SearchMatchCurrent graphics.Color
	BracketMatchBg     graphics.Color
	BracketMatchBorder graphics.Color
	WhitespaceChar     graphics.Color
	LineHighlight      graphics.Color
	MinimapBackground  graphics.Color
	MinimapSlider      graphics.Color
	FoldMarker         graphics.Color
	FoldMarkerActive   graphics.Color
	IndentGuide        graphics.Color
	IndentGuideActive  graphics.Color

	Font            graphics.Font
	LineHeight      float32
	TabWidth        int
	ShowLineNumbers bool
	ShowWhitespace  bool
	WordWrap        bool
	MinimapWidth    float32
}

func DefaultEditorTheme

func DefaultEditorTheme() *EditorTheme

func LightEditorTheme

func LightEditorTheme() *EditorTheme

type GoToDefinitionParams

type GoToDefinitionParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
	Position     Position               `json:"position"`
}

type GoTokenizer

type GoTokenizer struct{}

func (*GoTokenizer) Extensions

func (g *GoTokenizer) Extensions() []string

func (*GoTokenizer) LanguageName

func (g *GoTokenizer) LanguageName() string

func (*GoTokenizer) Tokenize

func (g *GoTokenizer) Tokenize(line string, lineNum int, prevState interface{}) ([]SyntaxToken, interface{})

type GroupBox

type GroupBox struct {
	meui.BaseWidget
	*theme.GroupBoxTheme
	Title        string
	FullTitle    bool
	Collapsible  bool
	Collapsed    bool
	BorderRadius float32 // 0 = use theme default
	BorderStroke float32 // 0 = use theme default
	ShowBorder   bool    // false = no border drawn
	// contains filtered or unexported fields
}

func NewGroupBox

func NewGroupBox() *GroupBox

func (*GroupBox) AddChild

func (g *GroupBox) AddChild(child meui.Widget)

func (*GroupBox) Children

func (g *GroupBox) Children() []meui.Widget

func (*GroupBox) ChildrenI

func (g *GroupBox) ChildrenI() []interface{}

func (*GroupBox) MinimumDimensions

func (g *GroupBox) MinimumDimensions() (float32, float32)

func (*GroupBox) OnMouseDown

func (g *GroupBox) OnMouseDown(x, y float32, button int) bool

func (*GroupBox) OnMouseMove

func (g *GroupBox) OnMouseMove(x, y float32)

func (*GroupBox) OnMouseUp

func (g *GroupBox) OnMouseUp(x, y float32, button int) bool

func (*GroupBox) Paint

func (g *GroupBox) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*GroupBox) PanelAt

func (g *GroupBox) PanelAt(x, y float32) meui.Widget

func (*GroupBox) PreferredDimensions

func (g *GroupBox) PreferredDimensions(target interface{}, width, height float32) (float32, float32)

func (*GroupBox) SetBorderRadius

func (g *GroupBox) SetBorderRadius(r float32) *GroupBox

func (*GroupBox) SetBorderStroke

func (g *GroupBox) SetBorderStroke(s float32) *GroupBox

func (*GroupBox) SetBoundProperty

func (g *GroupBox) SetBoundProperty(propName string, value interface{})

func (*GroupBox) SetCollapsed

func (g *GroupBox) SetCollapsed(b bool) *GroupBox

func (*GroupBox) SetCollapsible

func (g *GroupBox) SetCollapsible(b bool) *GroupBox

func (*GroupBox) SetContentLayout

func (g *GroupBox) SetContentLayout(l interface{}) *GroupBox

func (*GroupBox) SetEnabled

func (g *GroupBox) SetEnabled(enabled bool) *GroupBox

func (*GroupBox) SetFrameRect

func (g *GroupBox) SetFrameRect(rect graphics.Rect)

func (*GroupBox) SetFullTitle

func (g *GroupBox) SetFullTitle(b bool) *GroupBox

func (*GroupBox) SetShowBorder

func (g *GroupBox) SetShowBorder(b bool) *GroupBox

func (*GroupBox) SetTitle

func (g *GroupBox) SetTitle(title string) *GroupBox

func (*GroupBox) ValidateLayout

func (g *GroupBox) ValidateLayout()

type Histogram

type Histogram struct {
	meui.BaseWidget
	*theme.LabelTheme
	// contains filtered or unexported fields
}

Histogram draws a document's tonal distribution: the four bin arrays an image editor's histogram is made of, as the classic filled mountains.

It takes BINS, not a document, for the same reason Waveform takes peaks: the toolkit must not depend on meui-media (the media module is built on the toolkit), so the app computes the bins with `document.ComputeHistogram` and passes the four slices.

func NewHistogram

func NewHistogram() *Histogram

NewHistogram builds an empty histogram.

func (*Histogram) Bins

func (h *Histogram) Bins() int

Bins is how many bins per channel.

func (*Histogram) Paint

func (h *Histogram) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*Histogram) PreferredDimensions

func (h *Histogram) PreferredDimensions(target interface{}, width, height float32) (float32, float32)

func (*Histogram) SetBins

func (h *Histogram) SetBins(r, g, b, l []uint32) *Histogram

SetBins installs the four channels. All four must be the same length; a mismatch is refused rather than drawn, because a plot from mismatched arrays is a lie about the data rather than a cosmetic problem.

func (*Histogram) SetClipGuard

func (h *Histogram) SetClipGuard(on bool) *Histogram

SetClipGuard turns the extremes guard on or off (it is on by default; see the note in peak).

type HoverParams

type HoverParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
	Position     Position               `json:"position"`
}

type Image

type Image struct {
	meui.BaseWidget
	*theme.LabelTheme
	// contains filtered or unexported fields
}

Image displays a graphics.Image: an image VIEWER, not an editor. It owns no pixels and edits nothing — the display path of an image editor ends here, and the document behind it is a separate concern (see meui-media).

The default fit is CONTAIN, not fill: a viewer that silently crops or stretches what a user opened is the first thing they will not trust.

func NewImage

func NewImage() *Image

NewImage builds an empty viewer.

func (*Image) Checkerboard

func (w *Image) Checkerboard() bool

Checkerboard reports whether the transparency pattern is drawn.

func (*Image) ContentRect

func (w *Image) ContentRect() graphics.Rect

ContentRect is where the image itself lands, in WIDGET-LOCAL coordinates — the same space Paint receives after it translates, and the same space OnMouse*/ContainsPoint/PixelAt are given. It is exported because it is the geometry an app needs for the OTHER direction too (turning a pointer position into an image pixel), and two implementations of that mapping would eventually disagree.

func (*Image) CornerRadius

func (w *Image) CornerRadius() float32

CornerRadius is the current mask radius in widget pixels.

func (*Image) Fit

func (w *Image) Fit() ImageFit

Fit is the current fit.

func (*Image) Image

func (w *Image) Image() *graphics.Image

Image is the displayed image, which may be nil.

func (*Image) Overlay

func (w *Image) Overlay() *graphics.Image

Overlay is the image drawn on top, which may be nil.

func (*Image) Paint

func (w *Image) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*Image) PixelAt

func (w *Image) PixelAt(x, y float32) (px, py int, inside bool)

PixelAt maps a widget-local point to an image pixel, reporting whether it is inside the image. An app drawing a selection or a brush uses this rather than deriving the mapping again.

func (*Image) PreferredDimensions

func (w *Image) PreferredDimensions(target interface{}, width, height float32) (float32, float32)

PreferredDimensions offers the image's own size, which is what a viewer wants when nothing constrains it (the layout package does not consult this — an app sets the size itself).

func (*Image) SetBoundProperty

func (w *Image) SetBoundProperty(name string, value interface{})

SetBoundProperty applies the QML properties a scene sets on an Image. It is the widget's own vocabulary rather than a global handler, so `source` and `fillMode` cannot collide with another widget's property of the same name.

func (*Image) SetCheckerboard

func (w *Image) SetCheckerboard(on bool) *Image

SetCheckerboard turns the transparency checkerboard under the image on or off. It exists because a transparent area drawn over the theme's background is indistinguishable from opaque black — and in an image editor that difference is the point.

func (*Image) SetCornerRadius

func (w *Image) SetCornerRadius(r float32) *Image

SetCornerRadius rounds the displayed image's corners. The layer is built at the display size (once per size/radius change), so a radius is the radius you SEE — and it works in both renderers, which a clip path cannot.

func (*Image) SetFit

func (w *Image) SetFit(f ImageFit) *Image

SetFit chooses how the image maps into the widget.

func (*Image) SetImage

func (w *Image) SetImage(img *graphics.Image) *Image

SetImage installs the image to display. A nil image is legal and draws the empty state.

func (*Image) SetOverlay

func (w *Image) SetOverlay(img *graphics.Image) *Image

SetOverlay installs an image drawn ON TOP of the content, at the same rect. It is how an app shows something that belongs to the image without being part of it — a selection, a mask, a crop frame — and it is deliberately just an image: the viewer draws what it is given and knows nothing about what it means.

func (*Image) SetSource

func (w *Image) SetSource(path string) error

SetSource loads an image file and displays it. The path may be PNG, JPEG or the formats graphics already decodes; a load failure leaves the viewer empty and is returned so a scene can report it rather than show a blank card.

type ImageFit

type ImageFit uint8

ImageFit is how the image maps into the widget's rect.

const (
	// ImageFitContain fits the whole image inside the widget, preserving aspect ratio. The default.
	ImageFitContain ImageFit = iota
	// ImageFitNone draws the image 1:1, centred, and CLIPPED to the widget — what a pixel editor shows
	// at 100%, where one image pixel is one screen pixel.
	ImageFitNone
	// ImageFitFill stretches to the widget, aspect ratio ignored.
	ImageFitFill
	// ImageFitCover fills the widget preserving aspect ratio and CROPS the excess
	// (the widget clips it). It is the fit a web card uses: album art, a hero
	// image, a thumbnail — a stretched face or a letterboxed band both read wrong.
	ImageFitCover
)

func (ImageFit) String

func (f ImageFit) String() string

type InitializeParams

type InitializeParams struct {
	ProcessID    int                `json:"processId"`
	RootURI      string             `json:"rootUri"`
	Capabilities ClientCapabilities `json:"capabilities"`
}

type InsetSpacer

type InsetSpacer struct {
	meui.BaseWidget
	// contains filtered or unexported fields
}

InsetSpacer reserves a strip at the bottom of a shell for an OS inset — the on-screen keyboard, today — so that a bar above it is LIFTED rather than covered.

It exists because the toolkit REPORTS the keyboard through Insets.Keyboard but has no opinion about what to do with it: an app may draw behind the IME, and one that wants its navigation bar to stay visible puts this after the bar and sets the inset. It draws nothing, and at zero it is INVISIBLE, which the layout skips entirely — so a keyboard that is down costs nothing, rather than a zero-height row that could still take a hit.

The shell drives it from the platform's inset change (see meui/demoapp):

if sp, ok := reg.Get("keyboardSpacer").(*widgets.InsetSpacer); ok {
    sp.SetInset(wnd.Insets().Keyboard)
}

func NewInsetSpacer

func NewInsetSpacer() *InsetSpacer

NewInsetSpacer builds a spacer with no inset, i.e. hidden.

func (*InsetSpacer) Inset

func (s *InsetSpacer) Inset() float32

Inset is the height currently being reserved.

func (*InsetSpacer) Paint

func (s *InsetSpacer) Paint(canvas *graphics.Canvas, rect graphics.Rect)

Paint draws nothing: the spacer is a reservation, not a surface.

func (*InsetSpacer) PreferredDimensions

func (s *InsetSpacer) PreferredDimensions(target interface{}, w, h float32) (float32, float32)

PreferredDimensions is how the layout learns the reserved height. It takes the width it is given, because the strip spans the shell.

func (*InsetSpacer) PreferredSize

func (s *InsetSpacer) PreferredSize() (float32, float32)

func (*InsetSpacer) SetInset

func (s *InsetSpacer) SetInset(h float32) *InsetSpacer

SetInset sets the height to reserve. A negative value is clamped to zero rather than stored: an inset is a distance, and a negative one would move a bar DOWN over the content it is supposed to clear.

func (*InsetSpacer) Visible

func (s *InsetSpacer) Visible() bool

Visible is false at zero, so the layout skips the spacer instead of reserving a zero-height row. An explicit SetVisible(false) still hides it.

type JavaScriptTokenizer

type JavaScriptTokenizer struct{}

func (*JavaScriptTokenizer) Extensions

func (j *JavaScriptTokenizer) Extensions() []string

func (*JavaScriptTokenizer) LanguageName

func (j *JavaScriptTokenizer) LanguageName() string

func (*JavaScriptTokenizer) Tokenize

func (j *JavaScriptTokenizer) Tokenize(line string, lineNum int, prevState interface{}) ([]SyntaxToken, interface{})

type LSPClient

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

func NewLSPClient

func NewLSPClient(serverPath, langID, rootURI string) *LSPClient

func (*LSPClient) Close

func (c *LSPClient) Close()

func (*LSPClient) CodeAction

func (c *LSPClient) CodeAction(line, col int, diagnostics []Diagnostic) ([]interface{}, error)

func (*LSPClient) Completion

func (c *LSPClient) Completion(line, col int) (int, []CompletionItem, error)

func (*LSPClient) Connect

func (c *LSPClient) Connect() error

func (*LSPClient) DidChange

func (c *LSPClient) DidChange(text string)

func (*LSPClient) DidClose

func (c *LSPClient) DidClose()

func (*LSPClient) DidOpen

func (c *LSPClient) DidOpen(uri, languageID, text string)

func (*LSPClient) DidSave

func (c *LSPClient) DidSave()

func (*LSPClient) DocumentSymbols

func (c *LSPClient) DocumentSymbols() ([]interface{}, error)

func (*LSPClient) FindReferences

func (c *LSPClient) FindReferences(line, col int) ([]Location, error)

func (*LSPClient) GoToDefinition

func (c *LSPClient) GoToDefinition(line, col int) (string, Position, error)

func (*LSPClient) Hover

func (c *LSPClient) Hover(line, col int) (string, error)

func (*LSPClient) RenameSymbol

func (c *LSPClient) RenameSymbol(line, col int, newName string) error

func (*LSPClient) SetOnDiagnostics

func (c *LSPClient) SetOnDiagnostics(handler func(uri string, diagnostics []Diagnostic))

func (*LSPClient) SignatureHelp

func (c *LSPClient) SignatureHelp(line, col int) ([]ParameterHint, error)

type LSPMessage

type LSPMessage struct {
	JSONRPC string      `json:"jsonrpc"`
	ID      interface{} `json:"id,omitempty"`
	Method  string      `json:"method,omitempty"`
	Params  interface{} `json:"params,omitempty"`
	Result  interface{} `json:"result,omitempty"`
	Error   *struct {
		Code    int    `json:"code"`
		Message string `json:"message"`
	} `json:"error,omitempty"`
}

type Label

type Label struct {
	meui.BaseWidget
	*theme.LabelTheme
	Text      string
	Secondary bool
	HAlign    string // "left", "center", "right"
	VAlign    string // "top", "middle", "bottom"
	WrapMode  string // "noWrap", "wordWrap", "ellipsis"
	// MaxLines clamps a wrapped label to N lines and ellipsizes the last one — the
	// web's `-webkit-line-clamp`. Zero means "as many as it takes".
	MaxLines int

	RichText      bool
	OnLinkClicked func(string)
	// contains filtered or unexported fields
}

func NewLabel

func NewLabel() *Label

func (*Label) AccessibilityNode added in v0.5.8

func (l *Label) AccessibilityNode() platform.AccessibilityNode

func (*Label) CursorAt

func (l *Label) CursorAt(x, y float32) *platform.Cursor

func (*Label) EffectiveTextInk

func (l *Label) EffectiveTextInk() graphics.Color

EffectiveTextInk resolves the label's ink for the current theme: the token when one is set (live), otherwise the per-label colour.

func (*Label) OnMouseDown

func (l *Label) OnMouseDown(x, y float32, button int) bool

func (*Label) Paint

func (l *Label) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*Label) PreferredDimensions

func (l *Label) PreferredDimensions(target interface{}, w, h float32) (float32, float32)

func (*Label) SetBoundProperty

func (l *Label) SetBoundProperty(propName string, value interface{})

func (*Label) SetColor

func (l *Label) SetColor(color graphics.Color) *Label

func (*Label) SetColorToken

func (l *Label) SetColorToken(name string) *Label

SetColorToken pins the label to a theme role (e.g. "secondary") so runtime theme switches recolour it. It wins over SetColor until cleared.

func (*Label) SetFont

func (l *Label) SetFont(font graphics.Font) *Label

SetFont sets a custom font for this label (copy-on-write).

func (*Label) SetFontBold

func (l *Label) SetFontBold(bold bool) *Label

SetFontBold renders the label text in a bold face.

func (*Label) SetFontItalic

func (l *Label) SetFontItalic(italic bool) *Label

SetFontItalic renders the label text in an italic face.

func (*Label) SetFontSize

func (l *Label) SetFontSize(size float32) *Label

SetFontSize sets the label's font size, deriving from the current font.

func (*Label) SetHAlign

func (l *Label) SetHAlign(align string) *Label

func (*Label) SetLineHeight

func (l *Label) SetLineHeight(mul float32) *Label

SetLineHeight scales the label's line height (1.55 is a web body, 1.15 a heading). Zero restores the font's own.

func (*Label) SetMaxLines

func (l *Label) SetMaxLines(n int) *Label

SetMaxLines clamps a wrapped label to n lines, ellipsizing the last.

func (*Label) SetOnLinkClicked

func (l *Label) SetOnLinkClicked(fn func(string)) *Label

func (*Label) SetRichText

func (l *Label) SetRichText(rich bool) *Label

func (*Label) SetSecondary

func (l *Label) SetSecondary(secondary bool) *Label

func (*Label) SetText

func (l *Label) SetText(text string) *Label

func (*Label) SetVAlign

func (l *Label) SetVAlign(align string) *Label

func (*Label) SetWrapMode

func (l *Label) SetWrapMode(mode string) *Label

type ListItem

type ListItem struct {
	meui.BaseWidget
	*theme.LabelTheme

	// OnClicked fires when the row is tapped.
	OnClicked func()
	// contains filtered or unexported fields
}

ListItem is one row of a list: an optional leading icon, one to three lines of text, and an optional trailing icon or control. It is the workhorse the plan names — a `DataTable` becomes a list of these on a phone, and a `ListView` row should be one.

The text is drawn by the toolkit's own `Label`, so truncation, measurement and font derivation are the one implementation rather than a second one written for rows (AGENTS.md). The row itself owns only the geometry and the interaction: what a tap MEANS is the app's, reported through OnClicked.

func NewListItem

func NewListItem() *ListItem

NewListItem builds an empty one-line row.

func (*ListItem) HoverAt

func (l *ListItem) HoverAt(x, y float32)

HoverAt implements HoverTarget, so the row is told when the pointer leaves it.

func (*ListItem) IconRect

func (l *ListItem) IconRect(slot graphics.Rect) graphics.Rect

IconRect is an icon's square inside a slot, vertically centred.

func (*ListItem) LeadingRect

func (l *ListItem) LeadingRect(bounds graphics.Rect) graphics.Rect

LeadingRect is the leading slot's rect.

func (*ListItem) OnMouseDown

func (l *ListItem) OnMouseDown(x, y float32, button int) bool

func (*ListItem) OnMouseMove

func (l *ListItem) OnMouseMove(x, y float32)

func (*ListItem) OnMouseUp

func (l *ListItem) OnMouseUp(x, y float32, button int) bool

func (*ListItem) Paint

func (l *ListItem) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*ListItem) PreferredDimensions

func (l *ListItem) PreferredDimensions(target interface{}, w, h float32) (float32, float32)

func (*ListItem) RowHeight

func (l *ListItem) RowHeight() float32

RowHeight is the row's height: the theme's row metric, plus a line's worth for each extra line, and never under the touch floor.

func (*ListItem) Selected

func (l *ListItem) Selected() bool

func (*ListItem) SetBoundProperty

func (l *ListItem) SetBoundProperty(name string, value interface{})

SetBoundProperty implements the QML binding hook.

func (*ListItem) SetDivider

func (l *ListItem) SetDivider(on bool) *ListItem

SetDivider draws a hairline on the row's bottom edge. It is opt-in: a list of three rows reads better without them, and a table of thirty reads better with.

func (*ListItem) SetLeading

func (l *ListItem) SetLeading(icon string) *ListItem

SetLeading sets the leading icon's SVG name; an empty name draws no icon.

func (*ListItem) SetPrimary

func (l *ListItem) SetPrimary(text string) *ListItem

func (*ListItem) SetSecondary

func (l *ListItem) SetSecondary(text string) *ListItem

func (*ListItem) SetSelected

func (l *ListItem) SetSelected(on bool) *ListItem

func (*ListItem) SetTrailing

func (l *ListItem) SetTrailing(icon string) *ListItem

func (*ListItem) SetTrailingWidget

func (l *ListItem) SetTrailingWidget(w meui.Widget) *ListItem

SetTrailingWidget installs a control at the trailing edge — a switch, a checkbox, a button. It wins over the trailing icon.

func (*ListItem) SetVariant

func (l *ListItem) SetVariant(v ListItemVariant) *ListItem

func (*ListItem) TextRect

func (l *ListItem) TextRect(bounds graphics.Rect) graphics.Rect

TextRect is what is left for the text, between the two slots.

func (*ListItem) TrailingRect

func (l *ListItem) TrailingRect(bounds graphics.Rect) (graphics.Rect, bool)

TrailingRect is the trailing slot's rect, pinned to the right edge.

func (*ListItem) Variant

func (l *ListItem) Variant() ListItemVariant

type ListItemVariant

type ListItemVariant uint8

ListItemVariant selects a row's height by how many lines it carries. M3 publishes the three heights, and they are what makes a list scannable: a two-line row that is the same height as a one-line row makes the eye re-read every line.

const (
	// ListItemOneLine is the default: a single line of primary text.
	ListItemOneLine ListItemVariant = iota
	// ListItemTwoLine adds a secondary line.
	ListItemTwoLine
	// ListItemThreeLine is the tallest: a secondary line that may wrap.
	ListItemThreeLine
)

type ListView

type ListView struct {
	meui.BaseWidget
	*theme.ListViewTheme
	Items         []string
	ItemHeight    float32
	SelectedIndex int
	ScrollOffset  float32

	CheckableItems   bool
	ItemChecked      map[int]bool
	OnItemSelected   func(int, string)
	OnItemsReordered func([]string)

	HoveredIndex int

	MultiSelect     bool
	AlternatingRows bool
	// HideBorder drops the widget's own outline (e.g. a ListView embedded
	// in a ScrollPane: its edge line next to the pane's scrollbar lane
	// read as a second, extra-wide lane).
	HideBorder bool

	OnCheckChanged func(int, string, bool)

	VScroll *ScrollBar
	// contains filtered or unexported fields
}

func NewListView

func NewListView() *ListView

func (*ListView) AccessibilityNode added in v0.5.30

func (l *ListView) AccessibilityNode() platform.AccessibilityNode

func (*ListView) AccessibilityVirtualChildren added in v0.5.30

func (l *ListView) AccessibilityVirtualChildren() []meui.AccessibilityVirtualChild

AccessibilityVirtualChildren exposes visible rows. Publishing only the visible range keeps the tree bounded for long lists; scrolling changes the range on the next publish.

func (*ListView) AddItem

func (l *ListView) AddItem(item string) *ListView

func (*ListView) ClearItems

func (l *ListView) ClearItems() *ListView

ClearItems removes all items and selections (like QListWidget.clear).

func (*ListView) ClearSelection

func (l *ListView) ClearSelection() *ListView

func (*ListView) Focusable

func (l *ListView) Focusable() bool

func (*ListView) GetItem

func (l *ListView) GetItem(index int) string

GetItem returns the item at index, or "".

func (*ListView) GetSelectedIndices

func (l *ListView) GetSelectedIndices() []int

func (*ListView) GetSelectedItem

func (l *ListView) GetSelectedItem() string

GetSelectedItem returns the first selected item text, or "".

func (*ListView) ItemCount

func (l *ListView) ItemCount() int

ItemCount returns the number of items.

func (*ListView) MinimumDimensions

func (l *ListView) MinimumDimensions() (float32, float32)

func (*ListView) OnDragDrop

func (l *ListView) OnDragDrop(data *meui.DragData, x, y float32)

func (*ListView) OnDragEnter

func (l *ListView) OnDragEnter(data *meui.DragData, x, y float32)

func (*ListView) OnDragLeave

func (l *ListView) OnDragLeave(data *meui.DragData)

func (*ListView) OnDragOver

func (l *ListView) OnDragOver(data *meui.DragData, x, y float32)

func (*ListView) OnDragStart

func (l *ListView) OnDragStart(x, y float32) *meui.DragData

func (*ListView) OnKeyDown

func (l *ListView) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool

func (*ListView) OnKeyRepeat

func (l *ListView) OnKeyRepeat(keyCode platform.KeyCode, mod platform.Modifiers) bool

OnKeyRepeat is a key the user is HOLDING — Backspace over a word, an arrow along a row, a scrub. The window classifies an OS auto-repeat as a repeat rather than a fresh press (a widget without this method is asked once, deliberately), so this is what makes a held key work here.

func (*ListView) OnMouseDown

func (l *ListView) OnMouseDown(x, y float32, button int) bool

func (*ListView) OnMouseMove

func (l *ListView) OnMouseMove(x, y float32)

func (*ListView) OnMouseUp

func (l *ListView) OnMouseUp(x, y float32, button int) bool

func (*ListView) OnMouseWheel

func (l *ListView) OnMouseWheel(x, y float32, dx, dy float32) bool

func (*ListView) Paint

func (l *ListView) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*ListView) PerformAccessibilityAction added in v0.5.37

func (l *ListView) PerformAccessibilityAction(action platform.AccessibilityAction) bool

func (*ListView) PreferredDimensions

func (l *ListView) PreferredDimensions(target interface{}, w, h float32) (float32, float32)

func (*ListView) RemoveItem

func (l *ListView) RemoveItem(index int) *ListView

RemoveItem removes the item at index, fixing up selections (like QListWidget.takeItem).

func (*ListView) RestoreState added in v0.5.34

func (l *ListView) RestoreState(v any) bool

func (*ListView) SaveState added in v0.5.34

func (l *ListView) SaveState() any

func (*ListView) ScrollToIndex

func (l *ListView) ScrollToIndex(index int)

ScrollToIndex scrolls the list so the item is visible.

func (*ListView) SetAlternatingRows

func (l *ListView) SetAlternatingRows(enabled bool) *ListView

func (*ListView) SetBoundProperty

func (l *ListView) SetBoundProperty(propName string, value interface{})

func (*ListView) SetItemChecked

func (l *ListView) SetItemChecked(index int, checked bool) *ListView

func (*ListView) SetItems

func (l *ListView) SetItems(items []string) *ListView

func (*ListView) SetOnCheckChanged

func (l *ListView) SetOnCheckChanged(handler func(int, string, bool)) *ListView

func (*ListView) SetOnItemSelected

func (l *ListView) SetOnItemSelected(handler func(int, string)) *ListView

func (*ListView) SetOnItemsReordered

func (l *ListView) SetOnItemsReordered(handler func([]string)) *ListView

func (*ListView) SetSelectedIndex

func (l *ListView) SetSelectedIndex(index int) *ListView

type Location

type Location struct {
	URI       string
	Line      int
	Character int
}

type MarkdownEditor

type MarkdownEditor struct {
	meui.BaseContainer

	// OnTextChanged fires after the source pane edits the document.
	OnTextChanged func(text string)
	// contains filtered or unexported fields
}

MarkdownEditor is the two-pane markdown editor: a CodeEditor source pane and a MarkdownView preview pane over the same document.

The two clipboards fall out of the composition: copying in the source pane copies its own text, which *is* the markdown source, while copying in the preview uses the browser-grade selection in markdown_selection.go and yields plain text. Both panes are exposed (Source/Preview) so an app can configure them; the splitter is the toolkit's SplitView, so the panes can be resized and the ratio is remembered across mode switches.

func NewMarkdownEditor

func NewMarkdownEditor() *MarkdownEditor

NewMarkdownEditor builds the editor with both panes over an empty document.

func (*MarkdownEditor) Focusable

func (m *MarkdownEditor) Focusable() bool

Focusable reports that the editor can take keyboard focus: the source pane handles the keys when it has focus.

func (*MarkdownEditor) IsReadOnly

func (m *MarkdownEditor) IsReadOnly() bool

IsReadOnly reports the source pane's read-only state.

func (*MarkdownEditor) Mode

Mode returns the current mode.

func (*MarkdownEditor) Paint

func (m *MarkdownEditor) Paint(canvas *graphics.Canvas, rect graphics.Rect)

Paint draws the splitter (which paints both panes).

func (*MarkdownEditor) PanelAt

func (m *MarkdownEditor) PanelAt(x, y float32) meui.Widget

PanelAt continues the hit test into the splitter and its panes.

It must be explicit: BaseContainer provides DefaultPanelAt but not PanelAt, so a container that does not override it inherits BaseWidget.PanelAt, which returns the widget itself. That would swallow every press in the editor (no caret in the source pane, no selection in the preview) and, because the editor implements no FocusHandler, keyboard focus would never reach the panes either.

func (*MarkdownEditor) Preview

func (m *MarkdownEditor) Preview() *MarkdownView

Preview returns the rendered pane.

func (*MarkdownEditor) SetBoundProperty

func (m *MarkdownEditor) SetBoundProperty(propName string, value interface{})

SetBoundProperty applies the QML-bound properties registered for this widget (see qml/loader.go): text, readOnly, mode and splitRatio.

func (*MarkdownEditor) SetFrameRect

func (m *MarkdownEditor) SetFrameRect(rect graphics.Rect)

SetFrameRect forwards to the splitter so the panes follow the editor.

func (*MarkdownEditor) SetMode

SetMode selects split, source-only or preview-only.

func (*MarkdownEditor) SetReadOnly

func (m *MarkdownEditor) SetReadOnly(readOnly bool) *MarkdownEditor

SetReadOnly makes both panes read-only; selection and copy keep working in both (the preview is always read-only).

func (*MarkdownEditor) SetSplitRatio

func (m *MarkdownEditor) SetSplitRatio(ratio float32) *MarkdownEditor

SetSplitRatio positions the splitter (0 = preview only, 1 = source only).

func (*MarkdownEditor) SetText

func (m *MarkdownEditor) SetText(text string) *MarkdownEditor

SetText sets the document in both panes without firing OnTextChanged.

func (*MarkdownEditor) Source

func (m *MarkdownEditor) Source() *CodeEditor

Source returns the editor pane.

func (*MarkdownEditor) Split

func (m *MarkdownEditor) Split() *SplitView

Split returns the splitter hosting the two panes.

func (*MarkdownEditor) SplitRatio

func (m *MarkdownEditor) SplitRatio() float32

SplitRatio returns the remembered splitter position.

func (*MarkdownEditor) Text

func (m *MarkdownEditor) Text() string

Text returns the markdown source.

func (*MarkdownEditor) ValidateLayout

func (m *MarkdownEditor) ValidateLayout()

type MarkdownEditorMode

type MarkdownEditorMode int

MarkdownEditorMode selects which pane(s) the editor shows.

const (
	// MarkdownSplit shows the source and the preview side by side.
	MarkdownSplit MarkdownEditorMode = iota
	// MarkdownSourceOnly shows only the editor pane.
	MarkdownSourceOnly
	// MarkdownPreviewOnly shows only the rendered pane.
	MarkdownPreviewOnly
)

type MarkdownView

type MarkdownView struct {
	meui.BaseContainer

	// MarkdownTheme is every colour, metric and font the renderer uses. It is a pointer
	// to the global by default, so importing a theme restyles documents the way it
	// restyles everything else; a view that wants a private palette copies it.
	*theme.MarkdownTheme

	// OnTaskToggled fires after a task checkbox is clicked and the source
	// rewritten: index is the occurrence order of task checkboxes in the
	// document, checked is the new state. Text() returns the updated source.
	OnTaskToggled func(index int, checked bool)

	// OnDisclosureToggled fires when an embedded widget's disclosure is expanded or
	// collapsed, with the block index and the new state. It is how an app learns that
	// the user opened a step, without the view having to know what an app is.
	OnDisclosureToggled func(index int, collapsed bool)
	// OnLinkClicked is called when a link is clicked (a press that did not
	// become a drag, or a Ctrl/Cmd-click). When nil the URL is opened with
	// meui.OpenURL.
	OnLinkClicked func(url string)
	// contains filtered or unexported fields
}

func NewMarkdownView

func NewMarkdownView() *MarkdownView

func (*MarkdownView) Append

func (mv *MarkdownView) Append(text string) *MarkdownView

Append adds to the document, which is what a streaming answer needs.

WHY IT IS NOT SetText. Measured, not assumed: SetText costs 25ms on a 6250-character document and grows LINEARLY with it — 0.4ms at 125 chars, 4.5ms at 1250, 25ms at 6250 — and a frame is 16ms. Streaming by calling SetText per token is therefore slower than the stream. Of that 25ms, goldmark's whole-document parse is only 2.2ms; the other 23ms is this file's own walk. So the parse stays whole (it is the cheap part) and the WALK is resumed from the first block the append could have touched.

Append does not parse immediately. It buffers, and the parse happens once per frame at paint time, so twenty tokens in one frame cost one walk.

func (*MarkdownView) CaretOffset

func (mv *MarkdownView) CaretOffset() int

CaretOffset returns the moving end of the selection (the caret), or -1.

func (*MarkdownView) CaretRect

func (mv *MarkdownView) CaretRect(off int) graphics.Rect

CaretRect returns the caret rectangle for a source offset, in widget-local coordinates. It returns a zero rect when the offset cannot be placed.

func (*MarkdownView) ClearSelection

func (mv *MarkdownView) ClearSelection()

ClearSelection drops the selection (there is then no caret).

func (*MarkdownView) CollapseTo

func (mv *MarkdownView) CollapseTo(off int)

CollapseTo places the caret at off with no selection.

func (*MarkdownView) Copy

func (mv *MarkdownView) Copy()

Copy puts the selected plain text on the clipboard.

func (*MarkdownView) CopyMarkdown

func (mv *MarkdownView) CopyMarkdown()

CopyMarkdown puts the selected markdown source on the clipboard.

func (*MarkdownView) CursorAt

func (mv *MarkdownView) CursorAt(x, y float32) *platform.Cursor

CursorAt returns a text cursor over text and a pointing cursor over links.

func (*MarkdownView) Focusable

func (mv *MarkdownView) Focusable() bool

Focusable reports that the view can take keyboard focus.

func (*MarkdownView) HasSelection

func (mv *MarkdownView) HasSelection() bool

HasSelection reports whether a non-empty range is selected.

func (*MarkdownView) OnBlur

func (mv *MarkdownView) OnBlur()

func (*MarkdownView) OnFocus

func (mv *MarkdownView) OnFocus()

func (*MarkdownView) OnKeyDown

func (mv *MarkdownView) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool

func (*MarkdownView) OnKeyRepeat

func (mv *MarkdownView) OnKeyRepeat(keyCode platform.KeyCode, mod platform.Modifiers) bool

OnKeyRepeat is a key the user is HOLDING — Backspace over a word, an arrow along a row, a scrub. The window classifies an OS auto-repeat as a repeat rather than a fresh press (a widget without this method is asked once, deliberately), so this is what makes a held key work here.

func (*MarkdownView) OnMouseDown

func (mv *MarkdownView) OnMouseDown(x, y float32, button int) bool

func (*MarkdownView) OnMouseMove

func (mv *MarkdownView) OnMouseMove(x, y float32)

func (*MarkdownView) OnMouseUp

func (mv *MarkdownView) OnMouseUp(x, y float32, button int) bool

func (*MarkdownView) OnMouseWheel

func (mv *MarkdownView) OnMouseWheel(x, y float32, dx, dy float32) bool

func (*MarkdownView) Paint

func (mv *MarkdownView) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*MarkdownView) ScrollBy

func (mv *MarkdownView) ScrollBy(delta float32)

func (*MarkdownView) ScrollToBottom

func (mv *MarkdownView) ScrollToBottom()

ScrollToBottom puts the viewport at the end of the document, which is what a streaming view wants after new text arrives.

func (*MarkdownView) SelectAll

func (mv *MarkdownView) SelectAll()

SelectAll selects the whole document.

func (*MarkdownView) SelectBlockAt

func (mv *MarkdownView) SelectBlockAt(off int)

SelectBlockAt selects the whole block containing off.

func (*MarkdownView) SelectTo

func (mv *MarkdownView) SelectTo(off int)

SelectTo extends the selection to off, keeping the anchor where it is (this is what shift-click and shift-arrow do). An atomic object (an image, a task glyph) is selected whole: a focus inside one snaps to the edge the selection is coming from.

func (*MarkdownView) SelectWordAt

func (mv *MarkdownView) SelectWordAt(off int)

SelectWordAt selects the word (or whitespace or punctuation run) at off.

func (*MarkdownView) SelectedMarkdown

func (mv *MarkdownView) SelectedMarkdown() string

SelectedMarkdown returns the exact markdown source of the selection.

func (*MarkdownView) SelectedText

func (mv *MarkdownView) SelectedText() string

SelectedText returns the selected text as plain text: the rendered characters of the range, one line per visual line and one tab between table cells. This is what a browser puts on the clipboard for a text selection.

func (*MarkdownView) SelectionBounds

func (mv *MarkdownView) SelectionBounds() (int, int)

SelectionBounds returns the ordered source range of the selection. When nothing is selected both values are 0.

func (*MarkdownView) SelectionRects

func (mv *MarkdownView) SelectionRects(a, b int) []graphics.Rect

SelectionRects returns the highlight rectangles covering the source range [a, b) in widget-local coordinates.

func (*MarkdownView) SetBoundProperty

func (mv *MarkdownView) SetBoundProperty(propName string, value interface{})

func (*MarkdownView) SetChildren

func (mv *MarkdownView) SetChildren(index int, children []block) bool

SetChildren attaches child blocks to a visible block, so a collapsible region can hold MARKDOWN rather than only a widget. It is the general form of what a fence builds, and it is how an app assembles a region without inventing syntax for it.

The children are the caller's blocks; nothing here is parsed. It returns false for an index that is not a disclosure, because silently attaching to a paragraph would produce a document nobody can explain.

func (*MarkdownView) SetDarkPalette

func (mv *MarkdownView) SetDarkPalette() *MarkdownView

SetDarkPalette selects the dark renderer palette.

func (*MarkdownView) SetFilePath

func (mv *MarkdownView) SetFilePath(path string)

func (*MarkdownView) SetLightPalette

func (mv *MarkdownView) SetLightPalette() *MarkdownView

SetLightPalette selects the light renderer palette — the harness's document pane, read off the reference rather than invented. It copies, so a view that lightens itself leaves the global alone.

func (*MarkdownView) SetMarkdownTheme

func (mv *MarkdownView) SetMarkdownTheme(mt *theme.MarkdownTheme) *MarkdownView

SetMarkdownTheme gives the view a private palette, copied so a change here cannot reach the global. It is how a document is rendered light inside a dark app, which is what the harness's document pane is: a light surface, whatever the app around it does.

func (*MarkdownView) SetSelection

func (mv *MarkdownView) SetSelection(anchor, focus int)

SetSelection sets the selection to [anchor, focus] and redraws.

func (*MarkdownView) SetStreaming

func (mv *MarkdownView) SetStreaming(on bool) *MarkdownView

SetStreaming turns on tail-following: the viewport sticks to the bottom as the document grows, which is what a chat pane does and what a document view does not. It is off by default, so an ordinary document does not scroll itself while a reader is halfway down it.

func (*MarkdownView) SetText

func (mv *MarkdownView) SetText(text string)

func (*MarkdownView) SourceOffsetAt

func (mv *MarkdownView) SourceOffsetAt(localX, localY float32) int

SourceOffsetAt returns the markdown source offset nearest to a widget-local point. It returns -1 when the layout has no text at all.

func (*MarkdownView) Streaming

func (mv *MarkdownView) Streaming() bool

Streaming reports whether the view is following a tail.

func (*MarkdownView) Text

func (mv *MarkdownView) Text() string

func (*MarkdownView) ToggleDisclosure

func (mv *MarkdownView) ToggleDisclosure(index int) bool

ToggleDisclosure expands or collapses an embedded widget's disclosure and re-lays the document out. The block is ATOMIC for selection, so nothing about the selection state has to be preserved — which is a large part of why a widget is a good embed and free text is not.

type MarkdownWidget

type MarkdownWidget interface {
	// Height is the height the widget wants, given the width it will be given. It must be
	// cheap and must not paint: it is asked during layout, once per frame at most, for
	// every expanded widget in the document.
	Height(ctx *WidgetContext) float32
	// Paint draws into rect, whose height is exactly what Height returned. Painting
	// outside it is clipped away, so a widget that overruns its own height does not
	// silently overlap the next block.
	Paint(canvas *graphics.Canvas, rect graphics.Rect, ctx *WidgetContext)
}

MarkdownWidget is the contract an EMBEDDED widget implements: something a fence can stand for, drawn inside the document in the place the author wrote it.

## Why the embed is a fence

A fenced code block whose info string names a registered widget and carries its parameters:

```tool-call {"id":"read","timeout":45}

github.com/sixnineone/meui/widgets/markdown.go
```

renders that widget instead of preformatted text. The reason is LOSSLESSNESS: goldmark already parses a fence, the block already has a source span, and a fence already round-trips through copy as ordinary Markdown. So select-all-then-copy-all stays valid Markdown, and a document read by any other renderer shows the embed as a code block rather than as nothing. A `:::` directive would need a goldmark extension and a representation in the copied source, and would be unreadable everywhere else.

## The contract is deliberately two methods

Height is asked FIRST and the rect handed to Paint is exactly that height, so a widget never derives geometry by painting. The alternative — measuring by painting into a throwaway canvas — is how a widget ends up painting twice per frame, and it is not optional here: an embedded widget lives inside a DISCLOSURE, and a collapsed one must cost its header and nothing else (the same property TestACollapsedTranscriptRowCostsNoPixels asserts for a Collapsible). A widget that paints during layout fails that test, which is the point.

Input and hit-testing are a later phase. A widget that needs a click registers for it then; nothing in v1 requires it, and requiring it up front would put a hit-test method on every widget to serve a minority of them.

type MdiContainer

type MdiContainer struct {
	meui.BaseContainer

	ShowTaskbar bool
	MdiTheme    *theme.MdiTheme

	// Dock zones — each edge has a StackPanel (nil when empty) + size
	LeftStack   *StackPanel
	RightStack  *StackPanel
	TopStack    *StackPanel
	BottomStack *StackPanel
	LeftSize    float32
	RightSize   float32
	TopSize     float32
	BottomSize  float32

	// Collapsed state for each dock edge
	LeftCollapsed   bool
	RightCollapsed  bool
	TopCollapsed    bool
	BottomCollapsed bool

	// Auto-hide state: when true, dock auto-hides to a thin edge tab (VS Code style)
	LeftAutoHide   bool
	RightAutoHide  bool
	TopAutoHide    bool
	BottomAutoHide bool

	// When true, left/right docks span the full height (top/bottom don't reduce their height).
	// When false (default), top/bottom span full width (left/right don't reduce their width).
	DocksFullHeight bool

	// Center area rect (computed by layoutDockZones), for maximizing windows
	CenterRect graphics.Rect

	// Drop zone state during drag
	DropHighlight *DropZoneInfo // currently highlighted drop zone (nil = none)

	// Taskbar notification area
	Notifications []NotificationItem
	// contains filtered or unexported fields
}

MdiContainer is a container that holds MdiWindows as free-floating or docked children. It manages dock zones (left, right, top, bottom), floating windows (center), a taskbar, and drag-to-dock behavior.

func NewMdiContainer

func NewMdiContainer() *MdiContainer

func (*MdiContainer) AcceptDrop

func (mc *MdiContainer) AcceptDrop(mw *MdiWindow, info *DropZoneInfo)

AcceptDrop finalizes the drop. Calls release() to detach from the original parent, then reparents the window according to info.

func (*MdiContainer) AddChild

func (mc *MdiContainer) AddChild(child meui.Widget)

AddChild overrides BaseContainer.AddChild to set parent to the outer MdiContainer.

func (*MdiContainer) BringToFront

func (mc *MdiContainer) BringToFront(w meui.Widget)

func (*MdiContainer) Cascade

func (mc *MdiContainer) Cascade()

Cascade arranges all visible MdiWindows in a cascading diagonal pattern.

func (*MdiContainer) ClearDropHighlight

func (mc *MdiContainer) ClearDropHighlight()

ClearDropHighlight clears the visual highlight on the current drop zone.

func (*MdiContainer) DropHitTest

func (mc *MdiContainer) DropHitTest(x, y float32) *DropZoneInfo

DropHitTest returns the drop zone at (x,y) in MdiContainer-local coords, or nil if the window should stay floating. Called during drag to determine where the dragged window will land.

func (*MdiContainer) OnKeyDown

func (mc *MdiContainer) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool

OnKeyDown handles keyboard shortcut: Ctrl+Shift+D toggles left dock collapse.

func (*MdiContainer) OnMouseDown

func (mc *MdiContainer) OnMouseDown(x, y float32, button int) bool

func (*MdiContainer) OnMouseMove

func (mc *MdiContainer) OnMouseMove(x, y float32)

func (*MdiContainer) OnMouseUp

func (mc *MdiContainer) OnMouseUp(x, y float32, button int) bool

func (*MdiContainer) Paint

func (mc *MdiContainer) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*MdiContainer) PanelAt

func (mc *MdiContainer) PanelAt(x, y float32) meui.Widget

PanelAt returns the topmost MdiWindow that contains the point, or the container itself if no window is hit.

func (*MdiContainer) SetDocksFullHeight

func (mc *MdiContainer) SetDocksFullHeight(v bool)

SetDocksFullHeight changes the dock layout mode and triggers a layout update.

func (*MdiContainer) Tile

func (mc *MdiContainer) Tile()

func (*MdiContainer) ValidateLayout

func (mc *MdiContainer) ValidateLayout()

ValidateLayout lays out dock zones and updates maximized windows.

type MdiWindow

type MdiWindow struct {
	meui.BaseContainer
	Title       string
	Content     meui.Widget
	Closable    bool
	Minimizable bool
	Maximizable bool
	Minimized   bool
	Maximized   bool
	Resizable   bool
	PrevRect    graphics.Rect

	DockPos   DockPosition
	DockIndex int
	DockSize  float32

	MdiTheme *theme.MdiTheme

	// Icon
	Icon string
	// contains filtered or unexported fields
}

MdiWindow is a moveable, resizable child window with a title bar.

func NewMdiWindow

func NewMdiWindow() *MdiWindow

func (*MdiWindow) AddChild

func (mw *MdiWindow) AddChild(child meui.Widget)

func (*MdiWindow) AddTitleBarButton

func (mw *MdiWindow) AddTitleBarButton(btn TitleBarButton)

AddTitleBarButton adds a custom button to the right side of the title bar (before minimize).

func (*MdiWindow) Close

func (mw *MdiWindow) Close()

func (*MdiWindow) CursorAt

func (mw *MdiWindow) CursorAt(x, y float32) *platform.Cursor

CursorAt returns the appropriate resize cursor based on the edge under (x,y).

func (*MdiWindow) Maximize

func (mw *MdiWindow) Maximize()

func (*MdiWindow) Minimize

func (mw *MdiWindow) Minimize()

func (*MdiWindow) OnMouseDown

func (mw *MdiWindow) OnMouseDown(x, y float32, button int) bool

func (*MdiWindow) OnMouseMove

func (mw *MdiWindow) OnMouseMove(x, y float32)

func (*MdiWindow) OnMouseUp

func (mw *MdiWindow) OnMouseUp(x, y float32, button int) bool

func (*MdiWindow) Paint

func (mw *MdiWindow) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*MdiWindow) PanelAt

func (mw *MdiWindow) PanelAt(x, y float32) meui.Widget

PanelAt returns the MdiWindow itself for title bar clicks (for drag support) or resize edge clicks, otherwise delegates to the default child hit-testing.

func (*MdiWindow) RemoveTitleBarButtons

func (mw *MdiWindow) RemoveTitleBarButtons()

RemoveTitleBarButtons removes all custom title bar buttons.

func (*MdiWindow) Restore

func (mw *MdiWindow) Restore()

func (*MdiWindow) SetBoundProperty

func (mw *MdiWindow) SetBoundProperty(propName string, value interface{})

func (*MdiWindow) SetContent

func (mw *MdiWindow) SetContent(content meui.Widget) *MdiWindow

func (*MdiWindow) SetFrameRect

func (mw *MdiWindow) SetFrameRect(rect graphics.Rect)

SetFrameRect triggers layout so content is positioned.

func (*MdiWindow) SetIcon

func (mw *MdiWindow) SetIcon(icon string) *MdiWindow

func (*MdiWindow) SetOnClose

func (mw *MdiWindow) SetOnClose(handler func()) *MdiWindow

func (*MdiWindow) SetTitle

func (mw *MdiWindow) SetTitle(title string) *MdiWindow

func (*MdiWindow) ValidateLayout

func (mw *MdiWindow) ValidateLayout()
type Menu struct {
	Title string
	Items []MenuItem // unified MenuItem type (from contextmenu.go)
	// contains filtered or unexported fields
}
type MenuBar struct {
	meui.BaseWidget
	*theme.MenuBarTheme

	OnMenuSelected func(int, *Menu)
	// contains filtered or unexported fields
}

func NewMenuBar

func NewMenuBar() *MenuBar
func (m *MenuBar) AddMenu(title string, items []MenuItem) *MenuBar
func (m *MenuBar) CloseMenu()
func (m *MenuBar) IsMenuStrip() bool

IsMenuStrip marks the bar for MenuStripHost: while a popup is open the modal backdrop forwards pointer moves here for hover-switching.

func (m *MenuBar) MenuCount() int
func (m *MenuBar) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool
func (m *MenuBar) OnMouseDown(x, y float32, button int) bool
func (m *MenuBar) OnMouseMove(x, y float32)
func (m *MenuBar) OnMouseUp(x, y float32, button int) bool
func (m *MenuBar) Paint(canvas *graphics.Canvas, rect graphics.Rect)
func (m *MenuBar) SetBoundProperty(propName string, value interface{})
func (m *MenuBar) SetMenuItemAction(menuTitle, itemLabel string, action func()) bool

SetMenuItemAction finds a menu item by menu title and item label, and sets its Action.

func (m *MenuBar) SetMenuItemChecked(menuTitle, itemLabel string, checked bool) bool

SetMenuItemChecked finds a menu item by menu title and item label, and sets its Checked state. Returns false if the menu/item is not found.

func (m *MenuBar) SetMenus(menus []Menu) *MenuBar
type MenuItem struct {
	Label       string
	Shortcut    string
	Icon        string  // SVG icon name or emoji
	Height      float32 // custom item height (0 = auto)
	Action      func()
	IsSep       bool
	IsCheck     bool
	Checked     bool
	Enabled     bool
	SubMenu     []MenuItem
	CustomPanel *meui.Panel // custom widget (replaces label/shortcut rendering)
	// contains filtered or unexported fields
}

type ModalPopupPanel

type ModalPopupPanel struct {
	meui.BaseContainer
	Title   string
	Heading string // larger heading text shown below title bar
	Content *meui.Panel

	Modal *meui.ModalPopup // set by ShowModal caller

	PopupTheme      *theme.PopupTheme
	Draggable       bool // enable title bar drag
	DismissOnEscape bool // press Escape to dismiss
	// contains filtered or unexported fields
}

ModalPopupPanel is a reusable modal popup widget with title bar, content area, and button row. Use with Window.ShowModal().

func NewDialog

func NewDialog() *ModalPopupPanel

NewDialog creates a draggable popup. Used by QML/flow wrappers.

func NewInputDialog

func NewInputDialog(title, label string) *ModalPopupPanel

NewInputDialog creates an input dialog. Used by QML registry.

func NewMessageBox

func NewMessageBox(title, message string, buttons []string) *ModalPopupPanel

NewMessageBox creates a message box. Used by QML registry.

func NewModalPopupPanel

func NewModalPopupPanel(title, heading string, content *meui.Panel, buttons ...*Button) *ModalPopupPanel

NewModalPopupPanel creates a new modal popup panel. title: window title bar text heading: main body heading text content: optional widget for the body area (can be nil) buttons: buttons to show in the bottom button row

func ShowInputDialog

func ShowInputDialog(win *meui.Window, title, label string, onDone func(string, bool)) *ModalPopupPanel

ShowInputDialog shows a dialog with a label and text field for user input. onDone receives (text, accepted) where accepted is true if OK was pressed.

func ShowMessageBox

func ShowMessageBox(win *meui.Window, title, message string, buttons []string, onDone func(int)) *ModalPopupPanel

ShowMessageBox shows a simple message dialog with text and buttons. onDone receives the button index (0-based) when the user clicks.

func (*ModalPopupPanel) Children

func (p *ModalPopupPanel) Children() []meui.Widget

Children exposes the dialog's content and its button row. A dialog's widgets are NOT in the window's child tree — the window hosts the panel as a layer — so without this the focus traversal (Tab) could never see anything inside a dialog.

func (*ModalPopupPanel) Dismiss

func (p *ModalPopupPanel) Dismiss()

func (*ModalPopupPanel) MarkForRedraw

func (p *ModalPopupPanel) MarkForRedraw()

func (*ModalPopupPanel) OnClosed

func (p *ModalPopupPanel) OnClosed()

OnClosed is the window's "your layer is gone" notification. A dialog dismissed from outside its own buttons (Escape, the backdrop, a host that closes the top layer) still has to run the app's dismiss function, or the app keeps a popup it no longer owns.

func (*ModalPopupPanel) OnKeyDown

func (p *ModalPopupPanel) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool

func (*ModalPopupPanel) OnMouseDown

func (p *ModalPopupPanel) OnMouseDown(x, y float32, button int) bool

func (*ModalPopupPanel) OnMouseMove

func (p *ModalPopupPanel) OnMouseMove(x, y float32)

func (*ModalPopupPanel) OnMouseUp

func (p *ModalPopupPanel) OnMouseUp(x, y float32, button int) bool

func (*ModalPopupPanel) OnMouseWheel

func (p *ModalPopupPanel) OnMouseWheel(x, y float32, dx, dy float32) bool

func (*ModalPopupPanel) Paint

func (p *ModalPopupPanel) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*ModalPopupPanel) SetDismissFn

func (p *ModalPopupPanel) SetDismissFn(fn func())

func (*ModalPopupPanel) SetDismissOnEscape

func (p *ModalPopupPanel) SetDismissOnEscape(d bool) *ModalPopupPanel

func (*ModalPopupPanel) SetDraggable

func (p *ModalPopupPanel) SetDraggable(d bool) *ModalPopupPanel

func (*ModalPopupPanel) SetWindow

func (p *ModalPopupPanel) SetWindow(win *meui.Window)

type MultiLangTokenizer

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

func NewMultiLangTokenizer

func NewMultiLangTokenizer() *MultiLangTokenizer

func (*MultiLangTokenizer) GetTokenizer

func (m *MultiLangTokenizer) GetTokenizer(filename string, language string) SyntaxTokenizer

func (*MultiLangTokenizer) Register

func (m *MultiLangTokenizer) Register(name string, t SyntaxTokenizer)
type NavigationBar struct {
	meui.BaseWidget
	*theme.TabTheme

	// OnSelectionChanged fires when the selection moves. It is the whole point of the
	// control: the bar reports, the app decides what a destination means.
	OnSelectionChanged func(index int)
	// contains filtered or unexported fields
}

NavigationBar is the bottom navigation bar a phone wants: three to five destinations, icon over label, with an active indicator behind the current one.

It exists because a TOP tab bar is the wrong control on a phone — it is out of thumb reach and it is not what either platform's own guidance describes. The same destinations in a TabStrip and a NavigationBar are the same DATA; only the control differs, so an app can hold one list and choose the control by form factor.

Three to five is the platform's own range, and it is enforced softly rather than by refusing items: beyond five the items get narrow enough that their hit targets stop reaching the touch floor, and that is what the audit catches.

func NewNavigationBar

func NewNavigationBar() *NavigationBar

NewNavigationBar builds an empty bar, selected on the first destination.

func (n *NavigationBar) AddItem(item NavigationBarItem) *NavigationBar
func (n *NavigationBar) BarHeight() float32

BarHeight is the bar's own height, from the platform's own number: 64 on Android, 49 on iOS. It falls back to the tab height so a theme that has not set one still draws, and it is CLAMPED to the touch floor.

The clamp is not decoration. The fallback is a desktop tab height — 24 on the meui default — and a 24px bar on a phone is a bar whose destinations cannot be hit. The five-destination test found this by asserting the height on a theme that sets no NavBarHeight, and got 24 against a floor of 48. A control that is a tap target is at least the floor tall, whatever the preset says.

func (n *NavigationBar) Count() int
func (n *NavigationBar) HoverAt(x, y float32)

HoverAt implements HoverTarget, so the bar is told when the pointer leaves it rather than keeping the last destination lit.

func (n *NavigationBar) ItemAt(x, y float32) int

ItemAt reports which destination holds a point, or -1.

func (n *NavigationBar) ItemRect(i int) (graphics.Rect, bool)

ItemRect is a destination's rect in the bar's own coordinates.

func (n *NavigationBar) Items() []NavigationBarItem
func (n *NavigationBar) OnMouseDown(x, y float32, button int) bool
func (n *NavigationBar) OnMouseMove(x, y float32)
func (n *NavigationBar) OnMouseUp(x, y float32, button int) bool
func (n *NavigationBar) Paint(canvas *graphics.Canvas, rect graphics.Rect)
func (n *NavigationBar) PreferredDimensions(target interface{}, w, h float32) (float32, float32)

PreferredDimensions is how the LAYOUT learns the bar's height. The demo happens to give it an explicit height in markup, which is why this one worked before the app bar did — but a bar should not depend on the caller remembering.

func (n *NavigationBar) PreferredSize() (float32, float32)
func (n *NavigationBar) SelectID(id string) bool
func (n *NavigationBar) Selected() int
func (n *NavigationBar) SelectedID() string
func (n *NavigationBar) SetBoundProperty(name string, value interface{})

SetBoundProperty implements the QML binding hook, so `selected: 2` in markup works the same way it does on a TabStrip.

func (n *NavigationBar) SetItems(items []NavigationBarItem) *NavigationBar
func (n *NavigationBar) SetSelected(index int) bool

SetSelected moves the selection and reports it, so a programmatic move behaves like a tap. It refuses a disabled destination.

type NavigationBarItem struct {
	// ID is an optional caller-defined key, reported alongside the index.
	ID string
	// Label is the destination's text. M3 always shows it in a bottom bar.
	Label string
	// Icon is an SVG name (see meui.LoadSVGByName) or, failing that, a glyph string.
	Icon string
	// IconSize overrides the icon box; zero uses the bar's default.
	IconSize float32
	// Disabled draws the item dimmed and refuses to select it.
	Disabled bool
}

NavigationBarItem is one destination in a NavigationBar.

type NavigationRail struct {
	meui.BaseWidget
	*theme.TabTheme

	// OnSelectionChanged fires when the selection moves.
	OnSelectionChanged func(index int)
	// contains filtered or unexported fields
}

NavigationRail is the SIDE half of the adaptive pair the NavigationBar is the bottom half of: the same destinations, laid out vertically down the left edge for a surface with room for them.

Android's own guidance is that the two are one control with two presentations chosen by window size class — a bottom bar on a compact surface, a rail on a medium one — which is exactly what platform.FormFactor reports. An app holds one list of destinations and asks the form factor which of these to build; it does not choose by platform, because a tablet and a desktop window of the same width want the same thing.

It shares NavigationBarItem and the selection contract with NavigationBar deliberately: two controls that mean the same thing should not have two vocabularies.

func NewNavigationRail

func NewNavigationRail() *NavigationRail

NewNavigationRail builds an empty rail selected on the first destination.

func (r *NavigationRail) Count() int
func (r *NavigationRail) HoverAt(x, y float32)

HoverAt implements HoverTarget.

func (r *NavigationRail) ItemAt(x, y float32) int

ItemAt reports which destination holds a point, or -1.

func (r *NavigationRail) ItemHeight() float32

ItemHeight is one destination's height: enough for the icon, the indicator pill around it and the label beneath it, and at least the theme's tab height and the touch floor.

It used to be max(TabTheme.TabHeight, MinTouchTarget), which is only right when the theme's tab height happens to be big enough for that construction. On a DESKTOP theme TabHeight is 28 and MinTouchTarget is 0, so each destination was 28px while its own content needed ~54 — and every label was drawn on top of the NEXT destination's icon. The Android theme (TabHeight 64) hid it, which is why it only appeared at a tablet-sized window on a desktop theme. The rail's tests missed it because they assert geometry and hit-testing, never that an item is tall enough to draw what it draws.

func (r *NavigationRail) ItemRect(i int) (graphics.Rect, bool)

ItemRect is a destination's rect in the rail's own coordinates.

func (r *NavigationRail) Items() []NavigationBarItem
func (r *NavigationRail) OnMouseDown(x, y float32, button int) bool
func (r *NavigationRail) OnMouseMove(x, y float32)
func (r *NavigationRail) OnMouseUp(x, y float32, button int) bool
func (r *NavigationRail) Paint(canvas *graphics.Canvas, rect graphics.Rect)
func (r *NavigationRail) PreferredDimensions(target interface{}, w, h float32) (float32, float32)
func (r *NavigationRail) RailWidth() float32

RailWidth is the rail's own width. A rail is a fixed-width column, so unlike the bottom bar it does not divide the surface — the destinations stack down it instead.

func (r *NavigationRail) SelectID(id string) bool
func (r *NavigationRail) Selected() int
func (r *NavigationRail) SelectedID() string
func (r *NavigationRail) SetBoundProperty(name string, value interface{})

SetBoundProperty implements the QML binding hook.

func (r *NavigationRail) SetItems(items []NavigationBarItem) *NavigationRail
func (r *NavigationRail) SetSelected(index int) bool

SetSelected moves the selection and reports it, so a programmatic move behaves like a tap. It refuses a disabled destination.

type NotificationItem

type NotificationItem struct {
	Icon    string // SVG icon name
	Tooltip string
	OnClick func()
	IconSVG *meui.SVGDocument // cached SVG document (loaded on demand)
}

NotificationItem represents an icon in the taskbar notification area.

type ParameterHint

type ParameterHint struct {
	Label         string
	Documentation string
	ActiveParam   int
	StartLine     int
	StartCol      int
	EndLine       int
	EndCol        int
}

type PickerPresentation

type PickerPresentation uint8

PickerPresentation selects WHERE a picker's panel appears. It is a behaviour axis, so it follows the SURFACE's size class rather than the OS name.

const (
	// PickerAuto anchors the panel under its field on a surface with room, and lifts it into a
	// bottom sheet on a phone — where a dropdown under a field is a pointer control, and a popup
	// calendar is out of thumb reach. This is the plan's own rule for the pickers.
	PickerAuto PickerPresentation = iota
	// PickerDropdown forces the anchored panel.
	PickerDropdown
	// PickerSheet forces the bottom sheet.
	PickerSheet
)

type Position

type Position struct {
	Line      int `json:"line"`
	Character int `json:"character"`
}

type ProgressBar

type ProgressBar struct {
	meui.BaseWidget
	*theme.ProgressBarTheme
	Value         float32
	Minimum       float32
	Maximum       float32
	Indeterminate bool
	ShowText      bool
	// contains filtered or unexported fields
}

func NewProgressBar

func NewProgressBar() *ProgressBar

func (*ProgressBar) Dispose

func (p *ProgressBar) Dispose()

func (*ProgressBar) Paint

func (p *ProgressBar) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*ProgressBar) SetBoundProperty

func (p *ProgressBar) SetBoundProperty(propName string, value interface{})

func (*ProgressBar) SetIndeterminate

func (p *ProgressBar) SetIndeterminate(ind bool) *ProgressBar

func (*ProgressBar) SetMaximum

func (p *ProgressBar) SetMaximum(max float32) *ProgressBar

func (*ProgressBar) SetMinimum

func (p *ProgressBar) SetMinimum(min float32) *ProgressBar

func (*ProgressBar) SetShowText

func (p *ProgressBar) SetShowText(show bool) *ProgressBar

func (*ProgressBar) SetValue

func (p *ProgressBar) SetValue(value float32) *ProgressBar

type PullToRefresh

type PullToRefresh struct {
	meui.BaseContainer
	*theme.PopupTheme

	// OnRefresh fires once per gesture, when the pull is released past the threshold.
	OnRefresh func()
	// contains filtered or unexported fields
}

PullToRefresh wraps a scrollable surface and refreshes it when the user drags down from the top — the gesture every phone list has, and the one that makes "there may be newer data" something the user can ask for rather than something the app guesses at with a timer.

It is a CONTAINER THAT IS ALWAYS THE HIT (the `ScrollPane` and `SwipeActionRow` pattern), because the gesture has to be recognized before the content sees it: only the wrapper knows whether the content is already at the top, which is the whole difference between "scroll up" and "pull to refresh". A gesture it decides against is FORWARDED to the content, in the content's coordinates.

It does not refresh. `OnRefresh` reports the gesture; the app does the work and calls `Done()` when it is finished, which is what keeps the indicator up for exactly as long as the request takes.

func NewPullToRefresh

func NewPullToRefresh() *PullToRefresh

NewPullToRefresh builds an empty wrapper.

func (*PullToRefresh) AddChild

func (p *PullToRefresh) AddChild(child meui.Widget)

AddChild makes a QML child the CONTENT, as ScrollPane and SwipeActionRow do: the loader adds children through AddChild, so a container that keeps its content elsewhere has to say so.

func (*PullToRefresh) Content

func (p *PullToRefresh) Content() meui.Widget

func (*PullToRefresh) ContentRect

func (p *PullToRefresh) ContentRect(bounds graphics.Rect) graphics.Rect

ContentRect is the content's rect at rest. The paint translates it by the pull, so a gesture does not disturb the layout.

func (*PullToRefresh) Done

func (p *PullToRefresh) Done()

Done ends a refresh and lets the content settle back. The app calls it when its work is finished.

func (*PullToRefresh) HoverAt

func (p *PullToRefresh) HoverAt(x, y float32)

HoverAt implements HoverTarget.

func (*PullToRefresh) IndicatorRect

func (p *PullToRefresh) IndicatorRect(bounds graphics.Rect) graphics.Rect

IndicatorRect is the refresh indicator's square, centred above the content by half the pull.

func (*PullToRefresh) OnMouseDown

func (p *PullToRefresh) OnMouseDown(x, y float32, button int) bool

func (*PullToRefresh) OnMouseMove

func (p *PullToRefresh) OnMouseMove(x, y float32)

func (*PullToRefresh) OnMouseUp

func (p *PullToRefresh) OnMouseUp(x, y float32, button int) bool

func (*PullToRefresh) Paint

func (p *PullToRefresh) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*PullToRefresh) PanelAt

func (p *PullToRefresh) PanelAt(x, y float32) meui.Widget

PanelAt returns the WRAPPER itself, always: the gesture has to be recognized before the content sees it, and only the wrapper knows whether the content is at the top.

func (*PullToRefresh) PreferredDimensions

func (p *PullToRefresh) PreferredDimensions(target interface{}, w, h float32) (float32, float32)

func (*PullToRefresh) Pull

func (p *PullToRefresh) Pull() float32

Pull is the current pull distance; 0 when the content is at rest.

func (*PullToRefresh) Refreshing

func (p *PullToRefresh) Refreshing() bool

Refreshing reports whether the indicator is up waiting for Done.

func (*PullToRefresh) SetContent

func (p *PullToRefresh) SetContent(w meui.Widget) *PullToRefresh

func (*PullToRefresh) SetThreshold

func (p *PullToRefresh) SetThreshold(d float32) *PullToRefresh

SetThreshold overrides how far the pull has to travel; zero uses PullThreshold.

func (*PullToRefresh) ValidateLayout

func (p *PullToRefresh) ValidateLayout()

type PythonTokenizer

type PythonTokenizer struct{}

func (*PythonTokenizer) Extensions

func (p *PythonTokenizer) Extensions() []string

func (*PythonTokenizer) LanguageName

func (p *PythonTokenizer) LanguageName() string

func (*PythonTokenizer) Tokenize

func (p *PythonTokenizer) Tokenize(line string, lineNum int, prevState interface{}) ([]SyntaxToken, interface{})

type QMLTokenizer

type QMLTokenizer struct{}

func (*QMLTokenizer) Extensions

func (q *QMLTokenizer) Extensions() []string

func (*QMLTokenizer) LanguageName

func (q *QMLTokenizer) LanguageName() string

func (*QMLTokenizer) Tokenize

func (q *QMLTokenizer) Tokenize(line string, lineNum int, prevState interface{}) ([]SyntaxToken, interface{})

type RadioButton

type RadioButton struct {
	meui.BaseWidget
	*theme.RadioButtonTheme
	Selectable
	Text       string
	OnSelected func(bool)
	OnChanged  func(bool)
	// contains filtered or unexported fields
}

func NewRadioButton

func NewRadioButton() *RadioButton

func (*RadioButton) AccessibilityNode added in v0.5.27

func (r *RadioButton) AccessibilityNode() platform.AccessibilityNode

func (*RadioButton) Dispose

func (r *RadioButton) Dispose()

func (*RadioButton) Focusable

func (r *RadioButton) Focusable() bool

func (*RadioButton) GetSelectable

func (r *RadioButton) GetSelectable() *Selectable

func (*RadioButton) OnMouseDown

func (r *RadioButton) OnMouseDown(x, y float32, button int) bool

func (*RadioButton) OnMouseMove

func (r *RadioButton) OnMouseMove(x, y float32)

func (*RadioButton) Paint

func (r *RadioButton) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*RadioButton) PerformAccessibilityAction added in v0.5.27

func (r *RadioButton) PerformAccessibilityAction(action platform.AccessibilityAction) bool

func (*RadioButton) PreferredDimensions

func (r *RadioButton) PreferredDimensions(target interface{}, w, h float32) (float32, float32)

PreferredDimensions reports the circle + spacing + text width so stack layouts assign a frame wide enough for the label.

func (*RadioButton) SetBoundProperty

func (r *RadioButton) SetBoundProperty(propName string, value interface{})

func (*RadioButton) SetGroupID

func (r *RadioButton) SetGroupID(id string) *RadioButton

func (*RadioButton) SetOnSelected

func (r *RadioButton) SetOnSelected(handler func(bool)) *RadioButton

func (*RadioButton) SetSelected

func (r *RadioButton) SetSelected(selected bool) *RadioButton

func (*RadioButton) SetText

func (r *RadioButton) SetText(text string) *RadioButton

type Range

type Range struct {
	Start Position `json:"start"`
	End   Position `json:"end"`
}

type ReferenceParams

type ReferenceParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
	Position     Position               `json:"position"`
	Context      struct {
		IncludeDeclaration bool `json:"includeDeclaration"`
	} `json:"context"`
}

type ReleaseCallback

type ReleaseCallback func()

ReleaseCallback detaches a child widget from its current parent. Created when a drag starts so the drop target can release the child from the original parent before reparenting.

type RenameParams

type RenameParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
	Position     Position               `json:"position"`
	NewName      string                 `json:"newName"`
}

type ScrollBar

type ScrollBar struct {
	meui.BaseWidget
	*theme.ScrollBarTheme
	Orientation    int
	Value          float32
	Min            float32
	Max            float32
	VisibleAmount  float32
	OnValueChanged func(float32)
	// contains filtered or unexported fields
}

func NewScrollBar

func NewScrollBar() *ScrollBar

func (*ScrollBar) OnMouseDown

func (s *ScrollBar) OnMouseDown(x, y float32, button int) bool

func (*ScrollBar) OnMouseMove

func (s *ScrollBar) OnMouseMove(x, y float32)

func (*ScrollBar) OnMouseUp

func (s *ScrollBar) OnMouseUp(x, y float32, button int) bool

func (*ScrollBar) OnMouseWheel

func (s *ScrollBar) OnMouseWheel(x, y float32, dx, dy float32) bool

func (*ScrollBar) Paint

func (s *ScrollBar) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*ScrollBar) SetBoundProperty

func (s *ScrollBar) SetBoundProperty(propName string, value interface{})

func (*ScrollBar) SetMax

func (s *ScrollBar) SetMax(max float32) *ScrollBar

func (*ScrollBar) SetMin

func (s *ScrollBar) SetMin(min float32) *ScrollBar

func (*ScrollBar) SetOnValueChanged

func (s *ScrollBar) SetOnValueChanged(handler func(float32)) *ScrollBar

func (*ScrollBar) SetOrientation

func (s *ScrollBar) SetOrientation(orientation int) *ScrollBar

func (*ScrollBar) SetValue

func (s *ScrollBar) SetValue(value float32) *ScrollBar

type ScrollPane

type ScrollPane struct {
	meui.BaseContainer
	*theme.ScrollPaneTheme
	Content       meui.Widget
	ContentWidth  float32
	ContentHeight float32
	// VScroll/HScroll alias the host's bars (same pointers) so external
	// code can inspect scrollbar state.
	VScroll     *ScrollBar
	HScroll     *ScrollBar
	ShowHScroll bool
	ShowVScroll bool
	// contains filtered or unexported fields
}

ScrollPane clips a single content widget and overlays scrollbars when the content exceeds the viewport. Scrollbar geometry, wheel, drag tracking and clamping are delegated to ScrollbarHost.

func NewScrollPane

func NewScrollPane() *ScrollPane

func (*ScrollPane) AddChild

func (sp *ScrollPane) AddChild(child meui.Widget)

func (*ScrollPane) Children

func (sp *ScrollPane) Children() []meui.Widget

func (*ScrollPane) HitTestsContent

func (sp *ScrollPane) HitTestsContent() bool

HitTestsContent reports whether the content is hit-tested.

func (*ScrollPane) OnBlur

func (sp *ScrollPane) OnBlur()

func (*ScrollPane) OnCharacter

func (sp *ScrollPane) OnCharacter(ch rune)

func (*ScrollPane) OnFocus

func (sp *ScrollPane) OnFocus()

func (*ScrollPane) OnKeyDown

func (sp *ScrollPane) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool

func (*ScrollPane) OnMouseDown

func (sp *ScrollPane) OnMouseDown(x, y float32, button int) bool

func (*ScrollPane) OnMouseMove

func (sp *ScrollPane) OnMouseMove(x, y float32)

func (*ScrollPane) OnMouseUp

func (sp *ScrollPane) OnMouseUp(x, y float32, button int) bool

func (*ScrollPane) OnMouseWheel

func (sp *ScrollPane) OnMouseWheel(x, y float32, dx, dy float32) bool

func (*ScrollPane) Paint

func (sp *ScrollPane) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*ScrollPane) PanelAt

func (sp *ScrollPane) PanelAt(x, y float32) meui.Widget

func (*ScrollPane) RefreshSticky

func (sp *ScrollPane) RefreshSticky()

RefreshSticky pins every sticky descendant against the current scroll offset. Paint calls it, so the frames a hit test sees are the ones that were drawn; call it directly only when something needs the frames before the next frame (a click that arrives in the same tick as a programmatic scroll).

func (*ScrollPane) RestoreState added in v0.5.35

func (s *ScrollPane) RestoreState(v any) bool

func (*ScrollPane) SaveState added in v0.5.35

func (s *ScrollPane) SaveState() any

func (*ScrollPane) ScrollOffsets

func (sp *ScrollPane) ScrollOffsets() (float32, float32)

ScrollOffsets implements the scrollAdjuster interface used by Panel.PointToRoot.

func (*ScrollPane) ScrollTo

func (sp *ScrollPane) ScrollTo(y float32) *ScrollPane

ScrollTo scrolls so content y is at the viewport's top edge, clamped by the host's extents. It is how "choose a row and the list reveals it" is written: ScrollTo the row's top, or the bottom minus the viewport when the row is below the fold.

func (*ScrollPane) ScrollY

func (sp *ScrollPane) ScrollY() float32

ScrollY is the current vertical offset.

func (*ScrollPane) SetBoundProperty

func (sp *ScrollPane) SetBoundProperty(propName string, value interface{})

func (*ScrollPane) SetContent

func (sp *ScrollPane) SetContent(content meui.Widget) *ScrollPane

func (*ScrollPane) SetContentSize

func (sp *ScrollPane) SetContentSize(w, h float32) *ScrollPane

func (*ScrollPane) SetFrameless

func (sp *ScrollPane) SetFrameless(on bool) *ScrollPane

SetFrameless draws no background plate and no edge line: the pane is a viewport onto its content, which is what a web page inside a shell wants.

func (*ScrollPane) SetHitTestContent

func (sp *ScrollPane) SetHitTestContent(on bool) *ScrollPane

SetHitTestContent makes the pane's content tree visible to hit testing, so a widget inside a scrolling viewport can be clicked. See the field's comment for why this is opt-in.

func (*ScrollPane) ValidateLayout

func (sp *ScrollPane) ValidateLayout()

func (*ScrollPane) ViewportHeight

func (sp *ScrollPane) ViewportHeight() float32

ViewportHeight is the visible content height (the pane minus its scrollbars).

type ScrollbarHost

type ScrollbarHost struct {
	VScroll *ScrollBar
	HScroll *ScrollBar

	ShowV bool
	ShowH bool

	// ScrollAmount is the wheel notch step in pixels.
	ScrollAmount float32

	// BarSize is the scrollbar strip width (theme default unless set).
	BarSize float32
	// contains filtered or unexported fields
}

ScrollbarHost owns scrollbar geometry and interaction for any widget with scrollable content. All scrollable widgets (ScrollPane, Tree, Table, DataTable, ...) delegate their scrollbar mechanics here so the conventions exist exactly once.

Units are ABSOLUTE PIXELS, everywhere:

bar.Min = 0
bar.Max = content extent (px)
bar.VisibleAmount = viewport extent (px)
bar.Value = scroll offset (px), kept in [0, Max-VisibleAmount]

The host handles: bar visibility (with corner interplay), bar layout, thumb geometry (ScrollBar's standard model), track/page clicks, drag tracking, wheel routing, and offset clamping. Widgets keep only their content extent, content painting translated by the offsets, and a SetOnChange hook (invalidate caches / mark redraws).

All Handle*/Paint coordinates are WIDGET-LOCAL, and bar geometry is laid out from sizes only (LayoutBars(w, h)) so a parent-relative FrameRect() can never leak into the local space.

func NewScrollbarHost

func NewScrollbarHost() *ScrollbarHost

NewScrollbarHost creates a host with its two bars. Bars report value changes through SetOnChange.

func (*ScrollbarHost) BarRects

func (h *ScrollbarHost) BarRects() (v, hv, corner graphics.Rect)

BarRects exposes bar geometry for widgets painting bars at absolute positions (tests, overlays).

func (*ScrollbarHost) ContentSize

func (h *ScrollbarHost) ContentSize(w, hgt float32) (float32, float32)

ContentSize returns the viewport size inside a w x h local frame, excluding bar strips. Content painting clips to a rect of this size anchored at the widget's local origin.

func (*ScrollbarHost) HandleMouseDown

func (h *ScrollbarHost) HandleMouseDown(w, hgt, x, y float32, button int) bool

HandleMouseDown routes a widget-LOCAL press to the bars. Returns true if a bar consumed it. Coordinates are converted to bar-local (0-based at the bar's own frame) — the bars' hit math (thumbRect, setValueFrom*) is bar-local, not widget-local.

func (*ScrollbarHost) HandleMouseMove

func (h *ScrollbarHost) HandleMouseMove(x, y float32)

HandleMouseMove routes a widget-LOCAL move to the bars (thumb drags).

func (*ScrollbarHost) HandleMouseUp

func (h *ScrollbarHost) HandleMouseUp(x, y float32, button int)

HandleMouseUp routes a widget-LOCAL release to the bars.

func (*ScrollbarHost) HandleWheel

func (h *ScrollbarHost) HandleWheel(dx, dy float32) bool

HandleWheel applies a wheel notch to the offset. dy<0 scrolls down (toward the user). Returns true if any bar consumed it.

func (*ScrollbarHost) LayoutBars

func (h *ScrollbarHost) LayoutBars(w, hgt float32)

LayoutBars positions the bars inside a widget-LOCAL frame of size w x h (origin implied (0,0)). Call after SetExtents, before PaintBars.

Bars are FLUSH with the frame edges: no end padding, no clearance gap. The thumb's rounded caps stay fully visible at both scroll extremes because the strip's ends sit inside whatever the widget clips to (a widget's frame no longer overflows its page — see the VStack/Flex padding fix — so the cap is tangent to the clip line, not past it).

It takes sizes, never a rect with an origin, so a caller cannot accidentally pass FrameRect() (parent-relative): the bars always land in the same local space the widget's canvas and mouse events use.

func (*ScrollbarHost) Offsets

func (h *ScrollbarHost) Offsets() (float32, float32)

Offsets returns the current scroll offsets in pixels.

func (*ScrollbarHost) PaintBars

func (h *ScrollbarHost) PaintBars(canvas *graphics.Canvas)

PaintBars paints the visible bars. Call after LayoutBars with the same frame — the bars are drawn at their laid-out positions in the current canvas space.

func (*ScrollbarHost) SetExtents

func (h *ScrollbarHost) SetExtents(contentW, contentH, viewW, viewH float32)

SetExtents updates content and viewport sizes and recomputes bar visibility, including the corner interplay (a visible vertical bar narrows the effective viewport, which may force the horizontal bar).

func (*ScrollbarHost) SetOffsets

func (h *ScrollbarHost) SetOffsets(x, y float32)

SetOffsets scrolls to (x, y), clamped to the scrollable range.

func (*ScrollbarHost) SetOnChange

func (h *ScrollbarHost) SetOnChange(fn func())

SetOnChange registers a callback fired after any offset change. Widgets use it to invalidate paint caches and mark redraws.

func (*ScrollbarHost) SetOwner

func (h *ScrollbarHost) SetOwner(w meui.Widget)

SetOwner binds the bars to the widget they scroll. Bars are not children in the container tree (the widget paints them via PaintBars), but they need a parent so their own repaint requests — hover reveal and the overlay fade — reach the window. Call once from the widget constructor.

func (*ScrollbarHost) UpdateHover

func (h *ScrollbarHost) UpdateHover(x, y float32)

UpdateHover reveals overlay bars whose strip the pointer is inside (widget-local coordinates). Overlay pills otherwise fade out while idle; hovering the strip must bring them back so they can be grabbed. Safe to call on every mouse move (SetHovered only redraws on change).

func (*ScrollbarHost) VisibleH

func (h *ScrollbarHost) VisibleH() bool

func (*ScrollbarHost) VisibleV

func (h *ScrollbarHost) VisibleV() bool

VisibleV / VisibleH report whether the bars are currently shown.

type SearchView

type SearchView struct {
	meui.BaseContainer
	*theme.PopupTheme

	// OnQueryChanged fires as the user types.
	OnQueryChanged func(query string)
	// OnSubmit fires when the user commits the query (Enter).
	OnSubmit func(query string)
	// OnChoose fires with the chosen result's ID.
	OnChoose func(id string)
	// OnClose fires when the user asks to leave the search.
	OnClose func()
	// contains filtered or unexported fields
}

SearchView is the full-screen search a phone opens from its app bar: a back affordance, a query field that is focused on arrival, and a list of results the app feeds it. It is the app bar's search action's destination — the plan's "full-screen search, opened from the app bar".

It fills the area it is given, so the app shows it over the whole window (`Window.ShowModal`) or puts it in the shell; either way the field is a REAL `TextField`, so typing, the caret, selection and the on-screen keyboard are the ones the toolkit already has rather than a second implementation of a text box.

It does not search. The app owns the query and the results: the widget reports what was typed (`OnQueryChanged`), what was submitted (`OnSubmit`), which result was chosen (`OnChoose`) and when the user asked to leave (`OnClose`).

func NewSearchView

func NewSearchView() *SearchView

NewSearchView builds an empty search view.

func (*SearchView) BackRect

func (s *SearchView) BackRect(bounds graphics.Rect) graphics.Rect

BackRect is the leading control's rect.

func (*SearchView) ClearRect

func (s *SearchView) ClearRect(bounds graphics.Rect) (graphics.Rect, bool)

ClearRect is the trailing clear control, which exists only while there is something to clear.

func (*SearchView) Close

func (s *SearchView) Close()

Close asks to leave: it reports, and takes its own modal down when it has one.

func (*SearchView) Field

func (s *SearchView) Field() *TextField

Field exposes the query field, for an app that wants to focus or style it.

func (*SearchView) FieldRect

func (s *SearchView) FieldRect(bounds graphics.Rect) graphics.Rect

FieldRect is what is left of the header for the query field, between the two controls.

func (*SearchView) HeaderRect

func (s *SearchView) HeaderRect(bounds graphics.Rect) graphics.Rect

HeaderRect is the search app bar's strip.

func (*SearchView) HoverAt

func (s *SearchView) HoverAt(x, y float32)

HoverAt implements HoverTarget.

func (*SearchView) OnMouseDown

func (s *SearchView) OnMouseDown(x, y float32, button int) bool

func (*SearchView) OnMouseMove

func (s *SearchView) OnMouseMove(x, y float32)

func (*SearchView) OnMouseUp

func (s *SearchView) OnMouseUp(x, y float32, button int) bool

func (*SearchView) Paint

func (s *SearchView) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*SearchView) PreferredDimensions

func (s *SearchView) PreferredDimensions(target interface{}, w, h float32) (float32, float32)

PreferredDimensions fills the area it is given: a full-screen view is not sized by its content.

func (*SearchView) Query

func (s *SearchView) Query() string

func (*SearchView) ResultAt

func (s *SearchView) ResultAt(x, y float32) int

ResultAt reports which row holds a point, or -1.

func (*SearchView) ResultRect

func (s *SearchView) ResultRect(i int, bounds graphics.Rect) (graphics.Rect, bool)

ResultRect is the i-th result's rect, in the list below the header.

func (*SearchView) Results

func (s *SearchView) Results() []SearchViewResult

func (*SearchView) SetBoundProperty

func (s *SearchView) SetBoundProperty(name string, value interface{})

SetBoundProperty implements the QML binding hook.

func (*SearchView) SetPlaceholder

func (s *SearchView) SetPlaceholder(text string) *SearchView

func (*SearchView) SetQuery

func (s *SearchView) SetQuery(text string) *SearchView

func (*SearchView) SetResults

func (s *SearchView) SetResults(results []SearchViewResult) *SearchView

SetResults replaces the rows. The app filters; the widget only draws and reports.

func (*SearchView) SetWindow

func (s *SearchView) SetWindow(w *meui.Window)

SetWindow is how a widget hosted in the window's modal layer learns its window — and it FOCUSES the field, because a search view that opens without the keyboard up is a list with a decoration.

func (*SearchView) ValidateLayout

func (s *SearchView) ValidateLayout()

ValidateLayout places the field, which is the only child.

type SearchViewResult

type SearchViewResult struct {
	// ID is what OnChoose reports.
	ID string
	// Label is the row's primary text.
	Label string
	// Secondary is an optional second line.
	Secondary string
}

SearchViewResult is one suggestion or result row.

type Selectable

type Selectable struct {
	GroupID  string
	Selected bool
}

Selectable provides group-based exclusive selection behavior. Embed this in widgets that need group selection (Button, RadioButton, etc.)

func (*Selectable) Dispose

func (s *Selectable) Dispose(widget meui.Widget)

Dispose removes the widget from its group.

func (*Selectable) SetGroupID

func (s *Selectable) SetGroupID(id string, widget meui.Widget)

SetGroupID assigns the widget to a group. If already selected, syncs with the group.

func (*Selectable) SetSelected

func (s *Selectable) SetSelected(selected bool, widget meui.Widget, onSelected func(bool))

SetSelected sets selection state and manages group exclusivity.

type SignatureHelpParams

type SignatureHelpParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
	Position     Position               `json:"position"`
}

type Slider

type Slider struct {
	meui.BaseWidget
	*theme.SliderTheme
	Value          float32
	Minimum        float32
	Maximum        float32
	StepSize       float32
	SnapToStep     bool
	ShowTicks      bool
	Dragging       bool
	Orientation    int // 0=horizontal, 1=vertical
	OnValueChanged func(float32)
	// contains filtered or unexported fields
}

func NewSlider

func NewSlider() *Slider

func (*Slider) AccessibilityNode added in v0.5.8

func (s *Slider) AccessibilityNode() platform.AccessibilityNode

func (*Slider) Focusable

func (s *Slider) Focusable() bool

func (*Slider) OnKeyDown

func (s *Slider) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool

func (*Slider) OnKeyRepeat

func (s *Slider) OnKeyRepeat(keyCode platform.KeyCode, mod platform.Modifiers) bool

OnKeyRepeat is a key the user is HOLDING — Backspace over a word, an arrow along a row, a scrub. The window classifies an OS auto-repeat as a repeat rather than a fresh press (a widget without this method is asked once, deliberately), so this is what makes a held key work here.

func (*Slider) OnMouseDown

func (s *Slider) OnMouseDown(x, y float32, button int) bool

func (*Slider) OnMouseMove

func (s *Slider) OnMouseMove(x, y float32)

func (*Slider) OnMouseUp

func (s *Slider) OnMouseUp(x, y float32, button int) bool

func (*Slider) OnMouseWheel

func (s *Slider) OnMouseWheel(x, y float32, dx, dy float32) bool

func (*Slider) Paint

func (s *Slider) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*Slider) PerformAccessibilityAction added in v0.5.12

func (s *Slider) PerformAccessibilityAction(action platform.AccessibilityAction) bool

func (*Slider) SetBoundProperty

func (s *Slider) SetBoundProperty(propName string, value interface{})

func (*Slider) SetMaximum

func (s *Slider) SetMaximum(max float32) *Slider

func (*Slider) SetMinimum

func (s *Slider) SetMinimum(min float32) *Slider

func (*Slider) SetOnValueChanged

func (s *Slider) SetOnValueChanged(handler func(float32)) *Slider

func (*Slider) SetOrientation

func (s *Slider) SetOrientation(orient int) *Slider

func (*Slider) SetShowTicks

func (s *Slider) SetShowTicks(show bool) *Slider

func (*Slider) SetSnapToStep

func (s *Slider) SetSnapToStep(snap bool) *Slider

func (*Slider) SetStepSize

func (s *Slider) SetStepSize(step float32) *Slider

func (*Slider) SetValue

func (s *Slider) SetValue(value float32) *Slider

type Snackbar

type Snackbar struct {
	meui.BaseWidget
	*theme.PopupTheme

	// Duration overrides how long the message stays up; zero uses
	// DefaultSnackbarDuration.
	Duration time.Duration
	// OnDismissed fires when the message goes away, however it went away.
	OnDismissed func()
	// contains filtered or unexported fields
}

Snackbar is a brief message at the bottom of the screen, with an optional action.

It is a WIDGET IN THE APP'S OWN TREE rather than a global overlay. The toolkit's one global overlay is a drag ghost, and a snackbar that floated above every window would have to answer questions about which window it belongs to; a shell places it where it belongs and gets the right answer for free.

The app shows it and it dismisses itself. Nothing has to poll: the timer is a platform task, so it runs on the UI thread like every other callback.

func NewSnackbar

func NewSnackbar() *Snackbar

NewSnackbar builds a hidden snackbar.

func (*Snackbar) ActionRect

func (s *Snackbar) ActionRect() (graphics.Rect, bool)

ActionRect is the action button's rect, right-aligned, in the bar's own coordinates.

func (*Snackbar) BarHeight

func (s *Snackbar) BarHeight() float32

BarHeight is the message's height, from the popup metrics so it matches the other floating surfaces.

func (*Snackbar) Dismiss

func (s *Snackbar) Dismiss()

Dismiss hides the message immediately.

func (*Snackbar) OnMouseDown

func (s *Snackbar) OnMouseDown(x, y float32, button int) bool

func (*Snackbar) OnMouseUp

func (s *Snackbar) OnMouseUp(x, y float32, button int) bool

func (*Snackbar) Paint

func (s *Snackbar) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*Snackbar) PreferredDimensions

func (s *Snackbar) PreferredDimensions(target interface{}, w, h float32) (float32, float32)

func (*Snackbar) SetBoundProperty

func (s *Snackbar) SetBoundProperty(name string, value interface{})

SetBoundProperty implements the QML binding hook.

func (*Snackbar) Show

func (s *Snackbar) Show(text string)

Show displays a message with no action.

func (*Snackbar) ShowAction

func (s *Snackbar) ShowAction(text, action string, onDo func())

ShowAction displays a message with an action button.

func (*Snackbar) Showing

func (s *Snackbar) Showing() bool

Showing reports whether a message is up.

func (*Snackbar) Text

func (s *Snackbar) Text() string

func (*Snackbar) Visible

func (s *Snackbar) Visible() bool

Visible is false while no message is up. A Snackbar lives in the shell's FLOW, so one that reported itself visible while hidden would reserve layout space AND take every press in its band — which is what it did: on the device a drag over the page's lower band landed on the hidden Snackbar instead of the widget under the finger, and the ScrollPane never scrolled. Deriving it from the message's own state means no caller can forget to hide it.

type SpinBox

type SpinBox struct {
	meui.BaseWidget
	*theme.SpinBoxTheme
	Value    float32
	Minimum  float32
	Maximum  float32
	Step     float32
	Focused  bool
	OnChange func(float32)
	// Prefix/Suffix are rendered around the number (like QSpinBox). They are
	// not part of the edit buffer.
	Prefix   string
	Suffix   string
	Wrapping bool // step past the range wraps around

	Decimals int
	// contains filtered or unexported fields
}

func NewSpinBox

func NewSpinBox() *SpinBox

func (*SpinBox) Dispose

func (s *SpinBox) Dispose()

func (*SpinBox) Focusable

func (s *SpinBox) Focusable() bool

func (*SpinBox) GetText

func (s *SpinBox) GetText() string

GetText returns the formatted display text (including prefix/suffix).

func (*SpinBox) OnBlur

func (s *SpinBox) OnBlur()

func (*SpinBox) OnCharacter

func (s *SpinBox) OnCharacter(ch rune)

func (*SpinBox) OnFocus

func (s *SpinBox) OnFocus()

func (*SpinBox) OnKeyDown

func (s *SpinBox) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool

func (*SpinBox) OnKeyRepeat

func (s *SpinBox) OnKeyRepeat(keyCode platform.KeyCode, mod platform.Modifiers) bool

OnKeyRepeat is a key the user is HOLDING — Backspace over a word, an arrow along a row, a scrub. The window classifies an OS auto-repeat as a repeat rather than a fresh press (a widget without this method is asked once, deliberately), so this is what makes a held key work here.

func (*SpinBox) OnMouseDown

func (s *SpinBox) OnMouseDown(x, y float32, button int) bool

func (*SpinBox) OnMouseUp

func (s *SpinBox) OnMouseUp(x, y float32, button int) bool

func (*SpinBox) Paint

func (s *SpinBox) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*SpinBox) SetBoundProperty

func (s *SpinBox) SetBoundProperty(propName string, value interface{})

func (*SpinBox) SetDecimals

func (s *SpinBox) SetDecimals(d int) *SpinBox

func (*SpinBox) SetOnChange

func (s *SpinBox) SetOnChange(handler func(float32)) *SpinBox

func (*SpinBox) SetPrefix

func (s *SpinBox) SetPrefix(prefix string) *SpinBox

SetPrefix sets text rendered before the value (e.g. "$").

func (*SpinBox) SetRange

func (s *SpinBox) SetRange(min, max float32) *SpinBox

SetRange sets both bounds at once (like QSpinBox.setRange).

func (*SpinBox) SetStep

func (s *SpinBox) SetStep(step float32) *SpinBox

func (*SpinBox) SetSuffix

func (s *SpinBox) SetSuffix(suffix string) *SpinBox

SetSuffix sets text rendered after the value (e.g. " km/h").

func (*SpinBox) SetValue

func (s *SpinBox) SetValue(value float32) *SpinBox

func (*SpinBox) SetWrapping

func (s *SpinBox) SetWrapping(wrap bool) *SpinBox

SetWrapping makes stepping wrap around the range instead of clamping.

type SplitView

type SplitView struct {
	meui.BaseContainer
	*theme.StackPanelTheme
	Orientation   int // 0=horizontal, 1=vertical
	SplitPosition float32
	MinSize1      float32
	MinSize2      float32
	HandleSize    float32
	Panel1        meui.Widget
	Panel2        meui.Widget
	OnSplitMoved  func(position float32)
	// contains filtered or unexported fields
}

func NewSplitView

func NewSplitView() *SplitView

func (*SplitView) AddChild

func (s *SplitView) AddChild(child meui.Widget)

func (*SplitView) Children

func (s *SplitView) Children() []meui.Widget

func (*SplitView) ChildrenI

func (s *SplitView) ChildrenI() []interface{}

func (*SplitView) CursorAt

func (s *SplitView) CursorAt(x, y float32) *platform.Cursor

CursorAt reports the resize cursor while the pointer is on the splitter handle, using the same zone OnMouseDown starts a drag from.

func (*SplitView) HoverAt

func (s *SplitView) HoverAt(x, y float32)

HoverAt implements meui.HoverTarget. The window reports the pointer position (widget-local) on every move along the hit chain, because the deepest hit is normally a child of one of the panels — OnMouseMove alone therefore saw the pointer arrive on the handle and never saw it leave, which left the divider stuck in its hover ink.

func (*SplitView) OnMouseDown

func (s *SplitView) OnMouseDown(x, y float32, button int) bool

func (*SplitView) OnMouseMove

func (s *SplitView) OnMouseMove(x, y float32)

func (*SplitView) OnMouseUp

func (s *SplitView) OnMouseUp(x, y float32, button int) bool

func (*SplitView) Paint

func (s *SplitView) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*SplitView) PanelAt

func (s *SplitView) PanelAt(x, y float32) meui.Widget

func (*SplitView) SetBoundProperty

func (s *SplitView) SetBoundProperty(propName string, value interface{})

func (*SplitView) SetFrameRect

func (s *SplitView) SetFrameRect(rect graphics.Rect)

func (*SplitView) SetHandleSize

func (s *SplitView) SetHandleSize(size float32) *SplitView

SetHandleSize sets the splitter handle thickness in pixels.

func (*SplitView) SetHoverColorAlwaysOn

func (s *SplitView) SetHoverColorAlwaysOn(on bool) *SplitView

SetHoverColorAlwaysOn pins whether this split's divider is always drawn in the hover ink, overriding the theme's HoverColorAlwaysOn.

func (*SplitView) SetOnSplitMoved

func (s *SplitView) SetOnSplitMoved(handler func(position float32)) *SplitView

SetOnSplitMoved registers a callback fired when the user finishes dragging the splitter (like QSplitter.splitterMoved).

func (*SplitView) SetOrientation

func (s *SplitView) SetOrientation(orient int) *SplitView

func (*SplitView) SetPanels

func (s *SplitView) SetPanels(p1, p2 meui.Widget) *SplitView

func (*SplitView) SetSplitPosition

func (s *SplitView) SetSplitPosition(pos float32) *SplitView

func (*SplitView) ValidateLayout

func (s *SplitView) ValidateLayout()

type StackPanel

type StackPanel struct {
	meui.BaseContainer
	Orientation string // "vertical" or "horizontal"
	Items       []meui.Widget
	Sizes       []float32 // allocated size of each item (width or height)
	StackTheme  *theme.StackPanelTheme
	// contains filtered or unexported fields
}

StackPanel stacks widgets vertically or horizontally with draggable splitters.

func NewStackPanel

func NewStackPanel(orientation string) *StackPanel

func (*StackPanel) AddItem

func (sp *StackPanel) AddItem(w meui.Widget, size float32)

AddItem adds a widget to the stack with the given size.

func (*StackPanel) CursorAt

func (sp *StackPanel) CursorAt(x, y float32) *platform.Cursor

CursorAt reports the resize cursor on a splitter band, using the same band hitSplitterLocal and OnMouseDown drag from. A splitter is a part of the StackPanel's own area (the band lies between the item rects), so the window's hit test lands on the panel itself — without this method the walk fell through to the default arrow and only SplitView showed a resize cursor.

func (*StackPanel) DropHitTest

func (sp *StackPanel) DropHitTest(lx, ly float32) *DropZoneInfo

DropHitTest returns a DropZoneInfo if (lx, ly) in StackPanel-local coords is over an item's title/tab bar (merge) or between items (insert).

func (*StackPanel) HoverAt

func (sp *StackPanel) HoverAt(x, y float32)

HoverAt implements meui.HoverTarget: the window reports the pointer position (widget-local) on every move along the hit chain, so a splitter lights up under the pointer and goes back to its normal ink when the pointer moves onto either item — the items are the deepest hit, so OnMouseMove alone never saw the pointer leave the band.

func (*StackPanel) IndexOf

func (sp *StackPanel) IndexOf(w meui.Widget) int

IndexOf returns the index of the given widget, or -1.

func (*StackPanel) ItemCount

func (sp *StackPanel) ItemCount() int

ItemCount returns the number of items in the stack.

func (*StackPanel) OnMouseDown

func (sp *StackPanel) OnMouseDown(x, y float32, button int) bool

func (*StackPanel) OnMouseMove

func (sp *StackPanel) OnMouseMove(x, y float32)

func (*StackPanel) OnMouseUp

func (sp *StackPanel) OnMouseUp(x, y float32, button int) bool

func (*StackPanel) Paint

func (sp *StackPanel) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*StackPanel) PanelAt

func (sp *StackPanel) PanelAt(x, y float32) meui.Widget

PanelAt returns the deepest child widget containing the point (in local coordinates).

func (*StackPanel) RemoveItem

func (sp *StackPanel) RemoveItem(idx int) meui.Widget

RemoveItem removes the widget at index. Returns the removed widget.

func (*StackPanel) RemoveWidget

func (sp *StackPanel) RemoveWidget(w meui.Widget) bool

RemoveWidget finds and removes a widget from the stack.

func (*StackPanel) SetBoundProperty

func (sp *StackPanel) SetBoundProperty(propName string, value interface{})

func (*StackPanel) SetFrameRect

func (sp *StackPanel) SetFrameRect(rect graphics.Rect)

SetFrameRect overrides BaseWidget.SetFrameRect to trigger layout redistribution.

func (*StackPanel) SetHoverColorAlwaysOn

func (sp *StackPanel) SetHoverColorAlwaysOn(on bool) *StackPanel

SetHoverColorAlwaysOn pins whether this panel's splitters are always drawn in the hover ink, overriding the theme's HoverColorAlwaysOn.

func (*StackPanel) UpdateItemFrames

func (sp *StackPanel) UpdateItemFrames()

UpdateItemFrames sets the frame of each item based on current sizes, without painting. Called after structural changes so DropHitTest sees valid frames immediately (not deferred to the next Paint cycle).

func (*StackPanel) ValidateLayout

func (sp *StackPanel) ValidateLayout()

type StatusBar

type StatusBar struct {
	meui.BaseWidget
	*theme.StatusBarTheme
	Text     string
	Sections []string
	OnResize func()

	// Widgets rendered right-aligned (like addPermanentWidget)
	Widgets []meui.Widget
	// contains filtered or unexported fields
}

func NewStatusBar

func NewStatusBar() *StatusBar

func (*StatusBar) AddWidget

func (s *StatusBar) AddWidget(w meui.Widget) *StatusBar

AddWidget appends a widget rendered right-aligned before the size grip.

func (*StatusBar) ClearMessage

func (s *StatusBar) ClearMessage() *StatusBar

ClearMessage removes the temporary message immediately.

func (*StatusBar) OnMouseDown

func (s *StatusBar) OnMouseDown(x, y float32, button int) bool

func (*StatusBar) OnMouseMove

func (s *StatusBar) OnMouseMove(x, y float32)

func (*StatusBar) OnMouseUp

func (s *StatusBar) OnMouseUp(x, y float32, button int) bool

func (*StatusBar) Paint

func (s *StatusBar) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*StatusBar) SetBoundProperty

func (s *StatusBar) SetBoundProperty(propName string, value interface{})

func (*StatusBar) SetOnResize

func (s *StatusBar) SetOnResize(handler func()) *StatusBar

func (*StatusBar) SetSections

func (s *StatusBar) SetSections(sections []string) *StatusBar

func (*StatusBar) SetText

func (s *StatusBar) SetText(text string) *StatusBar

func (*StatusBar) ShowMessage

func (s *StatusBar) ShowMessage(message string, timeoutMs int) *StatusBar

ShowMessage displays a temporary message for timeoutMs, then restores the normal text (like QStatusBar.showMessage).

type SwipeAction

type SwipeAction struct {
	// ID is what OnAction reports.
	ID string
	// Label is the action's text. A swipe row's actions are text buttons: an icon alone gives no
	// warning about what is behind the row.
	Label string
	// Destructive fills it with the error ink — the action that deletes something.
	Destructive bool
	// OnAction is this action's own callback; the row's OnAction fires as well, with the ID.
	OnAction func()
}

SwipeAction is one action behind a row.

type SwipeActionRow

type SwipeActionRow struct {
	meui.BaseContainer
	*theme.PopupTheme

	// OnAction fires with the action's ID.
	OnAction func(id string)
	// OnOpened and OnClosed report the state change, so an app can close the other rows.
	OnOpened func()
	OnClosed func()
	// contains filtered or unexported fields
}

SwipeActionRow is a list row you swipe sideways to reveal the actions behind it — the gesture that makes a list feel like a phone rather than a table. It hosts one content widget (a `ListItem`, in practice) and draws the actions in the strip the content uncovers.

It is a CONTAINER THAT IS ALWAYS THE HIT (the `ScrollPane` pattern: `PanelAt` returns the row itself), because a swipe cannot be recognized by the child that owns the press. So the row takes the press, decides whether the gesture was a TAP or a SWIPE, and forwards a tap to its content — which is what keeps a row's own click working through the gesture.

Only TRAILING actions are implemented: the destructive ones a left swipe reveals. A leading swipe is a different gesture with a different meaning (usually "mark" or "pin"), and guessing at it would be worse than not having it.

func NewSwipeActionRow

func NewSwipeActionRow() *SwipeActionRow

NewSwipeActionRow builds an empty row with no content and no actions.

func (*SwipeActionRow) ActionAt

func (s *SwipeActionRow) ActionAt(x, y float32) int

ActionAt reports which action holds a point, or -1. An action that is still COVERED by the content is not a target: the row's own body must not fire the delete behind it.

func (*SwipeActionRow) ActionRect

func (s *SwipeActionRow) ActionRect(i int, bounds graphics.Rect) (graphics.Rect, bool)

ActionRect is the i-th action's rect. The actions are laid out from the RIGHT edge leftward in the order given, so the FIRST one is the outermost — which is where the thumb already is when the row finishes sliding, and the destructive action is the one an app puts first.

func (*SwipeActionRow) Actions

func (s *SwipeActionRow) Actions() []SwipeAction

func (*SwipeActionRow) ActionsWidth

func (s *SwipeActionRow) ActionsWidth() float32

ActionsWidth is the strip the actions occupy.

func (*SwipeActionRow) AddChild

func (s *SwipeActionRow) AddChild(child meui.Widget)

AddChild makes a QML child the CONTENT, the way ScrollPane does: the loader adds children through AddChild, so a container that keeps its content elsewhere has to say so or the markup's child lands in an unlaid-out list and never paints.

func (*SwipeActionRow) Close

func (s *SwipeActionRow) Close()

func (*SwipeActionRow) Content

func (s *SwipeActionRow) Content() meui.Widget

func (*SwipeActionRow) ContentRect

func (s *SwipeActionRow) ContentRect(bounds graphics.Rect) graphics.Rect

ContentRect is the content's rect while closed. The paint translates it by the offset, so the content's own frame stays put and the layout is not disturbed by a gesture.

func (*SwipeActionRow) HoverAt

func (s *SwipeActionRow) HoverAt(x, y float32)

HoverAt implements HoverTarget, so the row is told when the pointer leaves it.

func (*SwipeActionRow) IsOpen

func (s *SwipeActionRow) IsOpen() bool

IsOpen reports whether any action is revealed.

func (*SwipeActionRow) Offset

func (s *SwipeActionRow) Offset() float32

Offset is the content's displacement; 0 is closed.

func (*SwipeActionRow) OnMouseDown

func (s *SwipeActionRow) OnMouseDown(x, y float32, button int) bool

func (*SwipeActionRow) OnMouseMove

func (s *SwipeActionRow) OnMouseMove(x, y float32)

func (*SwipeActionRow) OnMouseUp

func (s *SwipeActionRow) OnMouseUp(x, y float32, button int) bool

func (*SwipeActionRow) Open

func (s *SwipeActionRow) Open()

Open reveals the actions, Close hides them.

func (*SwipeActionRow) Paint

func (s *SwipeActionRow) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*SwipeActionRow) PanelAt

func (s *SwipeActionRow) PanelAt(x, y float32) meui.Widget

PanelAt returns the ROW itself, always: a swipe cannot be recognized by the child that would otherwise take the press. The row then decides tap-versus-swipe and forwards a tap.

func (*SwipeActionRow) PreferredDimensions

func (s *SwipeActionRow) PreferredDimensions(target interface{}, w, h float32) (float32, float32)

func (*SwipeActionRow) SetActions

func (s *SwipeActionRow) SetActions(actions []SwipeAction) *SwipeActionRow

func (*SwipeActionRow) SetContent

func (s *SwipeActionRow) SetContent(w meui.Widget) *SwipeActionRow

func (*SwipeActionRow) ValidateLayout

func (s *SwipeActionRow) ValidateLayout()

type Switch

type Switch struct {
	meui.BaseWidget
	*theme.SwitchTheme
	Checked   bool
	Text      string // optional label rendered beside the track
	OnToggled func(bool)
	Animating bool
	// contains filtered or unexported fields
}

func NewSwitch

func NewSwitch() *Switch

func (*Switch) AccessibilityNode added in v0.5.8

func (s *Switch) AccessibilityNode() platform.AccessibilityNode

func (*Switch) Focusable

func (s *Switch) Focusable() bool

func (*Switch) OnKeyDown

func (s *Switch) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool

func (*Switch) OnMouseDown

func (s *Switch) OnMouseDown(x, y float32, button int) bool

func (*Switch) OnMouseMove

func (s *Switch) OnMouseMove(x, y float32)

func (*Switch) Paint

func (s *Switch) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*Switch) PerformAccessibilityAction added in v0.5.12

func (s *Switch) PerformAccessibilityAction(action platform.AccessibilityAction) bool

func (*Switch) SetBoundProperty

func (s *Switch) SetBoundProperty(propName string, value interface{})

func (*Switch) SetChecked

func (s *Switch) SetChecked(checked bool) *Switch

func (*Switch) SetOnToggled

func (s *Switch) SetOnToggled(handler func(bool)) *Switch

func (*Switch) SetText

func (s *Switch) SetText(text string) *Switch

SetText sets an optional label rendered to the right of the track.

type SyntaxTheme

type SyntaxTheme struct {
	Default         SyntaxTokenStyle
	Keyword         SyntaxTokenStyle
	String          SyntaxTokenStyle
	Number          SyntaxTokenStyle
	Comment         SyntaxTokenStyle
	Type            SyntaxTokenStyle
	Function        SyntaxTokenStyle
	Variable        SyntaxTokenStyle
	Constant        SyntaxTokenStyle
	Operator        SyntaxTokenStyle
	Punctuation     SyntaxTokenStyle
	Annotation      SyntaxTokenStyle
	Preprocessor    SyntaxTokenStyle
	Regex           SyntaxTokenStyle
	Escape          SyntaxTokenStyle
	Parameter       SyntaxTokenStyle
	Property        SyntaxTokenStyle
	Tag             SyntaxTokenStyle
	Attribute       SyntaxTokenStyle
	DiffAdd         SyntaxTokenStyle
	DiffDelete      SyntaxTokenStyle
	DiffChange      SyntaxTokenStyle
	MarkdownHeading SyntaxTokenStyle
	MarkdownLink    SyntaxTokenStyle
	MarkdownList    SyntaxTokenStyle
	Error           SyntaxTokenStyle
	Warning         SyntaxTokenStyle
	Info            SyntaxTokenStyle
}

func DefaultSyntaxTheme

func DefaultSyntaxTheme() *SyntaxTheme

func LightSyntaxTheme

func LightSyntaxTheme() *SyntaxTheme

type SyntaxToken

type SyntaxToken struct {
	Type  TokenType
	Start int
	End   int
}

type SyntaxTokenStyle

type SyntaxTokenStyle struct {
	Color     graphics.Color
	Bold      bool
	Italic    bool
	Underline bool
}

type SyntaxTokenizer

type SyntaxTokenizer interface {
	Tokenize(line string, lineNum int, prevState interface{}) ([]SyntaxToken, interface{})
	LanguageName() string
	Extensions() []string
}

func GetTokenizer

func GetTokenizer(filename, lang string) SyntaxTokenizer

type TabActionButton

type TabActionButton struct {
	Label   string
	Tooltip string
	Width   float32 // 0 = default 24
	OnClick func()
	// contains filtered or unexported fields
}

TabActionButton is a custom button rendered at the end of the tab bar.

type TabItem

type TabItem struct {
	ID       string
	Title    string
	Icon     string // SVG icon name or emoji
	IconSize float32
	Content  meui.Widget
	Pinned   bool   // pinned tabs show pin icon instead of close button
	Tooltip  string // optional, falls back to Title
}

type TabPanel

type TabPanel struct {
	meui.BaseContainer
	*theme.TabTheme

	Closable bool // when true, unpinned tabs show close button, pinned tabs show pin icon

	Orientation int // TabHorizontal or TabVertical

	// Callbacks
	OnTabChanged  func(index int)
	OnTabDetached func(tabIndex int, title string, content meui.Widget, localX, localY float32)
	OnTabRenamed  func(tabIndex int, oldTitle, newTitle string)
	OnClose       func(tabID, tabName string) bool

	// Custom action buttons at end of tab bar
	ActionButtons []TabActionButton
	// contains filtered or unexported fields
}

func NewTabPanel

func NewTabPanel() *TabPanel

func (*TabPanel) AccessibilityNode added in v0.5.29

func (t *TabPanel) AccessibilityNode() platform.AccessibilityNode

func (*TabPanel) AccessibilityVirtualChildren added in v0.5.29

func (t *TabPanel) AccessibilityVirtualChildren() []meui.AccessibilityVirtualChild

AccessibilityVirtualChildren exposes each tab as a semantic node. Tabs are data, not widgets, so without this a screen reader sees only the active page.

func (*TabPanel) ActiveTab

func (t *TabPanel) ActiveTab() int

func (*TabPanel) AddTab

func (t *TabPanel) AddTab(title string, content meui.Widget)

func (*TabPanel) AddTabEx

func (t *TabPanel) AddTabEx(id, title, icon string, content meui.Widget, pinned bool)

func (*TabPanel) Children

func (t *TabPanel) Children() []meui.Widget

func (*TabPanel) ChildrenI

func (t *TabPanel) ChildrenI() []interface{}

func (*TabPanel) DropHitTest

func (t *TabPanel) DropHitTest(lx, ly float32) *DropZoneInfo

DropHitTest returns a DropZoneInfo if (lx, ly) in TabPanel-local coords is on the tab bar, indicating the TabPanel can accept a merge.

func (*TabPanel) Focusable

func (t *TabPanel) Focusable() bool

func (*TabPanel) InsertTab

func (t *TabPanel) InsertTab(index int, title string, content meui.Widget)

func (*TabPanel) OnKeyDown

func (t *TabPanel) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool

func (*TabPanel) OnMouseDown

func (t *TabPanel) OnMouseDown(x, y float32, button int) bool

func (*TabPanel) OnMouseMove

func (t *TabPanel) OnMouseMove(x, y float32)

func (*TabPanel) OnMouseUp

func (t *TabPanel) OnMouseUp(x, y float32, button int) bool

func (*TabPanel) OnMouseWheel

func (t *TabPanel) OnMouseWheel(x, y float32, dx, dy float32) bool

func (*TabPanel) Paint

func (t *TabPanel) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*TabPanel) PanelAt

func (t *TabPanel) PanelAt(x, y float32) meui.Widget

func (*TabPanel) RemoveTab

func (t *TabPanel) RemoveTab(index int)

func (*TabPanel) RestoreState added in v0.5.34

func (t *TabPanel) RestoreState(v any) bool

func (*TabPanel) SaveState added in v0.5.34

func (t *TabPanel) SaveState() any

func (*TabPanel) SetActiveTab

func (t *TabPanel) SetActiveTab(index int)

func (*TabPanel) SetClosable

func (t *TabPanel) SetClosable(closable bool)

func (*TabPanel) SetEnabled

func (t *TabPanel) SetEnabled(enabled bool) *TabPanel

func (*TabPanel) SetFrameRect

func (t *TabPanel) SetFrameRect(rect graphics.Rect)

func (*TabPanel) SetTabIcon

func (t *TabPanel) SetTabIcon(index int, icon string) bool

SetTabIcon changes the tab's icon at runtime.

func (*TabPanel) SetTabText

func (t *TabPanel) SetTabText(index int, title string) bool

SetTabText renames the tab at index at runtime.

func (*TabPanel) SetTabsVisible

func (t *TabPanel) SetTabsVisible(v bool)

SetTabsVisible shows or hides the tab strip. Hiding it keeps the panel as the page host — SetActiveTab still switches pages and the content fills the whole rect — which is what a phone shell needs when the destinations live in a NavigationBar instead.

func (*TabPanel) TabCount

func (t *TabPanel) TabCount() int

func (*TabPanel) TabHeaderRect

func (t *TabPanel) TabHeaderRect(index int) (graphics.Rect, bool)

TabHeaderRect returns the header rect of tab index in widget-local coordinates. Mirrors the layout math used by hitTestTab and the painters; ok is false when the index is out of range. Useful for behavioral tests that need to click a specific tab header.

func (*TabPanel) TabsVisible

func (t *TabPanel) TabsVisible() bool

TabsVisible reports whether the tab strip is drawn.

func (*TabPanel) ValidateLayout

func (t *TabPanel) ValidateLayout()

type TabStrip

type TabStrip struct {
	meui.BaseWidget
	*theme.TabTheme

	// OnSelectionChanged fires when the selection moves, by click or by keyboard. It is
	// the radio group's whole interface: the index is the payload.
	OnSelectionChanged func(index int)
	// contains filtered or unexported fields
}

tabstrip.go — TabStrip: a segmented control that looks like a tab bar.

It behaves as a radio group — exactly one item is selected, clicking selects, and a client listens for the change — but it draws its items with the SAME painter a TabPanel's bar uses (tabbar.go), so a strip and a panel's tabs in one window look like the same control.

It is deliberately NOT a TabPanel with the body hidden. TabPanel keeps growing features a radio group has no use for — content panes, close buttons, drag reorder, tab detaching, a tab context menu — and inheriting those would mean every one of them had to be switched off, then re-checked whenever TabPanel grew another. The two share their APPEARANCE and nothing else.

func NewTabStrip

func NewTabStrip() *TabStrip

NewTabStrip builds an empty strip pointing at the shared default tab theme, so it restyles with TabPanel and with a theme switch.

func (*TabStrip) AccessibilityNode added in v0.5.39

func (s *TabStrip) AccessibilityNode() platform.AccessibilityNode

func (*TabStrip) AccessibilityVirtualChildren added in v0.5.39

func (s *TabStrip) AccessibilityVirtualChildren() []meui.AccessibilityVirtualChild

func (*TabStrip) AddItem

func (s *TabStrip) AddItem(item TabStripItem) *TabStrip

AddItem appends an item, selecting it if it is the first selectable one.

func (*TabStrip) Count

func (s *TabStrip) Count() int

Count is the number of items.

func (*TabStrip) CursorAt

func (s *TabStrip) CursorAt(x, y float32) *platform.Cursor

CursorAt reports the pointer cursor: a hand over a selectable item, so the strip reads as clickable.

func (*TabStrip) Focusable

func (s *TabStrip) Focusable() bool

Focusable lets the strip take focus, which is what makes the arrow keys reach it.

func (*TabStrip) ItemAt

func (s *TabStrip) ItemAt(x, y float32) int

ItemAt returns the item under a widget-local point, or -1.

func (*TabStrip) ItemRect

func (s *TabStrip) ItemRect(i int) (graphics.Rect, bool)

ItemRect is item i's rect in widget-local coordinates, for a caller that wants to position something over it (a badge, a test click).

func (*TabStrip) Items

func (s *TabStrip) Items() []TabStripItem

Items returns the items, for a caller that rebuilds or inspects them.

func (*TabStrip) OnBlur

func (s *TabStrip) OnBlur()

func (*TabStrip) OnFocus

func (s *TabStrip) OnFocus()

OnFocus and OnBlur are no-ops beyond the redraw the focus ring needs.

func (*TabStrip) OnKeyDown

func (s *TabStrip) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool

func (*TabStrip) OnKeyRepeat

func (s *TabStrip) OnKeyRepeat(keyCode platform.KeyCode, mod platform.Modifiers) bool

OnKeyDown walks the selection with the arrow keys, skipping disabled items, and wraps at the ends — what a radio group does. OnKeyRepeat is a key the user is HOLDING — Backspace over a word, an arrow along a row, a scrub. The window classifies an OS auto-repeat as a repeat rather than a fresh press (a widget without this method is asked once, deliberately), so this is what makes a held key work here.

func (*TabStrip) OnMouseDown

func (s *TabStrip) OnMouseDown(x, y float32, button int) bool

OnMouseDown selects the item under the press. There is no drag: a radio group does not reorder itself, and a press that moved an item would be a surprise.

func (*TabStrip) OnMouseLeave

func (s *TabStrip) OnMouseLeave()

OnMouseLeave clears the hover, so a strip the pointer left is not left highlighted.

func (*TabStrip) OnMouseMove

func (s *TabStrip) OnMouseMove(x, y float32)

OnMouseMove tracks the hovered item, so the bar highlights what a press would select. OnMouseMove tracks the hovered item. It takes no return value because that is the signature meui.EventListener declares, and a widget whose signature differs does not satisfy the interface — the window then silently skips its OnMouseDown, so it renders perfectly and takes no input at all. It returned bool once, and that is exactly what happened: the strip was visible, correct and completely unclickable.

func (*TabStrip) Paint

func (s *TabStrip) Paint(canvas *graphics.Canvas, rect graphics.Rect)

Paint draws the bar. There is no body: the strip IS the bar.

func (*TabStrip) PreferredSize

func (s *TabStrip) PreferredSize() (float32, float32)

PreferredSize is the strip's natural size: the width its items need and the bar's height. Note that the layout package does NOT consult this — it lays widgets out from their explicit width/height — so a caller still sets the strip's height (the bar height) and lets the layout give it a width. PreferredSize is for an app that sizes the strip itself.

func (*TabStrip) SelectID

func (s *TabStrip) SelectID(id string) bool

SelectID selects by ID and reports whether it found a selectable item.

func (*TabStrip) Selected

func (s *TabStrip) Selected() int

Selected is the selected index, or -1 when there is nothing selectable.

func (*TabStrip) SelectedID

func (s *TabStrip) SelectedID() string

SelectedID is the selected item's ID, or "" when there is no selection.

func (*TabStrip) SelectedLabel

func (s *TabStrip) SelectedLabel() string

SelectedLabel is the selected item's label, or "" when there is no selection.

func (*TabStrip) SetEnabled

func (s *TabStrip) SetEnabled(enabled bool) *TabStrip

SetEnabled disables the whole strip, which dims every item and refuses every press.

func (*TabStrip) SetItemDisabled

func (s *TabStrip) SetItemDisabled(index int, disabled bool) bool

SetItemDisabled enables or disables one item at runtime. Disabling the SELECTED item moves the selection to the next selectable one, because leaving the selection on a dead item would show a control that cannot be used.

func (*TabStrip) SetItems

func (s *TabStrip) SetItems(items []TabStripItem) *TabStrip

SetItems replaces the items. The selection is kept when the index still exists and otherwise moves to the first selectable item, because a strip with no selection is not a radio group.

func (*TabStrip) SetSelected

func (s *TabStrip) SetSelected(index int) bool

SetSelected selects an index. It reports false when the index is out of range or the item is disabled — a disabled item is not selectable, which is the point of having one — and fires OnSelectionChanged when the selection actually moves.

type TabStripItem

type TabStripItem struct {
	// ID is an optional caller-defined key, reported alongside the index.
	ID string
	// Label is the item's text. An item with no label and an icon is icon-only.
	Label string
	// Icon is an SVG name (see meui.LoadSVGByName) or, failing that, a glyph string.
	Icon string
	// IconSize overrides the icon box; zero uses the bar's default.
	IconSize float32
	// Disabled draws the item dimmed, refuses to select it, and skips it when the
	// keyboard walks the strip.
	Disabled bool
}

TabStripItem is one item in a strip: a label, an optional icon, and whether it can be selected. A disabled item is drawn dimmed and skipped by the keyboard, which is what makes a strip usable for "this option is not available right now" — a radio group with a dead option.

type Table

type Table struct {
	meui.BaseWidget
	*theme.TableTheme
	Columns             []string
	Rows                [][]TableCell
	SelectedRows        map[int]bool
	LastClickedRow      int
	SelectedCol         int
	HoveredRow          int
	ScrollOffset        float32
	RowHeight           float32
	HeaderHeight        float32
	AlternatingRows     bool
	ShowGrid            bool
	ShowHorizontalLines bool
	ShowVerticalLines   bool
	RowSelection        bool
	ColSelection        bool
	IntercellSpacing    float32
	GridColor           graphics.Color
	OnCellSelected      func(row, col int, cell *TableCell)

	VScroll *ScrollBar
	// contains filtered or unexported fields
}

func NewTable

func NewTable() *Table

func (*Table) AccessibilityNode added in v0.5.31

func (t *Table) AccessibilityNode() platform.AccessibilityNode

func (*Table) AccessibilityVirtualChildren added in v0.5.31

func (t *Table) AccessibilityVirtualChildren() []meui.AccessibilityVirtualChild

AccessibilityVirtualChildren exposes visible rows. Cell-level semantics need a hierarchical virtual model; row labels and selection are the useful first step for a screen reader scanning a table.

func (*Table) AddRow

func (t *Table) AddRow(cells []TableCell) *Table

func (*Table) CursorAt

func (t *Table) CursorAt(x, y float32) *platform.Cursor

func (*Table) Focusable

func (t *Table) Focusable() bool

func (*Table) OnCharacter

func (t *Table) OnCharacter(ch rune)

func (*Table) OnKeyDown

func (t *Table) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool

func (*Table) OnKeyRepeat

func (t *Table) OnKeyRepeat(keyCode platform.KeyCode, mod platform.Modifiers) bool

OnKeyRepeat is a key the user is HOLDING — Backspace over a word, an arrow along a row, a scrub. The window classifies an OS auto-repeat as a repeat rather than a fresh press (a widget without this method is asked once, deliberately), so this is what makes a held key work here.

func (*Table) OnMouseDown

func (t *Table) OnMouseDown(x, y float32, button int) bool

func (*Table) OnMouseMove

func (t *Table) OnMouseMove(x, y float32)

func (*Table) OnMouseUp

func (t *Table) OnMouseUp(x, y float32, button int) bool

func (*Table) OnMouseWheel

func (t *Table) OnMouseWheel(x, y float32, dx, dy float32) bool

func (*Table) Paint

func (t *Table) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*Table) PerformAccessibilityAction added in v0.5.37

func (t *Table) PerformAccessibilityAction(action platform.AccessibilityAction) bool

func (*Table) RestoreState added in v0.5.38

func (t *Table) RestoreState(v any) bool

func (*Table) SaveState added in v0.5.38

func (t *Table) SaveState() any

func (*Table) SetBoundProperty

func (t *Table) SetBoundProperty(propName string, value interface{})

func (*Table) SetCell

func (t *Table) SetCell(row, col int, cell TableCell)

func (*Table) SetColumns

func (t *Table) SetColumns(cols []string) *Table

func (*Table) SetRows

func (t *Table) SetRows(rows [][]TableCell) *Table

type TableCell

type TableCell struct {
	Text     string
	IsCheck  bool
	Checked  bool
	Icon     string
	IconSize float32
	Color    string
	BgColor  string
	OnRender func(canvas *graphics.Canvas, rect graphics.Rect, selected bool)
	// contains filtered or unexported fields
}

type TextArea

type TextArea struct {
	meui.BaseWidget
	*theme.TextAreaTheme
	Value           string
	Placeholder     string
	Focused         bool
	CursorLine      int
	CursorCol       int
	SelectStart     int
	SelectEnd       int
	ScrollOffset    float32
	CursorVisible   bool
	CursorTimer     *time.Timer
	OnTextChanged   func(string)
	ShowLineNumbers bool
	ShowScrollBar   bool
	WordWrap        bool
	ReadOnly        bool
	// Overwrite replaces the character under the caret instead of inserting before it. Insert toggles.
	Overwrite bool
	MaxLength int
	VScroll   *ScrollBar
	// contains filtered or unexported fields
}

func NewTextArea

func NewTextArea() *TextArea

func (*TextArea) AccessibilityNode added in v0.5.28

func (t *TextArea) AccessibilityNode() platform.AccessibilityNode

func (*TextArea) AppendText

func (t *TextArea) AppendText(text string)

AppendText adds text at the end of the buffer (ignores read-only mode? no — it respects it like Qt's read-only append; pass SetReadOnly(false) first).

func (*TextArea) Clear

func (t *TextArea) Clear()

Clear removes all text.

func (*TextArea) Copy

func (t *TextArea) Copy()

func (*TextArea) CursorAt

func (t *TextArea) CursorAt(x, y float32) *platform.Cursor

CursorAt reports the I-beam over the editable text; the line-number gutter and the scrollbar keep the default arrow.

func (*TextArea) Cut

func (t *TextArea) Cut()

func (*TextArea) Dispose

func (t *TextArea) Dispose()

func (*TextArea) Focusable

func (t *TextArea) Focusable() bool

func (*TextArea) GetSelectedText

func (t *TextArea) GetSelectedText() string

GetSelectedText returns the selected text, or "" if nothing is selected.

func (*TextArea) IsReadOnly

func (t *TextArea) IsReadOnly() bool

func (*TextArea) MinimumDimensions

func (t *TextArea) MinimumDimensions() (float32, float32)

func (*TextArea) OnBlur

func (t *TextArea) OnBlur()

func (*TextArea) OnCharacter

func (t *TextArea) OnCharacter(ch rune)

func (*TextArea) OnComposition

func (t *TextArea) OnComposition(text string, start, length int) bool

OnComposition shows the IME's in-progress text, replacing the previous preedit; empty text means the composition was cancelled. It is not undoable and does not fire OnTextChanged — the committed characters arrive through OnCharacter.

func (*TextArea) OnDragDrop

func (t *TextArea) OnDragDrop(data *meui.DragData, x, y float32)

OnDragDrop inserts the dragged text at the pointer. A drop into the area it came from MOVES it (the source selection is cut first), and a drop inside that selection is a no-op.

func (*TextArea) OnDragEnter

func (t *TextArea) OnDragEnter(data *meui.DragData, x, y float32)

func (*TextArea) OnDragLeave

func (t *TextArea) OnDragLeave(data *meui.DragData)

func (*TextArea) OnDragOver

func (t *TextArea) OnDragOver(data *meui.DragData, x, y float32)

func (*TextArea) OnDragStart

func (t *TextArea) OnDragStart(x, y float32) *meui.DragData

OnDragStart starts a drag when the press landed inside the selection.

func (*TextArea) OnFocus

func (t *TextArea) OnFocus()

func (*TextArea) OnKeyDown

func (t *TextArea) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool

func (*TextArea) OnKeyRepeat

func (t *TextArea) OnKeyRepeat(keyCode platform.KeyCode, mod platform.Modifiers) bool

OnKeyRepeat is a key the user is HOLDING — Backspace over a word, an arrow along a row, a scrub. The window classifies an OS auto-repeat as a repeat rather than a fresh press (a widget without this method is asked once, deliberately), so this is what makes a held key work here.

func (*TextArea) OnMouseDown

func (t *TextArea) OnMouseDown(x, y float32, button int) bool

func (*TextArea) OnMouseMove

func (t *TextArea) OnMouseMove(x, y float32)

func (*TextArea) OnMouseUp

func (t *TextArea) OnMouseUp(x, y float32, button int) bool

func (*TextArea) OnMouseWheel

func (t *TextArea) OnMouseWheel(x, y float32, dx, dy float32) bool

func (*TextArea) Paint

func (t *TextArea) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*TextArea) Paste

func (t *TextArea) Paste()

func (*TextArea) PerformAccessibilityAction added in v0.5.28

func (t *TextArea) PerformAccessibilityAction(action platform.AccessibilityAction) bool

func (*TextArea) PreferredDimensions

func (t *TextArea) PreferredDimensions(target interface{}, w, h float32) (float32, float32)

func (*TextArea) RemoveDraggedText

func (t *TextArea) RemoveDraggedText(data *meui.DragData)

RemoveDraggedText deletes the selection a drag borrowed, so a drop elsewhere is a MOVE.

func (*TextArea) RestoreState added in v0.5.34

func (t *TextArea) RestoreState(v any) bool

func (*TextArea) SaveState added in v0.5.34

func (t *TextArea) SaveState() any

func (*TextArea) SelectAll

func (t *TextArea) SelectAll()

func (*TextArea) SelectionLength

func (t *TextArea) SelectionLength() int

SelectionLength returns the selected byte length.

func (*TextArea) SetBoundProperty

func (t *TextArea) SetBoundProperty(propName string, value interface{})

func (*TextArea) SetFrameRect

func (t *TextArea) SetFrameRect(rect graphics.Rect)

func (*TextArea) SetOnTextChanged

func (t *TextArea) SetOnTextChanged(handler func(string)) *TextArea

func (*TextArea) SetPlaceholder

func (t *TextArea) SetPlaceholder(text string) *TextArea

func (*TextArea) SetReadOnly

func (t *TextArea) SetReadOnly(readOnly bool) *TextArea

SetReadOnly disables editing (selection and copy still work).

func (*TextArea) SetSelection

func (t *TextArea) SetSelection(start, end int)

SetSelection selects [start, end) byte offsets (clamped) and moves the cursor to the end of the selection.

func (*TextArea) SetShowLineNumbers

func (t *TextArea) SetShowLineNumbers(show bool) *TextArea

func (*TextArea) SetShowScrollBar

func (t *TextArea) SetShowScrollBar(show bool) *TextArea

func (*TextArea) SetText

func (t *TextArea) SetText(text string) *TextArea

func (*TextArea) SetValue

func (t *TextArea) SetValue(text string) *TextArea

func (*TextArea) SetWordWrap

func (t *TextArea) SetWordWrap(wrap bool) *TextArea

func (*TextArea) ValueText

func (t *TextArea) ValueText() string

type TextDocumentClientCapabilities

type TextDocumentClientCapabilities struct {
	Synchronization struct {
		DynamicRegistration bool `json:"dynamicRegistration"`
		WillSave            bool `json:"willSave"`
		WillSaveWaitUntil   bool `json:"willSaveWaitUntil"`
		DidSave             bool `json:"didSave"`
	} `json:"synchronization"`
	Completion struct {
		DynamicRegistration bool     `json:"dynamicRegistration"`
		CompletionItem      struct{} `json:"completionItem"`
	} `json:"completion"`
	Hover struct {
		DynamicRegistration bool `json:"dynamicRegistration"`
	} `json:"hover"`
	SignatureHelp struct {
		DynamicRegistration bool `json:"dynamicRegistration"`
	} `json:"signatureHelp"`
	Declaration struct {
		DynamicRegistration bool `json:"dynamicRegistration"`
	} `json:"declaration"`
	Definition struct {
		DynamicRegistration bool `json:"dynamicRegistration"`
	} `json:"definition"`
	TypeDefinition struct {
		DynamicRegistration bool `json:"dynamicRegistration"`
	} `json:"typeDefinition"`
	Implementation struct {
		DynamicRegistration bool `json:"dynamicRegistration"`
	} `json:"implementation"`
	References struct {
		DynamicRegistration bool `json:"dynamicRegistration"`
	} `json:"references"`
	DocumentHighlight struct {
		DynamicRegistration bool `json:"dynamicRegistration"`
	} `json:"documentHighlight"`
	DocumentSymbol struct {
		DynamicRegistration bool `json:"dynamicRegistration"`
	} `json:"documentSymbol"`
	Formatting struct {
		DynamicRegistration bool `json:"dynamicRegistration"`
	} `json:"formatting"`
	RangeFormatting struct {
		DynamicRegistration bool `json:"dynamicRegistration"`
	} `json:"rangeFormatting"`
	OnTypeFormatting struct {
		DynamicRegistration bool `json:"dynamicRegistration"`
	} `json:"onTypeFormatting"`
	Rename struct {
		DynamicRegistration bool `json:"dynamicRegistration"`
	} `json:"rename"`
	CodeAction struct {
		DynamicRegistration bool `json:"dynamicRegistration"`
	} `json:"codeAction"`
}

type TextDocumentIdentifier

type TextDocumentIdentifier struct {
	URI string `json:"uri"`
}

type TextDocumentItem

type TextDocumentItem struct {
	URI        string `json:"uri"`
	LanguageID string `json:"languageId"`
	Version    int    `json:"version"`
	Text       string `json:"text"`
}

type TextDocumentPositionParams

type TextDocumentPositionParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
	Position     Position               `json:"position"`
}

type TextField

type TextField struct {
	meui.BaseWidget
	*theme.TextFieldTheme
	Text         string
	Placeholder  string
	EchoChar     rune
	ShowPassword bool
	MaxLength    int
	ReadOnly     bool   // text cannot be edited; selection/copy allowed
	HAlign       string // "left" (default), "center", "right"
	// Overwrite means INSERT mode's opposite: the character under the caret is replaced instead of
	// pushed right. A plain Insert key toggles it, as in every editor that has the mode.
	Overwrite     bool
	Focused       bool
	CursorPos     int // byte index into t.Text
	SelectStart   int // byte index
	SelectEnd     int // byte index
	CursorVisible bool
	CursorTimer   *time.Timer
	OnTextChanged func(string)
	OnSubmit      func(string)
	OnFocusGained func()
	OnFocusLost   func()

	ValidationState string
	LeadingIcon     string
	TrailingIcon    string
	// contains filtered or unexported fields
}

func NewTextField

func NewTextField() *TextField

func (*TextField) AccessibilityNode added in v0.5.8

func (f *TextField) AccessibilityNode() platform.AccessibilityNode

func (*TextField) Clear

func (t *TextField) Clear()

Clear removes all text (respecting read-only mode).

func (*TextField) ClearUndo

func (t *TextField) ClearUndo()

func (*TextField) Copy

func (t *TextField) Copy()

func (*TextField) CursorAt

func (t *TextField) CursorAt(x, y float32) *platform.Cursor

CursorAt reports the I-beam over the editable text and leaves the icons to the default arrow.

func (*TextField) Cut

func (t *TextField) Cut()

func (*TextField) Dispose

func (t *TextField) Dispose()

Dispose cleans up the TextField resources, especially the cursor timer.

func (*TextField) Focusable

func (t *TextField) Focusable() bool

func (*TextField) GetSelectedText

func (t *TextField) GetSelectedText() string

GetSelectedText returns the selected text, or "" if nothing is selected.

func (*TextField) IsReadOnly

func (t *TextField) IsReadOnly() bool

func (*TextField) MinimumDimensions

func (t *TextField) MinimumDimensions() (float32, float32)

func (*TextField) OnBlur

func (t *TextField) OnBlur()

func (*TextField) OnCharacter

func (t *TextField) OnCharacter(ch rune)

OnCharacter handles character input (IME, unicode, etc.).

func (*TextField) OnComposition

func (t *TextField) OnComposition(text string, start, length int) bool

OnComposition shows the IME's in-progress text. It is called on every composition change, so the previous preedit is removed first; an EMPTY text means the composition was cancelled. The preedit is deliberately not undoable and does not fire OnTextChanged — it is replaced by the committed characters through OnCharacter.

func (*TextField) OnDragDrop

func (t *TextField) OnDragDrop(data *meui.DragData, x, y float32)

OnDragDrop inserts the dragged text at the pointer. A drop into the field it came from MOVES the text (the source selection is cut first), and a drop inside that same selection is a no-op — both as in every editor.

func (*TextField) OnDragEnter

func (t *TextField) OnDragEnter(data *meui.DragData, x, y float32)

OnDragEnter records where the drop would land, so OnDragLeave can put the caret back.

func (*TextField) OnDragLeave

func (t *TextField) OnDragLeave(data *meui.DragData)

func (*TextField) OnDragOver

func (t *TextField) OnDragOver(data *meui.DragData, x, y float32)

func (*TextField) OnDragStart

func (t *TextField) OnDragStart(x, y float32) *meui.DragData

OnDragStart starts a drag when the press landed inside the selection. Any other press is a selection gesture, which is why the editor does not begin a drag for every mouse movement.

func (*TextField) OnFocus

func (t *TextField) OnFocus()

func (*TextField) OnKeyDown

func (t *TextField) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool

func (*TextField) OnKeyRepeat

func (t *TextField) OnKeyRepeat(keyCode platform.KeyCode, mod platform.Modifiers) bool

OnKeyRepeat is a key the user is HOLDING — Backspace over a word, an arrow along a row, a scrub. The window classifies an OS auto-repeat as a repeat rather than a fresh press (a widget without this method is asked once, deliberately), so this is what makes a held key work here.

func (*TextField) OnMouseDown

func (t *TextField) OnMouseDown(x, y float32, button int) bool

func (*TextField) OnMouseMove

func (t *TextField) OnMouseMove(x, y float32)

func (*TextField) OnMouseUp

func (t *TextField) OnMouseUp(x, y float32, button int) bool

func (*TextField) Paint

func (t *TextField) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*TextField) Paste

func (t *TextField) Paste()

func (*TextField) PerformAccessibilityAction added in v0.5.15

func (f *TextField) PerformAccessibilityAction(action platform.AccessibilityAction) bool

func (*TextField) PreferredDimensions

func (t *TextField) PreferredDimensions(target interface{}, w, h float32) (float32, float32)

func (*TextField) Redo

func (t *TextField) Redo() bool

func (*TextField) RemoveDraggedText

func (t *TextField) RemoveDraggedText(data *meui.DragData)

RemoveDraggedText deletes the selection a drag borrowed, so a drop elsewhere is a MOVE. The source can still refuse (a drag that ended over nothing never calls this).

func (*TextField) RestoreState added in v0.5.34

func (t *TextField) RestoreState(v any) bool

func (*TextField) SaveState added in v0.5.34

func (t *TextField) SaveState() any

func (*TextField) SelectAll

func (t *TextField) SelectAll()

func (*TextField) SelectionLength

func (t *TextField) SelectionLength() int

SelectionLength returns the selected byte length.

func (*TextField) SetBoundProperty

func (t *TextField) SetBoundProperty(propName string, value interface{})

func (*TextField) SetEchoChar

func (t *TextField) SetEchoChar(ch rune) *TextField

func (*TextField) SetHAlign

func (t *TextField) SetHAlign(align string) *TextField

SetHAlign sets horizontal text alignment: "left", "center" or "right".

func (*TextField) SetLeadingIcon

func (t *TextField) SetLeadingIcon(icon string) *TextField

func (*TextField) SetMaxLength

func (t *TextField) SetMaxLength(max int) *TextField

func (*TextField) SetOnSubmit

func (t *TextField) SetOnSubmit(handler func(string)) *TextField

func (*TextField) SetOnTextChanged

func (t *TextField) SetOnTextChanged(handler func(string)) *TextField

func (*TextField) SetPlaceholder

func (t *TextField) SetPlaceholder(text string) *TextField

func (*TextField) SetReadOnly

func (t *TextField) SetReadOnly(readOnly bool) *TextField

SetReadOnly disables text editing (selection and copy still work), like QLineEdit.setReadOnly.

func (*TextField) SetSelection

func (t *TextField) SetSelection(start, end int)

SetSelection selects [start, end) in byte indices (clamped). Also moves the cursor to end, like QLineEdit.setSelection semantics.

func (*TextField) SetShowPassword

func (t *TextField) SetShowPassword(show bool) *TextField

func (*TextField) SetText

func (t *TextField) SetText(text string) *TextField

func (*TextField) SetTrailingIcon

func (t *TextField) SetTrailingIcon(icon string) *TextField

func (*TextField) SetValidationState

func (t *TextField) SetValidationState(state string) *TextField

func (*TextField) TogglePassword

func (t *TextField) TogglePassword() *TextField

func (*TextField) Undo

func (t *TextField) Undo() bool

type TextTokenizer

type TextTokenizer struct{}

func (*TextTokenizer) Extensions

func (t *TextTokenizer) Extensions() []string

func (*TextTokenizer) LanguageName

func (t *TextTokenizer) LanguageName() string

func (*TextTokenizer) Tokenize

func (t *TextTokenizer) Tokenize(line string, lineNum int, prevState interface{}) ([]SyntaxToken, interface{})

type TimePicker

type TimePicker struct {
	meui.BaseContainer
	// contains filtered or unexported fields
}

TimePicker is a time field: an editable HH:MM text box with a button that opens a time panel under it — a clock-face grid, or the mobile-style rollers (SetStyle). Either way any time is a click or a wheel away, and minutes are exact (not five-minute steps).

The text is parsed leniently (9:5, 09:05, 09:05:30) and normalised on Enter. Seconds are carried and shown only when SetShowSeconds says so; the panel picks hours and minutes.

func NewTimePicker

func NewTimePicker() *TimePicker

NewTimePicker returns a picker showing the current local time.

func (*TimePicker) Clear

func (t *TimePicker) Clear() *TimePicker

Clear unsets the picker: the field empties (showing its placeholder) and HasTime goes false, without firing OnTimeChanged.

func (*TimePicker) CursorAt

func (t *TimePicker) CursorAt(x, y float32) *platform.Cursor

CursorAt returns nil: the deepest hit under the pointer is the field, whose own CursorAt reports the text cursor, or the button, which keeps the arrow.

func (*TimePicker) Expanded

func (t *TimePicker) Expanded() bool

Expanded reports whether the time panel is open.

func (*TimePicker) HandleMouseDown

func (t *TimePicker) HandleMouseDown(lx, ly float32, button int) bool

func (*TimePicker) HandleMouseMove

func (t *TimePicker) HandleMouseMove(lx, ly float32) bool

func (*TimePicker) HandleMouseUp

func (t *TimePicker) HandleMouseUp(lx, ly float32, button int) bool

func (*TimePicker) HasTime

func (t *TimePicker) HasTime() bool

HasTime reports whether the picker holds a time.

func (*TimePicker) OnMouseDown

func (t *TimePicker) OnMouseDown(x, y float32, button int) bool

OnMouseDown, OnMouseUp and OnMouseMove forward to the field or the button under the point: a container dispatches by containment, not to the deepest hit, so a field inside a modal popup would otherwise never see the press.

func (*TimePicker) OnMouseMove

func (t *TimePicker) OnMouseMove(x, y float32)

func (*TimePicker) OnMouseUp

func (t *TimePicker) OnMouseUp(x, y float32, button int) bool

func (*TimePicker) OnMouseWheel

func (t *TimePicker) OnMouseWheel(x, y float32, dx, dy float32) bool

OnMouseWheel scrolls the open panel. The layer manager routes the wheel to the picker it belongs to, in layer-local coordinates, so the rollers scroll under the pointer — a wheel up (positive dy) moves the value up, the same direction as dragging the wheel upwards.

func (*TimePicker) Paint

func (t *TimePicker) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*TimePicker) PanelAt

func (t *TimePicker) PanelAt(x, y float32) meui.Widget

PanelAt routes a point to the field or the button.

func (*TimePicker) PanelRect

func (t *TimePicker) PanelRect() graphics.Rect

PanelRect is the open panel's rect in the window's content space, or the zero rect when closed.

func (*TimePicker) Presentation

func (t *TimePicker) Presentation() PickerPresentation

func (*TimePicker) SetBoundProperty

func (t *TimePicker) SetBoundProperty(propName string, value interface{})

SetBoundProperty applies a QML property (the loader routes unhandled properties here — see qml.HandleProperty).

func (*TimePicker) SetEnabled

func (t *TimePicker) SetEnabled(enabled bool) *TimePicker

SetEnabled enables or disables the field and its button together.

func (*TimePicker) SetExpanded

func (t *TimePicker) SetExpanded(expanded bool) *TimePicker

SetExpanded opens or closes the time panel.

func (*TimePicker) SetFrameRect

func (t *TimePicker) SetFrameRect(rect graphics.Rect)

func (*TimePicker) SetOnTimeChanged

func (t *TimePicker) SetOnTimeChanged(handler func(hour, minute, second int)) *TimePicker

SetOnTimeChanged registers the callback fired when the user commits a time — by picking cells or by pressing Enter on a valid one.

func (*TimePicker) SetPlaceholder

func (t *TimePicker) SetPlaceholder(text string) *TimePicker

SetPlaceholder sets the text shown while the field is empty.

func (*TimePicker) SetPresentation

func (t *TimePicker) SetPresentation(p PickerPresentation) *TimePicker

SetPresentation selects where the panel appears: anchored under the field, or a bottom sheet. Auto — the default — follows the surface's size class, so a phone gets the sheet.

func (*TimePicker) SetShowSeconds

func (t *TimePicker) SetShowSeconds(show bool) *TimePicker

SetShowSeconds shows (and accepts) seconds. Hours and minutes are what the panel picks either way.

func (*TimePicker) SetStyle

func (t *TimePicker) SetStyle(style TimePickerStyle) *TimePicker

SetStyle selects the panel's presentation.

func (*TimePicker) SetText

func (t *TimePicker) SetText(text string) *TimePicker

SetText sets the field from text — the QML `text` property. A value that is not a time is shown as typed and leaves the current time in place.

func (*TimePicker) SetTime

func (t *TimePicker) SetTime(hour, minute, second int) *TimePicker

SetTime sets the value (and the field) without firing OnTimeChanged: a programmatic set is not a user edit.

func (*TimePicker) Style

func (t *TimePicker) Style() TimePickerStyle

Style returns the current presentation.

func (*TimePicker) Text

func (t *TimePicker) Text() string

Text returns the field's text, exactly as shown.

func (*TimePicker) Time

func (t *TimePicker) Time() (hour, minute, second int)

Time returns the current hour, minute and second. HasTime says whether there is one: after Clear the field is empty and the returned value is the last time the picker had.

func (*TimePicker) ValidateLayout

func (t *TimePicker) ValidateLayout()

ValidateLayout places the field and the button inside the frame.

type TimePickerStyle

type TimePickerStyle int

TimePickerStyle selects what the picker's panel looks like.

const (
	// TimePickerGrid is a clock-face grid: hours in two columns of twelve,
	// minutes in five. Every cell is a value, so any time is one click away.
	TimePickerGrid TimePickerStyle = iota
	// TimePickerRollers is the mobile-app wheel: one scrollable column of hours
	// and one of minutes, the centred row being the value. Scroll it with the
	// mouse wheel, drag it, or tap a visible neighbour to bring it to the centre.
	TimePickerRollers
)

type TitleBarButton

type TitleBarButton struct {
	Icon    string // SVG icon name
	Tooltip string
	OnClick func()
}

TitleBarButton defines a custom button in the window title bar.

type TokenType

type TokenType int
const (
	TokenDefault TokenType = iota
	TokenKeyword
	TokenString
	TokenNumber
	TokenComment
	TokenTypeName
	TokenFunction
	TokenVariable
	TokenConstant
	TokenOperator
	TokenPunctuation
	TokenAnnotation
	TokenPreprocessor
	TokenRegex
	TokenEscape
	TokenParameter
	TokenProperty
	TokenTag
	TokenAttribute
	TokenError
	TokenWarning
	TokenInfo
	TokenMarkdownHeading
	TokenMarkdownLink
	TokenMarkdownList
)

func (TokenType) String

func (tt TokenType) String() string

type TokenizerState

type TokenizerState int
const (
	StateNormal TokenizerState = iota
	StateLineComment
	StateBlockComment
	StateStringSingle
	StateStringDouble
	StateStringBacktick
	StateRawString
	StateRegex
	StateHereDoc
)

type ToolBar

type ToolBar struct {
	meui.BaseWidget
	*theme.ToolBarTheme
	// contains filtered or unexported fields
}

func NewToolBar

func NewToolBar() *ToolBar

func (*ToolBar) AddButton

func (t *ToolBar) AddButton(text, icon string) *ToolBar

func (*ToolBar) AddSeparator

func (t *ToolBar) AddSeparator() *ToolBar

func (*ToolBar) AddToggle

func (t *ToolBar) AddToggle(text, icon string) *ToolBar

func (*ToolBar) AddWidget

func (t *ToolBar) AddWidget(w meui.Widget) *ToolBar

func (*ToolBar) OnMouseDown

func (t *ToolBar) OnMouseDown(x, y float32, button int) bool

func (*ToolBar) OnMouseMove

func (t *ToolBar) OnMouseMove(x, y float32)

func (*ToolBar) OnMouseUp

func (t *ToolBar) OnMouseUp(x, y float32, button int) bool

func (*ToolBar) Paint

func (t *ToolBar) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*ToolBar) SetBoundProperty

func (t *ToolBar) SetBoundProperty(propName string, value interface{})

func (*ToolBar) SetButtonEnabled

func (t *ToolBar) SetButtonEnabled(index int, enabled bool)

func (*ToolBar) SetButtonToggled

func (t *ToolBar) SetButtonToggled(index int, toggled bool)

func (*ToolBar) SetOnClicked

func (t *ToolBar) SetOnClicked(index int, handler func())

func (*ToolBar) SetSpacing

func (t *ToolBar) SetSpacing(s float32)

func (*ToolBar) SetToolsets

func (t *ToolBar) SetToolsets(toolsets []ToolSet)

func (*ToolBar) SetWrap

func (t *ToolBar) SetWrap(wrap bool)

type ToolButton

type ToolButton struct {
	Text      string
	Icon      string
	Enabled   bool
	Toggle    bool
	Toggled   bool
	OnClicked func()
}

type ToolSet

type ToolSet struct {
	Widgets    []meui.Widget
	Label      string
	Draggable  bool
	HandleRect graphics.Rect
	BoundsRect graphics.Rect
	// contains filtered or unexported fields
}

type Tooltip

type Tooltip struct {
	meui.BaseWidget
	*theme.TooltipTheme
	Text        string
	Delay       time.Duration
	AutoDismiss time.Duration
	// contains filtered or unexported fields
}

func NewTooltip

func NewTooltip() *Tooltip

func (*Tooltip) Dispose

func (t *Tooltip) Dispose()

func (*Tooltip) Hide

func (t *Tooltip) Hide()

func (*Tooltip) Paint

func (t *Tooltip) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*Tooltip) SetAutoDismiss

func (t *Tooltip) SetAutoDismiss(duration time.Duration) *Tooltip

func (*Tooltip) SetBoundProperty

func (t *Tooltip) SetBoundProperty(propName string, value interface{})

func (*Tooltip) SetDelay

func (t *Tooltip) SetDelay(delay time.Duration) *Tooltip

func (*Tooltip) SetText

func (t *Tooltip) SetText(text string) *Tooltip

func (*Tooltip) SetVisibleInternal

func (t *Tooltip) SetVisibleInternal(v bool)

func (*Tooltip) ShowFor

func (t *Tooltip) ShowFor(target meui.Widget)

type TopAppBar

type TopAppBar struct {
	meui.BaseWidget
	*theme.ToolBarTheme

	// OnLeading fires when the leading affordance is used — back, menu, or close.
	OnLeading func()
	// OnAction fires with the action's ID.
	OnAction func(id string)
	// OnOverflow fires when the overflow control is used, with the button's position in
	// the bar's own coordinates, so the app can open a menu there.
	OnOverflow func(x, y float32)
	// contains filtered or unexported fields
}

TopAppBar is the bar at the top of a mobile screen: a leading affordance, a title, and trailing actions, with an overflow control when there are more actions than fit.

It is the top half of the shell the NavigationBar is the bottom half of. Both are form-factor controls — on a desktop the same commands belong in a menu bar — but the bar itself has no opinion about that: it draws, reports, and lets the app decide.

It does NOT own its overflow popup. A popup needs window-level z-order and dismissal, which the toolkit already has in Popup/ContextMenu; a bar that drew its own menu would be clipped by its own rect and would fight the window for input. So the overflow button reports a position and the app opens the menu it already has.

func NewTopAppBar

func NewTopAppBar() *TopAppBar

NewTopAppBar builds an empty bar with no leading control and no actions.

func (*TopAppBar) ActionRect

func (b *TopAppBar) ActionRect(i int) (graphics.Rect, bool)

ActionRect is the i-th trailing action's rect, counting from the RIGHT.

func (*TopAppBar) Actions

func (b *TopAppBar) Actions() []TopAppBarAction

func (*TopAppBar) BarHeight

func (b *TopAppBar) BarHeight() float32

BarHeight is the bar's height. It comes from Metrics.ToolbarHeight because a top app bar IS a toolbar — the same control family, and the presets already carry the platform's number for it (64 on Android, 44 on iOS) — rather than a second metric for the same quantity. The ToolBarTheme has no height of its own, so the metric is the only source and there is nothing to drift.

func (*TopAppBar) HoverAt

func (b *TopAppBar) HoverAt(x, y float32)

HoverAt implements HoverTarget so the bar is told when the pointer leaves it.

func (*TopAppBar) Leading

func (b *TopAppBar) Leading() string

func (*TopAppBar) LeadingRect

func (b *TopAppBar) LeadingRect() (graphics.Rect, bool)

LeadingRect is the leading control's rect in the bar's own coordinates.

func (*TopAppBar) OnMouseDown

func (b *TopAppBar) OnMouseDown(x, y float32, button int) bool

func (*TopAppBar) OnMouseMove

func (b *TopAppBar) OnMouseMove(x, y float32)

func (*TopAppBar) OnMouseUp

func (b *TopAppBar) OnMouseUp(x, y float32, button int) bool

func (*TopAppBar) Overflow

func (b *TopAppBar) Overflow() bool

func (*TopAppBar) OverflowRect

func (b *TopAppBar) OverflowRect() (graphics.Rect, bool)

OverflowRect is the overflow control's rect.

func (*TopAppBar) Paint

func (b *TopAppBar) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*TopAppBar) PreferredDimensions

func (b *TopAppBar) PreferredDimensions(target interface{}, w, h float32) (float32, float32)

PreferredDimensions is how the LAYOUT learns the bar's height, and it is not optional: a bar that only implements PreferredSize gets whatever its frame happened to be — 20px in the demo — and then PAINTS at its real height, drawing over the page below it. That is what happened, and it looked like a content-overflow bug rather than a bar that never declared itself.

func (*TopAppBar) PreferredSize

func (b *TopAppBar) PreferredSize() (float32, float32)

func (*TopAppBar) SetActions

func (b *TopAppBar) SetActions(actions []TopAppBarAction) *TopAppBar

func (*TopAppBar) SetLeading

func (b *TopAppBar) SetLeading(icon, alt string) *TopAppBar

SetLeading sets the leading affordance: "back", "menu", or any other icon name. An empty name draws nothing, which is right for a root screen.

func (*TopAppBar) SetOverflow

func (b *TopAppBar) SetOverflow(on bool) *TopAppBar

SetOverflow draws the overflow control when true, which the app turns on only when it actually has hidden actions — a "more" button with nothing behind it is a dead end.

func (*TopAppBar) SetTitle

func (b *TopAppBar) SetTitle(title string) *TopAppBar

func (*TopAppBar) Title

func (b *TopAppBar) Title() string

func (*TopAppBar) TitleRect

func (b *TopAppBar) TitleRect() graphics.Rect

TitleRect is where the title is drawn: after the leading control and before the trailing ones, so a long title cannot run under a button.

type TopAppBarAction

type TopAppBarAction struct {
	// ID is the key reported to OnAction.
	ID string
	// Icon is an SVG name (see meui.LoadSVGByName) or, failing that, a glyph string.
	Icon string
	// Tooltip is shown on hover and, on a touch surface, is what a long-press would
	// report; it is also the fallback label when there is no icon.
	Tooltip  string
	Disabled bool
}

TopAppBarAction is one control in an app bar.

type Tree

type Tree struct {
	meui.BaseWidget
	*theme.ListViewTheme
	Root          *TreeNode
	SelectedIndex int
	HoveredIndex  int
	ScrollOffset  float32

	ItemHeight      float32
	AlternatingRows bool
	// HideBorder drops the widget's own outline (see ListView.HideBorder).
	HideBorder     bool
	OnItemSelected func(int, *TreeNode)
	OnCheckChanged func(*TreeNode)

	VScroll *ScrollBar
	// contains filtered or unexported fields
}

func NewTree

func NewTree() *Tree

func (*Tree) AddChild

func (t *Tree) AddChild(parent *TreeNode, label string) *TreeNode

func (*Tree) CollapseAll

func (t *Tree) CollapseAll()

CollapseAll collapses every node with children. Top-level items stay visible (the virtual root is kept expanded), matching QTreeWidget.

func (*Tree) ExpandAll

func (t *Tree) ExpandAll()

ExpandAll expands every node with children.

func (*Tree) ExpandNode

func (t *Tree) ExpandNode(node *TreeNode, expanded bool)

ExpandNode sets the expansion state of a single node. When expanding, all ancestors are expanded too so the node is visible.

func (*Tree) FlatCount

func (t *Tree) FlatCount() int

FlatCount returns the number of visible (expanded) rows.

func (*Tree) Focusable

func (t *Tree) Focusable() bool

func (*Tree) GetSelectedNode

func (t *Tree) GetSelectedNode() *TreeNode

GetSelectedNode returns the currently selected node, or nil.

func (*Tree) OnKeyDown

func (t *Tree) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool

func (*Tree) OnKeyRepeat

func (t *Tree) OnKeyRepeat(keyCode platform.KeyCode, mod platform.Modifiers) bool

OnKeyRepeat is a key the user is HOLDING — Backspace over a word, an arrow along a row, a scrub. The window classifies an OS auto-repeat as a repeat rather than a fresh press (a widget without this method is asked once, deliberately), so this is what makes a held key work here.

func (*Tree) OnMouseDown

func (t *Tree) OnMouseDown(x, y float32, button int) bool

func (*Tree) OnMouseMove

func (t *Tree) OnMouseMove(x, y float32)

func (*Tree) OnMouseUp

func (t *Tree) OnMouseUp(x, y float32, button int) bool

func (*Tree) OnMouseWheel

func (t *Tree) OnMouseWheel(x, y float32, dx, dy float32) bool

func (*Tree) Paint

func (t *Tree) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*Tree) RemoveNode

func (t *Tree) RemoveNode(node *TreeNode)

RemoveNode removes a node from its parent (or clears the root when node is the root).

func (*Tree) SetBoundProperty

func (t *Tree) SetBoundProperty(propName string, value interface{})

SetBoundProperty applies QML properties. hideBorder / border.width: 0 drop the widget's outline (embedded trees have no need for a frame of their own next to a ScrollPane lane).

func (*Tree) SetOnNodeSelected

func (t *Tree) SetOnNodeSelected(handler func(index int, node *TreeNode)) *Tree

SetOnNodeSelected registers the selection callback.

func (*Tree) SetRoot

func (t *Tree) SetRoot(root *TreeNode) *Tree

func (*Tree) ToggleNode

func (t *Tree) ToggleNode(index int)

type TreeNode

type TreeNode struct {
	Label     string
	Icon      string
	Checkable bool
	Checked   bool
	Expanded  bool
	Children  []*TreeNode
	Depth     int
	// contains filtered or unexported fields
}

type UndoEntry

type UndoEntry struct {
	Action     EditAction
	Text       string
	StartLine  int
	StartCol   int
	EndLine    int
	EndCol     int
	CursorLine int
	CursorCol  int
	SelStart   int
	SelEnd     int
}

type VersionedTextDocumentIdentifier

type VersionedTextDocumentIdentifier struct {
	URI     string `json:"uri"`
	Version int    `json:"version"`
}

type VirtualList

type VirtualList struct {
	*ScrollPane
	// contains filtered or unexported fields
}

VirtualList is the web-scale list: a ScrollPane whose rows are built from a Go function as they enter the viewport, not up front.

The web scenes' lists were QML children of a ScrollView — every row a widget — which is fine for twelve messages and is a thousand widgets for a thousand messages. In MEUI a row is a Panel with labels, so building them all is the expensive part, not painting.

vl := widgets.NewVirtualList()
vl.SetRowHeight(110)
vl.SetRowCount(len(messages))
vl.SetRowBuilder(func(i int) meui.Widget { return buildRow(messages[i]) })
vl.EnsureVisible(selected)

Rows are created for the visible range plus an overscan and dropped when they leave it. There is deliberately no recycling of a row widget for a DIFFERENT index: a row's bindings (texts, colours, click closures) are built into the widgets, so rebinding would need a second lifecycle API every row widget had to implement. Build-on-demand + drop is the honest first step; a RowBinder is the extension point if a list ever needs heavy row widgets at scale.

func NewVirtualList

func NewVirtualList() *VirtualList

NewVirtualList builds an empty, frameless list that hit-tests its own rows.

func (*VirtualList) EnsureVisible

func (vl *VirtualList) EnsureVisible(index int) *VirtualList

EnsureVisible scrolls just enough that row index is fully inside the viewport, below a sticky header when one is declared. It is the reveal a click needs.

func (*VirtualList) Paint

func (vl *VirtualList) Paint(canvas *graphics.Canvas, rect graphics.Rect)

Paint syncs the window first: scrolling changes which rows must exist, and this is the one call that happens on every frame after the frame and offsets are settled.

func (*VirtualList) Refresh

func (vl *VirtualList) Refresh()

Refresh rebuilds the visible window against the current frame and scroll offset. Paint calls it too, so an app only needs it when it wants the rows to exist before the next frame (a test, or a click that arrives before the first paint).

func (*VirtualList) RowCount

func (vl *VirtualList) RowCount() int

RowCount reports the data size.

func (*VirtualList) RowHeight

func (vl *VirtualList) RowHeight() float32

RowHeight reports the fixed row height.

func (*VirtualList) RowWidget

func (vl *VirtualList) RowWidget(index int) meui.Widget

RowWidget returns the built widget for an index, or nil when it is outside the window.

func (*VirtualList) ScrollToIndex

func (vl *VirtualList) ScrollToIndex(index int) *VirtualList

ScrollToIndex scrolls so row index is at the top of the viewport.

func (*VirtualList) SetBoundProperty

func (vl *VirtualList) SetBoundProperty(name string, value interface{})

SetBoundProperty carries the QML form:

VirtualList { rowHeight: 110; rowCount: 240; topInset: 40 }

The DATA and the row builder always come from Go — QML here is a builder, so a row template is a Go function, not a delegate.

func (*VirtualList) SetRowBuilder

func (vl *VirtualList) SetRowBuilder(fn func(index int) meui.Widget) *VirtualList

SetRowBuilder installs the function that builds one row's widget. It is called for indices as they enter the window, and may return nil to leave a row empty.

func (*VirtualList) SetRowCount

func (vl *VirtualList) SetRowCount(n int) *VirtualList

SetRowCount sets how many rows the data has and rebuilds the visible window.

func (*VirtualList) SetRowHeight

func (vl *VirtualList) SetRowHeight(h float32) *VirtualList

SetRowHeight fixes every row's height. It is one number, not per-row heights: a variable-height list needs a layout pass over the data to know the scroll extent, which is a different widget.

func (*VirtualList) SetTopInset

func (vl *VirtualList) SetTopInset(px float32) *VirtualList

SetTopInset tells the list that a sticky header covers the top of the viewport.

func (*VirtualList) TopInset

func (vl *VirtualList) TopInset() float32

TopInset reports the sticky header height the list lays its rows below.

func (*VirtualList) VisibleRange

func (vl *VirtualList) VisibleRange() (int, int)

VisibleRange reports the half-open index range the viewport shows.

func (*VirtualList) WalkBuilt

func (vl *VirtualList) WalkBuilt(fn func(index int, w meui.Widget))

WalkBuilt calls fn for every row widget currently built, in index order. It is how a selection change restyles the rows that exist without rebuilding them.

type Waveform

type Waveform struct {
	meui.BaseWidget
	*theme.LabelTheme

	// OnSeek reports a click as a fraction of the track (0 at the start, 1 at the end).
	OnSeek func(frac float32)
	// contains filtered or unexported fields
}

Waveform draws an audio envelope from PEAKS — the min/max per bucket a peak cache computes — with a playhead, and reports a click as a seek.

It takes plain slices rather than a media type on purpose: the toolkit must not depend on `meui-media` (the media module is built on the toolkit, not the other way round), so the app passes `peaks.Min, peaks.Max` and the widget knows nothing about audio beyond that.

A waveform cannot draw from samples — a screen is a few hundred pixels wide and a track is millions of samples — which is why peaks exist at all (MEDIA-PLAN P5): the reduction happens once, and the widget draws a few hundred vertical lines from it.

func NewWaveform

func NewWaveform() *Waveform

NewWaveform builds an empty waveform.

func (*Waveform) BucketAt

func (w *Waveform) BucketAt(x float32) int

BucketAt reports which peak bucket a local x maps to, or -1 when there is nothing to map. It is exported because the mapping is the widget's whole geometry contract: a test asserts it, and a caller drawing a hit marker uses the same function rather than reimplementing it.

func (*Waveform) FractionAt

func (w *Waveform) FractionAt(x float32) float32

FractionAt reports a local x as a fraction of the width, clamped — what a seek reports.

func (*Waveform) HoverAt

func (w *Waveform) HoverAt(x, y float32)

HoverAt implements HoverTarget.

func (*Waveform) OnMouseDown

func (w *Waveform) OnMouseDown(x, y float32, button int) bool

func (*Waveform) OnMouseMove

func (w *Waveform) OnMouseMove(x, y float32)

func (*Waveform) OnMouseUp

func (w *Waveform) OnMouseUp(x, y float32, button int) bool

func (*Waveform) Paint

func (w *Waveform) Paint(canvas *graphics.Canvas, rect graphics.Rect)

func (*Waveform) Peaks

func (w *Waveform) Peaks() int

Peaks is the number of buckets, so a caller can check that the envelope matches the width it set.

func (*Waveform) PreferredDimensions

func (w *Waveform) PreferredDimensions(target interface{}, width, height float32) (float32, float32)

PreferredDimensions: a waveform is a strip, so its natural height is the theme's row height.

func (*Waveform) Progress

func (w *Waveform) Progress() float32

Progress is the playhead's position.

func (*Waveform) SetPeaks

func (w *Waveform) SetPeaks(min, max []float32) *Waveform

SetPeaks installs the envelope. The slices are kept, not copied: a peak cache for a long track is megabytes, and copying it per frame is the cost this widget exists to avoid.

func (*Waveform) SetProgress

func (w *Waveform) SetProgress(frac float32) *Waveform

SetProgress moves the playhead, clamped to [0,1].

type WidgetContext

type WidgetContext struct {
	// Name is the widget's registered name, as written in the fence's info string.
	Name string
	// Params are the parsed JSON object from the info string. A widget that ignores a
	// parameter's TYPE fails silently, which is why they are parsed as JSON and
	// validated per widget rather than left as a string map.
	Params map[string]any
	// Body is the fence's content — the widget's own input, e.g. the path a tool call
	// read. It is NOT Markdown: a widget owns its body's meaning.
	Body string
	// Width is the width the widget will be given, so a widget can decide a height that
	// depends on wrapping without a second pass.
	Width float32
	// Theme is the renderer's palette, so a widget is themed the same way the document
	// around it is rather than inventing its own.
	Theme *theme.MarkdownTheme
	// Selected is true when the selection covers this block. A widget is ATOMIC — its
	// interior has no text for a caret to sit in — so the selection is one rect over
	// the widget, and a widget that draws its own content can show that.
	Selected bool
}

WidgetContext is what a widget is told about its own embedding. It is a value, not a pointer to the view, so a widget cannot reach the document and does not outlive it.

type WindowClientCapabilities

type WindowClientCapabilities struct {
	WorkDoneProgress bool `json:"workDoneProgress"`
}

type WindowFrame

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

WindowFrame is a custom title-bar controller:

[icon] [ middle: any widget, app-configured ] [ — □ ✕ ]

Fixed chrome at the edges; the middle is one app-provided widget (MenuBar, tab strip, status HStack…). Omit the icon and the middle runs flush to the left edge; hide buttons for a chromeless drag bar. Dragging the bar moves the window natively (SDL hit-test → WM move); window edges resize it. The app content area starts below the bar (the app offsets its SetContentRect by BarHeight).

func InstallChrome

func InstallChrome(root *meui.Window, w ChromeTarget, title string) *WindowFrame

InstallChrome builds the standard window frame for a window: the title bar, its minimize/maximize/close buttons, drag-to-move, and double-click to maximize.

It registers all four handlers deliberately. The frame's BarDoubleClick does nothing when no OnMaximize handler is set, so an app that wires only close gets a title bar whose maximize button and double-click are both silently inert — the reason this belongs in one place instead of in each app.

A caller installing this by hand must also shorten the content rect by BarHeight and move the root's content origin down by it (AddWindow does that for the default installation).

func NewWindowFrame

func NewWindowFrame() *WindowFrame

NewWindowFrame creates a bar controller with all three buttons.

func (*WindowFrame) BarDoubleClick

func (f *WindowFrame) BarDoubleClick(x, y float32) bool

BarDoubleClick handles a double press on the bar strip (desktop convention: toggles maximize/restore). Buttons and middle widgets consume their own clicks — false falls through to BarMouseDown.

func (*WindowFrame) BarHeight

func (f *WindowFrame) BarHeight() float32

BarHeight returns the bar strip height (content offset).

func (*WindowFrame) BarMouseDown

func (f *WindowFrame) BarMouseDown(x, y float32, button int) bool

BarMouseDown handles a press inside the bar strip. Returns true if consumed (a button).

func (*WindowFrame) BarMouseMove

func (f *WindowFrame) BarMouseMove(x, y float32)

BarMouseMove updates button hover states and routes moves to the middle widgets.

func (*WindowFrame) BarMouseUp

func (f *WindowFrame) BarMouseUp(x, y float32, button int) bool

BarMouseUp completes a button click.

func (*WindowFrame) BorderWidth

func (f *WindowFrame) BorderWidth() float32

BorderWidth returns the outline width the frame would paint right now.

func (*WindowFrame) FrameHit

func (f *WindowFrame) FrameHit(x, y, w, h float32) uint32

FrameHit classifies a window-relative point. Returns SDL_HITTEST_* values: 0 normal (buttons/clickable), 1 draggable (bar), 2..10 resize zones. Buttons win over edges; edges win over bar drag.

The bar can only move via the WM's interactive move (Wayland forbids client positioning — SDL_SetWindowPosition is ignored), which SDL starts when hit-test returns DRAGGABLE during a press. Returning DRAGGABLE immediately would hand every press to the WM, so a second press could never register as a double-click. Instead the drag is withheld: a fresh press returns NORMAL, motion beyond a threshold flips to DRAGGABLE mid-gesture, and a second press inside the double-click window toggles maximize/restore.

func (*WindowFrame) OnClose

func (f *WindowFrame) OnClose(fn func()) *WindowFrame

OnClose / OnMinimize / OnMaximize register the button handlers.

func (*WindowFrame) OnMaximize

func (f *WindowFrame) OnMaximize(fn func()) *WindowFrame

func (*WindowFrame) OnMinimize

func (f *WindowFrame) OnMinimize(fn func()) *WindowFrame

func (*WindowFrame) PaintBar

func (f *WindowFrame) PaintBar(c *graphics.Canvas, width float32)

PaintBar draws the title bar across the top of the window (bar-local space; the canvas origin is the window's top-left).

func (*WindowFrame) PaintBorder

func (f *WindowFrame) PaintBorder(canvas *graphics.Canvas, windowW, windowH float32)

PaintBorder strokes one outline around the whole window, the title bar included. The stroke follows the rounded window plate when one is set (top corners only in the GNOME headerbar style). Width 0 paints nothing — macOS windows have no outline.

The rect is the window box exactly, with no inset: the renderer draws a stroke as a band INSIDE the box and pixel-snaps it, so an inset rect would move the left/top outline one pixel inward instead of thinning it (pinned by the border test).

func (*WindowFrame) PaintOverlay

func (f *WindowFrame) PaintOverlay(canvas *graphics.Canvas, translateY, windowW, windowH float32)

PaintOverlay paints the window frame's outline and then the window's layers (dropdowns, popups). translateY = the content-space offset the layers' coordinates use (the bar height); windowW/windowH are the whole window in window space, chrome included. Called by the host last, after the title bar, so the outline encloses the chrome and popups float over the frame.

func (*WindowFrame) SetBackendDraggable

func (f *WindowFrame) SetBackendDraggable(fn func() bool) *WindowFrame

SetBackendDraggable pins this frame's backend drag policy instead of asking the platform. Nil restores the default. A test uses it to assert DRAGGABLE and NORMAL without depending on the ambient video driver, which is empty until a window exists and "x11" afterwards — the ordering dependence that made a bar assertion pass alone and fail in a suite.

func (*WindowFrame) SetBorder

func (f *WindowFrame) SetBorder(ink graphics.Color, width float32) *WindowFrame

SetBorder pins both the outline colour and width.

func (*WindowFrame) SetBorderInk

func (f *WindowFrame) SetBorderInk(ink graphics.Color) *WindowFrame

SetBorderInk pins the window outline colour. Unset, the ink follows the theme's Chrome token, then the theme's Border colour.

func (*WindowFrame) SetBorderWidth

func (f *WindowFrame) SetBorderWidth(w float32) *WindowFrame

SetBorderWidth pins the window outline width in pixels (0 = none). Unset, the width follows the active theme's Chrome token.

func (*WindowFrame) SetChrome

func (f *WindowFrame) SetChrome(style string) *WindowFrame

SetChrome selects the window-button style: "meui" (— □ ✕ on the right), "macos" (traffic-light dots on the left), "windows" (caption buttons), "gnome"/"kde" (circular buttons) or "metro" (flat caption buttons). Empty follows the active theme's Chrome token. Behavior (min/max/close actions) is unchanged.

func (*WindowFrame) SetIcon

func (f *WindowFrame) SetIcon(name string) *WindowFrame

SetIcon sets the left icon (embedded icon-set name). Empty removes the icon slot entirely so the middle extends to the left edge.

func (*WindowFrame) SetMiddle

func (f *WindowFrame) SetMiddle(w meui.Widget) *WindowFrame

SetMiddle installs the app-configurable center widget. Nil = the title fills the middle (centered, draggable). The widget is parented to the frame's bar node: the drag area excludes it (FrameHit marks interactive descendants NORMAL) and its events route through the normal widget tree.

func (*WindowFrame) SetOwnerRoot

func (f *WindowFrame) SetOwnerRoot(w meui.Widget) *WindowFrame

SetOwnerRoot wires the frame to the app's root window widget so title-bar widgets have a complete Parent() chain (dropdown layers, findWindow, PointToRoot). Call after the root widget exists. Also moves layer painting after the title bar (PaintOverlay) so popups cover the chrome.

func (*WindowFrame) SetShowClose

func (f *WindowFrame) SetShowClose(b bool) *WindowFrame

func (*WindowFrame) SetShowMax

func (f *WindowFrame) SetShowMax(b bool) *WindowFrame

func (*WindowFrame) SetShowMin

func (f *WindowFrame) SetShowMin(b bool) *WindowFrame

SetShowMin / SetShowMax / SetShowClose toggle the window buttons.

func (*WindowFrame) SetTitle

func (f *WindowFrame) SetTitle(t string) *WindowFrame

SetTitle sets the window title, drawn centered in the middle when no middle widget is installed.

func (*WindowFrame) SetWindowRadius

func (f *WindowFrame) SetWindowRadius(r float32)

SetWindowRadius rounds the bar's top corners to match a rounded window plate (0 = square).

func (*WindowFrame) SetWindowTopOnly

func (f *WindowFrame) SetWindowTopOnly(topOnly bool)

SetWindowTopOnly says the rounded plate rounds its top corners only (GNOME headerbar style), so the outline does the same. The host reports this through the adapter, next to SetWindowRadius.

type WorkspaceClientCapabilities

type WorkspaceClientCapabilities struct {
	Symbol struct {
		DynamicRegistration bool `json:"dynamicRegistration"`
	} `json:"symbol"`
}

Jump to

Keyboard shortcuts

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