| 1 | 1 | ▶ | use v5.12; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 0 | ▶ | use Wx; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 4 | |||
| 5 | package App::GUI::Juliagraph::Frame::Tab::Polynomial; | ||
| 6 | use base qw/Wx::Panel/; | ||
| 7 | |||
| 8 | use App::GUI::Juliagraph::Frame::Panel::Monomial; | ||
| 9 | |||
| 10 | sub new { | ||
| 11 | my ( $class, $parent) = @_; | ||
| 12 | my $self = $class->SUPER::new( $parent, -1); | ||
| 13 | |||
| 14 | $self->{'monomial_count'} = 4; | ||
| 15 | $self->{$_} = App::GUI::Juliagraph::Frame::Panel::Monomial->new( $self, $_) for 1 .. $self->{'monomial_count'}; | ||
| 16 | |||
| 17 | my $std = &Wx::wxALIGN_LEFT | &Wx::wxALIGN_CENTER_VERTICAL | &Wx::wxGROW; | ||
| 18 | my $box = $std | &Wx::wxTOP | &Wx::wxBOTTOM; | ||
| 19 | my $item = $std | &Wx::wxLEFT | &Wx::wxRIGHT; | ||
| 20 | |||
| 21 | my $sizer = Wx::BoxSizer->new(&Wx::wxVERTICAL); | ||
| 22 | $sizer->AddSpacer( 10 ); | ||
| 23 | $sizer->Add( $self->{'1'}, 0, $item, 10); | ||
| 24 | $sizer->Add( Wx::StaticLine->new( $self, -1), 0, $box, 10); | ||
| 25 | $sizer->Add( $self->{'2'}, 0, $item, 10); | ||
| 26 | $sizer->Add( Wx::StaticLine->new( $self, -1), 0, $box, 10); | ||
| 27 | $sizer->Add( $self->{'3'}, 0, $item, 10); | ||
| 28 | $sizer->Add( Wx::StaticLine->new( $self, -1), 0, $box, 10); | ||
| 29 | $sizer->Add( $self->{'4'}, 0, $item, 10); | ||
| 30 | $sizer->Add( 0, 0, &Wx::wxEXPAND | &Wx::wxGROW); | ||
| 31 | $self->SetSizer($sizer); | ||
| 32 | |||
| 33 | $self->init(); | ||
| 34 | $self; | ||
| 35 | } | ||
| 36 | |||
| 37 | sub init { $_[0]->{$_}->init() for 1 .. $_[0]->{'monomial_count'}; $_[0]->enable_coor(0) } | ||
| 38 | |||
| 39 | sub get_settings { return { map { $_ => $_[0]->{$_}->get_settings() } 1 .. $_[0]->{'monomial_count'} } } | ||
| 40 | sub set_settings { | ||
| 41 | my ( $self, $settings ) = @_; | ||
| 42 | return 0 unless ref $settings eq 'HASH' and exists $settings->{'1'}; | ||
| 43 | $self->{$_}->set_settings( $settings->{$_} ) for 1 .. $self->{'monomial_count'}; | ||
| 44 | 1; | ||
| 45 | } | ||
| 46 | |||
| 47 | sub enable_coor { | ||
| 48 | my ( $self, $on ) = @_; | ||
| 49 | return unless defined $on; | ||
| 50 | $self->{$_}->enable_coor( $on ) for 1 .. $self->{'monomial_count'}; | ||
| 51 | } | ||
| 52 | |||
| 53 | sub SetCallBack { | ||
| 54 | my ($self, $code) = @_; | ||
| 55 | return unless ref $code eq 'CODE'; | ||
| 56 | $self->{$_}->SetCallBack($code) for 1 .. $self->{'monomial_count'}; | ||
| 57 | } | ||
| 58 | |||
| 59 | 1; | ||