Image::Button::Set - Builds a set of related PNG buttons


Image-Button documentation  | view source Contained in the Image-Button distribution.

Index


NAME

Top

Image::Button::Set - Builds a set of related PNG buttons

SYNOPSIS

Top

  use Image::Button::Rect;
  use Image::Button::Plain;
  use Image::Button::Set;

  my $b1 = new Image::Button::Rect(text     => 'text b1',
                                   font     => 'newsgotn.ttf',
                                   fontsize => 20,
                                   fgcolor  => [0, 0, 0],
                                   file     => 'b1.png');

  my $b2 = $b1->copy(text => 'text b2', file => 'b2.png');

  my $set = new Image::Button::Set(buttons => [ $b1, $b2 ]);

  my $b3 = $b1->copy(text => 'text b3', file => 'b3.png');

  $set->push(button => $b3);

  my $b4 = $b1->copy(text => 'text b4', file => 'b4.png');
  my $b5 = $b1->copy(text => 'text b5', file => 'b5.png');

  my $b6 = new Image::Button::Plain(text     => 'text b6',
                                    font     => 'newsgotn.ttf',
                                    bdcolor  => [10, 10, 10]);

  $set->push(buttons => [$b4, $b5, $b6]);

  $set->print(sameWidth  => 0, 
              sameHeight => 1,
              prefix     => 'w-');
  $set->flush(sameWidth  => 1,
              sameHeight => 0,
              postfix    => '-h',
              override   => { bdcolor => [0, 0, 20],
                              btcolor => [20, 0, 0] });

DESCRIPTION

Top

Builds a set of related buttons. They might be forced to have the same width and/or height. Make sure you specify an output file in the constructor of the buttons, because otherwise they will all go to stdout and the result won't be what you expect.

FUNCTIONS

Top

Constructor

  my $set = new Image::Button::Set(buttons => [ $b1, $b2 ]);

Takes the same arguments as flush, coming next.

Add buttons

Either

  $set->push(button   => $b1,
             textlist => ['text b2', 'text b3', 'text b4']);

or

  $set->push(buttons  => [$b1, $b2],
             textlist => ['text b3', 'text b4']);

or $set->push(button => $b1); $set->push(textlist => ['text b2', 'text b3', 'text b4']);

Possible arguments are:

button => $button

A button to add to the list.

buttons => [$button1, $button2]

A reference to an array of buttons to add to the list.

textlist => ['text b1', 'text b2']

A list of button texts with which buttons will be built and appended. They will clone the last button on the list, so there has to be at least one. If called with a button or buttons argument it will go lat, so it will clone the last button you just added.

SEE ALSO

Top

Image::Button for a description of how to make buttons, and a list of available button types.

AUTHOR

Top

Juan M. García-Reyero <joanmg@twostones.org>

COPYRIGHT

Top


Image-Button documentation  | view source Contained in the Image-Button distribution.