… | |
… | |
525 | if $self->{parent}; |
525 | if $self->{parent}; |
526 | } |
526 | } |
527 | |
527 | |
528 | sub reconfigure { |
528 | sub reconfigure { |
529 | my ($self) = @_; |
529 | my ($self) = @_; |
|
|
530 | |
|
|
531 | # some widgets cache req_w and req_h |
|
|
532 | delete $self->{req_w}; |
|
|
533 | delete $self->{req_h}; |
530 | |
534 | |
531 | $self->realloc; |
535 | $self->realloc; |
532 | $self->update; |
536 | $self->update; |
533 | } |
537 | } |
534 | |
538 | |
… | |
… | |
1554 | return if $self->{text} eq "T$text"; |
1558 | return if $self->{text} eq "T$text"; |
1555 | $self->{text} = "T$text"; |
1559 | $self->{text} = "T$text"; |
1556 | |
1560 | |
1557 | $self->{layout} = new CFClient::Layout if $self->{layout}->is_rgba; |
1561 | $self->{layout} = new CFClient::Layout if $self->{layout}->is_rgba; |
1558 | $self->{layout}->set_text ($text); |
1562 | $self->{layout}->set_text ($text); |
|
|
1563 | |
1559 | delete $self->{req_h}; |
1564 | delete $self->{req_h}; |
1560 | |
|
|
1561 | $self->realloc; |
1565 | $self->realloc; |
1562 | $self->update; |
1566 | $self->update; |
1563 | } |
1567 | } |
1564 | |
1568 | |
1565 | sub set_markup { |
1569 | sub set_markup { |
… | |
… | |
1570 | |
1574 | |
1571 | my $rgba = $markup =~ /span.*(?:foreground|background)/; |
1575 | my $rgba = $markup =~ /span.*(?:foreground|background)/; |
1572 | |
1576 | |
1573 | $self->{layout} = new CFClient::Layout $rgba if $self->{layout}->is_rgba != $rgba; |
1577 | $self->{layout} = new CFClient::Layout $rgba if $self->{layout}->is_rgba != $rgba; |
1574 | $self->{layout}->set_markup ($markup); |
1578 | $self->{layout}->set_markup ($markup); |
|
|
1579 | |
1575 | delete $self->{req_h}; |
1580 | delete $self->{req_h}; |
1576 | |
|
|
1577 | $self->realloc; |
1581 | $self->realloc; |
1578 | $self->update; |
1582 | $self->update; |
1579 | } |
1583 | } |
1580 | |
1584 | |
1581 | sub size_request { |
1585 | sub size_request { |
… | |
… | |
1649 | : $self->{valign} > 0 ? $self->{h} - $tex->{h} - $self->{padding_y} |
1653 | : $self->{valign} > 0 ? $self->{h} - $tex->{h} - $self->{padding_y} |
1650 | : ($self->{h} - $tex->{h}) * 0.5); |
1654 | : ($self->{h} - $tex->{h}) * 0.5); |
1651 | }; |
1655 | }; |
1652 | |
1656 | |
1653 | glEnable GL_TEXTURE_2D; |
1657 | glEnable GL_TEXTURE_2D; |
|
|
1658 | |
|
|
1659 | if ($tex->{format} == GL_ALPHA) { |
|
|
1660 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; |
|
|
1661 | glColor @{$self->{fg}}; |
|
|
1662 | $tex->draw_quad_alpha ($self->{ox}, $self->{oy}); |
|
|
1663 | } else { |
1654 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
1664 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
1655 | |
|
|
1656 | glColor_premultiply @{$self->{fg}} |
|
|
1657 | if $tex->{format} == GL_ALPHA; |
|
|
1658 | |
|
|
1659 | $tex->draw_quad_alpha_premultiplied ($self->{ox}, $self->{oy}); |
1665 | $tex->draw_quad_alpha_premultiplied ($self->{ox}, $self->{oy}); |
|
|
1666 | } |
1660 | |
1667 | |
1661 | glDisable GL_TEXTURE_2D; |
1668 | glDisable GL_TEXTURE_2D; |
1662 | } |
1669 | } |
1663 | |
1670 | |
1664 | ############################################################################# |
1671 | ############################################################################# |