… | |
… | |
895 | my ($self, $w, $h) = @_; |
895 | my ($self, $w, $h) = @_; |
896 | |
896 | |
897 | $h -= List::Util::max 0, $self->border * 2; |
897 | $h -= List::Util::max 0, $self->border * 2; |
898 | $w -= List::Util::max 0, $self->border * 2; |
898 | $w -= List::Util::max 0, $self->border * 2; |
899 | |
899 | |
900 | $self->{title}->configure ($self->border, $self->border - $::FONTSIZE * 2, $w, $::FONTSIZE * 2) |
900 | $self->{title}->configure ($self->border, int $self->border - $::FONTSIZE * 2, $w, int $::FONTSIZE * 2) |
901 | if $self->{title}; |
901 | if $self->{title}; |
902 | |
902 | |
903 | $self->child->configure ($self->border, $self->border, $w, $h); |
903 | $self->child->configure ($self->border, $self->border, $w, $h); |
904 | } |
904 | } |
905 | |
905 | |
… | |
… | |
1399 | $self->{layout}->set_width ($self->{w}); |
1399 | $self->{layout}->set_width ($self->{w}); |
1400 | $self->{layout}->set_height (List::Util::min $self->{h}, $self->{fontsize} * $::FONTSIZE); |
1400 | $self->{layout}->set_height (List::Util::min $self->{h}, $self->{fontsize} * $::FONTSIZE); |
1401 | |
1401 | |
1402 | my $tex = new_from_layout CFClient::Texture $self->{layout}; |
1402 | my $tex = new_from_layout CFClient::Texture $self->{layout}; |
1403 | |
1403 | |
1404 | $self->{ox} = int $self->{align} < 0 ? $self->{padding} |
1404 | $self->{ox} = int ($self->{align} < 0 ? $self->{padding} |
1405 | : $self->{align} > 0 ? $self->{w} - $tex->{w} - $self->{padding} |
1405 | : $self->{align} > 0 ? $self->{w} - $tex->{w} - $self->{padding} |
1406 | : ($self->{w} - $tex->{w}) * 0.5; |
1406 | : ($self->{w} - $tex->{w}) * 0.5); |
1407 | |
1407 | |
1408 | $self->{oy} = int $self->{valign} < 0 ? $self->{padding} |
1408 | $self->{oy} = int ($self->{valign} < 0 ? $self->{padding} |
1409 | : $self->{valign} > 0 ? $self->{h} - $tex->{h} - $self->{padding} |
1409 | : $self->{valign} > 0 ? $self->{h} - $tex->{h} - $self->{padding} |
1410 | : ($self->{h} - $tex->{h}) * 0.5; |
1410 | : ($self->{h} - $tex->{h}) * 0.5); |
1411 | |
1411 | |
1412 | $tex |
1412 | $tex |
1413 | }; |
1413 | }; |
1414 | |
1414 | |
1415 | glEnable GL_TEXTURE_2D; |
1415 | glEnable GL_TEXTURE_2D; |
… | |
… | |
1470 | sub set_text { |
1470 | sub set_text { |
1471 | my ($self, $text) = @_; |
1471 | my ($self, $text) = @_; |
1472 | |
1472 | |
1473 | $self->{cursor} = length $text; |
1473 | $self->{cursor} = length $text; |
1474 | $self->_set_text ($text); |
1474 | $self->_set_text ($text); |
|
|
1475 | $self->update; |
1475 | $self->check_size; |
1476 | $self->check_size; |
1476 | $self->update; |
|
|
1477 | } |
1477 | } |
1478 | |
1478 | |
1479 | sub get_text { |
1479 | sub get_text { |
1480 | $_[0]{text} |
1480 | $_[0]{text} |
1481 | } |
1481 | } |
… | |
… | |
1521 | substr $text, $self->{cursor}++, 0, chr $uni; |
1521 | substr $text, $self->{cursor}++, 0, chr $uni; |
1522 | } |
1522 | } |
1523 | |
1523 | |
1524 | $self->_set_text ($text); |
1524 | $self->_set_text ($text); |
1525 | $self->update; |
1525 | $self->update; |
|
|
1526 | $self->check_size; |
1526 | } |
1527 | } |
1527 | |
1528 | |
1528 | sub focus_in { |
1529 | sub focus_in { |
1529 | my ($self) = @_; |
1530 | my ($self) = @_; |
1530 | |
1531 | |