|
|
1 | use utf8; |
|
|
2 | |
1 | package superchat; |
3 | package superchat; |
2 | |
4 | |
3 | # waaay cool widget. well... maybe at one point in the future |
5 | # waaay cool widget. well... maybe at one point in the future |
4 | |
6 | |
5 | use Gtk2; |
7 | use Gtk2; |
… | |
… | |
221 | 1; |
223 | 1; |
222 | }); |
224 | }); |
223 | |
225 | |
224 | $tag->set (background => "#e0e0ff"); |
226 | $tag->set (background => "#e0e0ff"); |
225 | |
227 | |
226 | $self->{buffer}->insert ($self->{buffer}->get_end_iter, "\n"); |
|
|
227 | $self->{buffer}->insert_with_tags ($self->{buffer}->get_end_iter, util::xmlto "\x{21f3} $header", $tag); |
|
|
228 | |
|
|
229 | $inlay = $self->new_inlay; |
228 | $inlay = $self->new_inlay; |
230 | |
229 | |
231 | $inlay->{visible} = 0; |
230 | $inlay->{visible} = 0; |
|
|
231 | $inlay->{header} = $header; |
232 | $inlay->{tag} = $tag; |
232 | $inlay->{tag} = $tag; |
233 | $inlay->{cb} = $cb; |
233 | $inlay->{cb} = $cb; |
234 | |
234 | |
235 | Scalar::Util::weaken $inlay->{tag}; |
235 | Scalar::Util::weaken $inlay->{tag}; |
236 | |
236 | |
… | |
… | |
267 | |
267 | |
268 | sub refresh { |
268 | sub refresh { |
269 | my ($self) = @_; |
269 | my ($self) = @_; |
270 | |
270 | |
271 | $self->clear; |
271 | $self->clear; |
|
|
272 | |
|
|
273 | my $arrow = $self->{visible} ? "⇧" : "⇩"; |
|
|
274 | |
|
|
275 | $self->{buffer}->insert ($self->riter, "\n"); |
|
|
276 | $self->{buffer}->insert_with_tags ($self->riter, util::xmlto "$arrow $self->{header}", $self->{tag}); |
|
|
277 | |
272 | return unless $self->{visible}; |
278 | return unless $self->{visible}; |
273 | |
279 | |
274 | $self->{cb}->($self); |
280 | $self->{cb}->($self); |
275 | } |
281 | } |
276 | |
282 | |