… | |
… | |
382 | sort { $a->{z} <=> $b->{z} } |
382 | sort { $a->{z} <=> $b->{z} } |
383 | @{$self->{children}}, $child |
383 | @{$self->{children}}, $child |
384 | ]; |
384 | ]; |
385 | |
385 | |
386 | $self->{w} = $self->{h} = -1; |
386 | $self->{w} = $self->{h} = -1; |
387 | $self->update; |
387 | |
|
|
388 | $child->check_size; |
388 | } |
389 | } |
389 | |
390 | |
390 | sub remove { |
391 | sub remove { |
391 | my ($self, $widget) = @_; |
392 | my ($self, $widget) = @_; |
392 | |
393 | |
… | |
… | |
754 | |
755 | |
755 | $child->set_parent ($self); |
756 | $child->set_parent ($self); |
756 | $self->{children}[$y][$x] = $child; |
757 | $self->{children}[$y][$x] = $child; |
757 | |
758 | |
758 | $self->{w} = $self->{h} = -1; |
759 | $self->{w} = $self->{h} = -1; |
759 | $self->update; |
760 | |
|
|
761 | $child->check_size; |
760 | } |
762 | } |
761 | |
763 | |
762 | # TODO: move to container class maybe? send childs a signal on removal? |
764 | # TODO: move to container class maybe? send childs a signal on removal? |
763 | sub clear { |
765 | sub clear { |
764 | my ($self) = @_; |
766 | my ($self) = @_; |
… | |
… | |
1324 | padding => 4, |
1326 | padding => 4, |
1325 | fg => [1, 1, 1], |
1327 | fg => [1, 1, 1], |
1326 | bg => [1, 1, 1, 0.2], |
1328 | bg => [1, 1, 1, 0.2], |
1327 | active_fg => [0, 0, 1], |
1329 | active_fg => [0, 0, 1], |
1328 | can_hover => 1, |
1330 | can_hover => 1, |
|
|
1331 | align => 0, |
|
|
1332 | valign => 0, |
1329 | @_ |
1333 | @_ |
1330 | ) |
1334 | ) |
1331 | } |
1335 | } |
1332 | |
1336 | |
1333 | sub button_up { |
1337 | sub button_up { |
… | |
… | |
1470 | } |
1474 | } |
1471 | |
1475 | |
1472 | sub size_request { |
1476 | sub size_request { |
1473 | my ($self) = @_; |
1477 | my ($self) = @_; |
1474 | |
1478 | |
1475 | ($self->{w}, $self->{h}) |
1479 | (30, 100) |
1476 | } |
1480 | } |
1477 | |
1481 | |
1478 | sub set_max { |
1482 | sub set_max { |
1479 | my ($self, $max) = @_; |
1483 | my ($self, $max) = @_; |
1480 | $self->{max_val} = $max; |
1484 | $self->{max_val} = $max; |