Home
Authors History
Donations Cats
News
News FVWM Logo
Logo Competition
Features
Features
Download
Download
Icons and Sounds
Screenshots
Desktop Screenshots Menu Screenshots
Window Decor Screenshots Vectorbuttons
Documentation
Documentation Man pages
FAQ Developer Info
Mailing Lists
Mailing Lists
Links
Links
Customize
 
 Official FVWM Home Page plain theme

FVWM - Perl library - FVWM::Module::Toolkit


FVWM::Module::Toolkit

Section: FVWM Perl library (3)
Updated: 2005-08-24
Source: FVWM/Module/Toolkit.pm
This page contents - Return to main index
 

NAME

FVWM::Module::Toolkit - FVWM::Module with abstract widget toolkit attached  

SYNOPSIS

1) May be used anywhere to require external Perl classes and report error in the nice dialog if absent:

    use FVWM::Module::Toolkit qw(Tk X11::Protocol Tk::Balloon);

    use FVWM::Module::Toolkit qw(Tk=804.024,catch X11::Protocol>=0.52);

There is the same syntactic sugar as in ``perl -M'', with an addition of ``>='' being fully equivalent to ``=''. The ``>='' form may look better for the user in the error message. If the required Perl class is absent, FVWM::Module::Toolkit->showMessage() is used to show the dialog and the application dies.

2) This class should be uses to implement concrete toolkit subclasses. A new toolkit subclass implementation may look like this:

    package FVWM::Module::SomeToolkit;
    # this automatically sets the base class and tries "use SomeToolkit;"
    use FVWM::Module::Toolkit qw(base SomeToolkit);

    sub showError ($$;$) {
        my ($self, $error, $title) = @_;
        $title ||= $self->name . " Error";

        # create a dialog box using SomeToolkit widgets
        SomeToolkit->Dialog(
            -title => $title,
            -text => $error,
            -buttons => ['Close'],
        );
    }

    sub eventLoop ($$) {
        my $self = shift;
        my @params = @_;

        # enter the SomeToolkit event loop with hooking $self->{istream}
        $self->eventLoopPrepared(@params);
        fileevent($self->{istream},
            read => sub {
                unless ($self->processPacket($self->readPacket)) {
                    $self->disconnect;
                    $top->destroy;
                }
                $self->eventLoopPrepared(@params);
            }
        );
        SomeToolkit->MainLoop;
        $self->eventLoopFinished(@params);
    }
 

DESCRIPTION

The FVWM::Module::Toolkit package is a sub-class of FVWM::Module that is intended to be uses as the base of sub-classes that attach widget toolkit library, like Perl/Tk or Gtk-Perl. It does some common work to load widget toolkit libraries and to show an error in the external window like xmessage if the required libraries are not available.

This class overloads one method addDefaultErrorHandler and expects sub-classes to overload the methods showError, showMessage and showDebug to use native widgets. These 3 methods are implemented in this class, they extend the superclass versions by adding a title parameter and using an external dialog tool to show error/message.

This manual page details only those differences. For details on the API itself, see FVWM::Module.  

METHODS

Only overloaded or new methods are covered here:
showError msg [title]
This method is intended to be overridden in subclasses to create a dialog box using the corresponding widgets. The default fall back implementation is similar to showMessage, but the error message (with title) is also always printed to STDERR.

May be good for module diagnostics or any other purpose.

showMessage msg [title]
This method is intended to be overridden in subclasses to create a dialog box using the corresponding widgets. The default fall back implementation is to find a system message application to show the message. The potentially used applications are gdialog, Xdialog, gtk-shell, xmessage, kdialog, or xterm as the last resort. If not given, title is based on the module name.

May be good for module debugging or any other purpose.

showDebug msg [title]
This method is intended to be overridden in subclasses to create a dialog box using the corresponding widgets. The default fall back implementation is to print a message (with a title that is the module name by default) to STDERR.

May be good for module debugging or any other purpose.

addDefaultErrorHandler
This methods adds a M_ERROR handler to automatically notify you that an error has been reported by FVWM. The M_ERROR handler then calls "showError()" with the received error text as a parameter to show it in a window.
 

AUTHOR

Mikhael Goikhman <migo@homemail.com>.  

SEE ALSO

For more information, see fvwm, FVWM::Module, FVWM::Module::Gtk, FVWM::Module::Gtk2, FVWM::Module::Tk.


 

Index

NAME
SYNOPSIS
DESCRIPTION
METHODS
AUTHOR
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 00:51:30 GMT, August 27, 2005

Last modified on April 26, 2010