NAME
Tk::AppWindow::BaseClasses::Extension - Baseclass for all extensions in this framework
SYNOPSIS
#This is useless
my $ext = Tk::AppWindow::BaseClasses::Extension->new($mainwindow);
#This is what you should do
package Tk::AppWindow::Ext::MyExtension
use base(Tk::AppWindow::BaseClasses::Extension);
sub new {
my $class = shift;
my $self = $class->SUPER::new(@_); #$mainwindow should be the first in @_
...
return $self
}
DESCRIPTION
Tk::AppWindow::BaseClasses::Extension is the base object for all extenstions in this Tk::AppWindow framework. All extensions inherit this class. It has access to the Tk::AppWindow object and autoloads its methods. It has the core mechanisms in place if your extensions need to reconfigure or veto a close command.
Use this class as a basis to define your own extension.
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 MainWindow widget.
- MenuItems
-
Returns an empty list. It is there for you to overwrite. It is called by the MenuBar 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 'Extension'.
- ReConfigure
-
Does nothing. It is called when the user clicks the Apply button in the settings dialog. Overwrite it to act on modified settings.
- Require($extension)
-
Only call this during extension construction. Loads $extension if it isn't already.
- SettingsPage
-
Returns an empty list. It is there for you to overwrite. It is called by the Settings 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.
- ToolItems
-
Returns and empty list. It is there for you to overwrite. It is called by the ToolBar extension. You can return a list with menu items here. For details on the format see Tk::AppWindow::Ext::ToolBar
- Quit
-
Does nothing. It is there for you to overwrite. Here you do everything needed to terminate.
AUTHOR
Hans Jeuken (hanje at cpan dot org)
BUGS
Unknown. If you find any, please contact the author.