Image::Button::Set - Builds a set of related PNG buttons |
Image::Button::Set - Builds a set of related PNG buttons
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] });
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.
my $set = new Image::Button::Set(buttons => [ $b1, $b2 ]);
Takes the same arguments as flush, coming next.
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:
$set->print(sameWidth => 1, sameHeight => 0, prefix => 'pre-', postfix => '-pos', override => { fontsize => 23, fgcolor => [0, 0, 0] });
or
$set->flush(sameWidth => 1, sameHeight => 0, prefix => 'pre-', postfix => '-pos');
They both take the same arguments:
After flush the button list is cleared. Flush understands an additional parameter, print, which defaults to 1. If set to zero the list will be cleared, but nothing will be printed.
Image::Button for a description of how to make buttons, and a list of available button types.
Juan M. García-Reyero <joanmg@twostones.org>
Copyright (C) 2003 Juan M. García-Reyero. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Image::Button::Set - Builds a set of related PNG buttons |