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