Tk-Gauge

 view release on metacpan or  search on metacpan

Tk/Gauge.pm  view on Meta::CPAN

$Tk::Gauge::VERSION = '0.3';

package Tk::Gauge;

use 5.8.2;
use Tk 804.027;
use Tk::widgets qw/ Trace /;
use base qw/ Tk::Derived Tk::Canvas /;
use strict;

Construct Tk::Widget 'Gauge';

# Class global definitions.

my $id = 0;			# needle ID

my ( %band_defaults )   = (
    -arccolor   =>        'white',
    -minimum    =>              0,
    -maximum    =>            100,
    -piecolor   =>        'white',
    -tag        =>             '',
);				# default band options

my $d2r = 0.0174532;		# degrees to radians

my ( %needle_defaults ) = (
    -arrowshape =>  [ 12, 23, 6 ],
    -color      =>        'black',
    -command    =>          undef,
    -format     =>           '%d',
    -id         =>              0,
    -radius     =>             96,
    -showvalue  =>              0,
    -tag        =>             '',
    -title      =>             '',
    -titlecolor =>        'black',
    -titlefont  => 'Helvetica-12',
    -titleplace =>        'south',
    -variable   =>       \my $var,
    -width      =>              5,
);				# default needle options

sub Populate {

    my ($self, $args) = @_;

    $self->SUPER::Populate($args);
    
    $self->ConfigSpecs(
        -background           => [ 'SELF',    'background'          , 'Background'          ,              'white' ],
        -bands                => [ 'PASSIVE', 'bands'               , 'Bands'               ,                undef ],
        -bandplace            => [ 'PASSIVE', 'bandPlace'           , 'BandPlace'           ,         'underticks' ],
        -bandstyle            => [ 'PASSIVE', 'bandStyle'           , 'BandStyle'           ,               'band' ],
        -bandwidth            => [ 'PASSIVE', 'bandWidth'           , 'BandWidth'           ,                   10 ],
        -caption              => [ 'PASSIVE', 'caption'             , 'Caption'             ,                   '' ],
        -captioncolor         => [ 'PASSIVE', 'captionColor'        , 'CaptionColor'        ,              'black' ],
        -extent               => [ 'PASSIVE', 'extent'              , 'Extent'              ,                 -270 ],
        -fill                 => [ 'PASSIVE', 'fill'                , 'Fill'                ,              'white' ],
        -finetickcolor        => [ 'PASSIVE', 'fineTickColor'       , 'FineTickColor'       ,              'black' ],
        -finetickinterval     => [ 'PASSIVE', 'fineTickInterval'    , 'FineTickInterval'    ,                undef ],
        -fineticklength       => [ 'PASSIVE', 'fineTickLength'      , 'FineTickLength'      ,                    2 ],
        -finetickthickness    => [ 'PASSIVE', 'fineTickThickness'   , 'FineTickThickness'   ,                    1 ],
        -from                 => [ 'PASSIVE', 'from'                , 'From'                ,                    0 ],
        -hubcolor             => [ 'PASSIVE', 'hubColor'            , 'HubColor'            ,      '#ef5bef5bef5b' ],
        -huboutline           => [ 'PASSIVE', 'hubOutline'          , 'HubOutline'          ,      '#ef5bef5bef5b' ],
        -hubplace             => [ 'PASSIVE', 'hubPlace'            , 'Hubplace'            ,         'overneedle' ],
        -hubradius            => [ 'PASSIVE', 'hubRadius'           , 'HubRadius'           ,                    5 ],



( run in 1.441 second using v1.01-cache-2.11-cpan-800906f7e73 )