Documentation
¶
Index ¶
- Constants
- Variables
- func CaptureDashState(dm *DashManager) map[string]DashConfig
- func CenterText(text string)
- func CenterTextDisabled(text string)
- func Checkbox(label string, checked bool) (bool, bool)
- func ColorEdit3(label string, r, g, b float32) (float32, float32, float32, bool)
- func ColorEdit4(label string, r, g, b, a float32) (float32, float32, float32, float32, bool)
- func Combo(label string, current int, items []string) (int, bool)
- func ConfigPath(appName, filename string) (string, error)
- func DefaultStyle()
- func FaderF(label string, value, min, max float32, params FaderParams) (float32, bool)
- func FaderI(label string, value int, min, max int, params FaderParams) (int, bool)
- func FaderN(label string, value float32, params FaderParams) (float32, bool)
- func FaderWithScaleF(label string, value, min, max float32, params FaderParams, scale ScaleConfig) (float32, bool)
- func FaderWithScaleI(label string, value int, min, max int, params FaderParams, scale ScaleConfig) (int, bool)
- func FaderWithScaleN(label string, value float32, params FaderParams, scale ScaleConfig) (float32, bool)
- func Input(label string, value string) (string, bool)
- func InputMultiline(label string, value string, width, height float32) (string, bool)
- func LoadJSON(path string, config interface{}) error
- func MatchExt(ext string) func(*FileNode) bool
- func MatchName(pattern string) (func(*FileNode) bool, error)
- func MatchPath(pattern string) (func(*FileNode) bool, error)
- func PopFont()
- func PushFont(fontIndex int)
- func RestoreDashState(dm *DashManager, config map[string]DashConfig)
- func SaveJSON(path string, config interface{}) error
- func SetTheme(theme Theme)
- func SetupFonts()
- func Slider(label string, value float32, min, max float32) (float32, bool)
- func SliderInt(label string, value int, min, max int) (int, bool)
- func Toggle(label string, value bool) (bool, bool)
- func Toolbar(label string)
- func ToolbarEx(label string, extra func())
- func ToolbarExLayout(label string, extra func(*ToolbarLayout))
- func WheelSlider(label string, value, min, max, wheelSteps float32, format string, ...) (float32, bool)
- type Action
- type ActionEvent
- type ActionRegistry
- type ActionSource
- type App
- func (app *App) Actions() *ActionRegistry
- func (app *App) GetWindowPos() (int, int)
- func (app *App) GetWindowSize() (int, int)
- func (app *App) Run() error
- func (app *App) SetRoot(root Component)
- func (app *App) SetShouldClose(shouldClose bool)
- func (app *App) SetWindowPos(x, y int)
- func (app *App) SetWindowSize(w, h int)
- func (app *App) SetWindowTitle(title string)
- func (app *App) Stop()
- func (app *App) Wait() error
- type BaseCommand
- type Bounds
- type ChildActionProvider
- type Command
- type Component
- type Config
- type Container
- type Dash
- type DashAttachment
- type DashConfig
- type DashManager
- type DashPrecedence
- type DragType
- type FaderParams
- type FileNode
- type FileTree
- type FlexLayout
- func (fl *FlexLayout) Arrange(components map[string]Component, state *State)
- func (fl *FlexLayout) ColWidths() [][]int
- func (fl *FlexLayout) HandleInput(state *State)
- func (fl *FlexLayout) RowHeights() []int
- func (fl *FlexLayout) SetColWidths(widths [][]int)
- func (fl *FlexLayout) SetRowHeights(heights []int)
- type FullCommand
- type Func
- type GridCell
- type GridLayout
- type HCollapse
- type HCollapseConfig
- type HueColorScheme
- type KeyEvent
- type KeyModifier
- type Layout
- type LocalActionProvider
- type LogBuffer
- type LogMessage
- type LogViewer
- type MergeableCommand
- type ModernTheme
- type MultiGrid
- func (mg *MultiGrid) AddComponent(id string, component Component)
- func (mg *MultiGrid) ComponentIDs() []string
- func (mg *MultiGrid) Draw(state *State)
- func (mg *MultiGrid) GetComponent(id string) (Component, bool)
- func (mg *MultiGrid) RemoveComponent(id string)
- func (mg *MultiGrid) SetLayout(layout Layout)
- type ScaleConfig
- type SizeDebugger
- type SlogHandler
- type SlogHandlerOptions
- type StampedCommand
- type State
- type Taper
- type Theme
- type ToolbarLayout
- type UndoSystem
- type VUMeter
- func (v *VUMeter) ChannelCount() int
- func (v *VUMeter) Draw(state *State)
- func (v *VUMeter) SetChannelCount(count int)
- func (v *VUMeter) SetLabel(channel int, label string)
- func (v *VUMeter) SetLabels(labels []string)
- func (v *VUMeter) SetLevel(channel int, level float32)
- func (v *VUMeter) SetLevels(levels []float32)
- func (v *VUMeter) Width() float32
- type VUMeterMode
- type VUWaterfall
- func (w *VUWaterfall) ChannelCount() int
- func (w *VUWaterfall) Clear()
- func (w *VUWaterfall) Draw(state *State)
- func (w *VUWaterfall) SetChannelCount(count int)
- func (w *VUWaterfall) SetHistorySize(size int)
- func (w *VUWaterfall) SetLevel(channel int, level float32)
- func (w *VUWaterfall) SetLevels(levels []float32)
- func (w *VUWaterfall) Width() float32
- type WindowConfig
- type Workspace
- func (ws *Workspace) Actions() *ActionRegistry
- func (ws *Workspace) Add(id, name string, component Component)
- func (ws *Workspace) ChildActions() []Component
- func (ws *Workspace) Current() string
- func (ws *Workspace) CurrentComponent() Component
- func (ws *Workspace) CurrentName() string
- func (ws *Workspace) GetName(id string) string
- func (ws *Workspace) LocalActions() *ActionRegistry
- func (ws *Workspace) Remove(id string)
- func (ws *Workspace) SetName(id, name string) bool
- func (ws *Workspace) Switch(id string) bool
- func (ws *Workspace) SwitchByIndex(index int) bool
- func (ws *Workspace) WorkspaceIds() []string
- func (ws *Workspace) WorkspaceNames() []string
Constants ¶
const ( DefaultDashSize = 400 DefaultDashMinSize = 40 DefaultDashMaxSize = 1000 DefaultTransitionMs = 100 DashBackgroundAlpha = 0.85 DashWindowRounding = 5 DashScrollbarSize = 5 DragHandleSize = 20 DashTitleBarHeight = 27 DashTitleBarOffset = 22 DashDragHandleOffset = 22 DashSurfacePadding = 20 FramerateToMs = 1000 )
const ( VerticalPrecedence = DashPrecedence(iota) HorizontalPrecedence )
const ( MainFont = 0 // default font (Gidole Regular, 20px) with Material Icons merged MonospaceFont = 1 // monospace font (JetBrains Mono, 16px) SmallFont = 2 // small font (Gidole Regular, 16px) with Material Icons merged )
font indices for easy access note: icon fonts are merged into their base fonts, not separate entries
const ( HCollapseHeaderHeight = 36 HCollapseDefaultMinWidth = 36 HCollapseDefaultTransition = 80 HCollapseResizeHandleSize = 20 )
HCollapse constants
const ( // default padding and spacing DefaultWindowPadding = 4 DefaultFramePadding = 4 DefaultItemSpacing = 4 // scrollbar and border sizes DefaultScrollbarSize = 12 DefaultWindowBorder = 0 DefaultChildBorder = 0 DefaultPopupBorder = 1 DefaultFrameBorder = 0 // rounding values DefaultWindowRounding = 3 DefaultChildRounding = 0 DefaultFrameRounding = 3 DefaultPopupRounding = 3 DefaultScrollbarRounding = 2 DefaultGrabRounding = 2 )
const ( VUZoneGreen = 0.6 // green zone boundary (0 to 60%) VUZoneYellow = 0.8 // yellow zone boundary (60% to 80%) )
VU zone thresholds for color transitions.
const (
LogTimeFormat = "[%8.3f]" // time formatting for log entries
)
Variables ¶
var ( LogTimeColor = imgui.Vec4{X: 0.5, Y: 0.5, Z: 0.5, W: 1.0} LogDebugColor = imgui.Vec4{X: 0.0, Y: 0.0, Z: 1.0, W: 1.0} LogWarningColor = imgui.Vec4{X: 1.0, Y: 1.0, Z: 0.0, W: 1.0} LogErrorColor = imgui.Vec4{X: 1.0, Y: 0.0, Z: 0.0, W: 1.0} LogFunctionColor = imgui.Vec4{X: 0.023, Y: 0.596, Z: 0.603, W: 1.0} LogFieldsColor = imgui.Vec4{X: 0.203, Y: 0.886, Z: 0.886, W: 1.0} )
var ( BlueTheme = NewHueColorScheme("Blue", 240, 50, 180) GreenTheme = NewHueColorScheme("Green", 120, 40, 170) RedTheme = NewHueColorScheme("Red", 0, 45, 175) PurpleTheme = NewHueColorScheme("Purple", 270, 35, 165) ModernDark = &ModernTheme{} )
predefined themes for convenience
var Fonts []*imgui.Font
Functions ¶
func CaptureDashState ¶
func CaptureDashState(dm *DashManager) map[string]DashConfig
CaptureDashState extracts configuration from a DashManager. returns a map with keys: "top", "left", "right", "bottom"
func CenterText ¶ added in v0.0.9
func CenterText(text string)
CenterText draws text centered horizontally and vertically in the available content region.
func CenterTextDisabled ¶ added in v0.0.9
func CenterTextDisabled(text string)
CenterTextDisabled draws disabled text centered horizontally and vertically in the available content region.
func ColorEdit3 ¶
ColorEdit3 edits RGB color. Returns new color and whether it changed.
func ColorEdit4 ¶
ColorEdit4 edits RGBA color. Returns new color and whether it changed.
func ConfigPath ¶
ConfigPath returns a standard configuration file path in the user's home directory Example: ConfigPath("myapp", "config.json") -> "~/.myapp/config.json"
func DefaultStyle ¶
func DefaultStyle()
DefaultStyle sets up the default ImGui style parameters this should be called after font setup but before theme application
func FaderF ¶
func FaderF(label string, value, min, max float32, params FaderParams) (float32, bool)
FaderF draws a vertical fader working in an arbitrary float range. Internally converts to/from normalized 0-1 space. Example: -60.0 to +12.0 dB, 20.0 to 20000.0 Hz
func FaderI ¶
FaderI draws a vertical fader working in an integer range. Internally converts to/from normalized 0-1 space. Example: 0 to 32767 for hardware, 0 to 127 for MIDI
func FaderN ¶
func FaderN(label string, value float32, params FaderParams) (float32, bool)
FaderN draws a vertical fader working in normalized 0.0-1.0 space. This is the foundation for FaderF and FaderI.
func FaderWithScaleF ¶
func FaderWithScaleF(label string, value, min, max float32, params FaderParams, scale ScaleConfig) (float32, bool)
FaderWithScaleF draws a float-range fader with tick marks and labels.
func FaderWithScaleI ¶
func FaderWithScaleI(label string, value int, min, max int, params FaderParams, scale ScaleConfig) (int, bool)
FaderWithScaleI draws an integer-range fader with tick marks and labels.
func FaderWithScaleN ¶
func FaderWithScaleN(label string, value float32, params FaderParams, scale ScaleConfig) (float32, bool)
FaderWithScaleN draws a normalized fader (0.0-1.0) with tick marks and labels.
func InputMultiline ¶
InputMultiline is a multiline text input
func LoadJSON ¶
LoadJSON loads a JSON file into a struct If the file doesn't exist, the config parameter is left unchanged (use defaults) Returns error only if the file exists but can't be read or parsed
func MatchExt ¶ added in v0.0.9
MatchExt returns a predicate that matches non-directory nodes whose file extension equals ext. the ext parameter should include the dot (e.g. ".go"). the comparison is case-insensitive.
func MatchName ¶ added in v0.0.9
MatchName returns a predicate that matches nodes whose Name matches the given regular expression pattern.
func MatchPath ¶ added in v0.0.9
MatchPath returns a predicate that matches nodes whose full Path() matches the given regular expression pattern.
func PushFont ¶
func PushFont(fontIndex int)
PushFont convenience function for temporarily switching fonts. passes the font's configured size to ensure correct rendering.
func RestoreDashState ¶
func RestoreDashState(dm *DashManager, config map[string]DashConfig)
RestoreDashState applies configuration to a DashManager. accepts a map with keys: "top", "left", "right", "bottom"
func SaveJSON ¶
SaveJSON saves any struct to a JSON file with proper formatting and error handling Creates parent directories if they don't exist
func SetupFonts ¶
func SetupFonts()
SetupFonts initializes and loads all fonts this should be called during app initialization
func Toggle ¶
Toggle creates a button that acts as a boolean toggle. when inactive (false), the button is dimmed. when active (true), it uses the checkmark color. returns (newValue, changed) following dfx conventions.
func Toolbar ¶ added in v0.0.9
func Toolbar(label string)
Toolbar draws a full-width header bar with the given label.
func ToolbarEx ¶ added in v0.0.9
func ToolbarEx(label string, extra func())
ToolbarEx draws a full-width header bar with the given label, and optionally calls extra to draw additional controls on the same line.
func ToolbarExLayout ¶ added in v0.1.1
func ToolbarExLayout(label string, extra func(*ToolbarLayout))
ToolbarExLayout draws a full-width header bar with the given label, and calls extra with a ToolbarLayout for precise vertical centering of mixed item types (combos, text, buttons).
func WheelSlider ¶
func WheelSlider(label string, value, min, max, wheelSteps float32, format string, flags imgui.SliderFlags) (float32, bool)
WheelSlider creates a slider that responds to mouse wheel when hovered. wheelSteps controls sensitivity (larger value = smaller adjustments per wheel tick). modifiers: Ctrl = 10x faster, Alt = 10x slower. returns (newValue, changed) following dfx conventions.
Types ¶
type Action ¶
type Action struct {
Id string
Label string // display name for menu items (if empty, uses Id)
Keys string // e.g. "Ctrl+A", "Alt+Shift+F1"
Handler func()
// contains filtered or unexported fields
}
Action represents a keybinding and its associated function
func NewMenuAction ¶
NewMenuAction creates an action suitable for both menus and keyboard shortcuts label: display name for menu items (e.g., "Save As...") keys: keyboard shortcut (e.g., "Ctrl+Shift+S") handler: function to execute
func (*Action) DrawMenuItem ¶
DrawMenuItem renders the action as a menu item returns true if the menu item was clicked
type ActionEvent ¶ added in v0.1.4
type ActionEvent struct {
Action *Action // the action that was invoked (Id, Label, Keys)
Source ActionSource // how it was triggered
Time time.Time // when it fired
}
ActionEvent describes a single action invocation, delivered to Config.OnAction. It is intended for usage telemetry (e.g. building a heatmap of which actions and shortcuts are exercised). The Action pointer is the live registered action and should be treated as read-only.
type ActionRegistry ¶
type ActionRegistry struct {
// contains filtered or unexported fields
}
ActionRegistry manages actions (unified for both App and Components)
func NewActionRegistry ¶
func NewActionRegistry() *ActionRegistry
func (*ActionRegistry) MustRegister ¶
func (r *ActionRegistry) MustRegister(id, key string, handler func())
func (*ActionRegistry) MustRegisterAction ¶
func (r *ActionRegistry) MustRegisterAction(action *Action)
MustRegisterAction adds a pre-created action and panics on error
func (*ActionRegistry) Register ¶
func (r *ActionRegistry) Register(id, keys string, handler func()) error
Register adds an action to the registry
func (*ActionRegistry) RegisterAction ¶
func (r *ActionRegistry) RegisterAction(action *Action) error
RegisterAction adds a pre-created action (e.g., menu action) to the registry
type ActionSource ¶ added in v0.1.4
type ActionSource uint8
ActionSource identifies how an action was invoked.
const ( ActionSourceKeyboard ActionSource = iota // triggered by a matching keyboard shortcut ActionSourceMenu // triggered by a menu click (reserved; not yet emitted) )
type App ¶
type App struct {
// contains filtered or unexported fields
}
func (*App) GetWindowPos ¶
GetWindowPos returns the current window position
func (*App) GetWindowSize ¶
GetWindowSize returns the current window size
func (*App) SetShouldClose ¶
SetShouldClose sets whether the window should close this can be used in OnClose callback to cancel closing
func (*App) SetWindowPos ¶ added in v0.1.5
SetWindowPos moves the window to the given position. the move is applied at the next frame boundary rather than immediately, since a geometry change made during a frame can re-enter the render loop; a later call before that boundary supersedes an earlier one. must be called on the UI goroutine (e.g. from an action handler or a Config callback), since the underlying GLFW window operation is main-thread only.
func (*App) SetWindowSize ¶ added in v0.1.5
SetWindowSize resizes the window to the given dimensions. applied at the next frame boundary; see SetWindowPos. must be called on the UI goroutine (e.g. from an action handler or a Config callback), since the underlying GLFW window operation is main-thread only.
func (*App) SetWindowTitle ¶
SetWindowTitle updates the window title
type BaseCommand ¶
type BaseCommand struct {
// contains filtered or unexported fields
}
BaseCommand provides default implementations for common command functionality. embed this struct to get sensible defaults for timestamp tracking.
func (*BaseCommand) SetStamp ¶
func (bc *BaseCommand) SetStamp(t time.Time)
SetStamp allows manual setting of the timestamp.
func (*BaseCommand) Stamp ¶
func (bc *BaseCommand) Stamp() time.Time
Stamp implements StampedCommand with automatic timestamp on first call.
type Bounds ¶ added in v0.1.0
Bounds represents a rectangular region with explicit position and dimensions.
type ChildActionProvider ¶ added in v0.0.10
type ChildActionProvider interface {
ChildActions() []Component
}
ChildActionProvider exposes child components for action traversal. components that compose other components can implement this to participate in hierarchical action lookup.
type Command ¶
type Command interface {
Description() string
Run()
Undo()
}
Command is the core interface for undoable operations. simple commands only need to implement these three methods.
type Component ¶
type Component interface {
// Draw renders the component. Unlike Surface.DrawF, we pass a State
// that contains more than just size - it has everything needed to draw.
Draw(state *State)
// Actions returns the component's action registry.
// this provides a consistent API for registering keyboard shortcuts.
Actions() *ActionRegistry
}
Component is the core abstraction - a drawable, interactive UI element.
type Config ¶
type Config struct {
Title string
Width int
Height int
X int // window X position (0 = don't set)
Y int // window Y position (0 = don't set)
OnSetup func(*App) // called once after imgui context created
OnShutdown func(*App) // called before shutdown
OnTick func(*App) // called each frame before drawing
OnClose func(*App) // called when window is about to close (can call SetShouldClose to cancel)
OnSizeChange func(int, int) // called when window is resized
OnAction func(ActionEvent) // called whenever an action is invoked (usage telemetry)
MenuBar Component // optional menu bar component
Theme Theme // optional theme (defaults to DefaultTheme)
DisableFonts bool // if true, skip font setup (use default ImGui fonts)
DisableTheming bool // if true, skip theme setup (use default ImGui theme)
Icons []image.Image // optional window icons
}
type Container ¶
type Container struct {
Visible bool
Children []Component
OnDraw func(*State)
// contains filtered or unexported fields
}
Container is a basic component implementation that others can embed. provides default implementations and common fields.
func (*Container) Actions ¶
func (c *Container) Actions() *ActionRegistry
Actions implements Component
func (*Container) ChildActions ¶ added in v0.0.10
ChildActions returns action-traversable children.
func (*Container) LocalActions ¶ added in v0.0.10
func (c *Container) LocalActions() *ActionRegistry
LocalActions returns this container's local action registry.
type Dash ¶
type Dash struct {
Container
Name string
Component Component
TargetSize int
CurrentSize int
MinSize int
MaxSize int
Resizable bool
TransitionMs int
Focused bool
}
func (*Dash) Actions ¶
func (d *Dash) Actions() *ActionRegistry
Actions implements Component by delegating to the child component
func (*Dash) ChildActions ¶ added in v0.0.10
ChildActions returns dash content for action traversal.
func (*Dash) Draw ¶
Draw implements Component interface - this is for when Dash is used as a standalone component
func (*Dash) DrawDash ¶
func (d *Dash) DrawDash(state *State, bounds Bounds, attachment DashAttachment)
func (*Dash) LocalActions ¶ added in v0.0.10
func (d *Dash) LocalActions() *ActionRegistry
LocalActions returns dash-local actions without delegation.
type DashAttachment ¶
type DashAttachment int
const ( LeftDash DashAttachment = iota RightDash TopDash BottomDash )
type DashConfig ¶
DashConfig holds configuration for a single dashboard panel
type DashManager ¶
type DashManager struct {
Container
Precedence DashPrecedence
TopMargin float32
Margin float32
Left *Dash
Top *Dash
Right *Dash
Bottom *Dash
Focused *Dash
Inner Component
}
func NewDashManager ¶
func NewDashManager() *DashManager
func (*DashManager) Actions ¶
func (d *DashManager) Actions() *ActionRegistry
Actions implements Component by prioritizing focused dash actions
func (*DashManager) ChildActions ¶ added in v0.0.10
func (d *DashManager) ChildActions() []Component
ChildActions returns the active child component for action traversal.
func (*DashManager) Draw ¶
func (d *DashManager) Draw(state *State)
func (*DashManager) LocalActions ¶ added in v0.0.10
func (d *DashManager) LocalActions() *ActionRegistry
LocalActions returns dash manager-local actions without delegation.
type DashPrecedence ¶
type DashPrecedence int
type FaderParams ¶
type FaderParams struct {
// Taper curve (affects UI feel, not values)
// nil = linear taper
Taper Taper
// Range stops (in normalized 0-1 space, applied after taper)
MinStop float32 // minimum value (default 0.0)
MaxStop float32 // maximum value (default 1.0)
// Reset value (in normalized 0-1 space)
ResetValue float32 // default 0.0
// Dimensions
Width float32 // default 30.0
Height float32 // default 300.0
// Display options
Format func(normalized float32) string // optional: custom tooltip format
ShowTooltip bool // show value on hover (default true)
// Mouse wheel sensitivity
WheelSteps float32 // default 100.0 (finer = more steps)
// Custom track/background color (nil = use theme default)
TrackColor *imgui.Vec4
}
FaderParams configures extended fader behavior.
func DefaultFaderParams ¶
func DefaultFaderParams() FaderParams
DefaultFaderParams returns sensible default parameters.
type FileNode ¶
FileNode represents a node in the filesystem tree. nodes maintain parent-child relationships and can represent either directories or files.
func BuildTree ¶
BuildTree recursively scans a filesystem path and builds a tree structure. the parent parameter should be nil for the root node.
type FileTree ¶
type FileTree struct {
Container
Root *FileNode
Selected *FileNode
OnSelect func(*FileNode)
OnDoubleClick func(*FileNode)
Filter func(*FileNode) bool
}
FileTree is a component that displays a filesystem tree with selection and interaction support.
func NewFileTree ¶
NewFileTree creates a new filesystem tree component.
func (*FileTree) SelectNode ¶
SelectNode programmatically selects a node.
type FlexLayout ¶
type FlexLayout struct {
// contains filtered or unexported fields
}
FlexLayout provides a resizable grid layout similar to the original MultiSurface
func NewFlexLayout ¶
func NewFlexLayout(arrangement [][]string) *FlexLayout
NewFlexLayout creates a flexible layout with the given arrangement
func (*FlexLayout) Arrange ¶
func (fl *FlexLayout) Arrange(components map[string]Component, state *State)
Arrange renders components in a flexible grid with resizable splitters
func (*FlexLayout) ColWidths ¶ added in v0.0.9
func (fl *FlexLayout) ColWidths() [][]int
ColWidths returns a copy of the current column widths for all rows.
func (*FlexLayout) HandleInput ¶
func (fl *FlexLayout) HandleInput(state *State)
HandleInput processes mouse input for resize operations
func (*FlexLayout) RowHeights ¶ added in v0.0.9
func (fl *FlexLayout) RowHeights() []int
RowHeights returns a copy of the current row heights.
func (*FlexLayout) SetColWidths ¶ added in v0.0.9
func (fl *FlexLayout) SetColWidths(widths [][]int)
SetColWidths sets the column widths for all rows. the structure must match the arrangement.
func (*FlexLayout) SetRowHeights ¶ added in v0.0.9
func (fl *FlexLayout) SetRowHeights(heights []int)
SetRowHeights sets the row heights. the slice length must match the number of rows.
type FullCommand ¶
type FullCommand interface {
MergeableCommand
StampedCommand
}
FullCommand combines both mergeable and stamped capabilities.
type Func ¶
type Func struct {
// contains filtered or unexported fields
}
Func is a function component that can have keyboard actions. use this when you need a simple component with keyboard shortcuts.
func (*Func) Actions ¶
func (f *Func) Actions() *ActionRegistry
func (*Func) LocalActions ¶ added in v0.0.10
func (f *Func) LocalActions() *ActionRegistry
LocalActions returns this component's local action registry.
type GridCell ¶
type GridCell struct {
Row, Col int // grid position (0-based)
RowSpan, ColSpan int // span (1,1 = single cell)
}
GridCell defines a component's position in the grid
type GridLayout ¶
type GridLayout struct {
// contains filtered or unexported fields
}
GridLayout provides fixed-position grid layout with no interactive resizing
func NewGridLayout ¶
func NewGridLayout(gridWidth, gridHeight int) *GridLayout
NewGridLayout creates a fixed grid layout
func (*GridLayout) Arrange ¶
func (gl *GridLayout) Arrange(components map[string]Component, state *State)
Arrange renders components at fixed grid positions
func (*GridLayout) HandleInput ¶
func (gl *GridLayout) HandleInput(state *State)
HandleInput processes input (no interactive resizing for grid layout)
type HCollapse ¶ added in v0.0.5
type HCollapse struct {
Container
Title string // displayed in header when expanded (also used for imgui ID)
Expanded bool // current state
ExpandedWidth float32 // width when fully expanded
CurrentWidth float32 // animated width (internal)
MinWidth float32 // collapsed width (toggle button only)
MaxWidth float32 // maximum width when resizing (0 = no limit)
Height float32 // vertical height (0 = use available height from state.Size.Y)
TransitionMs int // animation duration
Resizable bool // allow drag-to-resize when expanded
Content Component // the component to show/hide
OnToggle func(expanded bool) // optional callback on state change
}
HCollapse is a horizontal collapsible component that contains content to its right. when collapsed, only the toggle button is visible. when expanded, shows a header bar with title and the content below.
func NewHCollapse ¶ added in v0.0.5
func NewHCollapse(content Component, cfg HCollapseConfig) *HCollapse
NewHCollapse creates a new horizontal collapsible component.
func (*HCollapse) Actions ¶ added in v0.0.5
func (h *HCollapse) Actions() *ActionRegistry
Actions implements Component by delegating to the content component.
func (*HCollapse) ChildActions ¶ added in v0.0.10
ChildActions returns the content component for action traversal.
func (*HCollapse) LocalActions ¶ added in v0.0.10
func (h *HCollapse) LocalActions() *ActionRegistry
LocalActions returns panel-local actions without delegation.
type HCollapseConfig ¶ added in v0.0.5
type HCollapseConfig struct {
Title string
ExpandedWidth float32
MinWidth float32 // defaults to HCollapseDefaultMinWidth
MaxWidth float32 // 0 = no limit
Height float32 // 0 = fill available height from parent
TransitionMs int // defaults to HCollapseDefaultTransition
Resizable bool
Expanded bool // initial state
}
HCollapseConfig provides configuration options for NewHCollapse.
type HueColorScheme ¶
type HueColorScheme struct {
Hue int
TextSaturation float32
TextValue float32
MainSaturation float32
MainValue float32
AreaSaturation float32
AreaValue float32
BgSaturation float32
BgValue float32
// contains filtered or unexported fields
}
HueColorScheme creates themes based on HSV color space this allows dynamic theme generation with consistent relationships
func NewHueColorScheme ¶
func NewHueColorScheme(name string, hue int, sat, value float32) *HueColorScheme
NewHueColorScheme creates a new HSV-based color scheme. hue is expected in the 0-255 range (matching the ImGui style editor convention), not degrees. sat and value are also in 0-255 range.
func (*HueColorScheme) Apply ¶
func (s *HueColorScheme) Apply()
func (*HueColorScheme) Name ¶
func (s *HueColorScheme) Name() string
type KeyEvent ¶
type KeyEvent struct {
Key imgui.Key
Pressed bool
Modifier KeyModifier
}
KeyEvent represents keyboard input for component action checking
type KeyModifier ¶
type KeyModifier uint8
const ( ModNone KeyModifier = 0 ModCtrl KeyModifier = 1 << 0 ModShift KeyModifier = 1 << 1 ModAlt KeyModifier = 1 << 2 ModSuper KeyModifier = 1 << 3 )
type Layout ¶
type Layout interface {
// Arrange renders the components according to the layout strategy
Arrange(components map[string]Component, state *State)
// HandleInput processes user input for layout-specific interactions (resizing, etc)
HandleInput(state *State)
}
Layout defines how components are arranged and how user interaction is handled
type LocalActionProvider ¶ added in v0.0.10
type LocalActionProvider interface {
LocalActions() *ActionRegistry
}
LocalActionProvider exposes a component's local action registry. this allows traversal code to use local actions directly even when Actions() is used for legacy delegation behavior.
type LogBuffer ¶
type LogBuffer struct {
// contains filtered or unexported fields
}
LogBuffer is a thread-safe circular buffer for log messages.
func NewLogBuffer ¶
NewLogBuffer creates a new log buffer with the specified maximum size.
func (*LogBuffer) Add ¶
func (lb *LogBuffer) Add(msg LogMessage)
Add appends a log message to the buffer. if the buffer is full, the oldest message is overwritten.
func (*LogBuffer) Messages ¶
func (lb *LogBuffer) Messages() []LogMessage
Messages returns a copy of all messages in the buffer in order.
type LogMessage ¶
LogMessage represents a single log entry.
type LogViewer ¶
type LogViewer struct {
Container
Buffer *LogBuffer
AutoScroll bool
LevelFilter slog.Level // minimum level to show
ShowTime bool
ShowFunc bool
ShowFields bool
ShowDisabledMessage bool
DisabledMessage string
}
LogViewer is a component that displays log messages from a LogBuffer.
func NewLogViewer ¶
NewLogViewer creates a new log viewer component.
type MergeableCommand ¶
MergeableCommand extends Command with merge capability. implement this interface when commands can be merged together.
type ModernTheme ¶
type ModernTheme struct{}
ModernTheme implements a predefined dark theme
func (*ModernTheme) Apply ¶
func (m *ModernTheme) Apply()
func (*ModernTheme) Name ¶
func (m *ModernTheme) Name() string
type MultiGrid ¶
type MultiGrid struct {
Container
// contains filtered or unexported fields
}
MultiGrid is a flexible component container that separates component management from layout strategy. Components are managed as a named collection, and different layout strategies can be applied to arrange them.
func NewMultiGrid ¶
func NewMultiGrid() *MultiGrid
NewMultiGrid creates a new MultiGrid with no components and no layout
func (*MultiGrid) AddComponent ¶
AddComponent adds a named component to the collection
func (*MultiGrid) ComponentIDs ¶
ComponentIDs returns all component IDs in the collection
func (*MultiGrid) GetComponent ¶
GetComponent retrieves a component by ID
func (*MultiGrid) RemoveComponent ¶
RemoveComponent removes a component from the collection
type ScaleConfig ¶
type ScaleConfig struct {
// Tick marks at normalized positions (0.0-1.0)
// Example: []float32{0.0, 0.25, 0.5, 0.75, 1.0}
Marks []float32
// Labels at specific normalized positions
// Example: map[float32]string{0.0: "-60dB", 0.5: "-12dB", 1.0: "0dB"}
Labels map[float32]string
// Visual appearance
TickLength float32 // Length of tick marks in pixels (default: 5.0)
LabelOffset float32 // Distance from ticks to labels in pixels (default: 3.0)
Position string // "left" or "right" (default: "left")
}
ScaleConfig defines the appearance and content of a fader scale.
func DefaultScaleConfig ¶
func DefaultScaleConfig() ScaleConfig
DefaultScaleConfig returns sensible defaults for a fader scale.
type SizeDebugger ¶
type SizeDebugger struct {
Margin float32
// contains filtered or unexported fields
}
func NewSizeDebugger ¶
func NewSizeDebugger() *SizeDebugger
func (*SizeDebugger) Actions ¶
func (sd *SizeDebugger) Actions() *ActionRegistry
func (*SizeDebugger) Draw ¶
func (sd *SizeDebugger) Draw(state *State)
type SlogHandler ¶
type SlogHandler struct {
// contains filtered or unexported fields
}
SlogHandler is a slog.Handler implementation that writes to a LogBuffer. this provides integration with the df/dl logging framework.
func NewSlogHandler ¶
func NewSlogHandler(buffer *LogBuffer, opts *SlogHandlerOptions) *SlogHandler
NewSlogHandler creates a new slog handler that writes to a log buffer.
type SlogHandlerOptions ¶
SlogHandlerOptions configures the slog handler integration.
type StampedCommand ¶
StampedCommand extends Command with timestamp capability. implement this interface when commands need timestamp tracking.
type State ¶
type State struct {
// Size available for this component to draw in
Size imgui.Vec2
// Position where this component should draw (for absolute positioning)
Position imgui.Vec2
// IO provides access to imgui's input/output system
IO *imgui.IO
// App provides access to the application instance
App *App
// Parent component (nil for root)
Parent Component
}
State provides everything a component needs to draw. this consolidates what Surface scattered across multiple parameters.
type Taper ¶
type Taper interface {
// Apply taper: normalized (0-1) -> tapered (0-1) for UI positioning
Apply(normalized float32) float32
// Invert taper: tapered (0-1) -> normalized (0-1) from UI position
Invert(tapered float32) float32
}
Taper defines non-linear response curves for faders. Tapers affect the UI feel without changing the underlying value range.
func AudioTaper ¶
func AudioTaper() Taper
AudioTaper returns a standard audio fader taper. Optimized for dB scales, approximates analog audio faders.
func CustomTaper ¶
CustomTaper creates a taper from user-provided functions. apply: normalized (0-1) -> tapered (0-1) invert: tapered (0-1) -> normalized (0-1)
func DecibelTaper ¶
DecibelTaper returns a taper where UI position is linear with decibels. Use this when hardware values are proportional to linear amplitude and you want equal fader travel per dB across the entire range. dbRange is the total dB range (e.g., 72.0 for -60dB to +12dB).
func LinearTaper ¶
func LinearTaper() Taper
LinearTaper returns a taper with no curve (1:1 mapping).
type Theme ¶
type Theme interface {
Apply() // applies the theme to ImGui style
Name() string
}
Theme interface allows for extensible theming system
type ToolbarLayout ¶ added in v0.1.1
type ToolbarLayout struct {
// contains filtered or unexported fields
}
ToolbarLayout provides vertical centering helpers for items inside a toolbar.
func (*ToolbarLayout) CenterFrame ¶ added in v0.1.1
func (t *ToolbarLayout) CenterFrame()
CenterFrame sets the cursor Y to vertically center a frame-height item (combo, button, input) within the toolbar.
func (*ToolbarLayout) CenterText ¶ added in v0.1.1
func (t *ToolbarLayout) CenterText()
CenterText sets the cursor Y to align standalone text with the text baseline of frame-height items (combos, buttons) in the toolbar.
type UndoSystem ¶
type UndoSystem struct {
// RunF is called whenever a command is executed, useful for tracking modifications
RunF func(Command)
// contains filtered or unexported fields
}
UndoSystem manages command history and undo/redo operations.
func (*UndoSystem) CanRedo ¶
func (us *UndoSystem) CanRedo() bool
CanRedo returns true if there are commands that can be redone.
func (*UndoSystem) CanUndo ¶
func (us *UndoSystem) CanUndo() bool
CanUndo returns true if there are commands that can be undone.
func (*UndoSystem) Clear ¶
func (us *UndoSystem) Clear()
Clear removes all commands from both undo and redo stacks.
func (*UndoSystem) HistoryComponent ¶
func (us *UndoSystem) HistoryComponent() Component
HistoryComponent returns a component that displays the undo/redo history. this replaces the original Draw method with dfx's component architecture.
func (*UndoSystem) Redo ¶
func (us *UndoSystem) Redo()
Redo re-executes the last undone command and moves it back to the undo stack.
func (*UndoSystem) Run ¶
func (us *UndoSystem) Run(command Command)
Run executes a command and adds it to the undo stack. if the command is mergeable and can merge with the previous command, they will be merged instead of creating a new stack entry.
func (*UndoSystem) Undo ¶
func (us *UndoSystem) Undo()
Undo reverses the last command and moves it to the redo stack.
type VUMeter ¶ added in v0.0.4
type VUMeter struct {
Container
// display mode
Mode VUMeterMode // rendering style (default: VUMeterSolid)
// fixed size configuration
Height float32 // total height in pixels (default: 200)
ChannelWidth float32 // width of each channel meter (default: 12)
// segment configuration
SegmentCount int // number of vertical segments (default: 20)
SegmentGap float32 // gap between segments in pixels (default: 2)
ChannelGap float32 // gap between channel meters (default: 4)
// peak hold configuration
PeakHoldMs int // peak hold duration in ms, 0 = disabled (default: 1000)
PeakDecayRate float32 // peak decay rate per second (default: 0.5)
// clip indicator configuration
ClipHoldMs int // how long clip indicator stays lit in ms (default: 2000)
// labels (optional, per-channel)
Labels []string // custom labels like "L", "R", "Kick", etc.
LabelHeight float32 // height reserved for labels (default: 16)
// colors (configurable, with sensible defaults)
ColorLow imgui.Vec4 // green zone (0-60%)
ColorMid imgui.Vec4 // yellow zone (60-80%)
ColorHigh imgui.Vec4 // red zone (80-100%)
ColorOff imgui.Vec4 // inactive segment color
ColorPeak imgui.Vec4 // peak indicator color
ColorClip imgui.Vec4 // clip indicator color (bright red)
// contains filtered or unexported fields
}
VUMeter is a vertical level meter component. supports any number of channels displayed side by side.
func NewVUMeter ¶ added in v0.0.4
NewVUMeter creates a new VU meter with the specified number of channels.
func (*VUMeter) ChannelCount ¶ added in v0.0.4
ChannelCount returns the number of channels.
func (*VUMeter) SetChannelCount ¶ added in v0.0.4
SetChannelCount resizes the meter to the specified number of channels.
func (*VUMeter) SetLevel ¶ added in v0.0.4
SetLevel sets the level for a single channel (0.0 to 1.0).
type VUMeterMode ¶ added in v0.0.7
type VUMeterMode int
VUMeterMode defines the visual rendering style of the meter.
const ( // VUMeterSolid renders a continuous fill with color zones (default). VUMeterSolid VUMeterMode = iota // VUMeterHighres renders 1px segments with 1px gaps for high resolution display. VUMeterHighres // VUMeterSegmented renders discrete segments with configurable count and gap. VUMeterSegmented )
type VUWaterfall ¶ added in v0.0.7
type VUWaterfall struct {
Container
// dimensions
Height float32 // total height in pixels (default: 200)
ChannelWidth float32 // width per channel (default: 40)
ChannelGap float32 // gap between channels (default: 4)
RowHeight float32 // height of each history row (default: 2)
RowGap float32 // gap between rows (default: 0)
// history configuration
HistorySize int // number of samples to keep (default: 100)
SampleInterval time.Duration // minimum time between samples (default: 16ms)
// display mode
Highres bool // when true, alternates row opacity for scanline effect
// colors (same as VUMeter for consistency)
ColorLow imgui.Vec4 // green zone (0-60%)
ColorMid imgui.Vec4 // yellow zone (60-80%)
ColorHigh imgui.Vec4 // red zone (80-100%)
ColorOff imgui.Vec4 // background/inactive
// contains filtered or unexported fields
}
VUWaterfall is a scrolling history display of VU levels over time. new data appears at the bottom and scrolls upward. each row shows a horizontal bar whose width represents the level at that time slice.
func NewVUWaterfall ¶ added in v0.0.7
func NewVUWaterfall(channelCount int) *VUWaterfall
NewVUWaterfall creates a new waterfall display with the specified number of channels.
func (*VUWaterfall) ChannelCount ¶ added in v0.0.7
func (w *VUWaterfall) ChannelCount() int
ChannelCount returns the number of channels.
func (*VUWaterfall) Clear ¶ added in v0.0.7
func (w *VUWaterfall) Clear()
Clear resets the history buffer.
func (*VUWaterfall) Draw ¶ added in v0.0.7
func (w *VUWaterfall) Draw(state *State)
Draw renders the VU waterfall.
func (*VUWaterfall) SetChannelCount ¶ added in v0.0.7
func (w *VUWaterfall) SetChannelCount(count int)
SetChannelCount resizes the waterfall to the specified number of channels. this clears the history buffer.
func (*VUWaterfall) SetHistorySize ¶ added in v0.0.7
func (w *VUWaterfall) SetHistorySize(size int)
SetHistorySize sets the number of samples to keep and reinitializes the buffer. this clears the history buffer.
func (*VUWaterfall) SetLevel ¶ added in v0.0.7
func (w *VUWaterfall) SetLevel(channel int, level float32)
SetLevel sets the level for a single channel and adds a new history entry. note: this creates a new row with only this channel set; prefer SetLevels for multi-channel. If SampleInterval is set, samples are throttled to maintain consistent scroll speed.
func (*VUWaterfall) SetLevels ¶ added in v0.0.7
func (w *VUWaterfall) SetLevels(levels []float32)
SetLevels sets levels for all channels at once and adds a new history entry. If SampleInterval is set, samples are throttled to maintain consistent scroll speed.
func (*VUWaterfall) Width ¶ added in v0.0.7
func (w *VUWaterfall) Width() float32
Width returns the calculated total width of the waterfall.
type WindowConfig ¶
type WindowConfig struct {
X int
Y int
Width int
Height int
Maximized bool // window maximized state (capture only, restore not yet implemented)
}
WindowConfig holds window position and size configuration
func CaptureWindowState ¶
func CaptureWindowState(app *App) WindowConfig
CaptureWindowState gets current window state from App
func GetDefaultWindowConfig ¶
func GetDefaultWindowConfig() WindowConfig
GetDefaultWindowConfig returns sensible default window configuration
type Workspace ¶
type Workspace struct {
Container
// configuration
ShowSelector bool // if true, shows a combo selector at the top
SelectorLabel string // label for the combo selector
SelectorWidth float32 // width of selector (-1 for auto-width)
// callbacks
OnSwitch func(oldId, newId string) // called when workspace changes (passes IDs)
// contains filtered or unexported fields
}
Workspace manages multiple named components and allows switching between them. provides a high-level component for building applications with multiple views/modes. separates stable IDs from display names for flexibility.
func (*Workspace) Actions ¶ added in v0.0.10
func (ws *Workspace) Actions() *ActionRegistry
Actions returns the action registry of the current workspace component, enabling action propagation through the workspace to the active component.
func (*Workspace) Add ¶
Add adds or replaces a workspace with the given id, display name, and component. if this is the first workspace added, it becomes current. if a workspace with the same id exists, it is replaced.
func (*Workspace) ChildActions ¶ added in v0.0.10
ChildActions returns the current active workspace component for action traversal.
func (*Workspace) Current ¶
Current returns the id of the current workspace. returns empty string if no workspaces exist.
func (*Workspace) CurrentComponent ¶
CurrentComponent returns the current workspace component. returns nil if no workspaces exist.
func (*Workspace) CurrentName ¶
CurrentName returns the display name of the current workspace. returns empty string if no workspaces exist.
func (*Workspace) GetName ¶
GetName returns the display name for the given workspace Id. returns empty string if the workspace doesn't exist.
func (*Workspace) LocalActions ¶ added in v0.0.10
func (ws *Workspace) LocalActions() *ActionRegistry
LocalActions returns workspace-local actions without delegation.
func (*Workspace) Remove ¶
Remove removes a workspace by id. if the current workspace is removed, switches to the first available workspace.
func (*Workspace) SetName ¶
SetName changes the display name of a workspace without affecting its Id. returns true if the workspace was found and updated.
func (*Workspace) Switch ¶
Switch changes to the workspace with the given id. returns true if the switch was successful.
func (*Workspace) SwitchByIndex ¶
SwitchByIndex changes to the workspace at the given index. returns true if the switch was successful.
func (*Workspace) WorkspaceIds ¶
WorkspaceIds returns a copy of the workspace IDs in order.
func (*Workspace) WorkspaceNames ¶
WorkspaceNames returns a copy of the workspace display names in order.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
dfx_example_actions
command
|
|
|
dfx_example_composition
command
|
|
|
dfx_example_config
command
|
|
|
dfx_example_container
command
|
|
|
dfx_example_controls
command
|
|
|
dfx_example_custom_component
command
|
|
|
dfx_example_dash
command
|
|
|
dfx_example_demo
command
|
|
|
dfx_example_filetree
command
|
|
|
dfx_example_hcollapse
command
|
|
|
dfx_example_layout
command
|
|
|
dfx_example_lifecycle
command
|
|
|
dfx_example_logviewer
command
|
|
|
dfx_example_menu
command
|
|
|
dfx_example_mixer
command
|
|
|
dfx_example_multigrid
command
|
|
|
dfx_example_simple
command
|
|
|
dfx_example_simple_hcollapse
command
|
|
|
dfx_example_themes
command
|
|
|
dfx_example_undo
command
|
|
|
dfx_example_vumeter
command
|
|
|
dfx_example_workspace
command
|
|