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.52 by root, Sun Jan 8 00:48:14 2006 UTC vs.
Revision 1.53 by root, Sun Jan 8 01:16:09 2006 UTC

1025package urxvt::popup; 1025package urxvt::popup;
1026 1026
1027sub add_item { 1027sub add_item {
1028 my ($self, $item) = @_; 1028 my ($self, $item) = @_;
1029 1029
1030 $item->{rend}{normal} = "\x1b[0;30;47m" unless exists $item->{rend}{normal};
1031 $item->{rend}{hover} = "\x1b[0;30;46m" unless exists $item->{rend}{hover};
1032 $item->{rend}{active} = "\x1b[m" unless exists $item->{rend}{active};
1033
1034 $item->{render} ||= sub { $_[0]{text} };
1035
1030 push @{ $self->{item} }, $item; 1036 push @{ $self->{item} }, $item;
1037}
1038
1039sub add_separator {
1040 my ($self, $sep) = @_;
1041
1042 $sep ||= "═";
1043
1044 $self->add_item ({
1045 rend => { normal => "\x1b[0;30;47m", hover => "\x1b[0;30;47m", active => "\x1b[0;30;47m" },
1046 text => "",
1047 render => sub { $sep x $urxvt::TERM->ncol },
1048 activate => sub { },
1049 });
1050}
1051
1052sub add_title {
1053 my ($self, $title) = @_;
1054
1055 $self->add_item ({
1056 rend => { normal => "\x1b[38;5;11;44m", hover => "\x1b[38;5;11;44m", active => "\x1b[38;5;11;44m" },
1057 text => $title,
1058 activate => sub { },
1059 });
1031} 1060}
1032 1061
1033sub add_button { 1062sub add_button {
1034 my ($self, $text, $cb) = @_; 1063 my ($self, $text, $cb) = @_;
1035 1064
1036 $self->add_item ({ type => "button", text => "[ $text ]", activate => $cb, 1065 $self->add_item ({ type => "button", text => "[ $text ]", activate => $cb});
1037 render => sub { $_[0]{text} },
1038 });
1039} 1066}
1040 1067
1041sub add_toggle { 1068sub add_toggle {
1042 my ($self, $text, $cb, $value) = @_; 1069 my ($self, $text, $cb, $value) = @_;
1043 1070

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines