.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Gtk2::Ex::PodViewer 3pm" .TH Gtk2::Ex::PodViewer 3pm "2018-06-30" "perl v5.26.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Gtk2::Ex::PodViewer \- a Gtk2 widget for displaying Plain old Documentation (POD). .PP NB: This module used to be called Gtk2::PodViewer. That module is now a stub that points to this module. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use Gtk2 \-init; \& use Gtk2::Ex::PodViewer; \& \& my $viewer = Gtk2::Ex::PodViewer\->new; \& \& $viewer\->load(\*(Aq/path/to/file.pod\*(Aq); # load a file \& $viewer\->load(\*(AqIO::Scalar\*(Aq); # load a module \& $viewer\->load(\*(Aqperlvar\*(Aq); # load a perldoc \& $viewer\->load(\*(Aqbless\*(Aq); # load a function \& \& $viewer\->show; # see, it\*(Aqs a widget! \& \& my $window = Gtk2::Window\->new; \& $window\->add($viewer); \& \& $window\->show; \& \& Gtk2\->main; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Gtk2::Ex::PodViewer is a widget for rendering Perl \s-1POD\s0 documents. It is based on the Gtk2::TextView widget and uses Pod::Parser for manipulating \s-1POD\s0 data. .PP Gtk2::Ex::PodViewer widgets inherit all the methods and properties of Gtk2::TextView widgets. Full information about text buffers can be found in the Gtk+ documentation at . .SH "OBJECT HIERARCHY" .IX Header "OBJECT HIERARCHY" .Vb 6 \& L \& +\-\-\- L \& +\-\-\- L \& +\-\-\- L \& +\-\-\- L \& +\-\-\- L .Ve .SH "CONSTRUCTOR" .IX Header "CONSTRUCTOR" .Vb 1 \& my $view = Gtk2::Ex::PodViewer\->new; .Ve .PP creates and returns a new Gtk2::Ex::PodViewer widget. .SH "ADDITIONAL METHODS" .IX Header "ADDITIONAL METHODS" .Vb 1 \& $viewer\->clear; .Ve .PP This clears the viewer's buffer and resets the iter. You should never need to use this method since the loader methods (see \*(L"Document Loaders\*(R" below) will do it for you. .PP .Vb 1 \& my $db = $viewer\->get_db; .Ve .PP This method returns a hashref that contains the \s-1POD\s0 document database used internally by Gtk2::Ex::PodViewer. If you want to improve startup performance, you can cache this database using a module like \f(CW\*(C`Storable\*(C'\fR. To load a cached database into a viewer object, call .PP .Vb 1 \& $viewer\->set_db($db); .Ve .PP before making a call to any of the document loader methods below (otherwise, Gtk2::Ex::PodViewer will create a new database for itself). If you want to tell Gtk2::Ex::PodViewer to create a new document database (for example, after a new module has been installed), use .PP .Vb 1 \& $viewer\->reinitialize_db; .Ve .PP .Vb 1 \& @marks = $view\->get_marks; .Ve .PP This returns an array of section headers. So for example, a \s-1POD\s0 document of the form .PP .Vb 1 \& =pod \& \& =head1 NAME \& \& =head1 SYNOPSIS \& \& =cut .Ve .PP would result in .PP .Vb 1 \& @marks = (\*(AqNAME\*(Aq, \*(AqSYNOPSIS\*(Aq); .Ve .PP You can then use the contents of this array to create a document index. .PP .Vb 1 \& $name = \*(AqSYNOPSIS\*(Aq; \& \& $mark = $view\->get_mark($name); .Ve .PP returns the GtkTextMark object referred to by \f(CW$name\fR. .PP .Vb 1 \& $name = \*(AqSYNOPSIS\*(Aq; \& \& $view\->jump_to($name); .Ve .PP this scrolls the PodViewer window to the selected mark. .PP .Vb 1 \& $viewer\->load($document); .Ve .PP Loads a given document. \f(CW$document\fR can be a perldoc name (eg., \f(CW\*(Aqperlvar\*(Aq\fR), a module (eg. \f(CW\*(AqIO::Scalar\*(Aq\fR), a filename or the name of a Perl builtin function from perlfunc. Documents are searched for in that order, that is, the perlvar document will be loaded before a file called \f(CW\*(C`perlvar\*(C'\fR in the current directory. .SH "DOCUMENT LOADERS" .IX Header "DOCUMENT LOADERS" The \f(CW\*(C`load()\*(C'\fR method is a wrapper to a number of specialised document loaders. You can call one of these loaders directly to override the order in which Gtk2::Ex::PodViewer searches for documents: .PP .Vb 1 \& $viewer\->load_doc($perldoc); .Ve .PP loads a perldoc file or Perl module documentation, or undef on failure. .PP .Vb 1 \& $viewer\->load_file($file); .Ve .PP loads \s-1POD\s0 from a file, or returns undef on failure. .PP .Vb 1 \& $viewer\->load_function($function); .Ve .PP This method scans the perlfunc \s-1POD\s0 document for the documentation for a given function. The algorithm for this is lifted from the Pod::Perldoc module, so it should work identically to \f(CW\*(C`perldoc \-f [function]\*(C'\fR. .PP .Vb 1 \& $viewer\->load_string($string); .Ve .PP This method renders the \s-1POD\s0 data in the \f(CW$string\fR variable. .SS "\s-1DEPRECATED DOCUMENT LOADERS\s0" .IX Subsection "DEPRECATED DOCUMENT LOADERS" The following document loads are now deprecated, and are now just wrapper of the \f(CW\*(C`load_doc\*(C'\fR method: .PP .Vb 2 \& $viewer\->load_perldoc($perldoc); \& $viewer\->load_module($module); .Ve .PP .Vb 1 \& $parser = $view\->parser; .Ve .PP returns the \f(CW\*(C`Gtk2::Ex::PodViewer::Parser\*(C'\fR object used to render the \s-1POD\s0 data. .SH "SIGNALS" .IX Header "SIGNALS" Gtk2::Ex::PodViewer inherits all of Gtk2::TextView's signals, and has the following: .ie n .SS "The \*(Aqlink_clicked\*(Aq signal" .el .SS "The \f(CW\*(Aqlink_clicked\*(Aq\fP signal" .IX Subsection "The link_clicked signal" .Vb 1 \& $viewer\->signal_connect(\*(Aqlink_clicked\*(Aq, \e&clicked); \& \& sub clicked { \& my ($viewer, $link_text) = @_; \& print "user clicked on \*(Aq$link_text\*(Aq\en"; \& } .Ve .PP Emitted when the user clicks on a hyperlink within the \s-1POD.\s0 This may be a section title, a document name, or a \s-1URL.\s0 The receiving function will be giving two arguments: a reference to the Gtk2::Ex::PodViewer object, and a scalar containing the link text. .ie n .SS "The \*(Aqlink_enter\*(Aq signal" .el .SS "The \f(CW\*(Aqlink_enter\*(Aq\fP signal" .IX Subsection "The link_enter signal" .Vb 1 \& $viewer\->signal_connect(\*(Aqlink_enter\*(Aq, \e&enter); \& \& sub enter { \& my ($viewer, $link_text) = @_; \& print "user moused over \*(Aq$link_text\*(Aq\en"; \& } .Ve .PP Emitted when the user moves the mouse pointer over a hyperlink within the \s-1POD.\s0 This may be a section title, a document name, or a \s-1URL.\s0 The receiving function will be giving two arguments: a reference to the Gtk2::Ex::PodViewer object, and a scalar containing the link text. .ie n .SS "The \*(Aqlink_leave\*(Aq signal" .el .SS "The \f(CW\*(Aqlink_leave\*(Aq\fP signal" .IX Subsection "The link_leave signal" .Vb 1 \& $viewer\->signal_connect(\*(Aqlink_leave\*(Aq, \e&leave); \& \& sub clicked { \& my $viewer = shift; \& print "user moused out\en"; \& } .Ve .PP Emitted when the user moves the mouse pointer out from a hyperlink within the \s-1POD.\s0 .SH "Getting and Setting Font preferences" .IX Header "Getting and Setting Font preferences" You can set the font used to render text in a Gtk2::Ex::PodViewer widget like so: .PP .Vb 1 \& $viewer\->modify_font(Gtk2::Pango::FontDescription\->from_string($FONT_NAME); .Ve .PP To modify the appearance of the various elements of the page, you need to extract the Gtk2::TextTag from the viewer's buffer: .PP .Vb 2 \& my $tag = $viewer\->get_buffer\->get_tag_table\->lookup(\*(Aqmonospace\*(Aq); \& $tag\->set(\*(Aqfont\*(Aq => $FONT_NAME); .Ve .PP The tags used by Gtk2::Ex::PodViewer are: .ie n .IP """bold""" 4 .el .IP "\f(CWbold\fR" 4 .IX Item "bold" Used to format bold text. .ie n .IP """italic""" 4 .el .IP "\f(CWitalic\fR" 4 .IX Item "italic" Used to format italic text. .ie n .IP """head1"" ... ""head4""" 4 .el .IP "\f(CWhead1\fR ... \f(CWhead4\fR" 4 .IX Item "head1 ... head4" Used to format headers. .ie n .IP """monospace""" 4 .el .IP "\f(CWmonospace\fR" 4 .IX Item "monospace" Used to format preformatted text. .ie n .IP """typewriter""" 4 .el .IP "\f(CWtypewriter\fR" 4 .IX Item "typewriter" Used to format inline preformatted text. .ie n .IP """link""" 4 .el .IP "\f(CWlink\fR" 4 .IX Item "link" Used to format hyperlinks. .SH "THE podviewer PROGRAM" .IX Header "THE podviewer PROGRAM" \&\f(CW\*(C`podviewer\*(C'\fR is installed with Gtk2::Ex::PodViewer. It is a simple Pod viewing program. It is pretty minimal, but does do the job quite well. Those looking for a more feature-complete documentation browser should try PodBrowser, available from . .SH "BUGS AND TASKS" .IX Header "BUGS AND TASKS" Gtk2::Ex::PodViewer is a work in progress. All comments, complaints, offers of help and patches are welcomed. .PP We currently know about these issues: .IP "\(bu" 4 When rendering long documents the \s-1UI\s0 freezes for too long. .IP "\(bu" 4 Some strangeness with Unicode. .SH "PREREQUISITES" .IX Header "PREREQUISITES" .IP "\(bu" 4 Gtk2 (obviously). The most recent version will be from . .IP "\(bu" 4 Pod::Parser .IP "\(bu" 4 IO::Scalar .IP "\(bu" 4 Pod::Simple::Search .PP Gtk2::Ex::PodViewer::Parser, which is part of the Gtk2::Ex::PodViewer distribution, also requires Locale::gettext. .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "\(bu" 4 Gtk2 or .IP "\(bu" 4 .IP "\(bu" 4 Gtk2::Ex::PodViewer::Parser .SH "AUTHORS" .IX Header "AUTHORS" Gavin Brown, Torsten Schoenfeld and Scott Arrington. .SH "COPYRIGHT" .IX Header "COPYRIGHT" (c) 2003\-2005 Gavin Brown (gavin.brown@uk.com). All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.