Documentation
¶
Index ¶
- Constants
- Variables
- func BeginChild(id string, width, height float32, border bool) bool
- func BeginMenu(label string) bool
- func BeginMenuBar() bool
- func Button(label string) bool
- func ButtonSize(label string, width, height float32) bool
- func CaptureDashState(dm *DashManager) map[string]DashConfig
- 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 EndChild()
- func EndMenu()
- func EndMenuBar()
- 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 MenuItem(label string, shortcut string) bool
- func PopFont()
- func PushFont(fontIndex int)
- func RestoreDashState(dm *DashManager, config map[string]DashConfig)
- func SameLine()
- func SaveJSON(path string, config interface{}) error
- func Separator()
- 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 Spacing()
- func Text(text string)
- func TextColored(text string, r, g, b, a float32)
- func Toggle(label string, value bool) (bool, bool)
- func Tooltip(text string)
- func TreeNode(label string) bool
- func TreePop()
- func WheelSlider(label string, value, min, max, wheelSteps float32, format string, ...) (float32, bool)
- type Action
- type ActionRegistry
- 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) SetWindowTitle(title string)
- func (app *App) Stop()
- func (app *App) Wait() error
- type BaseCommand
- 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
- type FullCommand
- type Func
- type GridCell
- type GridLayout
- type HCollapse
- type HCollapseConfig
- type HueColorScheme
- type KeyEvent
- type KeyModifier
- type Layout
- 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 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 WindowConfig
- type Workspace
- func (ws *Workspace) Add(id, name string, component 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) 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 WheelNeutralValue = 0 )
const ( VerticalPrecedence = DashPrecedence(iota) HorizontalPrecedence )
const ( MainFont = 0 // default font (Gidole Regular, 20px) with Material Icons merged MonospaceFont = 1 // monospace font (JetBrains Mono, 18px) 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 (
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 BeginChild ¶
BeginChild starts a scrollable region
func ButtonSize ¶
ButtonSize creates a button with specific size
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 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 PushFont ¶
func PushFont(fontIndex int)
PushFont convenience function for temporarily switching fonts
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 TextColored ¶
TextColored displays colored text
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 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 MustBuildMenuAction ¶
MustBuildMenuAction is an alias for backward compatibility with imapp naming
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 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 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) 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 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
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)
}
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
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
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) Draw ¶
func (d *DashManager) Draw(state *State)
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.
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) HandleInput ¶
func (fl *FlexLayout) HandleInput(state *State)
HandleInput processes mouse input for resize operations
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
type GridCell ¶
type GridCell struct {
Row, Col int // grid position (0-based)
Span imgui.Vec2 // rowspan, colspan (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.
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
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 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 removed.
func (*LogBuffer) Messages ¶
func (lb *LogBuffer) Messages() []LogMessage
Messages returns a copy of all messages in the buffer.
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
}
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 UndoSystem ¶
type UndoSystem struct {
// RunF is called whenever a command is executed, useful for tracking modifications
RunF func()
// 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
// 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, digital (segmented) 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 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) 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) 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) 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_controls
command
|
|
|
dfx_example_custom_component
command
|
|
|
dfx_example_dash
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
|
|