math-image
view release on metacpan or search on metacpan
lib/App/MathImage/Tk/Perl/NumAxis.pm view on Meta::CPAN
# Copyright 2012, 2013 Kevin Ryde
# This file is part of Math-Image.
#
# Math-Image is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3, or (at your option) any later
# version.
#
# Math-Image is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with Math-Image. If not, see <http://www.gnu.org/licenses/>.
package App::MathImage::Tk::Perl::NumAxis;
use 5.008;
use strict;
use warnings;
use Tk;
use List::Util qw(min max);
use Math::Round;
use POSIX qw(floor ceil);
use base 'Tk::Derived', 'Tk::Canvas';
Tk::Widget->Construct('AppMathImageTkPerlNumAxis');
our $VERSION = 110;
# uncomment this to run the ### lines
#use Smart::Comments;
sub ClassInit {
my ($class, $mw) = @_;
### ClassInit(): $class
$class->SUPER::ClassInit($mw);
# event handlers for all instances
$mw->bind($class,'<Configure>', \&_do_resized);
$mw->bind($class,'<Button-1>', ['DragStart', Ev('x'), Ev('y')]);
$mw->bind($class,'<B1-Motion>', ['DragMotion', Ev('x'), Ev('y')]);
$mw->bind($class,'<MouseWheel>', ['MouseWheel', Ev('delta'), Ev('s')]);
$mw->bind($class,'<Button-4>', ['MouseWheel', 120, Ev('s')]);
$mw->bind($class,'<Button-5>', ['MouseWheel', -120, Ev('s')]);
}
sub Populate {
my ($self, $args) = @_;
### Drawing Populate(): $args
$self->ConfigSpecs('-min_decimals' => [ 'METHOD',
'TkPerlNumAxis',
'TkPerlNumAxis',
0 ]);
$self->ConfigSpecs('-orientation' => [ 'METHOD',
'TkPerlNumAxis',
'TkPerlNumAxis',
'vertical' ]);
$self->ConfigSpecs('-inverted' => [ 'PASSIVE',
'TkPerlNumAxis',
'TkPerlNumAxis',
0 ]);
$self->ConfigSpecs('-number_to_text' => [ 'METHOD',
'TkPerlNumAxis',
'TkPerlNumAxis',
'default_number_to_text' ]);
$self->ConfigSpecs('-lower' => [ 'PASSIVE',
'TkPerlNumAxis',
'TkPerlNumAxis',
0 ]);
$self->ConfigSpecs('-page_size' => [ 'PASSIVE',
'TkPerlNumAxis',
'TkPerlNumAxis',
0 ]);
my %args = (-background => 'black',
-foreground => 'white',
-activebackground => 'black',
-activeforeground => 'white',
-disabledforeground => 'white',
-borderwidth => 0, # default
( run in 0.541 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )