close
$win->close
Removes the window from its parent and clears any event handlers set using bind_event. Also recursively
closes any child windows.
Currently this is an optional method, as child windows are stored as weakrefs, so should be destroyed
when the last reference to them is dropped. Widgets should make sure to call this method anyway, because
this will be changed in a future version.
make_sub
$sub = $win->make_sub( $top, $left, $lines, $cols )
Constructs a new sub-window of the given geometry, and places it at the end of the child window list;
below any other siblings.
make_hidden_sub
$sub = $win->make_hidden_sub( $top, $left, $lines, $cols )
Constructs a new sub-window like "make_sub", but the window starts initially hidden. This avoids having
to call "hide" separately afterwards.
make_float
$float = $win->make_float( $top, $left, $lines, $cols )
Constructs a new sub-window of the given geometry, and places it at the start of the child window list;
above any other siblings.
make_popup
$popup = $win->make_popup( $top, $left, $lines, $cols )
Constructs a new floating popup window starting at the given coordinates relative to this window. It will
be sized to the given limits.
This window will have the root window as its parent, rather than the window the method was called on.
Additionally, a popup window will steal all keyboard and mouse events that happen, regardless of focus or
mouse position. It is possible that, if the window has an "on_mouse" handler, that it may receive mouse
events from outwide the bounds of the window.
bind_event
$id = $win->bind_event( $ev, $code, $data )
Installs a new event handler to watch for the event specified by $ev, invoking the $code reference when
it occurs. $code will be invoked with the given window, the event name, an event information object, and
the $data value it was installed with. "bind_event" returns an ID value that may be used to remove the
handler by calling "unbind_event_id".
$ret = $code->( $win, $ev, $info, $data )
The type of $info will depend on the kind of event that was received, as indicated by $ev. The
information structure types are documented in Tickit::Event.
bind_event(withflags)
$id = $win->bind_event( $ev, $flags, $code, $data )
The $code argument may optionally be preceded by an integer of flag values. This should be zero to apply
default semantics, or a bitmask of constants. The constants are documented in "bind_event (with flags)"
in Tickit::Term.
unbind_event_id
$win->unbind_event_id( $id )
Removes an event handler that returned the given $id value.
raise
$win->raise
lower
$win->lower
Moves the order of the window in its parent one higher or lower relative to its siblings.
raise_to_front
$win->raise_to_front
Moves the order of the window in its parent to be the front-most among its siblings.
lower_to_back
$win->lower_to_back
Moves the order of the window in its parent to be the back-most among its siblings.
parent
$parentwin = $win->parent
Returns the parent window; i.e. the window on which "make_sub" or "make_float" was called to create this
one
subwindows
@windows = $win->subwindows
Returns a list of the subwindows of this one. They are returned in order, highest first.
root
$rootwin = $win->root
Returns the root window
term
$term = $win->term
Returns the Tickit::Term instance of the terminal on which this window lives.
Note that it is not guaranteed that this method will return the same Perl-level terminal instance that
the root window was constructed with. In particular, if the root window in fact lives on a mock terminal
created by Tickit::Test::MockTerm this method may "forget" this fact, returning an object instance simply
in the "Tickit::Term" class instead. While the instance will still be useable as a terminal, the fact it
was a mock terminal may get forgotten.
tickit
$tickit = $win->tickit
Returns the Tickit instance with which this window is associated.
show
$win->show
Makes the window visible. Allows drawing methods to output to the terminal. Calling this method also
exposes the window, invoking the "on_expose" handler. Shows the cursor if this window currently has
focus.
hide
$win->hide
Makes the window invisible. Prevents drawing methods outputting to the terminal. Hides the cursor if this
window currently has focus.
is_visible
$visible = $win->is_visible
Returns true if the window is currently visible.
resize
$win->resize( $lines, $cols )
Change the size of the window.
reposition
$win->reposition( $top, $left )
Move the window relative to its parent.
change_geometry
$win->change_geometry( $top, $left, $lines, $cols )
A combination of "resize" and "reposition", to atomically change all the coordinates of the window. Will
only invoke "on_geom_changed" once, rather than twice as would be the case calling the above methods
individually.
expose
$win->expose( $rect )
Marks the given region of the window as having been exposed, to invoke the "on_expose" event handler on
itself, and all its child windows. The window's own handler will be invoked first, followed by all the
child windows, in screen order (top to bottom, then left to right).
If $rect is not supplied it defaults to exposing the entire window area.
The "on_expose" event handler isn't invoked immediately; instead, the "Tickit" "later" method is used to
invoke it at the next round of IO event handling. Until then, any other window could be exposed.
Duplicates are suppressed; so if a window and any of its ancestors are both queued for expose, the actual
handler will only be invoked once per unique region of the window.
getctlsetctl
$value = $win->getctl( $ctl )
$success = $win->setctl( $ctl, $value )
Accessor and mutator for window control options. $ctl should be one of the following options:
cursor-blink (bool)
cursor-shape (int)
cursor-visible (bool)
Cursor properties to set for the terminal cursor when this window has input focus.
focus-child-notify (bool)
Whether the window will also receive focus events about child windows.
steal-input (bool)
Whether the window is currently stealing input from its siblings.
set_focus_child_notify
$win->set_focus_child_notify( $notify )
If set to a true value, the "on_focus" event handler will also be invoked when descendent windows gain or
lose focus, in addition to when it gains or loses focus itself. Defaults to false; meaning the "on_focus"
handler only receives notifications about the window itself.
topbottomleftright
$top = $win->top
$bottom = $win->bottom
$left = $win->left
$right = $win->right
Returns the coordinates of the start of the window, relative to the parent window.
abs_topabs_left
$top = $win->abs_top
$left = $win->abs_left
Returns the coordinates of the start of the window, relative to the root window.
colslines
$cols = $win->cols
$lines = $win->lines
Obtain the size of the window
selfrect
$rect = $win->selfrect
Returns a Tickit::Rect containing representing the window's extent within itself. This will have "top"
and "left" equal to 0.
rect
$rect = $win->rect
Returns a Tickit::Rect containing representing the window's extent relative to its parent
pen
$pen = $win->pen
Returns the current Tickit::Pen object associated with this window
set_pen
$win->set_pen( $pen )
Replace the current Tickit::Pen object for this window with a new one. The object reference will be
stored, allowing it to be shared with other objects. If "undef" is set, then a new, blank pen will be
constructed.
getpenattr
$val = $win->getpenattr( $attr )
Returns a single attribue from the current pen
get_effective_pen
$pen = $win->get_effective_pen
Returns a new Tickit::Pen containing the effective pen attributes for the window, combined by those of
all its parents.
get_effective_penattr
$val = $win->get_effective_penattr( $attr )
Returns the effective value of a pen attribute. This will be the value of this window's attribute if set,
or the effective value of the attribute from its parent.
scrollrect
$success = $win->scrollrect( $rect, $downward, $rightward )
$success = $win->scrollrect( $top, $left, $lines, $cols, $downward, $rightward )
$success = $win->scrollrect( ..., $pen )
$success = $win->scrollrect( ..., %attrs )
Attempt to scroll the rectangle of the window (either given by a "Tickit::Rect" or defined by the first
four parameters) by an amount given by the latter two. Since most terminals cannot perform arbitrary
rectangle scrolling, this method returns a boolean to indicate if it was successful. The caller should
test this return value and fall back to another drawing strategy if the attempt was unsuccessful.
Optionally, a "Tickit::Pen" instance or hash of pen attributes may be provided, to override the
background colour used for erased sections behind the scroll.
The cursor may move as a result of calling this method; its location is undefined if this method returns
successful. The terminal pen, in particular the background colour, may be modified by this method even if
it fails to scroll the terminal (and returns false).
This method will enqueue all of the required expose requests before returning, so in this case the return
value is not interesting.
scroll
$success = $win->scroll( $downward, $rightward )
A shortcut for calling "scrollrect" on the entire region of the window.
scroll_with_children
$win->scroll_with_children( $downward, $rightward )
Similar to "scroll" but ignores child windows of this one, moving all of the terminal content paying
attention only to obscuring by newer siblings of ancestor windows.
This method is experimental, intended only for use by Tickit::Widget::ScrollBox. After calling this
method, the terminal content will have moved and the windows drawing them will be confused unless the
window position was also updated. "ScrollBox" takes care to do this.
cursor_at
$win->cursor_at( $line, $col )
Sets the position in the window at which the terminal cursor will be placed if this window has focus.
This method does not force the window to take the focus though; for that see "take_focus".
cursor_visible
$win->cursor_visible( $visible )
Sets whether the terminal cursor is visible on the window when it has focus. Normally it is, but passing
a false value will make the cursor hidden even when the window is focused.
cursor_shape
$win->cursor_shape( $shape )
Sets the shape that the terminal cursor will have if this window has focus. This method does not force
the window to take the focus though; for that see "take_focus". Valid values for $shape are the various
"CURSORSHAPE_*" constants from Tickit::Term.
take_focus
$win->take_focus
Causes this window to take the input focus, and updates the cursor position to the stored active position
given by "cursor_at".
focus
$win->focus( $line, $col )
A convenient shortcut combining "cursor_at" with "take_focus"; setting the focus cursor position and
taking the input focus.
is_focused
$focused = $win->is_focused
Returns true if this window currently has the input focus
is_steal_input
$steal = $win->is_steal_input
Returns true if this window is currently stealing input from its siblings
set_steal_input
$win->set_steal_input( $steal )
Controls whether this window is currently stealing input from its siblings