… | |
… | |
1491 | sub new { |
1491 | sub new { |
1492 | my $class = shift; |
1492 | my $class = shift; |
1493 | |
1493 | |
1494 | my $self = $class->SUPER::new ( |
1494 | my $self = $class->SUPER::new ( |
1495 | type => 'food', |
1495 | type => 'food', |
1496 | scale => 1, |
|
|
1497 | @_ |
1496 | @_ |
1498 | ); |
1497 | ); |
1499 | |
1498 | |
1500 | $self->{aspect} = $tex{$self->{type}}[0]{w} / $tex{$self->{type}}[0]{h}; |
1499 | $self->{aspect} = $tex{$self->{type}}[0]{w} / $tex{$self->{type}}[0]{h}; |
1501 | |
1500 | |
… | |
… | |
1503 | } |
1502 | } |
1504 | |
1503 | |
1505 | sub size_request { |
1504 | sub size_request { |
1506 | my ($self) = @_; |
1505 | my ($self) = @_; |
1507 | |
1506 | |
1508 | my $tex = $tex{$self->{type}}[0]; |
1507 | #my $tex = $tex{$self->{type}}[0]; |
1509 | |
1508 | #@$tex{qw(w h)} |
1510 | my ($w, $h) = map { $_ * $self->{scale} } @$tex{qw(w h)}; |
1509 | (0, 0) |
1511 | ($self->{vertical}) ? ($h, $w) : ($w, $h) |
|
|
1512 | } |
1510 | } |
1513 | |
1511 | |
1514 | sub set_max { |
1512 | sub set_max { |
1515 | my ($self, $max) = @_; |
1513 | my ($self, $max) = @_; |
1516 | |
1514 | |
… | |
… | |
1589 | my $self = $class->SUPER::new ( |
1587 | my $self = $class->SUPER::new ( |
1590 | @_, |
1588 | @_, |
1591 | ); |
1589 | ); |
1592 | |
1590 | |
1593 | $self->add ($self->{value} = new CFClient::UI::Label valign => 1, align => 0, template => "999"); |
1591 | $self->add ($self->{value} = new CFClient::UI::Label valign => 1, align => 0, template => "999"); |
1594 | $self->add ($self->{gauge} = new CFClient::UI::VGauge type => $self->{type}, expand => 1, scale => ($self->{scale} || 0.5)); |
1592 | $self->add ($self->{gauge} = new CFClient::UI::VGauge type => $self->{type}, expand => 1); |
1595 | $self->add ($self->{max} = new CFClient::UI::Label valign => 1, align => 0, template => "999"); |
1593 | $self->add ($self->{max} = new CFClient::UI::Label valign => 1, align => 0, template => "999"); |
1596 | |
1594 | |
1597 | $self |
1595 | $self |
1598 | } |
1596 | } |
1599 | |
1597 | |