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