1Prima(3) User Contributed Perl Documentation Prima(3)
2
3
4
6 Prima - a perl graphic toolkit
7
9 use Prima qw(Application Buttons);
10
11 Prima::MainWindow->new(
12 text => 'Hello world!',
13 size => [ 200, 200],
14 )-> insert( Button =>
15 centered => 1,
16 text => 'Hello world!',
17 onClick => sub { $::application-> close },
18 );
19
20 run Prima;
21
22 See more screenshots at <http://prima.eu.org/big-picture> .
23
25 The toolkit is combined from two basic set of classes - core and
26 external. The core classes are coded in C and form a base line for
27 every Prima object written in perl. The usage of C is possible together
28 with the toolkit; however, its full power is revealed in the perl
29 domain. The external classes present easily expandable set of widgets,
30 written completely in perl and communicating with the system using
31 Prima library calls.
32
33 The core classes form an hierarchy, which is displayed below:
34
35 Prima::Object
36 Prima::Component
37 Prima::AbstractMenu
38 Prima::AccelTable
39 Prima::Menu
40 Prima::Popup
41 Prima::Clipboard
42 Prima::Drawable
43 Prima::DeviceBitmap
44 Prima::Printer
45 Prima::Image
46 Prima::Icon
47 Prima::File
48 Prima::Region
49 Prima::Timer
50 Prima::Widget
51 Prima::Application
52 Prima::Window
53
54 The external classes are derived from these; the list of widget classes
55 can be found below in "SEE ALSO".
56
58 The very basic code shown in "SYNOPSIS" is explained here. The code
59 creates a window with 'Hello, world' title and a centered button with
60 the same text. The program terminates after the button is pressed.
61
62 A basic construct for a program written with Prima obviously requires
63
64 use Prima;
65
66 code; however, the effective programming requires usage of the other
67 modules, for example, "Prima::Buttons", which contains set of button
68 widgets. "Prima.pm" module can be invoked with a list of such modules,
69 which makes the construction
70
71 use Prima;
72 use Prima::Application;
73 use Prima::Buttons;
74
75 shorter by using the following scheme:
76
77 use Prima qw(Application Buttons);
78
79 Another basic issue is the event loop, which is called by
80
81 run Prima;
82
83 sentence and requires a "Prima::Application" object to be created
84 beforehand. Invoking "Prima::Application" standard module is one of
85 the possible ways to create an application object. The program usually
86 terminates after the event loop is finished.
87
88 The window is created by invoking
89
90 Prima::MainWindow->new();
91
92 or
93
94 Prima::MainWindow-> create()
95
96 code with the additional parameters. Actually, all Prima objects are
97 created by such a scheme. The class name is passed as the first
98 parameter, and a custom set of parameters is passed afterwards. These
99 parameters are usually represented in a hash syntax, although actually
100 passed as an array. The hash syntax is preferred for the code
101 readability:
102
103 $new_object = Class->new(
104 parameter => value,
105 parameter => value,
106 ...
107 );
108
109 Here, parameters are the class properties names, and differ from class
110 to class. Classes often have common properties, primarily due to the
111 object inheritance.
112
113 In the example, the following properties are set :
114
115 Window::text
116 Window::size
117 Button::text
118 Button::centered
119 Button::onClick
120
121 Property values can be of any type, given that they are scalar. As
122 depicted here, "::text" property accepts a string, "::size" - an
123 anonymous array of two integers and "onClick" - a sub.
124
125 onXxxx are special properties that form a class of events, which share
126 the "new"/"create" syntax, and are additive when the regular properties
127 are substitutive (read more in Prima::Object). Events are called in
128 the object context when a specific condition occurs. The "onClick"
129 event here, for example, is called when the user presses (or otherwise
130 activates) the button.
131
133 This section describes miscellaneous methods, registered in "Prima::"
134 namespace.
135
136 message TEXT
137 Displays a system message box with TEXT.
138
139 open_file, save_file
140 When the "Prima::Dialog::FileDialog" module is loaded, these
141 shortcut methods are registered in the "Prima::" namespace as an
142 alternative to the same methods in the module's own namespace. The
143 methods execute standard file open and save dialogs,
144 correspondingly.
145
146 See Prima::Dialog::FileDialog for more.
147
148 run Enters the program event loop. The loop is ended when
149 "Prima::Application"'s "destroy" or "close" method is called.
150
151 parse_argv @ARGS
152 Parses prima options from @ARGS, returns unparsed arguments.
153
155 Prima applications do not have a portable set of arguments; it depends
156 on the particular platform. Run
157
158 perl -e '$ARGV[0]=q(--help); require Prima'
159
160 or any Prima program with "--help" argument to get the list of
161 supported arguments. Programmaticaly, setting and obtaining these
162 options can be done by using "Prima::options" routine.
163
164 In cases where Prima argument parsing conflicts with application
165 options, use Prima::noARGV to disable automatic parsing; also see
166 parse_argv. Alternatively, the construct
167
168 BEGIN { local @ARGV; require Prima; }
169
170 will also do.
171
173 The toolkit documentation is divided by several subjects, and the
174 information can be found in the following files:
175
176 Tutorials
177 Prima::tutorial - introductory tutorial
178
179 Core toolkit classes
180 Prima::Object - basic object concepts, properties, events
181
182 Prima::Classes - binder module for the core classes
183
184 Prima::Drawable - 2-D graphic interface
185
186 Prima::Region - generic shape for clipping and hit testing
187
188 Prima::Image - bitmap routines
189
190 Prima::image-load - image subsystem and file operations
191
192 Prima::Widget - window management
193
194 • Prima::Widget::pack - Tk::pack geometry manager
195
196 • Prima::Widget::place - Tk::place geometry manager
197
198 Prima::Window - top-level window management
199
200 Prima::Clipboard - GUI interprocess data exchange
201
202 Prima::Menu - pull-down and pop-up menu objects
203
204 Prima::Timer - programmable periodical events
205
206 Prima::Application - root of widget objects hierarchy
207
208 Prima::Printer - system printing services
209
210 Prima::File - asynchronous stream I/O
211
212 Widget library
213 Prima::Buttons - buttons and button grouping widgets
214
215 Prima::Calendar - calendar widget
216
217 Prima::ComboBox - combo box widget
218
219 Prima::DetailedList - multi-column list viewer with controlling
220 header widget
221
222 Prima::DetailedOutline - a multi-column outline viewer with
223 controlling header widget
224
225 Prima::DockManager - advanced dockable widgets
226
227 Prima::Docks - dockable widgets
228
229 Prima::Edit - text editor widget
230
231 Prima::ExtLists - listbox with checkboxes
232
233 Prima::FrameSet - frameset widget class
234
235 Prima::Grids - grid widgets
236
237 Prima::HelpViewer - the built-in POD file browser
238
239 Prima::ImageViewer - bitmap viewer
240
241 Prima::InputLine - input line widget
242
243 Prima::KeySelector - key combination widget and routines
244
245 Prima::Menus - menu widgets
246
247 Prima::Label - static text widget
248
249 Prima::Lists - user-selectable item list widgets
250
251 Prima::MDI - top-level windows emulation classes
252
253 Prima::Notebooks - multipage widgets
254
255 Prima::Outlines - tree view widgets
256
257 Prima::PodView - POD browser widget
258
259 Prima::ScrollBar - scroll bars
260
261 Prima::Sliders - sliding bars, spin buttons and input lines, dial
262 widget etc.
263
264 Prima::Spinner - spinner animation
265
266 Prima::TextView - rich text browser widget
267
268 Prima::Widget::Date - standard date picker widget
269
270 Prima::Widget::Time - standard time input widget
271
272 Standard dialogs
273 Prima::Dialog::ColorDialog - color selection facilities
274
275 Prima::Dialog::FindDialog - find and replace dialogs
276
277 Prima::Dialog::FileDialog - file system related widgets and dialogs
278
279 Prima::Dialog::FontDialog - font dialog
280
281 Prima::Dialog::ImageDialog - image file open and save dialogs
282
283 Prima::Image::TransparencyControl - transparent color index
284 selection
285
286 Prima::MsgBox - message and input dialog boxes
287
288 Prima::Dialog::PrintDialog - standard printer setup dialog
289
290 Drawing helpers
291 Prima::Drawable::Antialias - plot antialiased shapes
292
293 Prima::Drawable::CurvedText - fit text to path
294
295 Prima::Drawable::Glyphs - bi-directional text input and complex
296 scripts output
297
298 Prima::Drawable::Gradient - gradient fills for primitives
299
300 Prima::Drawable::Markup - allow markup in widgets
301
302 Prima::Drawable::Metafile - graphic primitive recorder
303
304 Prima::Drawable::Path - stroke and fill complex paths
305
306 Prima::Drawable::Subcanvas - paint a hierarchy of widgets to any
307 drawable
308
309 Prima::Drawable::TextBlock - rich text representation
310
311 Visual Builder
312 VB - Visual Builder for the Prima toolkit
313
314 Prima::VB::VBLoader - Visual Builder file loader
315
316 prima-cfgmaint - configuration tool for Visual Builder
317
318 Prima::VB::CfgMaint - maintains visual builder widget palette
319 configuration
320
321 PostScript printer interface
322 Prima::PS::PostScript - PostScript interface to "Prima::Drawable"
323
324 Prima::PS::PDF - PDF interface to "Prima::Drawable"
325
326 Prima::PS::Printer - PostScript and PDF interfaces to
327 "Prima::Printer"
328
329 Widget helpers
330 Prima::Widget::BidiInput - heuristics for i18n input
331
332 Prima::Widget::GroupScroller - optional automatic scroll bars
333
334 Prima::Widget::Header - multi-column header widget
335
336 Prima::Widget::IntIndents - indenting support
337
338 Prima::Widget::Link - links embedded in widgets
339
340 Prima::Widget::ListBoxUtils - common paint routine for listboxes
341
342 Prima::Widget::MouseScroller - auto repeating mouse events
343
344 Prima::Widget::Panel - simple panel widget
345
346 Prima::Widget::RubberBand - draw rubberbands
347
348 Prima::Widget::ScrollWidget - scrollable generic document widget
349
350 Prima::Widget::StartupWindow - a simplistic startup banner window
351
352 Prima::Widget::UndoActions - undo and redo the content of editable
353 widgets
354
355 C interface to the toolkit
356 Prima::internals - Internal architecture
357
358 Prima::codecs - Step-by-step image codec creation
359
360 prima-gencls - "prima-gencls", a class compiler tool.
361
362 Miscellaneous
363 Prima::faq - frequently asked questions
364
365 Prima::Const - predefined toolkit constants
366
367 Prima::EventHook - event filtering
368
369 Prima::Image::Animate - animate gif and webp files
370
371 Prima::Image::base64 - hard-coded image files
372
373 Prima::IniFile - support of Windows-like initialization files
374
375 Prima::StdBitmap - shared access to the standard toolkit bitmaps
376
377 Prima::Stress - stress test module
378
379 Prima::Themes - widget themes manager
380
381 Prima::Tie - tie widget properties to scalars or arrays
382
383 Prima::types - builtin types
384
385 Prima::Utils - miscellaneous routines
386
387 System-specific modules and documentation
388 Prima::gp-problems - Graphic subsystem portability issues
389
390 Prima::X11 - usage guide for X11 environment
391
392 Prima::sys::gtk::FileDialog - GTK file system dialogs
393
394 Prima::sys::win32::FileDialog - Windows file system dialogs
395
396 Prima::sys::XQuartz - MacOSX/XQuartz facilities
397
398 Prima::sys::FS - unicode-aware core file functions
399
400 Class information
401 The Prima manual pages often provide information for more than one
402 Prima class. To quickly find out the manual page of a desired
403 class, as well as display the inheritance information, use
404 "prima-class" command. The command can produce output in text and
405 pod formats; the latter feature is used by the standard Prima
406 documentation viewer "podview" ( see File/Run/prima-class ).
407
409 Copyright 1997-2003 The Protein Laboratory, University of Copenhagen.
410 All rights reserved.
411
412 Copyright 2004-2023 Dmitry Karasik. All rights reserved.
413
414 This program is distributed under the BSD License.
415
417 Dmitry Karasik <dmitry@karasik.eu.org>, Anton Berezin
418 <tobez@tobez.org>, Vadim Belman <voland@lflat.org>,
419
420
421
422perl v5.36.0 2023-03-20 Prima(3)