dtRdr::GUI::Wx::NoteTree - treectrl subclass


dotReader documentation Contained in the dotReader distribution.

Index


Code Index:

NAME

Top

dtRdr::GUI::Wx::NoteTree - treectrl subclass

SYNOPSIS

Top

setup_menu

Overrides base class to change doubleclick and add options.

  $self->setup_menu;

item_activated

  $tree->item_activated($event);

AUTHOR

Top

Eric Wilhelm <ewilhelm at cpan dot org>

http://scratchcomputing.com/

COPYRIGHT

Top

NO WARRANTY

Top

Absolutely, positively NO WARRANTY, neither express or implied, is offered with this software. You use this software at your own risk. In case of loss, no person or entity owes you anything whatsoever. You have been warned.

LICENSE

Top

The dotReader(TM) is OSI Certified Open Source Software licensed under the GNU General Public License (GPL) Version 2, June 1991. Non-encrypted and encrypted packages are usable in connection with the dotReader(TM). The ability to create, edit, or otherwise modify content of such encrypted packages is self-contained within the packages, and NOT provided by the dotReader(TM), and is addressed in a separate commercial license.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


dotReader documentation Contained in the dotReader distribution.
package dtRdr::GUI::Wx::NoteTree;
$VERSION = eval{require version}?version::qv($_):$_ for(0.10.1);

use warnings;
use strict;
use Carp;

use Class::Accessor::Classy;
ro 'menu_item_show';
ro 'menu_item_edit';
no  Class::Accessor::Classy;

sub DISABLED_ITEMS { return(shift->SUPER::DISABLED_ITEMS(), 'edit'); }

use base 'dtRdr::GUI::Wx::Tree::AnnoBase';

use constant { anno_type => 'note' };

use dtRdr::Logger;

sub setup_menu {
  my $self = shift;
  $self->SUPER::setup_menu;
  $self->append_menu(@$_) for(
    ['show', 'Show'],
    ['edit', 'Edit'],
  );
  Wx::Event::EVT_TREE_ITEM_ACTIVATED($self, $self,
    sub {$_[0]->item_activated($_[1])}
  );

} # end subroutine setup_menu definition
########################################################################

sub item_activated {
  my $self = shift;
  my ($event) = @_;
  $self->menu_goto($event);
  my $item = $event->GetItem;
  my $anno = $self->get_data($item);
  $self->bv_manager->show_note($anno);
} # end subroutine item_activated definition
########################################################################

sub menu_show {
  my $self = shift;
  my ($event) = @_;

  my ($item, @items) = $self->event_or_selection_items($event);
  # TODO need a multi-note viewer
  @items and WARN("cannot show multiple notes yet");
  my $anno = $self->get_data($item);
  $self->bv_manager->show_note($anno);
} # end subroutine menu_show definition
########################################################################

sub menu_edit {
  my $self = shift;
  my ($event) = @_;

  my @items = $self->event_or_selection_items($event);
  foreach my $item (@items) {
    my $anno = $self->get_data($item);
    $self->bv_manager->edit_note($anno);
  }
} # end subroutine menu_edit definition
########################################################################

# vi:ts=2:sw=2:et:sta
1;