API Reference
Fugl.DEFAULT_FONT_PATH — Constant
DEFAULT_FONT_PATHPath to the default font file. Users can override this before calling load_default_font!() to use a custom font throughout their application.
Example
Fugl.DEFAULT_FONT_PATH[] = "/path/to/my/font.ttf"
Fugl.load_default_font!()Fugl.AbstractTextEditorView — Type
Abstract base type for text editor components. Both CodeEditor and TextBox inherit from this type.
Fugl.ButtonState — Type
Enum representing the state of a mouse button.
IsReleased: The button is currently released.IsPressed: The button is currently pressed.
Fugl.ClickResult — Type
Struct with Mouse click function with z-height for layering.
Fugl.CursorPosition — Type
Represents the position of a cursor in the editor.
line: Line number (1-based)column: Column number (1-based, character position within the line)
Fugl.DPIScaling — Type
Simple DPI scaling state for the current rendering context. Only manual scaling - no automatic system DPI detection.
Fugl.EditorState — Type
State for the code editor containing text, cursor position, and cached tokenization.
text: The full text contentcursor: Current cursor positionis_focused: Whether the editor is focusedselection_start: Start position of text selection (if any)selection_end: End position of text selection (if any)cached_lines: Cache of tokenized line datatext_hash: Hash of the text to detect changes
Fugl.EditorState — Method
Create a new EditorState from an existing state with keyword-based modifications.
Fugl.EditorState — Method
Create a new EditorState with old 5-parameter signature (for backward compatibility).
Fugl.EditorState — Method
Create a new EditorState with the given text and cursor at the beginning.
Fugl.GLContextState — Type
OpenGL Context State Management
This module provides a simple state management system for OpenGL contexts, allowing for framebuffer management, caching, and tracking of current OpenGL state.
Fugl.GlyphAtlas — Type
A texture atlas that stores multiple glyphs in a single OpenGL texture. This dramatically speeds up text rendering by avoiding texture creation per glyph.
Fugl.GlyphBatch — Type
A structure to hold batched glyph data for efficient rendering. Each glyph becomes two triangles (6 vertices) in the batch. Inspired by Makie.jl's TextureAtlas approach.
Fugl.GlyphKey — Type
Unique identifier for a glyph at a specific size and font.
Fugl.GlyphUV — Type
UV coordinates and dimensions for a glyph in the atlas.
Fugl.HeatmapElement — Method
Create a new HeatmapElement from an existing element with keyword-based modifications.
Fugl.HorizontalColorbar — Type
HorizontalColorbar represents a horizontal colorbar plot element. Size is controlled by FixedHeight layout component.
Fugl.HorizontalColorbar — Method
Create a new HorizontalColorbar from an existing colorbar with keyword-based modifications.
Fugl.HorizontalLineView — Type
Horizontal line separator that fills available width
Fugl.HorizontalScrollAreaView — Type
HorizontalScrollArea view that wraps content and provides horizontal scrolling
Fugl.HorizontalScrollState — Type
State for tracking horizontal scroll area scrolling information
Fugl.HorizontalScrollState — Method
Create a new HorizontalScrollState from an existing state with keyword-based modifications
Fugl.HorizontalScrollState — Method
Create a new HorizontalScrollState
Fugl.HorizontalSliderView — Type
HorizontalSlider with state management and discrete step support.
state: SliderState containing current value, range, and interaction statesteps: Optional step snapping (Int for number of steps, Real for step size, nothing for continuous)style: Style for the slideron_state_change: Callback for state changes (required for state updates)on_change: Callback for value changes only
Fugl.HorizontalSplitContainerView — Type
A container that allows horizontal resizing by dragging a vertical splitter handle between left and right child components. Optimized version with no runtime direction checks for better performance.
Fugl.InteractionState — Type
Interaction state management for GUI components.
Provides a common structure for tracking user interactions like hover, press, focus, etc.
Fugl.InteractionState — Method
Create a new InteractionState from an existing state with keyword-based modifications.
Fugl.InteractionState — Method
Create a new InteractionState with default (inactive) values.
Fugl.KeyEvent — Type
Struct representing a keyboard event.
key: GLFW key code (e.g., GLFW.KEYA, GLFW.KEYENTER)scancode: Hardware-specific scancodeaction: GLFW action (GLFW.PRESS, GLFW.RELEASE, GLFW.REPEAT)mods: Modifier key flags (GLFW.MODSHIFT, GLFW.MODCONTROL, etc.)
Fugl.LegendView — Type
Legend component for displaying plot element labels with visual representations.
Fugl.LineBatch — Type
Struct for storing a batch of lines for efficient drawing.
Fugl.LineCap — Type
Line cap styles for line endpoints.
Fugl.LinePattern — Type
Enumeration for different line patterns.
Fugl.LinePlotElement — Method
Create a new LinePlotElement from an existing element with keyword-based modifications.
Fugl.LineTokenData — Type
Cached tokenization data for a line of code.
line_number: The line number this data belongs toline_text: The original line texttokens: Vector of tokens for this linetoken_data: Processed token data with positions and colors
Fugl.MarkerBatch — Type
Struct for batch drawing markers.
Fugl.ModifierKeys — Type
Struct representing the current state of modifier keys. This provides a clean, explicit API that doesn't require knowledge of GLFW constants.
shift: Whether Shift key is pressedcontrol: Whether Control key is pressedalt: Whether Alt key is pressedsuper: Whether Super/Cmd/Windows key is pressedcaps_lock: Whether Caps Lock is activenum_lock: Whether Num Lock is active
Fugl.ModifierKeys — Method
Create ModifierKeys from GLFW modifier bit flags
Fugl.ModifierKeys — Method
Default constructor for ModifierKeys with all keys released
Fugl.MouseButton — Type
Enum representing the different mouse buttons.
LeftButton: The left mouse button.RightButton: The right mouse button.MiddleButton: The middle mouse button (scroll button).
Fugl.PartialBounds — Type
Partial bounds specification for initial view
Fugl.PeriodicCallback — Type
PeriodicCallback(func::Function, interval::Int)Represents a periodic callback that executes every N frames.
Arguments
func::Function: Function to execute periodicallyinterval::Int: Execute every N frames
Examples
# Run every 60 frames (~1 second at 60fps)
callback = PeriodicCallback(() -> println("Hello!"), 60)
run(MyApp, periodic_callbacks=[callback])Fugl.PlotState — Type
PlotState(initial_bounds, current_bounds, auto_scale, cache_id)Represents the state of a plot, including axis bounds, scaling, and cache information.
Fields:
initial_bounds: User-defined initial view bounds (preserved during drag operations). Can be Rectangle, PartialBounds, or Nothing.current_bounds: Current view bounds (after zoom/pan). If nothing, falls back to initial_bounds or auto-scale.auto_scale: Bool, whether to automatically scale axes to fit data when no bounds are specified.cache_id: Unique identifier for plot cache. Not user managed.drag_cursor_position: Plot coordinate where drag started. Not user managed.is_dragging: Whether plot is being dragged. Not user managed.
Fugl.PlotState — Method
Create a new PlotState from an existing state with keyword-based modifications.
Fugl.PlotState — Method
Create PlotState with explicit bounds
Fugl.PlotState — Method
Create PlotState with sensible defaults or initial view bounds
Fugl.PolarState — Method
Create a new PolarState with modified fields.
Fugl.PolarState — Method
Create PolarState with default values.
Fugl.PolarStyle — Method
Create a new PolarStyle with modified fields.
Fugl.PolarStyle — Method
Create PolarStyle with default values.
Fugl.Rectangle — Type
Simple 2D rectangle type.
Fugl.Rectangle — Method
Constructor convenience function for different numeric types
Fugl.RotateView — Type
A component that applies rotation transformation to any child component. Uses framebuffer rendering and GPU-based rotation for high quality results.
Fugl.ScatterPlotElement — Method
Create a new ScatterPlotElement from an existing element with keyword-based modifications.
Fugl.ScrollAreaStyle — Type
Style for scroll area appearance
Fugl.SimpleLine — Type
Simple struct for storing lines to be drawn.
Fugl.SizedView — Type
Abstract type for views that have constrained/intrinsic sizing behavior. These views know their preferred dimensions and can be used with alignment components. Examples: IntrinsicSize, FixedSize, IntrinsicWidth, IntrinsicHeight, etc.
Fugl.SliderState — Method
Create a new SliderState from an existing state with keyword-based modifications.
Fugl.SliderState — Method
Create a new SliderState with the given value within the specified range.
Fugl.SliderState — Method
Create a new SliderState with automatic type conversion to the specified output type. Useful for creating sliders that output specific types (e.g., Int for discrete values).
Fugl.StemPlotElement — Method
Create a new StemPlotElement from an existing element with keyword-based modifications.
Fugl.TableState — Type
TableState(column_widths, auto_size, cache_id)Represents the state of a table, including column widths and sizing behavior.
Fields:
column_widths: Vector of column widths in pixels. If nothing, will be auto-calculated.auto_size: Bool, whether to automatically size columns to fit content.cache_id: Unique identifier for table cache. Not user managed.
Fugl.TableState — Method
Create a new TableState from an existing state with keyword-based modifications.
Fugl.TableState — Method
Create TableState with explicit column widths
Fugl.TableState — Method
Create TableState with sensible defaults
Fugl.TextEditorStyle — Method
Generic constructor for TextEditorStyle with all parameters.
Fugl.TextStyle — Method
Copy constructor for TextStyle that allows overriding specific fields.
Fugl.TextStyle — Method
TextStyle(; font_cache_key=DEFAULT_FONT_CACHE_KEY, size_points=16, color=Vec{4,Float32}(0.0, 0.0, 0.0, 1.0))Create a TextStyle with the specified font cache key, size, and color.
The font referenced by the cache key should already be loaded into the font cache. By default, uses the default font cache key (a Symbol for optimal performance).
Example
# Use default font
style = TextStyle(size_points=20)
# Use a custom font
Fugl.get_font_by_path(:my_font, "/path/to/font.ttf")
style = TextStyle(font_cache_key=:my_font, size_points=20)Fugl.TooltipState — Method
Create a new TooltipState from an existing state with keyword-based modifications.
Fugl.TreeState — Method
Create a new TreeState from an existing state with keyword-based modifications.
Fugl.TreeState — Method
Create a new TreeState with the given tree.
Fugl.VerticalColorbar — Type
VerticalColorbar represents a vertical colorbar plot element. Size is controlled by FixedWidth layout component.
Fugl.VerticalColorbar — Method
Create a new VerticalColorbar from an existing colorbar with keyword-based modifications.
Fugl.VerticalLineView — Type
Vertical line separator that fills available height
Fugl.VerticalScrollAreaView — Type
VerticalScrollArea view that wraps content and provides vertical scrolling
Fugl.VerticalScrollState — Type
State for tracking vertical scroll area scrolling information
Fugl.VerticalScrollState — Method
Create a new VerticalScrollState from an existing state with keyword-based modifications
Fugl.VerticalScrollState — Method
Create a new VerticalScrollState
Fugl.VerticalSplitContainerView — Type
A container that allows vertical resizing by dragging a horizontal splitter handle between top and bottom child components. Optimized version with no runtime direction checks for better performance.
Fugl.AlignHorizontal — Function
AlignHorizontal(child::SizedView, alignment::Symbol)Aligns a sized child component horizontally within its container.
Arguments
child: A SizedView component that has intrinsic dimensionsalignment: Horizontal alignment (:left, :center, :right)
Example
AlignHorizontal(IntrinsicSize(Image("logo.png")), :left)
AlignHorizontal(FixedSize(Text("Hello"), 100.0f0, 50.0f0), :right)Fugl.AlignVertical — Function
AlignVertical(child::SizedView, alignment::Symbol)Aligns a sized child component vertically within its container.
Arguments
child: A SizedView component that has intrinsic dimensionsalignment: Vertical alignment (:top, :middle, :bottom)
Example
AlignVertical(IntrinsicSize(Image("logo.png")), :top)
AlignVertical(FixedSize(Text("Hello"), 100.0f0, 50.0f0), :middle)Fugl.ArrowsSpinner — Method
Create an arrows spinner
Fugl.BarsSpinner — Method
Create a simple bars spinner
Fugl.BaseContainer — Function
The BaseContainer is the most basic GUI component that can contain another component. It is the most basic building block of the GUI system.
Fugl.CheckBox — Method
Create a CheckBox component
Arguments
checked::Bool: Current checked state (user should passcheckbox_state[])label::String: Optional text label next to the checkboxstyle::CheckBoxStyle: Visual styling for the checkbox (includes label text style)on_change::Function: Callback when checkbox value changes:(new_value::Bool) -> nothingon_click::Function: Additional click callback
Example
# User-managed state
checkbox_state = Ref(false)
# Create checkbox with custom style
checkbox = CheckBox(
checkbox_state[], # Pass current value
label="Enable feature",
style=CheckBoxStyle(
size=18.0f0,
label_style=TextStyle(size_points=16, color=Vec4f(0.2, 0.2, 0.2, 1.0))
),
on_change=(new_value) -> checkbox_state[] = new_value # User updates state
)Fugl.CircleSpinner — Method
Create a circle/arc spinner
Fugl.CodeEditorStyle — Method
Create a TextEditorStyle with default values suitable for CodeEditor (dark theme).
Fugl.Container — Function
The Container is an interactive container component that extends BaseContainer with hover, pressed, and disabled states. It provides rich interaction handling including callbacks and state management. For simple non-interactive containers, use BaseContainer directly.
Fugl.DotsLongSpinner — Method
Create a long Braille-dots spinner
Fugl.DotsSpinner — Method
Create a dots spinner with Braille patterns
Fugl.FixedHeight — Method
FixedHeight(child::AbstractView, height::Real)Creates a view that has a fixed height but uses the child's intrinsic width.
Fugl.FixedSize — Method
FixedSize(child::AbstractView, width::Real, height::Real)Creates a view that has a fixed size, regardless of the child's intrinsic size. The child will be rendered at the specified width and height.
Fugl.FixedWidth — Method
FixedWidth(child::AbstractView, width::Real)Creates a view that has a fixed width but uses the child's intrinsic height.
Fugl.Focus — Method
Focus wraps a component to provide focus management. Focus is gained on left mouse button down inside the component. Focus is lost on left mouse button down outside the component.
Usage:
focus_state = Ref(false)
Focus(
my_component;
is_focused=focus_state[],
on_focus_change=(focused) -> focus_state[] = focused
)Fugl.FormattedTextField — Function
FormattedTextField(
state::EditorState=EditorState();
max_length::Union{Int, Nothing}=nothing,
parser::Union{Function, Nothing}=nothing,
validator::Union{Function, Nothing}=nothing,
style::TextEditorStyle=TextBoxStyle(border_width=1.0f0),
on_state_change::Function=(new_state::EditorState) -> nothing,
on_change::Function=(parsed_value) -> nothing,
on_focus::Function=() -> nothing,
on_blur::Function=() -> nothing
)Single-line form field with custom formatting, validation, and parsing.
Arguments
state::EditorState: Initial state of the text box.max_length::Union{Int, Nothing}: Maximum number of characters allowed (default isnothingfor unlimited).parser::Union{Function, Nothing}: Function that takes text and returns(cleaned_text::String, parsed_value). Applied on focus loss and Enter.validator::Union{Function, Nothing}: Function that filters input during typing. Takes text, returns filtered text.style::TextEditorStyle: Style for the text field.on_state_change::Function: Callback for when the state changes. Must update a state ref or similar.on_change::Function: Optional callback for when parsing succeeds. Receives the parsed value.on_focus::Function: Optional callback for when the component gains focus.on_blur::Function: Optional callback for when the component loses focus.
Example: Hex Color Field
hex_parser(text) = begin
# Remove # prefix if present, ensure uppercase
clean = uppercase(replace(text, "#" => ""))
# Validate hex format
if match(r"^[0-9A-F]{6}$", clean) !== nothing
return ("#" * clean, clean)
else
return ("#000000", "000000") # Default to black
end
end
hex_validator(text) = begin
# Allow only valid hex characters and #
replace(uppercase(text), r"[^#0-9A-F]" => "")
end
FormattedTextField(
state,
parser=hex_parser,
validator=hex_validator,
on_change=(hex_value) -> println("Valid hex: ", hex_value)
)Fugl.HLine — Method
Convenience constructor for horizontal line
Fugl.HorizontalLine — Method
Horizontal line separator that fills available width.
Fugl.HorizontalScrollArea — Method
Create a HorizontalScrollArea component
Arguments
content::AbstractView: The content to be scrolledscroll_state::HorizontalScrollState: Current scroll statestyle::ScrollAreaStyle: Styling for the scroll areashow_scrollbar::Bool: Show visual scrollbaron_scroll_change::Function: Callback when scroll state changeson_click::Function: Callback for click events
Fugl.HorizontalSplitContainer — Method
HorizontalSplitContainer(left, right; kwargs...)Create a horizontal split container with left and right child components.
Arguments
left::AbstractView: Left child componentright::AbstractView: Right child componentstyle::SplitContainerStyle=SplitContainerStyle(): Style configurationstate::SplitContainerState=SplitContainerState(): State including split position and interactionson_state_change::Function=() -> nothing: Callback for state changes (including split position)
Fugl.IconButton — Method
A button consisting of the icon only.
Fugl.IntrinsicSize — Function
IntrinsicSize(child::AbstractView=EmptyView())The IntrinsicSize component is used to wrap a child view and ensure that it uses its intrinsic size for layout. This is useful for components that should not stretch to fill their parent container, but rather use their natural size.
Fugl.KeyListener — Method
KeyListener wraps another component and triggers callbacks when specific keys are pressed. This allows adding keyboard shortcuts to any component.
Usage:
KeyListener(my_component, GLFW.KEY_A, () -> println("A pressed"))Single keyKeyListener(my_component, GLFW.KEY_S, GLFW.MOD_CONTROL, () -> save_file())Single key with modifierKeyListener(my_component, [(GLFW.KEY_A, nothing, callback1), (GLFW.KEY_S, GLFW.MOD_CONTROL, callback2)])Multiple keysKeyListener(my_component, [(GLFW.KEY_A, callback1), (GLFW.KEY_B, callback2)])Multiple simple keys
Fugl.NumberField — Function
NumberField(
state::EditorState=EditorState();
type::Type=Float64,
style::TextEditorStyle=TextBoxStyle(border_width=1.0f0),
on_state_change::Function=(new_state::EditorState) -> nothing,
on_change::Function=(parsed_value) -> nothing,
on_focus::Function=() -> nothing,
on_blur::Function=() -> nothing
)Form field for entering numbers. New values are parsed on focus loss.
Arguments
state::EditorState: Initial state of the text box.type::Type: The numeric type to parse the input as (default isFloat64).style::TextEditorStyle: Style for the text field.on_state_change::Function: Callback for when the state changes. Must update a state ref or similar.on_change::Function: Optional callback for when parsing succeeds. Passes the parsed value in specified type.on_focus::Function: Optional callback for when the component gains focus.on_blur::Function: Optional callback for when the component loses focus.
Fugl.Padding — Function
Padding component: adds padding around its child, but does not render any graphics.
Fugl.PolarLine — Method
Create a line plot element using polar coordinates.
In polar plots: xdata represents angle (θ), ydata represents radius (r)
Arguments
r_data: Radius values (will be stored in y_data)theta_data: Angle values in radians (will be stored in x_data)color: Line color (default: cyan-blue)width: Line width in pixels (default: 2.0)line_style: Line pattern (SOLID, DASH, DOT, etc.)label: Label for legend (default: "")
Example
theta = range(0, 2π, length=100)
r = 1.0f0 .+ 0.5f0 .* cos.(5.0f0 .* theta)
polar_line = PolarLine(r, theta,
color=Vec4{Float32}(1.0, 0.0, 0.0, 1.0),
width=2.5f0,
label="Rose Curve"
)Fugl.PolarPlot — Function
Create a polar plot component.
Arguments
elements: Vector of polar plot elements (lines, scatter, etc.)style: PolarStyle for appearance customizationstate: PolarState for coordinate system configurationon_state_change: Callback function when state changes
Example
theta = range(0, 2π, length=100)
r = 1 .+ 0.5 .* cos.(5 .* theta)
polar_plot = PolarPlot(
[PolarLine(r, theta, color=Vec4f(0.0, 0.5, 1.0, 1.0))],
PolarStyle(),
PolarState(theta_start=Float32(π/2)) # 0° points up
)Fugl.PolarScatter — Method
Create a scatter plot element using polar coordinates.
In polar plots: xdata represents angle (θ), ydata represents radius (r)
Arguments
r_data: Radius values (will be stored in y_data)theta_data: Angle values in radians (will be stored in x_data)fill_color: Marker fill color (default: cyan-blue)border_color: Marker border color (default: black)marker_size: Marker size in pixels (default: 8.0)border_width: Border width in pixels (default: 1.0)marker_type: Marker shape (CIRCLE, SQUARE, TRIANGLE, etc.)label: Label for legend (default: "")
Example
theta = range(0, 2π, length=16)
r = 0.6f0 .+ 0.3f0 .* rand(Float32, 16)
scatter = PolarScatter(r, theta,
fill_color=Vec4{Float32}(1.0, 0.0, 0.0, 1.0),
marker_size=10.0f0,
label="Data Points"
)Fugl.PolarStem — Method
Create a stem plot element using polar coordinates.
In polar plots: xdata represents angle (θ), ydata represents radius (r) Stems extend from baseline (radial value) to each data point.
Arguments
r_data: Radius values (will be stored in y_data)theta_data: Angle values in radians (will be stored in x_data)line_color: Stem line color (default: cyan-blue)fill_color: Marker fill color (default: cyan-blue)border_color: Marker border color (default: black)line_width: Stem line width in pixels (default: 1.5)marker_size: Marker size in pixels (default: 8.0)border_width: Marker border width in pixels (default: 1.0)marker_type: Marker shape (CIRCLE, SQUARE, TRIANGLE, etc.)baseline: Radial baseline where stems originate (default: 0.0 = center)label: Label for legend (default: "")
Example
theta = range(0, 2π, length=12)
r = 0.5f0 .+ 0.3f0 .* sin.(3.0f0 .* theta)
stem = PolarStem(r, theta,
line_color=Vec4{Float32}(0.0, 1.0, 0.0, 1.0),
fill_color=Vec4{Float32}(0.0, 1.0, 0.0, 1.0),
baseline=0.2f0, # Stems start at r=0.2
label="Stem Data"
)Fugl.Rotate — Method
Rotate(child::AbstractView; rotation_degrees::Float32=0.0f0)Create a rotated wrapper around any child component. Positive angles rotate counter-clockwise.
Uses a framebuffer approach: renders child to texture, then rotates the texture with a custom shader.
Arguments
child: The child component to rotaterotation_degrees: Rotation angle in degrees (default: 0.0)
Fugl.Spinner — Function
Create a Spinner component
Arguments
symbols::Vector{Char}: Array of Unicode characters to cycle throughinterval_seconds::Float64: Time between symbol changes (default: 0.1)text_style::TextStyle: Text styling for the spinner symbolstate::SpinnerState: Current spinner stateis_spinning::Bool: Whether the spinner should animateon_state_change::Function: Callback when spinner state changes
Fugl.Table — Method
Table(headers, data; kwargs...)Create a table component with column headers and row data.
Arguments
headers::Vector{String}: Column header namesdata::Vector{Vector{String}}: Table data as rows of stringsstyle::TableStyle=TableStyle(): Table styling optionsstate::TableState=TableState(): Table state for column widths and sizingon_cell_click::Function=(row, col) -> nothing: Callback for cell clickson_state_change::Function=(new_state) -> nothing: Callback for state changes
Example
headers = ["Name", "Age", "City"]
data = [
["Alice", "25", "New York"],
["Bob", "30", "London"],
["Carol", "28", "Tokyo"]
]
table = Table(headers, data)Fugl.TextBoxStyle — Method
Create a TextEditorStyle with default values suitable for TextBox (light theme).
Fugl.TextButton — Method
A button containing text only.
Fugl.TextField — Function
TextField(
state::EditorState=EditorState();
max_length::Union{Int, Nothing}=nothing,
style::TextEditorStyle=TextBoxStyle(border_width=1.0f0),
on_state_change::Function=(new_state::EditorState) -> nothing,
on_change::Function=(new_text) -> nothing,
on_focus::Function=() -> nothing,
on_blur::Function=() -> nothing
)Single-line form field for entering text. Supports optional length limiting.
Arguments
state::EditorState: Initial state of the text box.max_length::Union{Int, Nothing}: Maximum number of characters allowed (default isnothingfor unlimited).style::TextEditorStyle: Style for the text field.on_state_change::Function: Callback for when the state changes. Must update a state ref or similar.on_change::Function: Optional callback for when the text changes. Passes the new text string.on_focus::Function: Optional callback for when the component gains focus.on_blur::Function: Optional callback for when the component loses focus.
Fugl.VLine — Method
Convenience constructor for vertical line
Fugl.VerticalLine — Method
Vertical line separator that fills available height.
Fugl.VerticalScrollArea — Method
Create a VerticalScrollArea component
Arguments
content::AbstractView: The content to be scrolledscroll_state::VerticalScrollState: Current scroll statestyle::ScrollAreaStyle: Styling for the scroll areashow_scrollbar::Bool: Show visual scrollbaron_scroll_change::Function: Callback when scroll state changeson_click::Function: Callback for click events
Fugl.VerticalSplitContainer — Method
VerticalSplitContainer(top, bottom; kwargs...)Create a vertical split container with top and bottom child components.
Arguments
top::AbstractView: Top child componentbottom::AbstractView: Bottom child componentstyle::SplitContainerStyle=SplitContainerStyle(): Style configurationstate::SplitContainerState=SplitContainerState(): State including split position and interactionson_state_change::Function=() -> nothing: Callback for state changes (including split position)
Fugl._create_base_container — Method
Create BaseContainer with current active style for delegation.
Fugl.add_glyph_to_batch! — Method
Add a single glyph to the batch. This is much more efficient than individual rendering.
Fugl.add_line! — Function
Add a complete line (series of connected points) to the batch
Fugl.add_marker! — Method
Add a marker to the batch.
Fugl.add_overlay_function — Method
add_overlay_function(func::Function)Add a function to be rendered as an overlay after all main content is rendered. The function should take no arguments and handle its own rendering.
Fugl.add_rotated_glyph_to_batch! — Method
Add a single rotated glyph to the batch. Each glyph quad is rotated around its lower-left corner and positioned along a rotated baseline.
Fugl.adjust_manual_scaling! — Method
adjust_manual_scaling!(delta::Float32)Adjust manual scaling using the current DPI scaling context.
Fugl.adjust_manual_scaling! — Method
adjust_manual_scaling!(dpi_scaling_ref::Ref{DPIScaling}, delta::Float32)Adjust the manual scaling by a delta amount. Positive values increase scale, negative decrease. Clamped to reasonable bounds (0.25x to 4x with fractional values supported).
Fugl.apply_clipboard_action! — Method
Apply clipboard action with platform-specific clipboard access.
Fugl.apply_clipboard_action — Method
Apply clipboard action. Returns a new EditorState with clipboard operations applied.
Fugl.apply_delete_text! — Method
Apply delete text action.
Fugl.apply_delete_text — Method
Apply text deletion action. Returns a new EditorState with the text deleted.
Fugl.apply_editor_action — Method
Apply an editor action to the editor state. Returns a new EditorState with the action applied.
Fugl.apply_extend_mouse_selection — Method
Apply extend mouse selection action. Returns a new EditorState with selection extended to the given position.
Fugl.apply_insert_text — Method
Apply text insertion action. Returns a new EditorState with the text inserted.
Fugl.apply_layout — Method
apply_layout(component::AbstractView)Apply layout to a GUI component and its children. This function calculates and applies the layout to components. The interpret_view function then uses the positions and sizes calculated by this function.
Fugl.apply_layout — Method
Calculate layout to the container and its child.
Fugl.apply_layout — Method
Apply layout to horizontal scroll area - measures content and sets up viewport
Fugl.apply_layout — Method
Apply layout to vertical scroll area - measures content and sets up viewport
Fugl.apply_move_cursor! — Method
Apply cursor movement action.
Fugl.apply_move_cursor — Method
Apply cursor movement action. Returns a new EditorState with the cursor moved and selection updated if needed.
Fugl.apply_select_all — Method
Apply select all action. Returns a new EditorState with all text selected.
Fugl.apply_select_word — Method
Apply select word action. Returns a new EditorState with the word at the cursor position selected.
Fugl.apply_start_mouse_selection — Method
Apply start mouse selection action. Returns a new EditorState with selection started at the given position.
Fugl.apply_step_snapping — Method
Apply discrete step snapping to a value. Returns the value snapped to the nearest step if steps are defined. For discrete steps (Int), automatically rounds to the appropriate output type.
Fugl.calculate_and_update_column_widths! — Method
calculate_and_update_column_widths!(view::TableView, available_width::Float32)Calculate new column widths and update the table state via callback. This function can be called by the user when they want to recalculate column sizing.
Fugl.calculate_bounds_from_elements — Method
Calculate bounds from a vector of plot elements
Fugl.calculate_column_widths — Method
calculate_column_widths(view::TableView, available_width::Float32)::Vector{Float32}Calculate optimal column widths based on content and available space. Uses a simple algorithm that:
- Calculates minimum width needed for each column based on content
- If total minimum width < available width, distributes extra space proportionally
- If total minimum width > available width, scales all columns down proportionally
Fugl.calculate_line_progress — Method
calculate_line_progress(points::Vector{Point2f})Calculate cumulative distance along the line for pattern calculations.
Fugl.calculate_rotated_bounding_box — Method
Calculate the bounding box of a rotated rectangle. Returns (width, height) of the axis-aligned bounding box.
Fugl.calculate_tooltip_position — Method
Calculate where to position the tooltip relative to the wrapped component. Positions tooltip on the specified side of the component.
Fugl.calculate_tooltip_text_height — Method
Calculate the required height for the tooltip text given a specific width.
Fugl.calculate_visible_text — Method
Calculate which portion of a text line is visible given horizontal scroll and viewport width. Returns (visibletext, startx_offset) where:
- visible_text is the substring that should be drawn
- startxoffset is how much to shift the drawing position
Fugl.cartesian_to_polar — Function
Convert Cartesian coordinates (x, y) to polar coordinates (r, θ).
Returns angle normalized to [0, 2π) range.
Arguments
x::Float32: X coordinatey::Float32: Y coordinatetheta_start::Float32: Angle offset where θ=0 pointstheta_direction::Symbol: :counterclockwise or :clockwise rotation directioncenter_x::Float32: Center X coordinatecenter_y::Float32: Center Y coordinate
Returns
Tuple{Float32,Float32}: Polar coordinates (r, θ) where θ is in [0, 2π)
Fugl.char_callback — Method
New character callback for proper text input This function handles character input from the keyboard, converting Unicode codepoints to characters.
Fugl.char_length — Method
Get the character length of a string (not byte length).
Fugl.clamp_cursor — Method
Clamp cursor position to valid bounds within the text.
Fugl.cleanup_render_cache — Method
Clean up OpenGL resources for a single cache entry
Fugl.cleanup_render_cache_id! — Method
Clean up render cache for a specific cache ID
Fugl.cleanup_stale_render_caches! — Function
Clean up old caches that haven't been accessed recently. Call this periodically to prevent memory leaks from unused caches.
Fugl.clear_batch! — Method
Clear all data from a glyph batch to reuse it.
Fugl.clear_glyph_atlas! — Method
clear_glyph_atlas!()Clear the global glyph atlas cache and any associated batches.
Fugl.clear_overlays — Method
clear_overlays()Clear all pending overlay functions without rendering them. Useful for cleanup or when aborting rendering.
Fugl.clear_render_caches! — Method
Clear all render caches and free associated OpenGL resources. Call this when the OpenGL context is being destroyed or recreated.
Fugl.clear_selection — Method
Clear the text selection.
Fugl.clear_text_batch! — Method
Clear the global text batch to free memory.
Fugl.clip_text_with_ellipsis — Method
clip_text_with_ellipsis(text, font, size_points, available_width)Clip text at character level to fit within available width, adding "..." if clipped.
Fugl.compare_cursor_positions — Method
Compare two cursor positions. Returns:
- -1 if pos1 < pos2
- 0 if pos1 == pos2
- 1 if pos1 > pos2
Fugl.copy_to_clipboard — Method
Copy text to system clipboard using Julia's standard library.
Fugl.create_dpi_scaling_ref — Method
create_dpi_scaling_ref()::Ref{DPIScaling}Create a new DPI scaling reference with default 1x scaling. This must be passed to Fugl.run() for proper scaling support.
Example
dpi_ref = create_dpi_scaling_ref()
Fugl.run(MyApp, dpi_scaling=dpi_ref)Fugl.create_glyph_atlas — Function
create_glyph_atlas(width=4096, height=4096) -> GlyphAtlasCreate a new glyph atlas texture with larger size for better performance. Inspired by Makie.jl's approach with larger atlases to reduce cache misses.
Fugl.create_render_framebuffer — Method
Create a framebuffer with color and optional depth texture Returns (framebufferid, colortextureid, depthtexture_id)
Fugl.cull_line_data — Method
Cull line data and clip line segments to viewport bounds using proper interpolation. This function clips line segments at the exact viewport boundaries to prevent lines from extending outside the visible area. Returns culled x and y data arrays with clipped segments.
Fugl.cull_point_data — Method
Cull point data to only include points within the specified bounds. Returns culled x and y data arrays.
Fugl.delete_range! — Method
Delete text between two cursor positions.
Fugl.delete_selected_text — Method
Delete the currently selected text and return new state. Returns the state unchanged if no selection.
Fugl.detect_click — Method
Simple click detection - forwards all clicks to child without interaction logic.
Fugl.detect_click — Method
Detect click events and handle focus, cursor positioning, drag selection, and double-clicks.
Fugl.detect_click — Method
Detect clicks on the Column and its children. The method returns the click result with the highest z-height.
Fugl.detect_click — Method
Detect clicks with full interaction state management.
Fugl.detect_click — Method
Detect clicks within the horizontal scroll area
Fugl.detect_click — Method
Detect clicks on the IntrinsicColumn and its children. The method returns the click result with the highest z-height.
Fugl.detect_click — Method
Detect clicks on the IntrinsicRow and its children. The method returns the click result with the highest z-height.
Fugl.detect_click — Method
Detect clicks on the Row and its children. The method returns the click result with the highest z-height.
Fugl.detect_click — Method
Detect click events and handle focus, cursor positioning, drag selection, and double-clicks for TextBox.
Fugl.detect_click — Method
Handle interactions with the wrapped component and detect hover for tooltip.
Fugl.detect_click — Method
Detect clicks within the vertical scroll area
Fugl.draw_angular_labels — Method
Draw angular labels at specified angles.
Fugl.draw_angular_lines — Method
Draw angular grid lines (spokes) from center.
Fugl.draw_angular_ticks — Method
Draw angular tick marks on radial circles.
Fugl.draw_axes_with_labels — Method
Draw axes with labels and tick marks using both lines and Text components Axis lines, tick marks, and labels are positioned at plot edges (left/bottom), not at zero lines
Fugl.draw_cached_texture — Method
Draw a cached texture to screen using a simple textured quad with pixel alignment
Fugl.draw_checkmark — Method
Draw a checkmark symbol inside the checkbox using the new line drawing system
Fugl.draw_closed_lines — Method
draw_closed_lines(vertices::Vector{Point2f}, color_rgba::Vec4{<:Float32})Draw closed lines using the provided vertices and color.
Fugl.draw_colorbar_gradient — Method
Draw a colorbar gradient using the existing heatmap drawing system with proper coordinate transform.
Fugl.draw_configurable_rectangle — Method
draw_configurable_rectangle(
vertices, width, height, fill_color, border_color, border_width,
corner_radii, projection_matrix, anti_aliasing_width
)Draw a rectangle with configurable per-corner radii.
Arguments
vertices: Vector of corner positionswidth,height: Rectangle dimensionsfill_color: Fill color as Vec4border_color: Border color as Vec4border_width: Border thickness in pixelscorner_radii: Vec4 of corner radii (top-left, top-right, bottom-right, bottom-left)projection_matrix: Projection matrixanti_aliasing_width: Anti-aliasing width in pixels
Fugl.draw_cursor — Function
Draw the cursor at the specified position.
Fugl.draw_glyph_atlas_debug — Method
draw_glyph_atlas_debug(atlas, x, y, scale, projection_matrix)Draw the entire glyph atlas texture to the screen for debugging purposes. This helps visualize what glyphs are actually stored in the atlas.
Fugl.draw_glyph_from_atlas — Method
draw_glyph_from_atlas(texture, x, y, width, height, u_min, v_min, u_max, v_max, projection_matrix, color)Draw a single glyph from the atlas texture with specified UV coordinates.
Fugl.draw_grid — Method
Draw a grid with specified parameters using the enhanced line shader
Fugl.draw_line — Method
draw_line(points::Vector{Point2f}, color::Vec4{Float32}, width::Float32, line_style::LinePattern, projection_matrix::Mat4{Float32}; anti_aliasing_width::Float32=1.5f0)Draw a single line with the specified properties.
Fugl.draw_lines — Method
Batched line drawing function.
Fugl.draw_lines — Method
draw_lines(lines::Vector{SimpleLine}, projection_matrix::Mat4{Float32}; anti_aliasing_width::Float32=1.5f0)Draw multiple lines efficiently in a single batch.
Fugl.draw_markers — Method
Draw markers from a batch using the marker shader.
Fugl.draw_matrix_with_colormap — Method
Generalized texture-based rendering function for colormapped data. Can be used by heatmaps, colorbars, and other texture-based visualizations.
Fugl.draw_multiline_text_batched — Function
Multi-line batched text rendering that collects all lines into a single batch. This provides maximum performance for rendering multiple lines of text.
Fugl.draw_polar_element — Method
Draw a polar element by converting polar coordinates to Cartesian screen coordinates.
Fugl.draw_radial_circles — Method
Draw radial grid circles at specified radii.
Fugl.draw_radial_labels — Method
Draw radial labels at specified radii.
Fugl.draw_radial_ticks — Method
Draw radial tick marks on the outer circle at angular positions.
Fugl.draw_rectangle — Method
draw_rectangle(vertices::Vector{Point2f}, color_rgba::Vec4{<:Float32}, projection_matrix::Mat4{Float32})Draw a rectangle using the provided vertices and color.
Fugl.draw_rotated_texture — Method
Draw a texture with rotation applied via shader
Fugl.draw_rounded_rectangle — Method
draw_rounded_rectangle(
vertices::Vector{Point2f},
width::Float32, height::Float32,
fill_color_rgba::Vec4{<:Float32}, border_color_rgba::Vec4{<:Float32},
border_width::Float32, radius::Float32,
projection_matrix::Mat4{Float32},
anti_aliasing_width::Float32
)Draw a rounded rectangle with border using the custom shader.
Fugl.draw_scatter_plot — Method
Draw cached text texture to screen
Fugl.draw_selection_background — Function
Draw selection background for a line of text.
Fugl.draw_simple_line — Method
draw_simple_line(start_point::Point2f, end_point::Point2f, color::Vec4{Float32}, width::Float32, projection_matrix::Mat4{Float32}; line_style::LinePattern=SOLID, anti_aliasing_width::Float32=1.5f0)Convenience function to draw a simple line between two points.
Fugl.draw_text_batched — Function
Optimized batched text rendering function that collects all glyphs first, then renders them in a single draw call. Much faster for large amounts of text.
Fugl.draw_tooltip — Method
Main function to draw the entire tooltip.
Fugl.draw_tooltip_background — Method
Draw the tooltip background with shadow and border.
Fugl.draw_tooltip_text — Method
Draw the tooltip text with proper wrapping and layout.
Fugl.ensure_cursor_visible — Method
Ensure the cursor is visible by adjusting scroll offsets if needed.
Arguments:
state: Current editor statefont: Font used for rendering textsize_points: Font size in pixelsvisible_width: Width of the visible area in pixels (excluding padding)visible_height: Height of the visible area in pixels (excluding padding)padding: Padding around the text
Returns a new EditorState with adjusted scroll offsets if the cursor was out of view.
Fugl.enum_display_names — Method
Generic function to get display names for enum values. Uses a display name mapping if provided, otherwise converts enum names to strings.
Fugl.enum_index — Method
Generic function to get the index of an enum value (1-based).
Fugl.enum_values — Method
Generic function to get all enum values as a vector.
Fugl.find_word_boundary — Method
Find word boundary for word-based movement.
Fugl.fugl_to_pixels — Method
fugl_to_pixels(dpi_scaling_ref::Ref{DPIScaling}, fugl_coord::Float32)::Float32Convert a Fugl logical coordinate to screen pixels using manual scaling. 1 point = manual_scale pixels.
Fugl.fugl_to_pixels_y — Method
fugl_to_pixels_y(dpi_scaling_ref::Ref{DPIScaling}, fugl_y::Float32)::Float32Convert a Fugl logical Y coordinate to screen pixels using manual scaling.
Fugl.generate_cache_id — Method
Generate a unique cache ID for a component
Fugl.generate_line_geometry — Method
generate_line_geometry(points::Vector{Point2f}, color::Vec4{Float32}, width::Float32, line_style::LinePattern)Generate geometry for a single line using triangles. Returns arrays for positions, directions, widths, colors, vertextypes, linestyles, and line_progresses.
Fugl.generate_rectangle_vertices — Method
generate_rectangle_vertices(x, y, width, height)Function to generate a rectangle with specified position and size in pixel coordinates.
This function creates a rectangle defined by its top-left corner (x, y), width, and height.
Fugl.generate_tick_positions — Function
Generate reasonable tick positions for a given range
Fugl.get_current_dpi_scaling — Method
get_current_dpi_scaling()::Ref{DPIScaling}Get the current DPI scaling ref for this rendering context. Throws an error if no DPI scaling is set (which shouldn't happen during normal rendering).
Fugl.get_current_framebuffer — Method
Get the current framebuffer binding
Fugl.get_current_viewport — Method
Get the current viewport state
Fugl.get_default_font — Method
get_default_font()::FreeTypeAbstraction.FTFontGet the default font from cache. If not already loaded, calls load_default_font!() automatically.
Fugl.get_dpi_scale — Method
get_dpi_scale(dpi_scaling_ref::Ref{DPIScaling})::Tuple{Float32, Float32}Get the current manual scaling factor as both X and Y scaling (they're the same).
Fugl.get_dpi_scale — Method
get_dpi_scale()::Tuple{Float32, Float32}Get the current DPI scaling factors using the current DPI scaling context.
Fugl.get_effective_bounds — Method
Get effective bounds for plotting (considering zoom state) Priority: currentbounds -> initialbounds (with partial bounds support) -> auto-calculated from elements
Fugl.get_effective_column_widths — Method
get_effective_column_widths(view::TableView, available_width::Float32)::Vector{Float32}Get effective column widths for rendering. Priority: state.column_widths -> auto-calculated widths
Fugl.get_effective_scale — Method
get_effective_scale(dpi_scaling_ref::Ref{DPIScaling})::Float32Get the effective scaling factor being applied to the UI. This is just the manual scaling factor (1.0 = 1 point = 1 pixel).
Fugl.get_effective_scale — Method
get_effective_scale()::Float32Get the effective scaling factor using the current DPI scaling context.
Fugl.get_element_bounds — Method
Helper function to extract data bounds from any plot element
Fugl.get_font — Method
get_font(cache_key::Symbol)::FreeTypeAbstraction.FTFontRetrieve a font from the cache by its cache key. Automatically loads the default font if the cache key matches DEFAULTFONTCACHE_KEY. Throws an error if the font is not found in the cache.
Fugl.get_font — Method
get_font(style::TextStyle)::FreeTypeAbstraction.FTFontRetrieve the font associated with a TextStyle from the font cache.
Fugl.get_font_by_name — Method
get_font_by_name(cache_key::Symbol, font_name::String)::FreeTypeAbstraction.FTFontFind and load a system font by name, caching it with the specified key. If already cached with this key, returns the cached font.
Example
# Load a system font
get_font_by_name(:my_system_font, "Arial")
style = TextStyle(font_cache_key=:my_system_font, size_points=16)Fugl.get_font_by_path — Method
get_font_by_path(cache_key::Symbol, font_path::String)::FreeTypeAbstraction.FTFontLoad a font from a file path and cache it with the specified key. If already cached with this key, returns the cached font.
Example
# Load a custom font with an explicit cache key
get_font_by_path(:my_title_font, "/path/to/font.ttf")
style = TextStyle(font_cache_key=:my_title_font, size_points=32)Fugl.get_font_hash — Method
get_font_hash(font::FreeTypeAbstraction.FTFont) -> UInt64Get a unique hash for a font face.
Fugl.get_from_clipboard — Method
Get text from system clipboard using Julia's standard library.
Fugl.get_glyph_atlas — Method
get_glyph_atlas() -> GlyphAtlasGet the global glyph atlas, creating it if it doesn't exist.
Fugl.get_hover_duration — Method
Helper function to get hover duration safely.
Fugl.get_line_count — Method
Get the number of lines in the editor.
Fugl.get_line_length — Method
Get the character length of a specific line (1-indexed). Returns 0 if the line number is out of bounds.
Fugl.get_lines — Method
Split text into lines for easier manipulation. Returns a vector of strings, where each string is a line of text.
Fugl.get_lines — Method
Split text into lines for easier manipulation. Returns a vector of strings, where each string is a line of text.
Fugl.get_logical_size — Method
get_logical_size(dpi_scaling_ref::Ref{DPIScaling})::Tuple{Float32, Float32}Get the current window size in logical coordinates (width, height). This is what components should use for layout calculations.
Fugl.get_manual_scaling — Method
get_manual_scaling(dpi_scaling_ref::Ref{DPIScaling})::Float32Get the current manual scaling factor (1.0 = normal, 2.0 = twice as large, etc.)
Fugl.get_manual_scaling — Method
get_manual_scaling()::Float32Get the current manual scaling factor using the current DPI scaling context.
Fugl.get_or_insert_glyph! — Method
get_or_insert_glyph!(atlas::GlyphAtlas, font, char, pixelsize) -> GlyphUVGet glyph UV coordinates from atlas, inserting the glyph if not present.
Fugl.get_orthographic_matrix — Method
get_orthographic_matrix(left::T, right::T, bottom::T, top::T, near::T, far::T)::Matrix{T} where {T<:Real}Create an orthographic projection matrix.
Fugl.get_pixel_perfect_scale — Method
get_pixel_perfect_scale(dpi_scaling_ref::Ref{DPIScaling})::Float32Get the scaling factor that achieves 1 point = 1 actual pixel when manual_scale=1. This compensates for the system DPI ratio.
Fugl.get_pixel_perfect_scale — Method
get_pixel_perfect_scale()::Float32Get the pixel-perfect scaling factor using the current DPI scaling context.
Fugl.get_pixel_size — Method
get_pixel_size(dpi_scaling_ref::Ref{DPIScaling})::Tuple{Float32, Float32}Get the current framebuffer size in actual pixels (width, height). This is used internally for OpenGL rendering.
Fugl.get_render_cache — Method
Get or create a render cache for the given cache ID.
Fugl.get_render_cache_stats — Method
Get cache statistics for debugging/monitoring
Fugl.get_selected_text — Method
Get the currently selected text. Returns empty string if no selection.
Fugl.get_selected_text_or_line — Method
Get the currently selected text, or the current line if no text is selected.
Fugl.get_selection_range — Method
Get the selection range in a normalized form (start <= end). Returns (startpos, endpos) or (nothing, nothing) if no selection.
Fugl.get_system_dpi_ratio — Method
get_system_dpi_ratio(dpi_scaling_ref::Ref{DPIScaling})::Float32Get the system's DPI ratio (pixels per point). On Retina displays this is typically 2.0.
Fugl.get_system_dpi_ratio — Method
get_system_dpi_ratio()::Float32Get the system DPI ratio using the current DPI scaling context.
Fugl.get_tokenized_line — Method
Get or create tokenized line data for a specific line.
Fugl.handle_horizontal_scroll_wheel — Method
Handle horizontal mouse wheel scrolling
Fugl.handle_key_input — Method
Handle key input for TextBox (same as CodeEditor but without syntax highlighting).
Fugl.handle_search_input — Method
Handle key input for dropdown search functionality.
Fugl.handle_vertical_scroll_wheel — Method
Handle vertical mouse wheel scrolling
Fugl.has_any_modifier — Method
Check if any modifier key is pressed
Fugl.has_selection — Method
Check if there is an active text selection.
Fugl.hash_text_content — Method
Generate a content hash for text components (TextBox/CodeEditor) that captures all rendering-relevant state
Fugl.hash_tree_content — Method
Generate a content hash for all rendering-relevant tree state
Fugl.initialize_gl_state! — Method
Initialize the GL state management system
Fugl.initialize_plot_shaders — Method
Initialize the plot shader programs (must be called after OpenGL context is created)
Fugl.initialize_shaders — Method
Initialize the shader program (must be called after OpenGL context is created)
Fugl.interpret_view — Method
interpret_view(component::AbstractView, x::Float32, y::Float32, width::Float32, height::Float32, projection_matrix::Mat4{Float32}, mouse_x::Float32, mouse_y::Float32)Interpret the view of a GUI component. This function is responsible for interpreting the view of a GUI component based on its layout and properties.
Fugl.interpret_view — Method
Render the container and its child.
Fugl.interpret_view — Method
Render the container using BaseContainer with selected style.
Fugl.interpret_view — Method
Render the horizontal scroll area with content and optional scrollbar
Fugl.interpret_view — Method
Render the wrapped component and handle tooltip overlay.
Fugl.interpret_view — Method
Render the vertical scroll area with content and optional scrollbar
Fugl.invalidate_render_cache! — Method
Manually invalidate a render cache to force re-render on next frame
Fugl.is_cache_framebuffer — Method
Check if a framebuffer is a cache framebuffer
Fugl.is_command_key — Method
Check if Control or Command (Super) key is pressed - common pattern for shortcuts
Fugl.is_framebuffer_valid — Method
Check if a framebuffer is still valid and complete
Fugl.is_interacting — Method
Helper function to check if interaction state indicates any active interaction.
Fugl.is_word_char — Method
Helper function to determine if a character is part of a word
Fugl.key_callback — Method
Alternative signature in case GLFW passes Char directly This function adds a character directly to the key buffer.
Fugl.key_event_to_action — Method
Convert a GLFW key event to an EditorAction.
Fugl.load_default_font! — Method
load_default_font!()Load the font at DEFAULT_FONT_PATH into the font cache as the default font. This should be called before creating any text components. Users can override DEFAULT_FONT_PATH before calling this function to use a custom default font.
Example
# Use default font
Fugl.load_default_font!()
# Or use custom font
Fugl.DEFAULT_FONT_PATH[] = "/path/to/my/font.ttf"
Fugl.load_default_font!()Fugl.measure — Method
Measure the intrinsic size of a component.
Fugl.measure — Method
Measure the horizontal scroll area - measures content width, takes all available space in height
Fugl.measure — Method
measure(view::TextView)::Tuple{Float32,Float32}Assumes text is rendered in a single line.
Fugl.measure — Method
Measure function - tooltip takes the size of the wrapped component.
Fugl.measure — Method
Measure the vertical scroll area - takes all available space in width, measures content height
Fugl.measure_height — Method
Measure the intrinsic height of a component given an available width.
Fugl.measure_height — Method
Measure the height of the column when constrained by available width.
Fugl.measure_height — Method
Measure the height of the component when constrained by available width.
Fugl.measure_height — Method
Measure the height of the component when constrained by available width.
Fugl.measure_height — Method
Measure the height of the component when constrained by available width.
Fugl.measure_height — Method
Measure the height of the component when constrained by available height.
Fugl.measure_height — Method
Measure height - tooltip takes the height of the wrapped component.
Fugl.measure_width — Method
Measure the intrinsic width of a component given an available height.
Fugl.measure_width — Method
Measure the width of the column when constrained by available height.
Fugl.measure_width — Method
Measure the width of the component when constrained by available height.
Fugl.measure_width — Method
Measure the width of the component when constrained by available height.
Fugl.measure_width — Method
Measure the width of the component when constrained by available height.
Fugl.measure_width — Method
Measure the width of the component when constrained by available height.
Fugl.measure_width — Method
Measure the width of the text when constrained by available height.
Fugl.measure_width — Method
Measure width - tooltip takes the width of the wrapped component.
Fugl.measure_word_width — Method
measure_word_width(font::FreeTypeAbstraction.FTFont, word::AbstractString, size_points::Int)::Float32Measure the width of a word using FreeType for accurate rendering metrics. This is more accurate but slower than estimatewordwidth.
Fugl.measure_word_width — Method
measure_word_width(style::TextStyle, word::AbstractString)::Float32Measure the width of a word using a TextStyle. Convenience function that extracts the font and size from the style.
Fugl.measure_word_width_cached — Method
measure_word_width_cached(font::FreeTypeAbstraction.FTFont, word::AbstractString, size_points::Int)::Float32Measure the width of a word using cached glyph advance widths from the glyph atlas. This is faster than measurewordwidth since it avoids re-rendering glyphs that are already cached.
Fugl.measure_word_width_cached — Method
measure_word_width_cached(style::TextStyle, word::AbstractString)::Float32Measure the width of a word using a TextStyle. Convenience function that extracts the font and size from the style.
Fugl.mouse_position_callback — Method
Mouse position callback to track mouse movement and detect dragging
Fugl.mouse_to_cursor_position — Method
Convert mouse coordinates to cursor position within a text editor component. This is a generic function that works for both CodeEditor and TextBox.
Fugl.needs_retokenization — Method
Check if a line needs to be re-tokenized based on text changes.
Fugl.pixels_to_fugl — Method
pixels_to_fugl(dpi_scaling_ref::Ref{DPIScaling}, pixel_coord::Float32)::Float32Convert screen pixels to Fugl logical coordinates using manual scaling.
Fugl.pixels_to_fugl_x — Method
pixels_to_fugl_x(dpi_scaling_ref::Ref{DPIScaling}, pixel_x::Float32)::Float32Convert screen pixels to Fugl logical X coordinate using manual scaling.
Fugl.pixels_to_fugl_y — Method
pixels_to_fugl_y(dpi_scaling_ref::Ref{DPIScaling}, pixel_y::Float32)::Float32Convert screen pixels to Fugl logical Y coordinate using manual scaling.
Fugl.polar_to_cartesian — Function
Convert polar coordinates (r, θ) to Cartesian coordinates (x, y).
Automatically handles negative angles - no conversion needed! Just pass your angles as-is (e.g., -π to π works directly).
Arguments
r::Float32: Radiustheta::Float32: Angle in radians (can be negative, e.g., -π to π)theta_start::Float32: Angle offset where θ=0 points (0 = right/east, π/2 = up/north, π = left/west, 3π/2 = down/south)theta_direction::Symbol: :counterclockwise or :clockwise rotation directioncenter_x::Float32: Center X coordinate in Cartesian spacecenter_y::Float32: Center Y coordinate in Cartesian space
Returns
Tuple{Float32,Float32}: Cartesian coordinates (x, y)
Fugl.pop_framebuffer! — Method
Pop the previous framebuffer from the stack and restore it
Fugl.pop_viewport! — Method
Pop the previous viewport from the stack and restore it
Fugl.preferred_height — Method
Check if the component has a preferred height.
Fugl.preferred_height — Method
Container delegates preferred height to its child.
Fugl.preferred_height — Method
Preferred height - IntrinsicColumn has preferred height if any child does.
Fugl.preferred_height — Method
Preferred height - IntrinsicRow has preferred height if any child does.
Fugl.preferred_height — Method
Text prefers its intrinsic height based on font size and line count.
Fugl.preferred_height — Method
Preferred height - tooltip propagates the wrapped component's preferred height.
Fugl.preferred_height — Method
Delegate preferred height to the text component.
Fugl.preferred_size — Method
Check if the component has a preferred size.
Fugl.preferred_width — Method
Check if the component has a preferred width.
Fugl.preferred_width — Method
Container delegates preferred width to its child.
Fugl.preferred_width — Method
Preferred width - IntrinsicColumn has preferred width if any child does.
Fugl.preferred_width — Method
Preferred width - IntrinsicRow has preferred width if any child does.
Fugl.preferred_width — Method
Text prefers its intrinsic width based on content.
Fugl.preferred_width — Method
Preferred width - tooltip propagates the wrapped component's preferred width.
Fugl.preferred_width — Method
Delegate preferred width to the text component.
Fugl.push_framebuffer! — Method
Push the current framebuffer onto the stack and bind a new one
Fugl.push_viewport! — Method
Push the current viewport onto the stack and set a new one
Fugl.register_cache_framebuffer! — Method
Register a framebuffer as a cache framebuffer
Fugl.register_shader_initializer! — Method
register_shader_initializer!(init_function::Function)Register an external shader initialization function to be called during Fugl's shader initialization. This allows external packages (like FuglDrawing.jl) to register their shaders.
Arguments
init_function::Function: A function that will be called during shader initialization
Example
# In FuglDrawing.jl
function initialize_drawing_shaders()
# Initialize drawing-specific shaders
drawing_prog[] = Program(drawing_vertex_shader, drawing_fragment_shader)
end
# Register with Fugl
Fugl.register_shader_initializer!(initialize_drawing_shaders)Fugl.render_child_to_framebuffer — Method
Render the child component to the framebuffer
Fugl.render_fps_overlay — Method
render_fps_overlay(frame_count, fps, screen_width, screen_height, projection_matrix)Render debug overlay showing frame count and FPS in the upper right corner.
Fugl.render_glyph_batch! — Method
Render all glyphs in the batch with a single draw call. This is dramatically faster than individual glyph rendering.
Fugl.render_horizontal_scrollbar — Method
Render horizontal scrollbar
Fugl.render_line_from_cache — Method
Render a line using cached tokenization data with optimized batched rendering.
Fugl.render_no_overlay — Method
render_no_overlay(frame_count, fps, screen_width, screen_height, projection_matrix)No-op function for when FPS overlay is disabled. This gets optimized away by the compiler.
Fugl.render_overlays — Method
render_overlays()Render all overlay functions and clear the overlay list. This should be called after all main content is rendered.
Fugl.render_tree_content — Method
Render the tree content (shared between direct and framebuffer drawing)
Fugl.render_vertical_scrollbar — Method
Render vertical scrollbar
Fugl.reset_plot_view_bounds — Method
reset_plot_view_bounds(state::PlotState)Returns a copy of the PlotState with currentbounds reset to nothing, falling back to initialbounds.
Fugl.run — Method
run(ui_function::Function; title::String="Fugl", window_width_points::Integer=1920, window_height_points::Integer=1080, fps_overlay::Bool=false, periodic_callbacks::Vector{PeriodicCallback}=PeriodicCallback[])Run the main loop for the GUI application. This function handles the rendering and event processing for the GUI.
Arguments
ui_function::Function: Function that returns an AbstractView for the UItitle::String="Fugl": Window titlewindow_width_points::Integer=1920: Initial window width in logical pointswindow_height_points::Integer=1080: Initial window height in logical pointsfps_overlay::Bool=false: Show frame count and FPS in upper right cornerperiodic_callbacks::Vector{PeriodicCallback}=PeriodicCallback[]: [Experimental] Periodic callbacks to execute at specified frame intervals
Examples
# Create a callback that runs every 60 frames (approximately once per second at 60fps)
file_check_callback = PeriodicCallback(() -> check_files(), 60)
# Create a callback that runs every 300 frames (every 5 seconds at 60fps)
data_update_callback = PeriodicCallback(() -> update_data(), 300)
run(MyApp, periodic_callbacks=[file_check_callback, data_update_callback])Fugl.safe_substring — Method
Safely get a substring using character-based indexing instead of byte indexing. This handles Unicode characters correctly.
Fugl.safe_substring_to_end — Method
Safely get a substring from start to end of string using character indexing.
Fugl.scroll_callback — Method
Mouse scroll callback to track scroll wheel input
Fugl.set_current_dpi_scaling! — Method
set_current_dpi_scaling!(dpi_scaling_ref::Ref{DPIScaling})Set the current DPI scaling ref for this rendering context. This is used internally by the rendering system.
Fugl.set_manual_scaling! — Method
set_manual_scaling!(scale_factor::Float32)Set manual scaling using the current DPI scaling context.
Fugl.set_manual_scaling! — Method
set_manual_scaling!(scale_factor::Float32)Set the UI scaling factor (1x = 1 point = 1 pixel, 2x = 1 point = 2 pixels). System DPI scaling is ignored for consistent 1:1 pixel mapping. Supports fractional values for smooth scaling.
Arguments
scale_factor: UI scale multiplier (0.25 = quarter size, 0.5 = half size, 1.0 = normal size, 2.0 = twice as large, etc.)
Example
# Half size: 1 point = 0.5 pixels
Fugl.set_manual_scaling!(0.5f0)
# Normal size: 1 point = 1 pixel
Fugl.set_manual_scaling!(1.0f0)
# Large UI: 1 point = 2 pixels
Fugl.set_manual_scaling!(2.0f0)Fugl.set_selection — Method
Set a text selection from start to end position.
Fugl.should_invalidate_cache — Method
Check if a cache needs to be invalidated based on content hash and bounds. Each component should provide its own contenthashfunc that captures all the state that affects rendering.
Fugl.should_invalidate_text_cache — Method
Check if text component cache should be invalidated
Fugl.split_line_at_nan — Method
Split line data at NaN values into separate continuous segments. Returns a vector of (xsegment, ysegment) tuples.
Fugl.string_to_enum — Method
Generic function to convert string to enum value.
Fugl.toggle_mute — Method
Toggle the muted state of a HeatmapElement.
Fugl.toggle_mute — Method
Toggle the muted state of a HorizontalColorbar.
Fugl.toggle_mute — Method
Toggle the muted state of a LinePlotElement.
Fugl.toggle_mute — Method
Toggle the muted state of a ScatterPlotElement.
Fugl.toggle_mute — Method
Toggle the muted state of a StemPlotElement.
Fugl.toggle_mute — Method
Toggle the muted state of a VerticalColorbar.
Fugl.tokenize_julia_line — Method
Tokenize a Julia line and return tokens with color data. Returns (tokens, tokendata) where tokendata is [(position, text, color), ...]
Fugl.tokenize_line_with_colors — Method
Tokenize a line of code and return tokens with color data. Returns (tokens, tokendata) where tokendata is [(position, text, color), ...]
Fugl.tree_from_walkdir — Method
Convert walkdir output to TreeNode tree
Fugl.unfocus_components — Method
Defocus all components in a view by simulating a click outside their bounds.
Fugl.unregister_cache_framebuffer! — Method
Cleanup function to remove framebuffer from tracking when deleted
Fugl.update_cache! — Method
Update a cache with new framebuffer, content hash, and bounds
Fugl.update_dpi_scaling! — Method
update_dpi_scaling!(dpi_scaling_ref::Ref{DPIScaling}, window_width::Integer, window_height::Integer, fb_width::Integer, fb_height::Integer)Update the DPI scaling with current window and framebuffer sizes. No automatic DPI detection - only tracks window dimensions.
Fugl.update_fps_stats! — Method
update_fps_stats!(debug_frame_count, debug_last_time, frame_start_time, debug_fps_update_interval, current_fps)Update FPS statistics when overlay is enabled. Returns current FPS value.
Fugl.update_interaction_state — Method
Update interaction state based on current mouse/input state. Returns a new InteractionState with updated values.
Fugl.update_no_fps_stats — Method
update_no_fps_stats(debug_frame_count, debug_last_time, frame_start_time, debug_fps_update_interval, current_fps)No-op function for when FPS overlay is disabled. Returns unchanged debug_fps value.
Fugl.wrap_cell_text — Method
wrap_cell_text(text, font, size_points, available_width, max_rows)Wrap text for a table cell, respecting maxrows limit and clipping if necessary. Returns a vector of strings representing the lines to display. maxrows = 0 means no wrapping (single line with character-level clipping and ellipsis).