NAME

Tk::Program - MainWindow Widget with special features.

SYNOPSIS

  use Tk;
  use Tk::Program;

  my $top = Tk::Program->new(
	-app => 'xpix',
	-cfg => './testconfig.cfg',
	-icon	=> './icon.gif',
	-logo => './logo.gif',
	-about => \$about,
	-help => '../Tk/Program.pm',
  	-add_prefs => [
		'Tools',
			['acrobat', '=s', '/usr/local/bin/acroread',
			{	'subtype' => 'file',
				'help' => 'Path to acrobat reader.'
			} ],
  	],
  );

  MainLoop;

DESCRIPTION

This is a megawidget to display a program window. I was tyred in every application to create a menu, prefs dialog, about .... I search for a standard way and write this module. This remember the font, size and postion from the Mainwindow and use also the function from Tk::Mainwindow.

WIDGET-SPECIFIC OPTIONS

-app => $Applikation_Name

Set a Application name, default is Program

-icon => $Path_to_icon_image

Set a Application Icon, please give this in 32x32 pixel and in gif format.

-cfg => $path_to_config_file;

Set the path to the config file, default:

$HOME/.$Application_Name.cfg

-add_prefs => $arrey_ref_more_prefs;

This allow mor Preferences as the default:

  	-add_prefs => [
		'Tools',
			['acrobat', '=s', '/usr/local/bin/acroread',
			{	'subtype' => 'file',
				'help' => 'Path to acrobat reader.'
			} ],
  	],

-logo => $image_file;

One logo for one program ;-) This picture will use from Splash and About Method. Carefully, if this not defined in Splash then returnd this with an error.

-help => $pod_file;

This include a Help function as a topwindow with Poddisplay. Look for more Information on Tk::Pod. Default is the program source ($0).

METHODS

These are the methods you can use with this Widget.

$top->init_prefs( $prefs );

This will initialize the user or default preferences. This returnd a Prefsobject. More information about the prefsobject look on Tk::Getopt from slaven. The Program with use this Module have a configuration dialog in tk and on the commandline with the following standard options:

Geometry: Save the geometry (size and position) from mainwindow.
Font: Save the font from mainwindow.
Color: Save the color from mainwindow.

In the Standard menu you find the preferences dialog under File - Prefs.

I.E.:

my $opt = $top->init_prefs();
$opt->save_options;
....	

$top->prefs();

Display the Configuration dialog.

$top->init_menu( $menuitems );

Initialize the user or default Menu and returnd the Menuobject. You can set your own menu with the first parameter. the other (clever) way, you add your own menu to the standart menu. I.E:

# New menu item
my $edit_menu = $mw->Menu();
$edit_menu->command(-label => '~Copy', -command => sub{ print "Choice Copy \n" });
$edit_menu->command(-label => '~Cut', -command => sub{ print "Choice Cut \n" });
# ....	

my $menu = $mw->init_menu();
$menu->insert(1, 'cascade', -label => 'Edit', -menu => $edit_menu);

$top->splash( $milliseconds );

Display the Splashscreen for (optional) x milliseconds. The -logo option is required to initialize with a Picture. Also you can this use as Switch, without Parameter:

$top->splash();	# Splash on
....
working
...
$top->splash(); # Splash off

ADVERTISED WIDGETS

You can use the advertice widget with the following command $top- Subwidget('name_from_adv_widget')>.

main: Mainframe

status: Statusframe

status_name: StatusEntry from $top->add_status

CHANGES

$Log: Program.pm,v $
Revision 1.1  2003/06/04 17:14:35  xpix
* New Modul for standart way to build a Programwindow.

AUTHOR

Copyright (C) 2003 , Frank (xpix) Herrmann. All rights reserved.

http://xpix.dieserver.de

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

KEYWORDS

Tk, Tk::MainWindow

__END__