Gtk2::SourceView - Perl wrappers for the GtkSourceView widget


Gtk2-SourceView documentation  | view source Contained in the Gtk2-SourceView distribution.

Index


NAME

Top

Gtk2::SourceView - Perl wrappers for the GtkSourceView widget

SYNOPSIS

Top

  use Gtk2 '-init';
  use Gtk2::SourceView;

  $lm = Gtk2::SourceView::LanguagesManager->new;
  $lang = $lm->get_language_from_mime_type("application/x-perl");
  if ($lang)
  {
  	$sb = Gtk2::SourceView::Buffer->new_with_language($lang);
	$sb->set_highlight(1);
  }
  else
  {
    $sb = Gtk2::SourceView::Buffer->new(undef);
	$sb->set_highlight(0);
  }

  # loading a file should be atomically undoable.
  $sb->begin_not_undoable_action();
  open INFILE, "program.pl" or die "Unable to open program.pl";
  while (<INFILE>)
  {
    $sb->insert($sb->get_end_iter(), $_);
  }
  $sb->end_not_undoable_action();

  # Gtk2::SourceView::Buffer inherits from Gtk2::TextBuffer.
  $sb->set_modified(0);
  $sb->place_cursor($sb->get_start_iter());

  $win = Gtk2::Window->new('toplevel');
  $sw = Gtk2::ScrolledWindow->new;
  $sw->set_policy('automatic', 'automatic');
  $win->add($sw);

  # Gtk2::SourceView::View inherits from Gtk2::TextView.
  $view = Gtk2::SourceView::View->new_with_buffer($sb);
  $sw->add($view);
  $view->show;
  $win->show_all;

  Gtk2->main;

  0;

ABSTRACT

Top

Perl bindings to the 1.x series of the GtkSourceView widget libraries.

DESCRIPTION

Top

Perl bindings to the 1.x series of the GtkSourceView widget libraries. This module allows you to write Perl applications that utilize the GtkSourceView library for source editing and printing.

To discuss gtk2-perl, ask questions and flame/praise the authors, join gtk-perl-list@gnome.org at lists.gnome.org.

SEE ALSO

Top

perl(1), Glib(3pm), Gtk2(3pm), Gnome2::Print(3pm).

AUTHORS

Top

Emmanuele Bassi <emmanuele.bassi@iol.it> muppet <scott at asofyet dot org> Torsten Schoenfeld <kaffeetisch at gmx dot de>

gtk2-perl created by the gtk2-perl team: http://gtk2-perl.sf.net

COPYRIGHT AND LICENSE

Top


Gtk2-SourceView documentation  | view source Contained in the Gtk2-SourceView distribution.