.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "Tk::ColoredButton 3"
.TH Tk::ColoredButton 3 "2011-07-18" "perl v5.26.3" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
Tk::ColoredButton \- Button widget with background gradient color.
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 3
\& #!/usr/bin/perl
\& use strict;
\& use warnings;
\&
\& use Tk;
\& use Tk::ColoredButton;
\&
\& my $mw = MainWindow\->new( \-background => \*(Aqwhite\*(Aq, \-title => \*(AqColoredButton example\*(Aq );
\& $mw\->minsize( 300, 300 );
\&
\& my $coloredbutton = $mw\->ColoredButton(
\& \-text => \*(AqColoredButton1\*(Aq,
\& \-autofit => 1,
\& \-font => \*(Aq{arial} 12 bold\*(Aq,
\& \-command => [ \e&display, \*(AqColoredButton1\*(Aq ],
\& )\->pack(qw/\-padx 10 \-pady 10 /);
\&
\& my $coloredbutton2 = $mw\->ColoredButton(
\& \-text => \*(AqColoredButton2\*(Aq,
\& \-font => \*(Aq{arial} 12 bold\*(Aq,
\& \-command => [ \e&display, \*(AqColoredButton2\*(Aq ],
\& \-height => 40,
\& \-width => 160,
\& \-gradient => {
\& \-start_color => \*(Aq#FFFFFF\*(Aq,
\& \-end_color => \*(Aq#BFD4E8\*(Aq,
\& \-type => \*(Aqmirror_vertical\*(Aq,
\& \-start => 50,
\& \-number_color => 10
\& },
\& \-activegradient => {
\& \-start_color => \*(Aq#BFD4E8\*(Aq,
\& \-end_color => \*(Aq#FFFFFF\*(Aq,
\& \-type => \*(Aqmirror_vertical\*(Aq,
\& \-start => 50,
\& \-number_color => 10
\& },
\& \-tooltip => \*(Aqmy button message\*(Aq,
\& )\->pack(qw/\-padx 10 \-pady 10 /);
\& $coloredbutton2\->flash();
\&
\& my $button = $mw\->Button(
\& \-activebackground => \*(Aqyellow\*(Aq,
\& \-background => \*(Aqgreen\*(Aq,
\& \-text => \*(AqReal Button\*(Aq,
\& \-font => \*(Aq{arial} 12 bold\*(Aq,
\& \-command => [ \e&display, \*(AqButton\*(Aq ],
\& )\->pack(qw/\-ipadx 10 \-pady 10 /);
\&
\& MainLoop;
\&
\& sub display {
\& my $message = shift;
\& if ($message) { print "$message\en"; }
\& }
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
Tk::ColoredButton is an extension of the \fBTk::Canvas::GradientColor\fR widget. It is an easy way to simulate
a button widget with gradient background color.
.SH "STANDARD OPTIONS"
.IX Header "STANDARD OPTIONS"
The following Tk::Button options are supported :
.PP
\&\fB\-activebackground\fR \fB\-activeforeground\fR \fB\-anchor\fR \fB\-background\fR
\&\fB\-bitmap\fR \fB\-borderwidth\fR \fB\-command\fR \fB\-compound\fR
\&\fB\-cursor\fR \fB\-disabledforeground\fR \fB\-font\fR \fB\-foreground\fR
\&\fB\-height\fR \fB\-highlightbackground\fR \fB\-highlightcolor\fR \fB\-highlightthickness\fR
\&\fB\-image\fR \fB\-justify\fR \fB\-padx\fR \fB\-pady\fR
\&\fB\-relief\fR \fB\-repeatdelay\fR \fB\-repeatinterval\fR \fB\-state\fR
\&\fB\-takefocus\fR \fB\-text\fR \fB\-textvariable\fR \fB\-width\fR
\&\fB\-wraplength\fR
.SH "WIDGET-SPECIFIC OPTIONS"
.IX Header "WIDGET-SPECIFIC OPTIONS"
There are many options which allow you to configure your button as you want.
.IP "Name: \fBactiveGradient\fR" 4
.IX Item "Name: activeGradient"
.PD 0
.IP "Class: \fBActiveGradient\fR" 4
.IX Item "Class: ActiveGradient"
.IP "Switch: \fB\-activegradient\fR => \fIhash reference\fR" 4
.IX Item "Switch: -activegradient => hash reference"
.PD
Specifies gradient background color to use when the mouse cursor is positioned over
the button. Please read the options of the \fBset_gradientcolor\fR method of Tk::Canvas::GradientColor to
understand the options.
.Sp
.Vb 7
\& \-activegradient => {
\& \-start_color => \*(Aq#BFD4E8\*(Aq,
\& \-end_color => \*(Aq#FFFFFF\*(Aq,
\& \-type => \*(Aqmirror_vertical\*(Aq,
\& \-start => 50,
\& \-number_color => 10
\& },
.Ve
.Sp
Default : \fB{ \-start_color => '#FFFFFF', \-end_color => '#B2B2B2' }\fR
.IP "Name: \fBautofit\fR" 4
.IX Item "Name: autofit"
.PD 0
.IP "Class: \fBAutofit\fR" 4
.IX Item "Class: Autofit"
.IP "Switch: \fB\-autofit\fR => \fI1 or 0\fR" 4
.IX Item "Switch: -autofit => 1 or 0"
.PD
Enables automatic adjustment (width and height) of the button depending on the displayed content (text, image, bitmap, ...).
.Sp
.Vb 1
\& \-autofit => 1,
.Ve
.Sp
Default : \fB0\fR
.IP "Name: \fBgradient\fR" 4
.IX Item "Name: gradient"
.PD 0
.IP "Class: \fBGradient\fR" 4
.IX Item "Class: Gradient"
.IP "Switch: \fB\-gradient\fR" 4
.IX Item "Switch: -gradient"
.PD
Specifies gradient background color on the button. Please read the options of the
\&\fBset_gradientcolor\fR method of \*(L"set_gradientcolor\*(R" in Tk::Canvas::GradientColor to understand the options.
.Sp
.Vb 7
\& \-gradient => {
\& \-start_color => \*(Aq#FFFFFF\*(Aq,
\& \-end_color => \*(Aq#BFD4E8\*(Aq,
\& \-type => \*(Aqmirror_vertical\*(Aq,
\& \-start => 50,
\& \-number_color => 10
\& },
.Ve
.Sp
Default : \fB{ \-start_color => '#B2B2B2', \-end_color => '#FFFFFF' }\fR
.IP "\fB\-height or \-width\fR" 4
.IX Item "-height or -width"
Specifies a desired window height/width that the button widget should request from its geometry manager.
The value may be specified in any of the forms described in the \*(L"\s-1COORDINATES\*(R"\s0 in Tk::Canvas section below.
.Sp
You can also use the \fBautofit\fR option if you want to have an automatic adjustment for your button.
.Sp
Default : \fB\-height => 20,\fR \fB\-width => 80,\fR
.IP "Name: \fBimageDisabled\fR" 4
.IX Item "Name: imageDisabled"
.PD 0
.IP "Class: \fBImageDisabled\fR" 4
.IX Item "Class: ImageDisabled"
.IP "Switch: \fB\-imagedisabled\fR => \fI\f(CI$image_photo\fI\fR" 4
.IX Item "Switch: -imagedisabled => $image_photo"
.PD
Specifies an image to display in the button when it is disabled. (
See Tk::Photo or Tk::Image for details of image creation.).
.Sp
.Vb 1
\& \-imagedisabled => $image_photo,
.Ve
.Sp
Default : \fBundef\fR
.IP "Name: \fBtooltip\fR" 4
.IX Item "Name: tooltip"
.PD 0
.IP "Class: \fBTooltip\fR" 4
.IX Item "Class: Tooltip"
.IP "Switch: \fB\-tooltip\fR => \fI\f(CI$tooltip\fI or [$tooltip, \f(CI$iniwait\fI?]\fR" 4
.IX Item "Switch: -tooltip => $tooltip or [$tooltip, $iniwait?]"
.PD
Creates and attaches help balloons (using Tk::Balloon). Then,
when the mouse pauses over the button, a help balloon is popped up.
.Sp
\&\f(CW$iniwait\fR Specifies the amount of time to wait without activity before popping up a
help balloon. Specified in milliseconds. Defaults to \fB350 milliseconds\fR. This applies
to both the popped up balloon and the status bar message.
.Sp
.Vb 2
\& \-tooltip => \*(Aqmy button message\*(Aq,
\& \-tooltip => [\*(Aqmy button message\*(Aq, 200],
.Ve
.Sp
Default : \fBundef\fR
.SH "WIDGET-SPECIFIC METHODS"
.IX Header "WIDGET-SPECIFIC METHODS"
You can use \fBinvoke\fR method like in Tk::Button.
.SS "delete_tooltip"
.IX Subsection "delete_tooltip"
.IP "\fI\f(CI$button_bgc\fI\fR\->\fBdelete_tooltip\fR" 4
.IX Item "$button_bgc->delete_tooltip"
Delete the help balloon created with tooltip option.
.Sp
.Vb 1
\& $button_bgc\->delete_tooltip;
.Ve
.SS "flash"
.IX Subsection "flash"
.IP "\fI\f(CI$button_bgc\fI\fR\->\fBflash\fR(?$interval) \fIin ms\fR" 4
.IX Item "$button_bgc->flash(?$interval) in ms"
Flash the button. This is accomplished by change foreground color of the button several times,
alternating between active and normal colors. At the end of the flash the button
is left in the same normal/active state as when the command was invoked. This command
is ignored if the button's state is \fBdisabled\fR.
.Sp
\&\f(CW$interval\fR is the time in milliseconds between each alternative.
.Sp
If \f(CW$interval\fR is not specified, the button will alternate between active and normal colors every 300 \fBmilliseconds\fR.
.Sp
If \f(CW$interval\fR is zero, any current flash operation will be cancel.
.Sp
If \f(CW$interval\fR is non-zero, the button will alternate every \f(CW$interval\fR milliseconds until
it is explicitly cancelled via \f(CW$interval\fR to zero or using \fBcancel\fR method to id returned.
.Sp
.Vb 2
\& my $id = $button_bgc\->flash(1000);
\& $button_bgc\->flash(0); # Cancel the flash
.Ve
.SS "redraw_button"
.IX Subsection "redraw_button"
.IP "\fI\f(CI$button_bgc\fI\fR\->\fBredraw_button\fR" 4
.IX Item "$button_bgc->redraw_button"
Re-creates the button. Tk::ColoredButton supports the \fBconfigure\fR and \fBcget\fR methods
described in the Tk::options manpage. If you use configure method to change
a widget specific option, the modification will not be display. You have to update your
widget by redraw it using this method.
.Sp
.Vb 1
\& $button_bgc\->redraw_button;
.Ve
.SH "AUTHOR"
.IX Header "AUTHOR"
Djibril Ousmanou, \f(CW\*(C`<djibel at cpan.org>\*(C'\fR
.SH "BUGS"
.IX Header "BUGS"
Please report any bugs or feature requests to \f(CW\*(C`bug\-tk\-coloredbutton at rt.cpan.org\*(C'\fR, or through
the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Tk\-ColoredButton>. I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
See also Tk::StyledButton and Tk::Button.
.SH "SUPPORT"
.IX Header "SUPPORT"
You can find documentation for this module with the perldoc command.
.PP
.Vb 1
\& perldoc Tk::ColoredButton
.Ve
.PP
You can also look for information at:
.IP "\(bu" 4
\&\s-1RT: CPAN\s0's request tracker
.Sp
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Tk\-ColoredButton>
.IP "\(bu" 4
AnnoCPAN: Annotated \s-1CPAN\s0 documentation
.Sp
<http://annocpan.org/dist/Tk\-ColoredButton>
.IP "\(bu" 4
\&\s-1CPAN\s0 Ratings
.Sp
<http://cpanratings.perl.org/d/Tk\-ColoredButton>
.IP "\(bu" 4
Search \s-1CPAN\s0
.Sp
<http://search.cpan.org/dist/Tk\-ColoredButton/>
.SH "ACKNOWLEDGEMENTS"
.IX Header "ACKNOWLEDGEMENTS"
.SH "LICENSE AND COPYRIGHT"
.IX Header "LICENSE AND COPYRIGHT"
Copyright 2011 Djibril Ousmanou.
.PP
This program is free software; you can redistribute it and/or modify it
under the terms of either: the \s-1GNU\s0 General Public License as published
by the Free Software Foundation; or the Artistic License.
.PP
See http://dev.perl.org/licenses/ for more information.