NAME

Tk::AppWindow::BaseClasses::Plugin - Baseclass for all plugins.

SYNOPSIS

#This is useless
my $plug = Tk::AppWindow::BaseClasses::Plugin->new($frame);

#This is what you should do
package My::App::Path::Plugins::MyPlugin
use base(Tk::AppWindow::BaseClasses::Plugin);
sub new {
   my $class = shift;
   my $self = $class->SUPER::new(@_); #$mainwindow should be the first in @_
   if (defined $self) {
      ...
   }
   return $self
}

DESCRIPTION

A plugin is different from an extension in a couple of ways:

- A plugin can be loaded and unloaded by the end user.
  If they do not desire the functionality they can simply 
  unload it.
- A plugin can not define config variables

This is a base class you can inherit to write your own plugin.

It autoloads methods from the mainwindow class.

METHODS

CanQuit

Returns 1. It is there for you to overwrite. It is called when you attempt to close the window or execute the quit command. Overwrite it to check for unsaved data and possibly veto these commands by returning a 0.

GetAppWindow

Returns a reference to the toplevel frame. The toplevel frame should be a Tk::AppWindow class.

Returns and empty list. It is there for you to overwrite. It is called by the Plugins extension. You can return a list with menu items here. For details on the format see Tk::AppWindow::Ext::MenuBar

Name

returns the module name of $self, without the path. So, if left uninherited, it returns 'Plugin'.

ReConfigure

Does nothing. It is called when the user clicks the Apply button in the settings dialog. Overwrite it to act on modified settings.

ToolItems

Returns and empty list. It is there for you to overwrite. It is called by the Plugins extension. You can return a list with menu items here. For details on the format see Tk::AppWindow::Ext::MenuBar

SettingsPage

Returns an empty list. It is there for you to overwrite. It is called by the Plugins extension. You can return a paired list of pagenames and widget.

sub SettingsPage {
.   return (
      'Some title' => ['MyWidget', @options],
   )
}

If 'MyWidget' has an 'Apply' method it will be called when you hit the 'Apply' button.

Quit

Does nothing. It is there for you to overwrite. Here you do everything needed when the application is to terminate.

UnLoad

Removes the settings page for this plugin from the settings dialog if applicable. Returns 1. When overwriting this method, make a call to SUPER::Unload to include this. and do what is needed to completely unload your plugin.

AUTHOR

Hans Jeuken (hanje at cpan dot org)

BUGS

Unknown. If you find any, please contact the author.

SEE ALSO

Tk::AppWindow::BaseClasses::Extension
Tk::AppWindow