API Reference

Fugl.ButtonStateType

Enum representing the state of a mouse button.

  • IsReleased: The button is currently released.
  • IsPressed: The button is currently pressed.
source
Fugl.CursorPositionType

Represents the position of a cursor in the editor.

  • line: Line number (1-based)
  • column: Column number (1-based, character position within the line)
source
Fugl.EditorStateType

State for the code editor containing text, cursor position, and cached tokenization.

  • text: The full text content
  • cursor: Current cursor position
  • is_focused: Whether the editor is focused
  • cached_lines: Cache of tokenized line data
  • text_hash: Hash of the text to detect changes
source
Fugl.EditorStateMethod

Create a new EditorState with updated text, preserving cursor and focus state from the old state.

source
Fugl.EditorStateMethod

Create a new EditorState with updated focus state, preserving text and cursor from the old state.

source
Fugl.KeyEventType

Struct representing a keyboard event.

  • key: GLFW key code (e.g., GLFW.KEYA, GLFW.KEYENTER)
  • scancode: Hardware-specific scancode
  • action: GLFW action (GLFW.PRESS, GLFW.RELEASE, GLFW.REPEAT)
  • mods: Modifier key flags (GLFW.MODSHIFT, GLFW.MODCONTROL, etc.)
source
Fugl.LineTokenDataType

Cached tokenization data for a line of code.

  • line_number: The line number this data belongs to
  • line_text: The original line text
  • tokens: Vector of tokens for this line
  • token_data: Processed token data with positions and colors
source
Fugl.MouseButtonType

Enum representing the different mouse buttons.

  • LeftButton: The left mouse button.
  • RightButton: The right mouse button.
  • MiddleButton: The middle mouse button (scroll button).
source
Fugl.SizedViewType

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.

source
Fugl.AlignHorizontalFunction
AlignHorizontal(child::SizedView, alignment::Symbol)

Aligns a sized child component horizontally within its container.

Arguments

  • child: A SizedView component that has intrinsic dimensions
  • alignment: Horizontal alignment (:left, :center, :right)

Example

AlignHorizontal(IntrinsicSize(Image("logo.png")), :left)
AlignHorizontal(FixedSize(Text("Hello"), 100.0f0, 50.0f0), :right)
source
Fugl.AlignVerticalFunction
AlignVertical(child::SizedView, alignment::Symbol)

Aligns a sized child component vertically within its container.

Arguments

  • child: A SizedView component that has intrinsic dimensions
  • alignment: Vertical alignment (:top, :center, :bottom)

Example

AlignVertical(IntrinsicSize(Image("logo.png")), :top)
AlignVertical(FixedSize(Text("Hello"), 100.0f0, 50.0f0), :center)
source
Fugl.ContainerFunction

The Container is the most basic GUI component that can contain another component. It is the most basic building block of the GUI system.

source
Fugl.FixedSizeMethod
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.

source
Fugl.IntrinsicSizeFunction
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.

source
Fugl.apply_layoutMethod
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.

source
Fugl.char_callbackMethod

Alternative signature in case GLFW passes Char directly This function adds a character directly to the key buffer.

source
Fugl.char_callbackMethod

New character callback for proper text input This function handles character input from the keyboard, converting Unicode codepoints to characters.

source
Fugl.draw_closed_linesMethod
draw_closed_lines(vertices::Vector{Point2f}, color_rgba::Vec4{<:AbstractFloat})

Draw closed lines using the provided vertices and color.

source
Fugl.draw_rectangleMethod
draw_rectangle(vertices::Vector{Point2f}, color_rgba::Vec4{<:AbstractFloat}, projection_matrix::Mat4{Float32})

Draw a rectangle using the provided vertices and color.

source
Fugl.draw_rounded_rectangleMethod
draw_rounded_rectangle(
    vertices::Vector{Point2f},
    width::Float32, height::Float32,
    fill_color_rgba::Vec4{<:AbstractFloat}, border_color_rgba::Vec4{<:AbstractFloat},
    border_width::Float32, radius::Float32,
    projection_matrix::Mat4{Float32}
)

Draw a rounded rectangle with border using the custom shader.

source
Fugl.generate_rectangle_verticesMethod
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.

source
Fugl.get_orthographic_matrixMethod
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.

source
Fugl.interpret_viewMethod
interpret_view(component::AbstractView, x::Float32, y::Float32, width::Float32, height::Float32, projection_matrix::Mat4{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.

source
Fugl.runMethod
run(ui_ref[]::AbstractView; title::String="Fugl", window_width_px::Integer=1920, window_height_px::Integer=1080)

Run the main loop for the GUI application. This function handles the rendering and event processing for the GUI.

source
Fugl.tokenize_julia_lineMethod

Tokenize a Julia line and return tokens with color data. Returns (tokens, tokendata) where tokendata is [(position, text, color), ...]

source
Fugl.tokenize_line_with_colorsMethod

Tokenize a line of code and return tokens with color data. Returns (tokens, tokendata) where tokendata is [(position, text, color), ...]

source