Windows are the primary top-level user interface components in Howl. They can hold an arbitrary number of other user interface components within, called “views”, which are all ordered in a grid. The most common examples of such a views are of course Editor instances, but it’s possible to place various other types of graphical components in a Window, although there are currently no examples of this.
A window has, apart from the grid components described above, always two graphical elements associated with it; A Status instance used for displaying informational message to the user, and a Readline instance allowing for user input.
The currently focused window is accessible as Application.window.
A Window delegates to the corresponding Gtk Window, which means that you can access GtkWindow properties and methods directly on the Window instance. For example:
howl.app.window.accept_focus -- => true howl.app.window:get_size() -- => 1920, 1056
See also:
The currently focused view. The return value is a table with same fields as is documented in views.
The currently focused Gtk view within the window.
A boolean indicating whether the window is fullscreen or not. Assign to this to force a particular state.
A boolean indicating whether the window is maximized or not. Assign to this to force a particular state.
A Readline instance associated with the window.
A Status instance associated with the window.
A list of view information for the currently existing views in the window grid. Each element is a table with the following fields:
x
: The horizontal position of the view in the grid (1-based)y
: The vertical position of the view in the grid (1-based)width
: The number of horizontal grid squares the view spansheight
: The number of vertical grid squares the view spansview
: A reference to the Gtk viewThe returned list is sorted in left-to-right, top-to-bottom order.
Note that the view
field, as the documentation says, holds a reference to the
“Gtk view”. This means that you cannot expect this to be, for instance, a
reference to an Editor. Should you need to map a particular view to an
Editor instance, you could instead iterate through
Application.editors and see whether an Editor’s
to_gobject corresponds to the view
field.
Returns a a table of siblings for view
, which should be a Gtk view. The
returned table contains four values accessible through the keys up
, down
,
left
and right
. Each value is a table with same fields as is documented in
views.
wraparound
controls what is returned if no sibling is found for a particular
direction. If it’s false
, as is the default, nil
is returned if no sibling
can be found for a particular direction. If it’s true
, then the search for
siblings will wrap around in a left-to-right, top-to-bottom order fashion.
Returns the underlying Gtk window.
Adds view
to the grid. If view
is not a Gtk view, it’s automatically cast
using the view’s to_gobject
, if it’s present. placement
specifies where to
place the view in the grid, relative to anchor
which should be an existing
view in the grid. Valid values for placement
are:
left_of
: Places the view left of anchor
right_of
: Places the view right of anchor
.above
: Places the view above anchor
.below
:Places the view below anchor
.Removes the specified view
, or the currently focused view if not specified,
from the grid.
Gets the view information for the object o
. The return value is a table with
same fields as is documented in views. Returns nil
if o
is not in
the window grid.