Lynx.@appMacro
@app() -> LynxApp

Returns the current LynxApp or throws an exception if no LynxApp has been created.

source
Lynx.@onMacro
    @on widget.event() do args... body... end

Adds a event callback to the corresponding widget

Usage

@on window.destroy() do args...
    # do something when the window is destroyed
end

@on button.clicked() do args...
    # do something when the button is clicked
end
source
Lynx.@sizeMacro
    @size -> Tuple{Int, Int}

The width and height of the current canvas.

source
Lynx.@useMacro
    @use widget

Adds the widget to the current application and returns it.

source
Lynx.@waitforMacro
    @waitfor widget.event

Block the current task until the event is triggered for widget.

Examples:

window = Window("Hello, world", 800, 600)

... # Some UI stuff

if !isinteractive()
    # If the code is not running on a interactive julia session
    # (e.g. the REPL), then the line below will block the current
    # task until the window is destroyed
    @waitfor window.destroy
end
source
Base.fill!Method
    fill!(bar::ProgressBar, fraction::Real) -> Nothing

Causes the progress bar to “fill in” the given fraction of the bar. The fraction should be between 0.0 and 1.0, inclusive.

source
Lynx.gcpreserveMethod
gcpreserve(widget::GtkWidget, obj)

Preserve obj until widget has been destroyed.

source
Lynx.loop!Method
loop!(x::Bool)

Whether or not the update function should be called every frame.

source
Lynx.maprMethod
    mapr(t, a, b, c, d) -> Real

Maps the value t from the interval [a, b] to [c, d]

source
Lynx.maprMethod
    mapr(t, a, b) -> Real

Maps the value t from the interval [0, 1] to [a, b]

source
Lynx.onmousedownMethod
    onmousedown(callback, canvas)

The mouse-down event is fired when the user press with the mouse on the canvas.

source
Lynx.onmousedragMethod
    onmousedrag(callback, canvas)

The mouse-drag event is fired when the user holds down and move the cursor on the canvas.

source
Lynx.onmousemoveMethod
    onmousemove(callback, canvas)

The mouse-move event is fired when the user moves the cursor on the canvas.

source
Lynx.onmouseupMethod
    onmouseup(callback, canvas)

The mouse-up event is fired when the user release the mouse on the canvas.

source
Lynx.onscrollMethod
    onscroll(callback, canvas)

The scroll event is fired when the user scrolls with the mouse-wheel on the canvas.

source
Lynx.pulse!Method
    pulse!(widget::ProgressBar) -> Nothing

Make the progress bar pulse, indicating that a unknown amount of progress has been made.

source
Lynx.run!Function
    run!(update::Function [, setup::Function]; await = false) -> Nothing

Run the current LynxApp with the given update function. If await is true, the main task will be blocked until the user closes the window.

You can also specify a setup function that will be called when the window is created.

source
Lynx.spanMethod
    span(; rows = 1, cols = 1) -> GridElement

Creates a empty GridElement that spans multiple rows and cols.

source
Lynx.use!Method
    use!(widget) -> Widget

Adds the widget to the current application and returns it.

source
Lynx.value!Method
    value!(widget::Input, value) -> Nothing

Sets the value of a Input widget.

source
Lynx.valueMethod
    value(widget::Input{T}) -> T

Returns the value of a Input widget.

source
Lynx.AbstractLayoutType

Layouts are used to organize the canvas and other widgets within the window.

They are simple function or callable structures.

Example of layout implementation:

struct MyLayout <: AbstractLayout
    fields...
    function MyLayout(args...)
        ...
    end
end

function (layout::MyLayout)(window, canvas, widgets...)
    ...
end

The call implementation of a layout should return a widget that contains (or not) the canvas and the widgets. The returned widget will then be added to the window.

source
Lynx.BoxMethod
    Box(direction, children...; props...) -> Box

Creates a Box widget.

The direction parameter determines the direction the widgets are packed. :v for vertical or :h for horizontal.

source
Lynx.GridMethod
    Grid(rows::Vector; props...) -> Grid

Creates a Grid and adds to it each element in rows.

The rows argument must be a list of Vector{<:Widget}. The position of each element in rows determines its position within the grid.

You can also use GridElement to make widgets span multiple cells within the grid.

Example:

grid = Grid(
    Label("A"), Label("B"),     |,
    Label("C"), Label("D"),     |,
    Label("E") |> span(cols=2), |,
)
source
Lynx.GridElementType

Represents a grid element that may span multiple rows and/or columns.

You can use the span function to create a empty GridElement.

Calling a empty GridElement as a function and passing a Widget as argument will transform that widget into a GridElement, making it span multiple cells in a Grid container.

Usage:

grid = Grid([
    # The Button will span 3 columns
    [Button("Example 1") |> span(cols=3)],
    # The Button will span 2 rows
    [Button("Example 2") |> span(rows=2)],
    # The Button will span an 2 rows and 3 columns
    [Button("Example 3") |> span(2, 3)],
])
source
Lynx.LabelType

A widget that displays a small to medium amount of text

source
Lynx.LynxAppType

An LynxApp is a basic structure that holds a window, a canvas and other widgets to make a interactive application with a few lines of code.

source
Lynx.PanedMethod
    Paned(direction, children...; props...) -> Paned

Creates a Paned widget.

The direction parameter determines how the two panes are arranged, either horizontally :h, or vertically :v.

source
Lynx.SideBarType

The SideBar layout divides the window between the canvas and a sidebar containing the other widgets.

source
Lynx.SideBarType
    SideBar(position = :left, size = .25, props = NamedTuple()) -> SideBar

Creates a SideBar layout. The position determines where the sidebar is placed relative to the canvas (can be either :left or :right). The size controls the width of the sidebar relative to the width of the window (must be a value between 0 and 1). You can also pass aditional properties for the sidebar widget using the props parameter.

source