Prima(3)
π NAME π
okay so welcome to Prima(3) β User Contributed Perl Documentation, bestie β and the name says it all: Prima is a Perl graphic toolkit. πβ¨
β¨ SYNOPSIS β¨
here's the little hello-world moment, literally iconic:
use Prima qw(Application Buttons);
Prima::MainWindow->new(
text => 'Hello world!',
size => [ 200, 200],
)-> insert( Button =>
centered => 1,
text => 'Hello world!',
onClick => sub { $::application-> close },
);
run Prima;
see more screenshots at http://prima.eu.org/big-picture π¦
πΈ DESCRIPTION πΈ
so Prima is a classic 2D GUI toolkit that works under Windows and X11 environments. it features a rich widget library, extensive 2D graphic support, PDF generation, modern Unicode text input and output, and supports a wide set of image formats. plus β not me being dramatic β the RAD-style Visual Builder and POD viewer are included. the toolkit can interoperate with other popular event loop libraries. π
π CLASS HIERARCHY π
the toolkit is built with a combination of two basic sets of classes β core and external. the core classes are coded in C and form a baseline for every Prima object written in Perl. the usage of C is possible together with the toolkit; however, its full power is revealed in the Perl domain. the external classes present an easily expandable set of widgets, written entirely in Perl and communicating with the system using Prima library calls. π§
the core classes form a hierarchy, which is displayed below:
Prima::Object
Prima::Component
Prima::AbstractMenu
Prima::AccelTable
Prima::Menu
Prima::Popup
Prima::Clipboard
Prima::Drawable
Prima::DeviceBitmap
Prima::Printer
Prima::Image
Prima::Icon
Prima::File
Prima::Region
Prima::Timer
Prima::Widget
Prima::Application
Prima::Window
the external classes are derived from these; the list of widget classes can be found below in SEE ALSO. π
π BASIC PROGRAM π
the very basic code shown in SYNOPSIS is explained here. the code creates a window with a 'Hello, world' title and a button with the same text. the program terminates after the button is pressed. periodt. π
a basic construct for a program written with Prima requires
use Prima;
code; however, effective programming requires the usage of the other modules, for example, "Prima::Buttons", which contains various button widgets. the "Prima.pm" module can be invoked together with a list of such modules, which makes the construction
use Prima;
use Prima::Application;
use Prima::Buttons;
shorter by using the following scheme:
use Prima qw(Application Buttons);
another basic issue is the event loop, which is called by
run Prima;
code and requires a Prima::Application object to be created beforehand. invoking the Prima::Application standard module is one of the possible ways to create an application object. the program usually terminates after the event loop is finished. π¦
the main window is created by invoking
Prima::MainWindow->new();
or
Prima::MainWindow->create()
code with additional parameters. all Prima objects are created by the same scheme; the class name is passed as the first parameter, and a custom set of parameters is passed afterward:
$new_object = Class->new(
parameter => value,
parameter => value,
...
);
here, parameters are the class property names, and they differ from class to class. classes often have common properties, primarily due to object inheritance. π
in the example, the following properties are used:
Window::text
Window::size
Button::text
Button::centered
Button::onClick
property values can be of any scalar type. for example, the ::text property accepts a string, ::size β an anonymous array of two integers, and onClick β a sub. π
onXxxx are special properties that describe events that can be used together with the new/create syntax, and are additive when the regular properties are substitutive (read more in Prima::Object). events are called in the object context when a specific condition occurs. the onClick event here, for example, is called when the user presses (or otherwise activates) the button. β¨
π«Ά API π«Ά
this section describes miscellaneous methods, registered in the Prima:: namespace.
message TEXTβ displays a system message box with TEXT. π¬open_file,save_fileβ when thePrima::Dialog::FileDialogmodule is loaded, these shortcut methods are registered in thePrima::namespace as an alternative to the same methods in the module's namespace. the methods execute standard file open and save dialogs, correspondingly. see Prima::Dialog::FileDialog for more. πrunβ enters the program event loop. the loop is ended whenPrima::Application'sdestroyorclosemethod is called. π₯parse_argv @ARGSβ parses Prima options from @ARGS, returns unparsed arguments. π
π OPTIONS π
Prima applications do not have a portable set of arguments; it depends on the particular platform. run
perl -e '$ARGV[0]=q(--help); require Prima'
or any Prima program with a --help argument to get the list of supported arguments. programmatically, setting and obtaining these options can be done by using the Prima::options routine. πΈ
in cases where the Prima argument parsing conflicts with the application options, use Prima::noARGV to disable the automatic parsing; also see parse_argv. alternatively, the construct
BEGIN { local @ARGV; require Prima; }
will also do. π¦
π SEE ALSO π
okay so the toolkit docs are split into a bunch of sections, and the individual manuals live in these files β bestie, this is your map πΊοΈβ¨
π Tutorials π
Prima::tutorialβ introductory tutorial
π Core toolkit classes π
Prima::Objectβ basic object concepts, properties, eventsPrima::Classesβ binder module for the core classesPrima::Drawableβ 2-D graphic interfacePrima::Regionβ generic shape for clipping and hit testingPrima::Imageβ bitmap routinesPrima::image-loadβ image subsystem and file operationsPrima::Widgetβ window managementPrima::Widget::packβTk::packgeometry managerPrima::Widget::placeβTk::placegeometry manager
Prima::Windowβ top-level window managementPrima::Clipboardβ GUI interprocess data exchangePrima::Menuβ pull-down and pop-up menu objectsPrima::Timerβ programmable periodical eventsPrima::Applicationβ the root of widget objects hierarchyPrima::Printerβ system printing servicesPrima::Fileβ asynchronous stream I/O
π¦ Widget library π¦
Prima::Buttonsβ buttons, checkboxes, radiosPrima::Calendarβ calendar widgetPrima::ComboBoxβ combo box widgetPrima::DetailedListβ multi-column list viewer with controlling header widgetPrima::DetailedOutlineβ multi-column outline viewer with controlling header widgetPrima::DockManagerβ advanced dockable widgetsPrima::Docksβ dockable widgetsPrima::Editβ text editorPrima::ExtListsβ listbox with checkboxesPrima::FrameSetβ frameset widgetPrima::Gridsβ grid widgetsPrima::HelpViewerβ the built-in POD browserPrima::ImageViewerβ image viewerPrima::InputLineβ input line widgetPrima::KeySelectorβ key combination widget and routinesPrima::Menusβ menu widgetsPrima::Labelβ static text widgetPrima::Listsβ list widgetsPrima::MDIβ top-level window emulationPrima::Notebooksβ multipage widgetsPrima::Outlinesβ tree view widgetsPrima::PodViewβ POD browser widgetPrima::ScrollBarβ scroll barsPrima::Slidersβ sliding bars, spin buttons, dial widgets, etc.Prima::Spinnerβ spinner animation widgetPrima::TextViewβ rich text browser widgetPrima::Widget::Dateβ date picker widgetPrima::Widget::Timeβ time input widget
πΈ Standard dialogs πΈ
Prima::Dialog::ColorDialogβ color selection facilitiesPrima::Dialog::FindDialogβ find and replace dialogsPrima::Dialog::FileDialogβ file system-related widgets and dialogsPrima::Dialog::FontDialogβ font dialogPrima::Dialog::ImageDialogβ image file open and save dialogsPrima::Image::TransparencyControlβ transparent color index selectionPrima::MsgBoxβ message and input dialog boxesPrima::Dialog::PrintDialogβ standard printer setup dialog
π§ Drawing helpers π§
Prima::Drawable::Antialiasβ alternative API for antialiased shapesPrima::Drawable::CurvedTextβ fit text to pathPrima::Drawable::Glyphsβ bi-directional text input and complex scripts outputPrima::Drawable::Gradientβ gradient fills for primitivesPrima::Drawable::Markupβ allow markup in widgetsPrima::Drawable::Metafileβ graphics recorderPrima::Drawable::Pathβ stroke and fill complex pathsPrima::Drawable::Podβ POD parser and rendererPrima::Drawable::Subcanvasβ paint a hierarchy of widgets to any drawablePrima::Drawable::TextBlockβ rich text representation
π Visual Builder π
VBβ Visual Builder for the Prima toolkitPrima::VB::VBLoaderβ Visual Builder file loaderprima-cfgmaintβ configuration tool for Visual BuilderPrima::VB::CfgMaintβ configures the widget palette in the Visual Builderprima-fmviewβ .fm file viewer
π₯ PostScript printer interface π₯
Prima::PS::PostScriptβ PostScript interface toPrima::DrawablePrima::PS::PDFβ PDF interface toPrima::DrawablePrima::PS::Printerβ PostScript and PDF interfaces toPrima::Printer
π«Ά Widget helpers π«Ά
Prima::Widget::BidiInputβ heuristics for i18n inputPrima::Widget::Faderβ fading- in/out functionsPrima::Widget::GroupScrollerβ optional automatic scroll barsPrima::Widget::Headerβ multi-column header widgetPrima::Widget::IntIndentsβ indenting supportPrima::Widget::Linkβ links embedded in widgetsPrima::Widget::ListBoxUtilsβ common paint routine for listboxesPrima::Widget::MouseScrollerβ auto-repeating mouse eventsPrima::Widget::Panelβ simple panel widgetPrima::Widget::RubberBandβ dynamic rubberbandsPrima::Widget::ScrollWidgetβ scrollable generic document widgetPrima::Widget::StartupWindowβ a simplistic startup banner windowPrima::Widget::UndoActionsβ undo and redo the content of editable widgets
π C interface to the toolkit π
Prima::internalsβ Internal architecturePrima::codecsβ Step-by-step image codec creationprima-genclsβprima-gencls, a class compiler tool.prima-tmlinkβprima-tmlink, optimizer tool for files produced byprima-gencls.
π Miscellaneous π
Prima::faqβ frequently asked questionsPrima::Constβ predefined toolkit constantsPrima::EventHookβ event filteringPrima::Image::Animateβ animate gif and webp filesPrima::Image::base64β hardcoded image filesPrima::Image::Exifβ manipulate Exif recordsPrima::Image::Loaderβ progressive loading and saving for multiframe imagesPrima::IniFileβ support of Windows-like initialization filespodviewβ POD viewerprima-pod2pdfβ POD printerPrima::StdBitmapβ shared access to the standard bitmapsPrima::Stressβ stress test modulePrima::Themesβ widget themes managerPrima::Tieβ tie widget properties to scalars and arraysPrima::typesβ builtin typesPrima::Utilsβ miscellaneous routines
β System-specific modules and documentation β
Prima::gp-problemsβ Graphic subsystem portability issuesPrima::X11β usage guide for X11 environmentPrima::sys::gtk::FileDialogβ GTK file system dialogsPrima::sys::win32::FileDialogβ Windows file system dialogsPrima::sys::XQuartzβ MacOSX/XQuartz facilitiesPrima::sys::FSβ unicode-aware core file functions
π§ Class information π§
The Prima manual pages often provide information for more than one Prima class. To quickly find out the manual page of a desired class, as well as display the inheritance information, use the prima-class command. The command can produce output in the text and pod formats; the latter feature is used by the standard Prima documentation viewer podview ( see File/Run/prima-class ).
π COPYRIGHT π
- Copyright 1997-2003 The Protein Laboratory, University of Copenhagen. All rights reserved.
- Copyright 2004-2024 Dmitry Karasik. All rights reserved.
This program is distributed under the BSD License.
β¨ AUTHORS β¨
- Dmitry Karasik <dmitry@karasik.eu.org>
- Anton Berezin <tobez@tobez.org>
- Vadim Belman <voland@lflat.org>,
that's the whole vibe check, bestie π this page is from perl v5.42.0, dated 2024-08-20, and it's literally Prima(3) β mwah ππ
π¦ where this page comes from
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms