The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

UI::Various::Tk::base - abstract helper class for Tk's UI elements

SYNOPSIS

    # This module should only be used by the UI::Various::Tk UI
    # element classes!

ABSTRACT

This module provides some helper functions for the UI elements of the Perl/Tk 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::Tk classes:

Attributes

_tk [rw, optional]

a reference to the main Perl/Tk element used for the implementation of the UI element

Note that usually this should only be used within UI::Various::Tk.

METHODS

The module also provides the following common (internal) methods for all UI::Various::Tk UI element classes:

_attributes - return common attributes of UI element

    my @attributes = $self->_attributes();

description:

This method determines returns all defined common attributes of a UI element in the representation needed by Tk (as key / value pairs). It returns an array, that could be empty, as all common attributes are optional.

Note that certain Tk widgets ignore some of the options returned here.

returns:

array of all defined common attributes in Tk representation

_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.

SEE ALSO

UI::Various

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>