NAME
Tk::AppWindow::OverView - Getting started with Tk::AppWindow
DESCRIPTION
This document gives a brief overview of techniques used.
CALLBACKS
Besides regular Tk callbacks Tk::AppWindowheavily relies on callbacks from the module Tk::AppWindow::BaseClasses::Callback. This type of callback is used in commands and configvariables.
It allows the addition and removal of hooks. A hook is a routine linked to the callback that is executed before of after the execution of the actual callback. This is used mainly in plugins.
COMMANDS
The method cmdConfig in Tk::AppWindow allows you to issue commands that later can be executed through the method cmdExecute. Plugins can hook onto these commands. You can give parameters to a command.
CONFIGVARIABLES
Tk::AppWindow extends on Perl/Tk's option system with -configvariables. You may modify all configvariables with configPut and retrieve the values with configGet. You can add configvariables to the AppWindow object the following ways:
These ways use the classical Tk::ConfigSpecs method and should always be added before AppWindow's ConfigSpecs call. That means that beside -preconfig this can only be done during initialization of extensions. It also means that only the PASSIVE and CALLBACK types make any sense. You specify them as:
-option1 => ['PASSIVE', 'optionName', 'OptionClass', $defaultvalue'],
-option2 => ['CALLBACK', undef, undef, ['Method', $obj]],
- The -preconfig option
-
Specify this option at create time.
- AddPreConfig method
-
This method is called during initialization of extensions when needed.
The second way is through the ConfigInit method. It is sort of a replacement of the classical METHOD. They are immediately available upon creation. And you can apply hooks to them.
$app->configInit('-option1' => ['Method', $obj]);
$app->configInit('-option2' => sub { $var = shift; return $var});
EXTENSIONS
Extensions are modules that add functionality to Tk::AppWindow. By default they live in Tk::AppWindow::Ext. You may define an extra name space using the -namespace option.
Extensions can add config variables and commands to Tk::Appindow. They can add entries into toolbars and menus. Some extensions depend on others. They will be loaded automatically.
Without extensions loaded, Tk::AppWindow is no more than a sophisticated mainwindow.
The following extenstion are available within Tk::AppWindow:
- Art
-
Everything about images and icons
- ConfigFolder
-
Store settings and temp files in a configfolder
- Help
-
Help center
- Keyboard
-
All about keyboard bindings
- MDI
-
Multiple Document Interface
- MenuBar
-
Menus and stuff
- Panels
-
Arrange your panels, like Toolbar, StatusBar and Work area.
- Plugins
-
Manage your plugins
- SDI
-
Single document interface
- Selector
-
Provides a side bar with a document tree for use with MDI-like extensions.
- Settings
-
Init and edit your application settings.
- SideBars
-
Create and populate side bars.
- StatusBar
-
Log messages and special events.
- ToolBar
-
What to say?
HOOKS
Hooks are a feature of the Tk::AppWindow::BaseClasses::Callback object. All commands and config variables of the configInit type can have hooks applied to them. Used mainly to facilitate loading and unloading of plugins. See the following methods in Tk::AppWindow:
cmdHookAfter
cmdHookBefore
cmdUnhookAfter
cmdUnhookBefore
configHookAfter
configHookBefore
configUnhookAfter
configUnhookBefore
A good programming practice is to always use the command instead of the method that is called by it. This way hooks can be honoured. So:
$app->cmdExecute('doc_open', $file);
Instead of:
$mdi->docOpen($file);
PLUGINS
Plugins are modules that add functionality to Tk::AppWindow. Unlike extensions they can be loaded and unloaded by the end user at request. By default they live in Tk::AppWindow::Plugins. You may define an extra name space using the -namespace option. Plugins are handled by the Plugins extension.
Plugins can add commands, menu entries, panel entries and toolbar entries. Plugins can not add config variables.
AUTHOR
Hans Jeuken (hanje at cpan dot org)
SEE ALSO
- Tk::AppWindow
- Tk::AppWindow::CookBook
- Tk::AppWindow::CookBook::ContentManager
- Tk::AppWindow::CookBook::Extension
- Tk::AppWindow::CookBook::Plugin
- Tk::AppWindow::BaseClasses::Callback
- Tk::AppWindow::BaseClasses::ContentManager
- Tk::AppWindow::BaseClasses::Extension
- Tk::AppWindow::BaseClasses::Plugin
- Tk::AppWindow::BaseClasses::PluginJobs
- Tk::AppWindow::Ext::Art
- Tk::AppWindow::Ext::ConfigFolder
- Tk::AppWindow::Ext::Daemons
- Tk::AppWindow::Ext::Help
- Tk::AppWindow::Ext::Keyboard
- Tk::AppWindow::Ext::MDI
- Tk::AppWindow::Ext::MenuBar
- Tk::AppWindow::Ext::Panels
- Tk::AppWindow::Ext::Plugins
- Tk::AppWindow::Ext::SDI
- Tk::AppWindow::Ext::Selector
- Tk::AppWindow::Ext::Settings
- Tk::AppWindow::Ext::SideBars
- Tk::AppWindow::Ext::StatusBar
- Tk::AppWindow::Ext::ToolBar
- Tk::AppWindow::PluginsForm