Kevin Ryde > Gtk2-Ex-ErrorTextDialog-11 > Gtk2::Ex::TextView::FollowAppend

Download:
Gtk2-Ex-ErrorTextDialog-11.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: 11   Source  

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 ^

This is slightly experimental and might move to a different dist.

TextView::FollowAppend arranges to automatically scroll to follow text appended in the underlying TextBuffer. The effect is like Emacs compilation-scroll-output and is good for following text progressively added by a background task or subprocess, but still allowing 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.

Implementation

This is implemented as a subclass of TextView since that seems the easiest way 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.

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);

SEE ALSO ^

Gtk2::TextView, Gtk2::TextBuffer

HOME PAGE ^

http://user42.tuxfamily.org/gtk2-ex-errortextdialog/

LICENSE ^

Gtk2-Ex-ErrorTextDialog is Copyright 2007, 2008, 2009, 2010, 2011, 2013 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/.

syntax highlighting: