The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Tk::AppWindow::Ext::ToolBar - add a tool bar

SYNOPSIS

 my $app = new Tk::AppWindow(@options,
    -extensions => ['ToolBar'],
 );
 $app->MainLoop;

DESCRIPTION

Add a toolbar to your application.

CONFIG VARIABLES

-autotool

Default value 1.

Specifies if the toolbar items of all extensions should be loaded automatically.

-toolbarpanel

Default value 'TOP'. Sets the name of the panel home to ToolBar.

-toolbarvisible

Default value 1. Show or hide tool bar.

-tooliconsize

Default value 16

-toolitems

Default value [].

Configure your tool bar here. Example:

 [    #type             #label    #command       #icon               #help
    [   'tool_button',   'New',     'doc_new',     'document-new',     'Create a new document' ],
 
    [   'tool_list' ],
    [   'tool_button',   'Save',    'doc_save',    'document-save',    'Save current document' ],
    [   'tool_button',   'Save as', 'doc_save_as', 'document-save-as', 'Rename and save current document' ],
    [   'tool_separator' ],
    [   'tool_button',   'Save all','doc_save_all','document-save-as', 'Save all modified documents' ],
    [   'tool_list_end' ],
 
    [   'tool_separator' ],
 
      #type             #label,   #class
    [   'tool_widget',    'Widget', 'MyWidget', @options ],
    [   'tool_widget',    '*Nolabel,'MyWidget', @options ],
 ]

'MyWidget', must be the class name of a packable Tk widget.

-tooltextposition

Specifies where text should be displayed in tool buttons. Default value right. Can be top, left, bottom, right or none.

METHODS

AddItem$item, ?$position?);

Adds an item to the toolbar. The item must be a valid tk widget. Your addition will be lost after a call to ReConfigure.

ConfigureTypes($type = $call, ...);

Call this method before MainLoop runs. Configure additional types for your toolbar. Already defined types are i<tool_button> and -tool_separator. $call can be any valid Tk callback. Just make sure the callback returns a valid Tk widget.

RemoveItem$position);

Removes the item at $position from the tool bar. The item will re-appear after a call to ReConfigure if the item is included in the -toolitems option. Returns the removed item.

AUTHOR

Hans Jeuken (hanje at cpan dot org)

BUGS

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

SEE ALSO

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