Documentation
¶
Overview ¶
Package ferrumgui is a cross-platform GUI toolkit for Go with a Rust GPU engine.
The public API is idiomatic Go. Native rendering is provided by an internal Rust engine exposed through a stable C ABI. Application code must not use CGO or unsafe pointers.
Phase 5 adds light/dark themes, style overrides, Checkbox, TextInput, Slider, ScrollView, Tabs, and Dialog on top of Label/Button/VBox/HBox. NewApp → NewWindow → SetContent → Run is the supported path.
Suggested import alias:
import gui "github.com/ZYCT10/ferrumgui"
Example ¶
Example shows constructing widgets without opening a native window.
package main
import (
"fmt"
gui "github.com/ZYCT10/ferrumgui"
)
func main() {
label := gui.NewLabel("hello")
button := gui.NewButton("go")
box := gui.VBox(label, button)
fmt.Println(label.Text(), button.Text(), len(box.Children()))
}
Output: hello go 2
Index ¶
- Constants
- Variables
- func DragDropSupported() bool
- func F(v float32) *float32
- func OpenURL(url string) error
- func SetLocale(loc Locale, table map[string]string)
- func T(loc Locale, key string) string
- type Accordion
- type AlignItems
- type App
- func (a *App) ApplyTokens(tokens Tokens) error
- func (a *App) Close() error
- func (a *App) Dispatch(fn func()) error
- func (a *App) LoadFontFile(path string) error
- func (a *App) NewWindow(title string, width, height int) (*Window, error)
- func (a *App) Run() error
- func (a *App) ScaleFactor() float64
- func (a *App) SetReducedMotion(reduced bool) error
- func (a *App) SetTheme(mode ThemeMode) error
- func (a *App) SetTokens(tokens Tokens) error
- func (a *App) SystemAppearance() SystemAppearance
- func (a *App) Tokens() Tokens
- type Avatar
- type Badge
- type Button
- func (b *Button) Enabled() bool
- func (b *Button) HasError() bool
- func (b *Button) OnClick(handler func())
- func (b *Button) Selected() bool
- func (b *Button) SetEnabled(enabled bool) error
- func (b *Button) SetError(on bool) error
- func (b *Button) SetSelected(selected bool) error
- func (b *Button) SetStyle(style Style) error
- func (b *Button) SetText(text string) error
- func (b *Button) Text() string
- type Canvas
- type Card
- type Checkbox
- func (c *Checkbox) Checked() bool
- func (c *Checkbox) Enabled() bool
- func (c *Checkbox) HasError() bool
- func (c *Checkbox) OnChange(handler func(bool))
- func (c *Checkbox) SetChecked(checked bool) error
- func (c *Checkbox) SetEnabled(enabled bool) error
- func (c *Checkbox) SetError(on bool) error
- func (c *Checkbox) SetStyle(style Style) error
- type Color
- type ColorOverrides
- type ColorTokens
- type Container
- type Dialog
- type Dim
- type DimKind
- type ElevationTokens
- type FileDialog
- type FontFamily
- type Grid
- type GroupBox
- type Icon
- type Image
- type JustifyContent
- type Label
- type Layout
- type Link
- type ListView
- type Locale
- type NumberInput
- type Observable
- type OverflowMode
- type Overlay
- type PositionMode
- type Progress
- type Radio
- type RadioGroup
- type RadiusTokens
- type RangeSlider
- type ScrollView
- type Select
- type Separator
- type SizeTokens
- type Slider
- func (s *Slider) Enabled() bool
- func (s *Slider) HasError() bool
- func (s *Slider) OnChange(handler func(float32))
- func (s *Slider) SetEnabled(enabled bool) error
- func (s *Slider) SetError(on bool) error
- func (s *Slider) SetStyle(style Style) error
- func (s *Slider) SetValue(value float32) error
- func (s *Slider) Value() float32
- type SpaceTokens
- type Spacer
- type Spinner
- type SplitView
- type Stack
- type StubWidget
- type Style
- type Switch
- type SystemAppearance
- type Table
- type Tabs
- type TextArea
- type TextInput
- func (t *TextInput) Enabled() bool
- func (t *TextInput) HasError() bool
- func (t *TextInput) OnChange(handler func(string))
- func (t *TextInput) Password() bool
- func (t *TextInput) SetEnabled(enabled bool) error
- func (t *TextInput) SetError(on bool) error
- func (t *TextInput) SetPassword(password bool) error
- func (t *TextInput) SetStyle(style Style) error
- func (t *TextInput) SetText(text string) error
- func (t *TextInput) Text() string
- type TextOverflow
- type TextWrap
- type ThemeMode
- type Toast
- type Tokens
- type Tooltip
- type TypeTokens
- type VirtualList
- type Widget
- type Window
- func (w *Window) Close() error
- func (w *Window) ConfirmClose() error
- func (w *Window) ScaleFactor() (float64, error)
- func (w *Window) SetContent(node Widget) error
- func (w *Window) SetFullscreen(fullscreen bool) error
- func (w *Window) SetMaxSize(width, height int) error
- func (w *Window) SetMinSize(width, height int) error
- func (w *Window) SetOnClose(fn func()) error
- func (w *Window) SetResizable(resizable bool) error
- func (w *Window) SetSize(width, height int) error
- func (w *Window) SetTitle(title string) error
Examples ¶
Constants ¶
const ( // StateDisabled is app-writable; skips hit-testing and dims the widget. StateDisabled uint32 = 1 << 0 // StateSelected is app-writable; applies a selected/tint appearance. StateSelected uint32 = 1 << 1 // StateError is app-writable; applies an error/danger border. StateError uint32 = 1 << 2 // StateHovered is engine-managed (pointer over); read via StateFlags. StateHovered uint32 = 1 << 3 // StatePressed is engine-managed (pointer down); read via StateFlags. StatePressed uint32 = 1 << 4 // StateFocused is engine-managed (text focus); read via StateFlags. StateFocused uint32 = 1 << 5 // StateChecked is derived from checkbox checked; read via StateFlags. StateChecked uint32 = 1 << 6 )
Widget state bit flags (aligned with FG_STATE_* in the C ABI).
const ABIVersion = 1
ABIVersion is the expected native C ABI major version. It must match ferrumgui_abi_version() from the Rust engine.
const Version = "0.1.0"
Version is the Go module semantic version for this source tree.
Variables ¶
var ( // ErrNotImplemented is returned for APIs that are designed but not wired yet. ErrNotImplemented = errors.New("ferrumgui: not implemented yet") // ErrClosed is returned when an operation is attempted on a closed resource. ErrClosed = errors.New("ferrumgui: resource closed") // ErrInvalidHandle is returned when a native handle is invalid or stale. ErrInvalidHandle = errors.New("ferrumgui: invalid handle") // ErrWrongThread is returned when a UI operation runs off the UI thread. ErrWrongThread = errors.New("ferrumgui: operation requires the UI thread; use App.Dispatch") // ErrGPU is returned when GPU initialization or rendering fails. ErrGPU = errors.New("ferrumgui: GPU error") // ErrInvalidArg is returned for invalid widget construction arguments. ErrInvalidArg = errors.New("ferrumgui: invalid argument") )
var DefaultLocale = Locale{ID: "en-US"}
DefaultLocale is used when the host locale is unknown.
var RTLLocaleIDs = []string{"ar", "he", "fa", "ur"}
RTLLocaleIDs lists locales that require right-to-left layout when a bidi engine ships.
Functions ¶
func DragDropSupported ¶
func DragDropSupported() bool
DragDropSupported reports whether native drag-and-drop is implemented.
func OpenURL ¶
OpenURL opens a URL with the system default handler. Caller must ensure explicit user intent.
Types ¶
type Accordion ¶
type Accordion struct {
// contains filtered or unexported fields
}
Accordion is a stack of expandable sections.
func NewAccordion ¶
NewAccordion builds sections from parallel titles and page widgets.
type AlignItems ¶
type AlignItems uint8
AlignItems is cross-axis alignment for flex containers.
const ( // AlignUnset keeps the widget-kind default. AlignUnset AlignItems = AlignItems(bindings.AlignUnset) // AlignStart packs items toward the start of the cross axis. AlignStart AlignItems = AlignItems(bindings.AlignStart) // AlignCenter centers items on the cross axis. AlignCenter AlignItems = AlignItems(bindings.AlignCenter) // AlignEnd packs items toward the end of the cross axis. AlignEnd AlignItems = AlignItems(bindings.AlignEnd) // AlignStretch stretches items across the cross axis. AlignStretch AlignItems = AlignItems(bindings.AlignStretch) )
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the root application object.
func (*App) ApplyTokens ¶
ApplyTokens stores the token set and applies its colors as the live engine theme. Widgets using explicit Style keep their overrides; theme-default paint updates.
func (*App) Dispatch ¶
Dispatch schedules fn to run on the UI thread. Safe to call from other goroutines. Before Run starts, jobs are queued and flushed when the event loop begins.
func (*App) LoadFontFile ¶
LoadFontFile queues a TTF/OTF file for the renderer font database. The caller must ensure redistribution rights. Applies on the next paint.
func (*App) ScaleFactor ¶
ScaleFactor returns the last DPI scale observed for the primary window (1.0 before Run).
func (*App) SetReducedMotion ¶
SetReducedMotion enables accessibility mode where animations snap to their end state.
func (*App) SetTheme ¶
SetTheme switches to a built-in Light or Dark theme and refreshes App tokens. ThemeCustom is rejected; use ApplyTokens / NewTheme for custom palettes.
func (*App) SetTokens ¶
SetTokens stores tokens on the App and pushes the color palette to the engine (runtime theme switch / redraw). Prefer ApplyTokens for clarity.
func (*App) SystemAppearance ¶
func (a *App) SystemAppearance() SystemAppearance
SystemAppearance returns the last OS appearance hint captured on the UI thread.
type Avatar ¶
type Avatar struct {
// contains filtered or unexported fields
}
Avatar is a circle showing initials (bitmap decode deferred).
type Badge ¶
type Badge struct {
// contains filtered or unexported fields
}
Badge is a compact label chip.
type Button ¶
type Button struct {
// contains filtered or unexported fields
}
Button is a clickable button.
func (*Button) OnClick ¶
func (b *Button) OnClick(handler func())
OnClick registers a click handler. The handler runs on the UI thread.
func (*Button) SetEnabled ¶
SetEnabled enables or disables the button (disabled skips clicks and dims).
func (*Button) SetSelected ¶
SetSelected toggles selected appearance (e.g. toggle-button look).
type Canvas ¶
type Canvas struct {
// contains filtered or unexported fields
}
Canvas is a custom drawing surface using high-level commands (no GPU handles).
type Card ¶
type Card struct {
// contains filtered or unexported fields
}
Card is a padded surface around one child.
type Checkbox ¶
type Checkbox struct {
// contains filtered or unexported fields
}
Checkbox is a toggle control with a label.
func NewCheckbox ¶
NewCheckbox creates a checkbox.
func (*Checkbox) Checked ¶
Checked returns the current state (local cache; refreshed after engine events).
func (*Checkbox) OnChange ¶
OnChange registers a handler invoked after the user toggles the checkbox.
func (*Checkbox) SetChecked ¶
SetChecked updates the checked state. During App.Run this must be called on the UI thread (or via App.Dispatch).
func (*Checkbox) SetEnabled ¶
SetEnabled enables or disables the checkbox.
type Color ¶
type Color struct {
R, G, B, A float32
}
Color is an RGBA color with channels in 0..=1.
type ColorOverrides ¶
type ColorOverrides struct {
Background *Color
Foreground *Color
Primary *Color
OnPrimary *Color
Surface *Color
Border *Color
Danger *Color
Success *Color
}
ColorOverrides are optional color-role replacements merged onto a base theme. Nil fields keep the base value. Any non-nil field yields ThemeCustom.
type ColorTokens ¶
type ColorTokens struct {
Background Color
Foreground Color
Primary Color
OnPrimary Color
Surface Color
Border Color
Danger Color
Success Color
}
ColorTokens are named color roles.
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container lays out child widgets.
type Dialog ¶
type Dialog struct {
// contains filtered or unexported fields
}
Dialog is a modal overlay with a title and body. Starts closed.
func (*Dialog) OnClose ¶
func (d *Dialog) OnClose(handler func())
OnClose registers a handler for backdrop dismiss.
type DimKind ¶
type DimKind uint8
DimKind selects how a layout dimension is interpreted.
const ( // DimUnset keeps the widget-kind default size. DimUnset DimKind = DimKind(bindings.DimUnset) // DimAuto uses Taffy auto sizing. DimAuto DimKind = DimKind(bindings.DimAuto) // DimLength is an absolute size in logical pixels. DimLength DimKind = DimKind(bindings.DimLength) // DimPercent is a fraction of the parent size (1.0 = 100%). DimPercent DimKind = DimKind(bindings.DimPercent) )
type ElevationTokens ¶
type ElevationTokens struct {
None, Low, Mid, High float32
}
ElevationTokens are shadow-blur steps in logical pixels.
type FileDialog ¶
type FileDialog struct{}
FileDialog provides native open/save/directory pickers (blocking).
Call from App.Dispatch while Run is active so the dialog runs on the UI thread. Cancellation returns ErrNotImplemented.
func (FileDialog) PickDirectory ¶
func (FileDialog) PickDirectory() (string, error)
PickDirectory shows a native directory picker and returns the chosen path.
func (FileDialog) PickOpenFile ¶
func (FileDialog) PickOpenFile() (string, error)
PickOpenFile shows a native open-file dialog and returns the chosen path.
func (FileDialog) PickSaveFile ¶
func (FileDialog) PickSaveFile() (string, error)
PickSaveFile shows a native save-file dialog and returns the chosen path.
type FontFamily ¶
type FontFamily int
FontFamily selects a generic system font family.
const ( // FontSans is the default sans-serif family. FontSans FontFamily = 1 // FontSerif is a serif family. FontSerif FontFamily = 2 // FontMono is a monospace family. FontMono FontFamily = 3 )
type Grid ¶
type Grid struct {
// contains filtered or unexported fields
}
Grid is a CSS-like grid with equal flexible columns and auto rows. Children are placed in row-major order.
type GroupBox ¶
type GroupBox struct {
// contains filtered or unexported fields
}
GroupBox is a titled border around one child widget.
func NewGroupBox ¶
NewGroupBox creates a group box around child.
type Icon ¶
type Icon struct {
// contains filtered or unexported fields
}
Icon displays a text glyph fallback (no icon-font dependency).
type Image ¶
type Image struct {
// contains filtered or unexported fields
}
Image is a STUB placeholder until a license-checked bitmap decoder ships.
type JustifyContent ¶
type JustifyContent uint8
JustifyContent is main-axis distribution for flex containers.
const ( // JustifyUnset keeps the widget-kind default. JustifyUnset JustifyContent = JustifyContent(bindings.JustifyUnset) // JustifyStart packs toward the start. JustifyStart JustifyContent = JustifyContent(bindings.JustifyStart) // JustifyCenter centers along the main axis. JustifyCenter JustifyContent = JustifyContent(bindings.JustifyCenter) // JustifyEnd packs toward the end. JustifyEnd JustifyContent = JustifyContent(bindings.JustifyEnd) // JustifySpaceBetween distributes free space between items. JustifySpaceBetween JustifyContent = JustifyContent(bindings.JustifySpaceBetween) // JustifySpaceAround distributes free space around items. JustifySpaceAround JustifyContent = JustifyContent(bindings.JustifySpaceAround) // JustifySpaceEvenly distributes equal space between and around items. JustifySpaceEvenly JustifyContent = JustifyContent(bindings.JustifySpaceEvenly) )
type Label ¶
type Label struct {
// contains filtered or unexported fields
}
Label displays read-only text.
func (*Label) SetEnabled ¶
SetEnabled enables or disables the label (visual dimming when disabled).
type Layout ¶
type Layout struct {
FlexGrow *float32
FlexShrink *float32
Width *Dim
Height *Dim
MinWidth *Dim
MinHeight *Dim
MaxWidth *Dim
MaxHeight *Dim
Gap *float32
Padding *float32
AlignItems AlignItems
JustifyContent JustifyContent
Position PositionMode
Overflow OverflowMode
Left *Dim
Top *Dim
Right *Dim
Bottom *Dim
}
Layout holds optional per-node layout overrides. Nil / zero-kind fields keep widget-kind Taffy defaults.
type Link ¶
type Link struct {
// contains filtered or unexported fields
}
Link is clickable hyperlink-styled text (no automatic navigation).
type ListView ¶
type ListView struct {
// contains filtered or unexported fields
}
ListView shows a modest string list (not for huge data).
type Locale ¶
type Locale struct {
// ID is a BCP 47 tag such as "en-US".
ID string
}
Locale identifies a language/region tag (BCP 47). Phase 14 STUB — no ICU/runtime loader yet.
type NumberInput ¶
type NumberInput struct {
// contains filtered or unexported fields
}
NumberInput is a stepped numeric field.
func NewNumberInput ¶
func NewNumberInput(value, min, max, step float64) *NumberInput
NewNumberInput creates a number input.
func (*NumberInput) OnChange ¶
func (n *NumberInput) OnChange(fn func()) error
type Observable ¶
type Observable[T any] struct { // contains filtered or unexported fields }
Observable is a minimal optional binding helper (Phase 17). No global store, no FFI.
func NewObservable ¶
func NewObservable[T any](initial T) *Observable[T]
NewObservable creates an observable holding an initial value.
func (*Observable[T]) Set ¶
func (o *Observable[T]) Set(v T)
Set updates the value and notifies subscribers.
func (*Observable[T]) Subscribe ¶
func (o *Observable[T]) Subscribe(fn func(T))
Subscribe registers a callback invoked on each Set (caller must not block).
type OverflowMode ¶
type OverflowMode uint8
OverflowMode controls descendant clipping.
const ( // OverflowUnset keeps the widget-kind default (visible). OverflowUnset OverflowMode = OverflowMode(bindings.OverflowUnset) // OverflowVisible allows descendants to paint/hit outside bounds. OverflowVisible OverflowMode = OverflowMode(bindings.OverflowVisible) // OverflowHidden clips descendants outside the node bounds (paint + hit-test). OverflowHidden OverflowMode = OverflowMode(bindings.OverflowHidden) )
type Overlay ¶
type Overlay struct {
// contains filtered or unexported fields
}
Overlay places layers above a base widget within the same bounds.
func NewOverlay ¶
NewOverlay creates an overlay with a base and optional layers (bottom → top).
type PositionMode ¶
type PositionMode uint8
PositionMode selects CSS-like positioning.
const ( // PositionUnset keeps the widget-kind default. PositionUnset PositionMode = PositionMode(bindings.PosUnset) // PositionRelative keeps normal flow and establishes a containing block. PositionRelative PositionMode = PositionMode(bindings.PosRelative) // PositionAbsolute takes the node out of flow; use Left/Top/Right/Bottom. PositionAbsolute PositionMode = PositionMode(bindings.PosAbsolute) )
type Progress ¶
type Progress struct {
// contains filtered or unexported fields
}
Progress is a determinate bar (value 0..1).
func (*Progress) SetEnabled ¶
type Radio ¶
type Radio struct {
// contains filtered or unexported fields
}
Radio is one option within a RadioGroup.
type RadioGroup ¶
type RadioGroup struct {
// contains filtered or unexported fields
}
RadioGroup provides exclusive selection among Radio children.
func NewRadioGroup ¶
func NewRadioGroup(options ...*Radio) *RadioGroup
NewRadioGroup creates a horizontal radio group from options.
func (*RadioGroup) Options ¶
func (g *RadioGroup) Options() []*Radio
func (*RadioGroup) SetStyle ¶
func (g *RadioGroup) SetStyle(style Style) error
type RadiusTokens ¶
type RadiusTokens struct {
None, S, M, L float32
}
RadiusTokens are corner-radius steps in logical pixels.
type RangeSlider ¶
type RangeSlider struct {
// contains filtered or unexported fields
}
RangeSlider selects an interval on a track.
func NewRangeSlider ¶
func NewRangeSlider(low, high, min, max float32) *RangeSlider
NewRangeSlider creates a dual-thumb slider.
func (*RangeSlider) OnChange ¶
func (r *RangeSlider) OnChange(fn func()) error
type ScrollView ¶
type ScrollView struct {
// contains filtered or unexported fields
}
ScrollView clips and scrolls a single child vertically.
func NewScrollView ¶
func NewScrollView(child Widget) *ScrollView
NewScrollView wraps child in a scrollable viewport.
func (*ScrollView) SetStyle ¶
func (s *ScrollView) SetStyle(style Style) error
SetStyle applies optional color overrides.
type Select ¶
type Select struct {
// contains filtered or unexported fields
}
Select is a single-choice dropdown (Combo/Dropdown share this implementation).
type Separator ¶
type Separator struct {
// contains filtered or unexported fields
}
Separator is a horizontal or vertical rule line.
func NewSeparator ¶
NewSeparator creates a separator. When horizontal is true the line spans the layout width.
func (*Separator) Horizontal ¶
Horizontal reports orientation.
type SizeTokens ¶
SizeTokens are control sizing steps in logical pixels.
type Slider ¶
type Slider struct {
// contains filtered or unexported fields
}
Slider is a numeric range control.
func NewSlider ¶
NewSlider creates a slider with value clamped to [min, max].
Example ¶
ExampleNewSlider shows slider clamping helpers on the Go side.
package main
import (
"fmt"
gui "github.com/ZYCT10/ferrumgui"
)
func main() {
s := gui.NewSlider(50, 0, 100)
fmt.Printf("%.0f\n", s.Value())
}
Output: 50
func (*Slider) SetEnabled ¶
SetEnabled enables or disables the slider.
type SpaceTokens ¶
type SpaceTokens struct {
XS, S, M, L, XL, XXL float32
}
SpaceTokens are spacing steps in logical pixels.
type Spacer ¶
type Spacer struct {
// contains filtered or unexported fields
}
Spacer is flexible empty space in a flex container (default flex_grow=1).
type Spinner ¶
type Spinner struct {
// contains filtered or unexported fields
}
Spinner is an indeterminate activity indicator (engine rotates paint each frame).
type SplitView ¶
type SplitView struct {
// contains filtered or unexported fields
}
SplitView lays out two children with a draggable divider.
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
Stack layers children in the same bounds (paint order = argument order).
type StubWidget ¶
type StubWidget struct {
// contains filtered or unexported fields
}
StubWidget marks deferred widgets in the gallery (DatePicker, Menu bar, …).
func NewStubWidget ¶
func NewStubWidget(label string) *StubWidget
NewStubWidget creates a labeled STUB placeholder.
type Style ¶
type Style struct {
Background *Color
Foreground *Color
BorderColor *Color
BorderWidth *float32
CornerRadius *float32
Padding *float32
Margin *float32
Opacity *float32
FontSize *float32
ShadowBlur *float32
FontFamily FontFamily // 0 = unset
FontWeight uint16 // 0 = unset; else 100..=900
FontItalic bool
TextWrap TextWrap // 0 = unset
TextOverflow TextOverflow // 0 = unset
}
Style holds optional per-widget visual overrides. Padding/Margin also update layout on apply. CornerRadius is stored for API compatibility; GPU rounded fills arrive later. ShadowBlur draws a soft offset rect.
type Switch ¶
type Switch struct {
// contains filtered or unexported fields
}
Switch is a boolean on/off control (distinct paint from Checkbox).
func (*Switch) SetEnabled ¶
type SystemAppearance ¶
type SystemAppearance int
SystemAppearance reports the OS window chrome preference when known.
const ( // SystemAppearanceUnknown means the engine has not observed a theme yet. SystemAppearanceUnknown SystemAppearance = iota // SystemAppearanceLight is the OS light preference. SystemAppearanceLight // SystemAppearanceDark is the OS dark preference. SystemAppearanceDark )
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table shows column headers and virtualized body cells.
func (*Table) SetWindowCells ¶
SetWindowCells sets flat visible cell values (row-major).
type Tabs ¶
type Tabs struct {
// contains filtered or unexported fields
}
Tabs is a tabbed container; only the selected page is shown.
func NewTabs ¶
NewTabs creates tabs from parallel titles and page widgets.
Example ¶
ExampleNewTabs shows tab construction.
package main
import (
"fmt"
gui "github.com/ZYCT10/ferrumgui"
)
func main() {
tabs := gui.NewTabs(
[]string{"A", "B"},
gui.NewLabel("page a"),
gui.NewLabel("page b"),
)
fmt.Println(tabs.Selected())
}
Output: 0
func (*Tabs) SetSelected ¶
SetSelected selects a tab by index. During App.Run this must be called on the UI thread (or via App.Dispatch).
type TextArea ¶
type TextArea struct {
TextInput
}
TextArea is a multi-line editable field (same editing model as TextInput).
func NewTextArea ¶
NewTextArea creates a multi-line text area with initial text.
type TextInput ¶
type TextInput struct {
// contains filtered or unexported fields
}
TextInput is a single-line editable field.
Unicode editing uses grapheme clusters (emoji ZWJ, combining marks, CJK). BiDi/RTL shaping is performed by glyphon (Shaping::Advanced); the public API stores UTF-8 and does not expose a custom shaper.
Keyboard (when focused): arrows + Shift selection, Backspace/Delete, Ctrl+A/C/X/V/Z/Y, Escape clears focus. Tab / Shift+Tab cycle focus among focusable controls. Clipboard access happens only on explicit Ctrl+C/X/V.
IME: composition/preedit is painted when the platform delivers winit Ime events; coverage is validated on Windows x86_64 first—other platforms are not claimed until interactive smoke exists (see PLATFORMS).
func NewPasswordInput ¶
NewPasswordInput creates a single-line password field (value is never copied to the clipboard by the engine; display is masked).
func NewTextInput ¶
NewTextInput creates a text input with initial text.
func (*TextInput) SetEnabled ¶
SetEnabled enables or disables the text input.
func (*TextInput) SetPassword ¶
SetPassword toggles password masking. When masked, clipboard copy yields empty.
type TextOverflow ¶
type TextOverflow int
TextOverflow controls clipped single-line overflow.
const ( // TextOverflowClip clips without an ellipsis. TextOverflowClip TextOverflow = 1 // TextOverflowEllipsis truncates with an ellipsis. TextOverflowEllipsis TextOverflow = 2 )
type TextWrap ¶
type TextWrap int
TextWrap controls shaped-text wrapping.
const ( // TextWrapNone disables wrapping (single line). TextWrapNone TextWrap = 1 // TextWrapWord wraps at word boundaries. TextWrapWord TextWrap = 2 // TextWrapGlyph wraps at glyph boundaries. TextWrapGlyph TextWrap = 3 // TextWrapWordOrGlyph prefers words, else glyphs. TextWrapWordOrGlyph TextWrap = 4 )
type ThemeMode ¶
type ThemeMode int
ThemeMode selects a built-in or custom application theme.
const ( // ThemeLight is the default light palette. ThemeLight ThemeMode = ThemeMode(bindings.ThemeLight) // ThemeDark is the dark palette. ThemeDark ThemeMode = ThemeMode(bindings.ThemeDark) // ThemeCustom marks a palette built with overrides / ApplyTokens. ThemeCustom ThemeMode = ThemeMode(bindings.ThemeCustom) )
type Toast ¶
type Toast struct {
// contains filtered or unexported fields
}
Toast is a transient banner message.
func (*Toast) SetVisible ¶
SetVisible shows or hides the toast.
type Tokens ¶
type Tokens struct {
Color ColorTokens
Space SpaceTokens
Type TypeTokens
Radius RadiusTokens
Elevation ElevationTokens
Size SizeTokens
// contains filtered or unexported fields
}
Tokens is a design-token set (colors, space, type, radius, elevation, size). Values are plain data resolved by the app into Style / Layout; nothing executes.
func Inherit ¶
func Inherit(base ThemeMode, o ColorOverrides) Tokens
Inherit returns NewTheme(base, o) — Light/Dark inheritance with overrides.
func NewTheme ¶
func NewTheme(base ThemeMode, o ColorOverrides) Tokens
NewTheme builds tokens from a Light/Dark base with optional color overrides. Any override marks the result as ThemeCustom.
func TokensForMode ¶
TokensForMode returns TokensLight or TokensDark. ThemeCustom falls back to TokensLight (use NewTheme for custom palettes).
func (Tokens) StyleDanger ¶
StyleDanger builds a danger-accent Style.
func (Tokens) StylePrimary ¶
StylePrimary builds a primary-accent Style (e.g. filled button look).
func (Tokens) StyleSurface ¶
StyleSurface builds a surface Style from tokens (bg/fg/border/radius/pad).
func (Tokens) WithColorOverrides ¶
func (t Tokens) WithColorOverrides(o ColorOverrides) Tokens
WithColorOverrides returns a copy with non-nil color roles replaced. Marks the result ThemeCustom when any override is set.
type Tooltip ¶
type Tooltip struct {
// contains filtered or unexported fields
}
Tooltip shows helper text (typically in an overlay layer).
type TypeTokens ¶
TypeTokens are font sizes in logical pixels.
type VirtualList ¶
type VirtualList struct {
// contains filtered or unexported fields
}
VirtualList virtualizes rows (engine paints a visible window only).
func NewVirtualList ¶
func NewVirtualList(rowCount uint32, rowHeight float32) *VirtualList
NewVirtualList creates a virtual list with logical row count.
func (*VirtualList) SetWindowLabels ¶
func (v *VirtualList) SetWindowLabels(labels []string) error
SetWindowLabels sets labels for currently visible rows (length ≈ viewport).
type Widget ¶
type Widget interface {
// contains filtered or unexported methods
}
Widget is a node in the UI tree.
func WithLayout ¶
WithLayout returns a widget that applies layout overrides after materialization. Useful for Absolute positioning of leaf widgets inside Stack/Overlay.
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window is a native top-level window.
func (*Window) ConfirmClose ¶
ConfirmClose completes an intercepted close and requests exit.
func (*Window) ScaleFactor ¶
ScaleFactor returns the last observed DPI scale for this window.
func (*Window) SetContent ¶
SetContent sets the root widget tree for the window.
func (*Window) SetFullscreen ¶
SetFullscreen toggles borderless fullscreen (best effort).
func (*Window) SetMaxSize ¶
SetMaxSize sets maximum inner size. Zero clears an axis while running.
func (*Window) SetMinSize ¶
SetMinSize sets minimum inner size. Zero clears an axis while running.
func (*Window) SetOnClose ¶
SetOnClose installs a close intercept. Call ConfirmClose from the callback to exit.
func (*Window) SetResizable ¶
SetResizable enables or disables user resizing.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
hello
command
Command hello demonstrates themes, controls, tabs, scrolling, and a dialog.
|
Command hello demonstrates themes, controls, tabs, scrolling, and a dialog. |
|
widget-gallery
command
Minimal Phase 11 widget gallery (Windows + CGO).
|
Minimal Phase 11 widget gallery (Windows + CGO). |
|
internal
|
|
|
bindings
Package bindings wraps the FerrumGUI C ABI for use by the public Go API.
|
Package bindings wraps the FerrumGUI C ABI for use by the public Go API. |
|
native
Package native registers embedded FerrumGUI engine artifacts for the secure loader (internal/nativeload).
|
Package native registers embedded FerrumGUI engine artifacts for the secure loader (internal/nativeload). |
|
nativeload
Package nativeload extracts and loads embedded FerrumGUI engine shared libraries.
|
Package nativeload extracts and loads embedded FerrumGUI engine shared libraries. |
|
platform
Package platform contains OS-thread and platform helpers for FerrumGUI.
|
Package platform contains OS-thread and platform helpers for FerrumGUI. |
|
tools
|
|
|
abigen
command
|