NAME
Gtk2::Ex::TextView::FollowAppend -- variant of TextView following appended text
SYNOPSIS
use Gtk2::Ex::TextView::FollowAppend;
my $textview = Gtk2::Ex::TextView::FollowAppend->new;
WIDGET HIERARCHY
Gtk2::Ex::TextView::FollowAppend
is a subclass of Gtk2::TextView
.
Gtk2::Widget
Gtk2::Container
Gtk2::TextView
Gtk2::Ex::TextView::FollowAppend
DESCRIPTION
Caution! This is preliminary. It might move to a different dist and might get a rename, so don't use it yet, or only give it a try!
TextView::FollowAppend is a variant of TextView which automatically scrolls down to follow text appended in its TextBuffer. The effect is like Emacs compilation-scroll-output
. It's good for following text progressively added by a background task or subprocess, yet still allow the user to scroll back to see earlier output.
A scroll is done when the insertion point cursor is at the end of the buffer and the buffer end is visible. Any text, pixbuf or child insertion, or child resize or window resize then gets a scroll to keep the end still visible.
FUNCTIONS
$textview = Gtk2::Ex::TextView::FollowAppend->new (key=>value,...)
-
Create and return a new TextView::FollowAppend object. Optional key/value pairs set initial properties as per
Glib::Object->new
.$textview = Gtk2::Ex::TextView::FollowAppend->new;
$textview = Gtk2::Ex::TextView::FollowAppend->new_with_buffer ($textbuf)
-
Create and return a new TextView::FollowAppend with an initial TextBuffer. This is as per
Gtk2::TextView->new_with_buffer
, but creating a TextView::FollowAppend. It's the same as$textview = Gtk2::Ex::TextView::FollowAppend->new (buffer => $textbuf);
OTHER NOTES
This is done as a subclass of TextView since that seems the easiest say to catch a size-allocate
before the new size has been applied, so as to see whether the cursor-at-end plus end-visible conditions are met and thus end-visible should be forced on the new size. Because size-allocate
is a "run first" signal an external signal connection only runs once the new size is applied. Maybe it'd be possible to track end-visible all the time though, ready for a window resize or contents resize.
SEE ALSO
Gtk2::Ex::TextView, Gtk2::Ex::TextBuffer
HOME PAGE
http://www.geocities.com/user42_kevin/gtk2-ex-errortextdialog/
LICENSE
Gtk2-Ex-ErrorTextDialog is Copyright 2007, 2008, 2009 Kevin Ryde
Gtk2-Ex-ErrorTextDialog is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Gtk2-Ex-ErrorTextDialog is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Gtk2-Ex-ErrorTextDialog. If not, see http://www.gnu.org/licenses/.