NAME
UI::Various::Curses::base - abstract helper class for Curses's UI elements
SYNOPSIS
# This module should only be used by the UI::Various::Curses UI
# element classes!
ABSTRACT
This module provides some helper functions for the UI elements of the Curses::UI GUI.
DESCRIPTION
The documentation of this module is only intended for developers of the package itself.
All functions of the module will be included as second "base class" (in @ISA
). Note that this is not a diamond pattern as this "base class" does not import anything besides Exporter
, though it add a common private attribute to all UI::Various::Curses
classes:
Attributes
- _cui [rw, optional]
-
a reference to the main Curses::UI element used for the implementation of the UI element
Note that usually this should only be used within
UI::Various::Curses
. - _cid [ro, auto]
-
a unique ID needed for accessing some Curses::UI methods, most notably
delete
Note that we can't simply use our own object (
$self
) as Curses::UI uses the class-name if it encounters an object as ID.
METHODS
The module also provides the following common (internal) methods for all UI::Various::Curses UI element classes:
_cleanup - cleanup UI element
$ui_element->cleanup;
description:
This method prepares a UI element for destruction by removing all of the references it is holding (including its parent reference). An object will therefore only survive if it is additionally still referenced outside of UI::Various
, e.g. a variable used to create it in the first place.
_reference - remember SCALAR referenece
$self->_reference($scalar, $update);
parameters:
$self reference to derived object
$scalar reference to SCALAR
$update flag to initiate update of objects using same SCALAR
description:
This method stores all SCALAR references for later updates when the content of a SCALAR is changes. If the optional update flag is set (to any true value) all other references are updated (by calling their _update
method).
_update_all_references - update all SCALAR refereneces
$self->_update_all_references();
parameters:
$self unused reference object
description:
This method updates all stored SCALAR references for all objects. Currently it's only used after destroying a UI::Various::Curses::Dialog.
_common_attributes - compute array of common Curses::UI
attributes
my @attributes = $ui_element->_common_attributes();
description:
This method returns an array of attributes of a UI element that are common to all Curses::UI
widgets.
_needed_width - determine needed width of UI element
$ui_element->_needed_width();
description:
This method updates determines the width a UI element needs, which is either specified explicitly or the maximum width of its text lines (with possible embedded newlines).
SEE ALSO
LICENSE
Copyright (C) Thomas Dorner.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See LICENSE file for more details.
AUTHOR
Thomas Dorner <dorner (at) cpan (dot) org>