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.18 by root, Tue Jan 3 02:01:27 2006 UTC vs.
Revision 1.21 by root, Tue Jan 3 04:20:37 2006 UTC

53 53
54=back 54=back
55 55
56=item digital-clock 56=item digital-clock
57 57
58Displays a digital clock using the built-in overlay.
59
60=item example-refresh-hooks
61
58Displays a very simple digital clock in the upper right corner of the 62Displays a very simple digital clock in the upper right corner of the
59window. Illustrates overwriting the refresh callbacks to create your own 63window. Illustrates overwriting the refresh callbacks to create your own
60overlays or changes. 64overlays or changes.
61
62=item simple-overlay-clock
63
64Displays a digital clock using the built-in overlay (colourful, useless).
65 65
66=back 66=back
67 67
68=head2 General API Considerations 68=head2 General API Considerations
69 69
194 194
195=item $time = urxvt::NOW 195=item $time = urxvt::NOW
196 196
197Returns the "current time" (as per the event loop). 197Returns the "current time" (as per the event loop).
198 198
199=back
200
199=head2 RENDITION 201=head2 RENDITION
200 202
201Rendition bitsets contain information about colour, font, font styles and 203Rendition bitsets contain information about colour, font, font styles and
202similar information for each screen cell. 204similar information for each screen cell.
203 205
218Return the rendition mask used for overlays by default. 220Return the rendition mask used for overlays by default.
219 221
220=item $rendbit = urxvt::RS_Bold, RS_Italic, RS_Blink, RS_RVid, RS_Uline 222=item $rendbit = urxvt::RS_Bold, RS_Italic, RS_Blink, RS_RVid, RS_Uline
221 223
222Return the bit that enabled bold, italic, blink, reverse-video and 224Return the bit that enabled bold, italic, blink, reverse-video and
223underline, respectively. To enable such a style, just or it onto the 225underline, respectively. To enable such a style, just logically OR it into
224bitset. 226the bitset.
225 227
226=item $foreground = urxvt::GET_BASEFG $rend 228=item $foreground = urxvt::GET_BASEFG $rend
227 229
228=item $background = urxvt::GET_BASEBG $rend 230=item $background = urxvt::GET_BASEBG $rend
229 231
233 235
234=item $rend = urxvt::SET_BGCOLOR ($rend, $new_colour) 236=item $rend = urxvt::SET_BGCOLOR ($rend, $new_colour)
235 237
236Replace the foreground/background colour in the rendition mask with the 238Replace the foreground/background colour in the rendition mask with the
237specified one. 239specified one.
240
241=item $value = urxvt::GET_CUSTOM ($rend)
242
243Return the "custom" value: Every rendition has 5 bits for use by
244extensions. They can be set and changed as you like and are initially
245zero.
246
247=item $rend = urxvt::SET_CUSTOM ($rend, $new_value)
248
249Change the custom value.
238 250
239=back 251=back
240 252
241=cut 253=cut
242 254
348 return 1 if $v->($term, @_); 360 return 1 if $v->($term, @_);
349 } 361 }
350 362
351 0 363 0
352} 364}
353
354=back
355 365
356=head2 The C<urxvt::term> Class 366=head2 The C<urxvt::term> Class
357 367
358=over 4 368=over 4
359 369
415 425
416=item $oldtext = $term->selection ([$newtext]) 426=item $oldtext = $term->selection ([$newtext])
417 427
418Return the current selection text and optionally replace it by C<$newtext>. 428Return the current selection text and optionally replace it by C<$newtext>.
419 429
420=item $term->scr_overlay ($x, $y, $text) 430#=item $term->overlay ($x, $y, $text)
421 431#
422Create a simple multi-line overlay box. See the next method for details. 432#Create a simple multi-line overlay box. See the next method for details.
423 433#
424=cut 434#=cut
425 435
426sub urxvt::term::scr_overlay { 436sub urxvt::term::scr_overlay {
437die;
427 my ($self, $x, $y, $text) = @_; 438 my ($self, $x, $y, $text) = @_;
428 439
429 my @lines = split /\n/, $text; 440 my @lines = split /\n/, $text;
430 441
431 my $w = 0; 442 my $w = 0;
435 446
436 $self->scr_overlay_new ($x, $y, $w, scalar @lines); 447 $self->scr_overlay_new ($x, $y, $w, scalar @lines);
437 $self->scr_overlay_set (0, $_, $lines[$_]) for 0.. $#lines; 448 $self->scr_overlay_set (0, $_, $lines[$_]) for 0.. $#lines;
438} 449}
439 450
440=item $term->scr_overlay_new ($x, $y, $width, $height) 451=item $term->overlay ($x, $y, $width, $height[, $rstyle[, $border]])
441 452
442Create a new (empty) overlay at the given position with the given 453Create a new (empty) overlay at the given position with the given
443width/height. A border will be put around the box. If either C<$x> or 454width/height. C<$rstyle> defines the initial rendition style
444C<$y> is negative, then this is counted from the right/bottom side, 455(default: C<OVERLAY_RSTYLE>).
445respectively.
446 456
447=item $term->scr_overlay_off 457If C<$border> is C<2> (default), then a decorative border will be put
458around the box.
448 459
449Switch the overlay off again. 460If either C<$x> or C<$y> is negative, then this is counted from the
461right/bottom side, respectively.
450 462
451=item $term->scr_overlay_set_char ($x, $y, $char, $rend = OVERLAY_RSTYLE) 463This method returns an urxvt::overlay object. The overlay will be visible
464as long as the perl object is referenced.
452 465
453Put a single character (specified numerically) at the given overlay 466Currently, the only method on the C<urxvt::overlay> object is C<set>:
454position.
455 467
456=item $term->scr_overlay_set ($x, $y, $text) 468=item $overlay->set ($x, $y, $text, $rend)
457 469
458Write a string at the given position into the overlay. 470Similar to C<< $term->ROW_t >> and C<< $term->ROW_r >> in that it puts
471text in rxvt-unicode's special encoding and an array of rendition values
472at a specific position inside the overlay.
459 473
460=item $cellwidth = $term->strwidth $string 474=item $cellwidth = $term->strwidth $string
461 475
462Returns the number of screen-cells this string would need. Correctly 476Returns the number of screen-cells this string would need. Correctly
463accounts for wide and combining characters. 477accounts for wide and combining characters.
558=head2 The C<urxvt::timer> Class 572=head2 The C<urxvt::timer> Class
559 573
560This class implements timer watchers/events. Time is represented as a 574This class implements timer watchers/events. Time is represented as a
561fractional number of seconds since the epoch. Example: 575fractional number of seconds since the epoch. Example:
562 576
563 # create a digital clock display in upper right corner 577 $term->{overlay} = $term->overlay (-1, 0, 8, 1, urxvt::OVERLAY_RSTYLE, 0);
564 $term->{timer} = urxvt::timer 578 $term->{timer} = urxvt::timer
565 ->new 579 ->new
566 ->start (urxvt::NOW) 580 ->interval (1)
567 ->cb (sub { 581 ->cb (sub {
568 my ($timer) = @_;
569 my $time = $timer->at;
570 $timer->start ($time + 1);
571 $self->scr_overlay (-1, 0, 582 $term->{overlay}->set (0, 0,
572 POSIX::strftime "%H:%M:%S", localtime $time); 583 sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]);
573 }); 584 });
574 585
575=over 4 586=over 4
576 587
577=item $timer = new urxvt::timer 588=item $timer = new urxvt::timer
578 589
579Create a new timer object in stopped state. 590Create a new timer object in started state. It is scheduled to fire
591immediately.
580 592
581=item $timer = $timer->cb (sub { my ($timer) = @_; ... }) 593=item $timer = $timer->cb (sub { my ($timer) = @_; ... })
582 594
583Set the callback to be called when the timer triggers. 595Set the callback to be called when the timer triggers.
584 596
587Return the time this watcher will fire next. 599Return the time this watcher will fire next.
588 600
589=item $timer = $timer->set ($tstamp) 601=item $timer = $timer->set ($tstamp)
590 602
591Set the time the event is generated to $tstamp. 603Set the time the event is generated to $tstamp.
604
605=item $timer = $timer->interval ($interval)
606
607Normally (and when C<$interval> is C<0>), the timer will automatically
608stop after it has fired once. If C<$interval> is non-zero, then the timer
609is automatically rescheduled at the given intervals.
592 610
593=item $timer = $timer->start 611=item $timer = $timer->start
594 612
595Start the timer. 613Start the timer.
596 614

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines