cvs commit: p5ee/App-Widget/lib/App/Widget SelectSaveAs.pm

[email protected] (Stephen Adkins)
Newsgroups perl.cvs.p5ee
Message-ID <[email protected]>
cvsuser     04/10/27 08:53:28

  Added:       App-Widget/lib/App/Widget SelectSaveAs.pm
  Log:
  new
  
  Revision  Changes    Path
  1.1                  p5ee/App-Widget/lib/App/Widget/SelectSaveAs.pm
  
  Index: SelectSaveAs.pm
  ===================================================================
  
  ######################################################################
  ## $Id: SelectSaveAs.pm,v 1.1 2004/10/27 15:53:28 spadkins Exp $
  ######################################################################
  
  package App::Widget::SelectSaveAs;
  $VERSION = do { my @r=(q$Revision: 1.1 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
  
  use App::Widget::StylizableContainer;
  @ISA = ( "App::Widget::StylizableContainer" );
  
  use strict;
  
  =head1 NAME
  
  App::Widget::SelectSaveAs - Select from a list: Open Save Delete SaveAs
  
  =head1 SYNOPSIS
  
  
  =cut
  
  ######################################################################
  # ATTRIBUTES
  ######################################################################
  
  # INPUTS FROM THE ENVIRONMENT
  
  =head1 DESCRIPTION
  
  This class is a select element, followed by four buttons.
  
  =cut
  
  ######################################################################
  # CONSTRUCTOR
  ######################################################################
  
  sub _init {
      my $self = shift;
      $self->SUPER::_init(@_);
      my $name = $self->{name};
      my $context = $self->{context};
  
      # NOTE: container is inferred by the naming convention
      #       otherwise, I should include "container => $name," line
      $context->widget("${name}.selected",  # note: container is inferred
          class => "App::Widget::Select",
          #lightweight => 1,
      );
  
      $context->widget("${name}.open",
          class => "App::Widget::Button",
          label => "Open",
          #lightweight => 1,
      );
  
      $context->widget("${name}.save",
          class => "App::Widget::Button",
          label => "Save",
          #lightweight => 1,
      );
  
      $context->widget("${name}.delete",
          class => "App::Widget::Button",
          label => "Delete",
          #lightweight => 1,
      );
  
      $context->widget("${name}.saveas",
          class => "App::Widget::Button",
          label => "Save As",
          #lightweight => 1,
      );
  
      $context->widget("${name}.saveas_selected",  # note: container is inferred
          class => "App::Widget::TextField",
          #lightweight => 1,
      );
  }
  
  ######################################################################
  # EVENTS
  ######################################################################
  
  # Usage: $widget->handle_event($name, $event, @args);
  #sub handle_event {
  #    my ($self, $name, $event, @args) = @_;
  #
  #    if ($event eq "change") {
  #        #$self->split_date($name, $event, @args);
  #        return 1;
  #    }
  #    elsif ($event eq "click") {
  #        #$self->split_date($name, $event, @args);
  #        return 1;
  #    }
  #    else {
  #        return $self->SUPER::handle_event($name, $event, @args);
  #    }
  #}
  
  ######################################################################
  # OUTPUT METHODS
  ######################################################################
  
  sub html {
      my $self = shift;
      my ($context, $name);
  
      $context = $self->{context};
      $name = $self->{name};
  
      return 
          $context->widget("${name}.selected")->html() . "&nbsp;" .
          $context->widget("${name}.open")->html() . "&nbsp;" .
          $context->widget("${name}.save")->html() . "&nbsp;" .
          $context->widget("${name}.delete")->html() . "&nbsp;:&nbsp;" .
          $context->widget("${name}.saveas")->html() . "&nbsp;" .
          $context->widget("${name}.saveas_selected")->html();
          # $self->callback_event_tag("change");
  }
  
  1;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.