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::Image::TransparencyControl - standard dialog for transparent
231 color index selection
232
233 Prima::ImageViewer - bitmap viewer
234
235 Prima::InputLine - input line widget
236
237 Prima::KeySelector - key combination widget and routines
238
239 Prima::Label - static text widget
240
241 Prima::Lists - user-selectable item list widgets
242
243 Prima::MDI - top-level windows emulation classes
244
245 Prima::Notebooks - multipage widgets
246
247 Prima::Outlines - tree view widgets
248
249 Prima::PodView - POD browser widget
250
251 Prima::ScrollBar - scroll bars
252
253 Prima::ScrollWidget - scrollable generic document widget
254
255 Prima::Sliders - sliding bars, spin buttons and input lines, dial
256 widget etc.
257
258 Prima::Spinner - spinner animation
259
260 Prima::StartupWindow - a simplistic startup banner window
261
262 Prima::TextView - rich text browser widget
263
264 Prima::Themes - widget themes manager
265
266 Standard dialogs
267 Prima::ColorDialog - color selection facilities
268
269 Prima::EditDialog - find and replace dialogs
270
271 Prima::FileDialog - file system related widgets and dialogs
272
273 Prima::FontDialog - font dialog
274
275 Prima::ImageDialog - image file open and save dialogs
276
277 Prima::MsgBox - message and input dialog boxes
278
279 Prima::PrintDialog - standard printer setup dialog
280
281 Prima::StdDlg - wrapper module to the toolkit standard dialogs
282
283 Drawing helpers
284 Prima::Drawable::CurvedText - fit text to path
285
286 Prima::Drawable::Gradient - gradient fills for primitives
287
288 Prima::Drawable::Path - stroke and fill complex paths
289
290 Prima::Drawable::Subcanvas - paint a hierarchy of widgets to any
291 drawable
292
293 Visual Builder
294 VB - Visual Builder for the Prima toolkit
295
296 Prima::VB::VBLoader - Visual Builder file loader
297
298 prima-cfgmaint - configuration tool for Visual Builder
299
300 Prima::VB::CfgMaint - maintains visual builder widget palette
301 configuration
302
303 PostScript printer interface
304 Prima::PS::Drawable - PostScript interface to "Prima::Drawable"
305
306 Prima::PS::Encodings - latin-based encodings
307
308 Prima::PS::Fonts - PostScript device fonts metrics
309
310 Prima::PS::Printer - PostScript interface to "Prima::Printer"
311
312 C interface to the toolkit
313 Prima::internals - Internal architecture
314
315 Prima::codecs - Step-by-step image codec creation
316
317 prima-gencls - "prima-gencls", a class compiler tool.
318
319 Miscellaneous
320 Prima::faq - frequently asked questions
321
322 Prima::Bidi - bi-directional text input and output
323
324 Prima::Const - predefined toolkit constants
325
326 Prima::EventHook - event filtering
327
328 Prima::Image::Animate - animate gif and webp files
329
330 Prima::IniFile - support of Windows-like initialization files
331
332 Prima::IntUtils - internal functions
333
334 Prima::StdBitmap - shared access to the standard toolkit bitmaps
335
336 Prima::Stress - stress test module
337
338 Prima::Tie - tie widget properties to scalars or arrays
339
340 Prima::Utils - miscellaneous routines
341
342 Prima::Widgets - miscellaneous widget classes
343
344 Prima::gp-problems - Graphic subsystem portability issues
345
346 Prima::X11 - usage guide for X11 environment
347
348 Class information
349 The Prima manual pages often provide information for more than one
350 Prima class. To quickly find out the manual page of a desired
351 class, as well as display the inheritance information, use
352 "prima-class" command. The command can produce output in text and
353 pod formats; the latter feature is used by the standard Prima
354 documentation viewer "podview" ( see File/Run/prima-class ).
355
357 Copyright 1997-2003 The Protein Laboratory, University of Copenhagen.
358 All rights reserved.
359
360 Copyright 2004-2012 Dmitry Karasik. All rights reserved.
361
362 This program is distributed under the BSD License.
363
365 Dmitry Karasik <dmitry@karasik.eu.org>, Anton Berezin
366 <tobez@tobez.org>, Vadim Belman <voland@lflat.org>,
367
368
369
370perl v5.30.0 2019-08-21 Prima(3)