ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/urxvt.pm
(Generate patch)

Comparing rxvt-unicode/src/urxvt.pm (file contents):
Revision 1.47 by root, Sat Jan 7 21:22:02 2006 UTC vs.
Revision 1.48 by root, Sat Jan 7 21:43:17 2006 UTC

397 397
398=cut 398=cut
399 399
400package urxvt; 400package urxvt;
401 401
402use utf8;
402use strict; 403use strict;
403use Scalar::Util (); 404use Scalar::Util ();
405use List::Util ();
404 406
405our $TERM; 407our $TERM;
406our @HOOKNAME; 408our @HOOKNAME;
407our $LIBDIR; 409our $LIBDIR;
408 410
1000} 1002}
1001 1003
1002sub add_button { 1004sub add_button {
1003 my ($self, $text, $cb) = @_; 1005 my ($self, $text, $cb) = @_;
1004 1006
1005 $self->add_item ({ type => "button", text => "[ $text ]", activate => $cb }); 1007 $self->add_item ({ type => "button", text => "[ $text ]", activate => $cb,
1008 render => sub { $_[0]{text} },
1009 });
1010}
1011
1012sub add_toggle {
1013 my ($self, $text, $cb, $value) = @_;
1014
1015 $self->add_item ({ type => "button", text => " $text", value => $value,
1016 render => sub { ($_[0]{value} ? "✔" : " ") . substr $_[0]{text}, 1 },
1017 activate => sub { $cb->($_[0]{value} = !$_[0]{value}); },
1018 });
1006} 1019}
1007 1020
1008sub show { 1021sub show {
1009 my ($self) = @_; 1022 my ($self) = @_;
1010 1023

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines