Provided by: padre_1.00+dfsg-1_all bug

NAME

       Padre::Wx::Action - Padre Action Object

SYNOPSIS

         my $action = Padre::Wx::Action->new(
             name       => 'file.save',
             label      => 'Save',
             comment    => 'Saves the current file to disk',
             icon       => '...',
             shortcut   => 'Ctrl-S',
             menu_event => sub { },
         );

DESCRIPTION

       This is the base class for the Padre Action API.

KEYS

       Each module is constructed using a number of keys. While only the name is technically
       required there are few reasons for actions which lack a label or menu_event.

       The keys are listed here in the order they usually appear.

   name
       Each action requires an unique name which is used to reference and call it.

       The name usually has the syntax

         group.action

       Both group and action should only contain \w+ chars.

   label
       Text which is shown in menus and allows the user to see what this action does.

       Remember to use Wx::gettext to make this translatable.

   need_editor
       This action should only be enabled/shown if there is a open editor window with a
       (potentially unsaved) document in it.

       The action may be called anyway even if there is no editor (all documents closed), but it
       shouldn't.

       Set to a value of 1 to use it.

   need_file
       This action should only be enabled/shown if the current document has a file name (meaning
       there is a copy on disk which may be older than the in-memory document).

       The action may be called anyway even if there is no file name for the current document,
       but it shouldn't.

       Set to a value of 1 to use it.

   need_modified
       This action should only be enabled/shown if the current document has either been modified
       after the last save or was never saved on disk at all.

       The action may be called anyway even if the file is up-to-date with the in-memory
       document, but it shouldn't.

       Set to a value of 1 to use it.

   need_selection
       This action should only be enabled/shown if there is some text selected within the current
       document.

       The action may be called anyway even if nothing is selected, but it shouldn't.

       Set to a value of 1 to use it.

   need
       Expected to contain a CODE reference which returns either true or false.

       If the code returns true, the action should be enabled/shown, otherwise it shouldn't,
       usually because it won't make sense to use this action without
       whatever_is_checked_by_the_code. (For example, UNDO can't be used if there was no change
       which could be undone.)

       The CODE receives a list of objects which should help with the decision:

         config      Contains the current configuration object
         editor      The current editor object
         document    The current document object
         main        The main Wx object

       A typical sub for handling would look like this:

         need => sub {
             my $current = shift;
             my $editor  = $current->editor or return 0;
             return $editor->CanUndo;
         },

       Use this with caution! As this function is called very often there are few to no checks
       and if this isn't a CODE reference, Padre may crash at all or get very slow if your CODE
       is inefficient and requires a lot of processing time.

   comment
       A comment (longer than label) which could be used in lists. It should contain a short
       description of what this action does.

       Remember to use Wx::gettext to make this translatable.

   icon
       If there is an icon for this action, specify it here.

   shortcut
       The shortcut may be set by the user. This key sets the default shortcut to be used if
       there is no user-defined value.

   menu_event
       This is expected to contain a CODE reference which does the job of this action or an ARRAY
       reference of CODE references which are executed in order.

METHODS

   new
       A default constructor for action objects.

COPYRIGHT & LICENSE

       Copyright 2008-2013 The Padre development team as listed in Padre.pm.

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

       The full text of the license can be found in the LICENSE file included with this module.