NAME
Wx::Perl::PodRichText -- POD in a RichTextCtrl
SYNOPSIS
use Wx::Perl::PodRichText;
my $podtext = Wx::Perl::PodRichText->new;
$podtext->goto_pod (module => 'Foo::Bar');
CLASS HIERARCHY
Wx::Perl::PodRichText
Wx::RichTextCtrl
DESCRIPTION
This is a Wx::RichTextCtrl
displaying formatted POD documents, either from .pod or .pm files or parsed from a string or file handle.
See Wx::Perl::PodBrowser for a whole browser window.
Details
The initial SetSize
is a sensible size for POD, currently about 80 columns by 30 lines of the default font. A parent widget can make it bigger or smaller as desired.
The POD to text conversion tries to make use of the RichText features.
Indentation is done with the left indent feature so text paragraphs flow nicely within
=over
etc.=item
bullet points use the RichText bullet feature, and numbered=item
the RichText numbering likewise. Circa Wx 2.8.12 numbered points seem to display with the text overlapping a big number, but it's presumed that's a Wx matter and for small numbers it's fine.Verbatim paragraphs are done in
wxFONTFAMILY_TELETYPE
and withwxRichTextLineBreakChar
for line breaks at each newline. Wraparound is avoided by a large negative right indent but there's no scroll bar or visual indication that there's more text off to the right. Avoiding wraparound helps tables and ascii art.L<>
links to URLs are underlined and buttonized with the "URL" style.L<>
links to POD similarly, but using apod://
pseudo-URL. Is that a good idea? The URL won't be usable by anything else, but the attribute is a handy place to hold the link target.The current code has an
EVT_TEXT_URL
handler following links to target POD orWx::LaunchDefaultBrowser()
for URLs. But that might change, as it might be better to leave that to the browser parent, if some applications wanted to display only a single POD.S<>
non-breaking text is done with latin-1 0xA0 non-breaking spaces. RichText obeys those when word wrapping.
The display is reckoned as text so =begin text
sections are included in the display. Other =begin
types are ignored.
Reading a large POD file is slow. The work is done piece-wise from the event loop to keep the rest of the application running, but expect noticeable lag.
FUNCTIONS
$podtext = Wx::Perl::PodRichText->new()
$podtext = Wx::Perl::PodRichText->new($id,$parent)
-
Create and return a new PodRichText widget.
$podtext->goto_pod (key => value, ...)
-
Go to a specified POD module, filename, section etc. The key/value options are
module => $str module etc in @INC filename => $str file name filehandle => $fh string => $str guess => $str section => $string line => $integer line number
The target POD document is given by
module
,filename
, etc.string
is POD in a string. Modules are .pod or .pm in the usual@INC
(as perPod::Find
).$podtext->goto_pod (module => "perlpodspec");
guess
tries a module or filename. It's intended for use from a command line or similar loose input to let the user enter either module or filename.Optional
section
orline
is a position within the document. They can be given alone to move within the currently displayed document.# move within current displayed document $podtext->goto_pod (section => "DESCRIPTION");
section
can be an=head
heading or an=item
text. The first word from an=item
works as a target too. This is common for the POD formatters and helps cross-references to perlfunc and similar. @strings = $podtext->reload ()
-
Re-read the current
module
orfilename
source. @strings = $podtext->get_heading_list ()
-
Return a list of the
=head
headings in the displayed document.This list grows as the parse progresses (ie. when the parse yields control back to the main loop).
BUGS
Wx::wxTE_AUTO_URL
is turned on attempting to pick up unlinked URLs, but it doesn't seem to have any effect circa Wx 2.8.12 under Gtk. Is that option only for the plain Wx::TextCtrl
? Could search and linkize apparent URLs manually, though perhaps it's best left to L<>
markup in the source POD anyway.
SEE ALSO
Wx, Wx::Perl::PodBrowser, Pod::Find
Padre::Wx::Frame::POD displays POD by converting to HTML
HOME PAGE
http://user42.tuxfamily.org/math-image/index.html
LICENSE
Copyright 2012 Kevin Ryde
Wx-Perl-PodBrowser 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.
Wx-Perl-PodBrowser 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 Wx-Perl-PodBrowser. If not, see <http://www.gnu.org/licenses/>.