Introduction

Introduction

Scope of this package

GtkReactive is a package building on the functionality of Gtk.jl and Reactive.jl. Its main purpose is to simplify the handling of interactions among components of a graphical user interface (GUI).

Creating a GUI generally involves some or all of the following:

  1. creating the controls
  2. arranging the controls (layout) in one or more windows
  3. specifying the interactions among components of the GUI
  4. (for graphical applications) canvas drawing
  5. (for graphical applications) canvas interaction (mouse clicks, drags, etc.)

GtkReactive is targeted primarily at items 1, 3, and 5. Layout is handled by Gtk.jl, and drawing (with a couple of exceptions) is handled by plotting packages or at a lower level by Cairo.

GtkReactive is suitable for:

For usage with Glade, the Input widgets and Output widgets defined by this package allow you to supply a preexisting widget (which you might load with GtkBuilder) rather than creating one from scratch. Users interested in using GtkReactive with Glade are encouraged to see how the player widget is constructed (see src/extrawidgets.jl).

At present, GtkReactive supports only a small subset of the widgets provided by Gtk. It is fairly straightforward to add new ones, and pull requests would be welcome.

Concepts

The central concept of Reactive.jl is the Signal, a type that allows updating with new values that then triggers actions that may update other Signals or execute functions. Your GUI ends up being represented as a "graph" of Signals that collectively propagate the state of your GUI. GtkReactive couples Signals to Gtk.jl's widgets. In essence, Reactive.jl allows ordinary Julia objects to become the triggers for callback actions; the primary advantage of using Julia objects, rather than Gtk widgets, as the "application logic" triggers is that it simplifies reasoning about the GUI and seems to reduce the number of times ones needs to consult the Gtk documentation.

Because these can sometimes be a source of bugs, it's worth emphasizing two crucial features of Reactive.jl Signals:

Please see the Reactive.jl documentation for more information.