1Prima::IntUtils(3) User Contributed Perl Documentation Prima::IntUtils(3)
2
3
4
6 Prima::IntUtils - internal functions
7
9 The module provides packages, containing common functionality for some
10 standard classes. The packages are designed as a code containers, not
11 as widget classes, and are to be used as secondary ascendants in the
12 widget inheritance declaration.
13
15 Implements routines for emulation of auto repeating mouse events. A
16 code inside "MouseMove" callback can be implemented by the following
17 scheme:
18
19 if ( mouse_pointer_inside_the_scrollable_area) {
20 $self-> scroll_timer_stop;
21 } else {
22 $self-> scroll_timer_start unless $self-> scroll_timer_active;
23 return unless $self-> scroll_timer_semaphore;
24 $self-> scroll_timer_semaphore( 0);
25 }
26
27 The class uses a semaphore "{mouseTransaction}", which should be set to
28 non-zero if a widget is in mouse capture state, and set to zero or
29 "undef" otherwise.
30
31 The class starts an internal timer, which sets a semaphore and calls
32 "MouseMove" notification when triggered. The timer is assigned the
33 timeouts, returned by "Prima::Application::get_scroll_rate" ( see
34 "get_scroll_rate" in Prima::Application ).
35
36 Methods
37 scroll_timer_active
38 Returns a boolean value indicating if the internal timer is
39 started.
40
41 scroll_timer_semaphore [ VALUE ]
42 A semaphore, set to 1 when the internal timer was triggered. It is
43 advisable to check the semaphore state to discern a timer-generated
44 event from the real mouse movement. If VALUE is specified, it is
45 assigned to the semaphore.
46
47 scroll_timer_start
48 Starts the internal timer.
49
50 scroll_timer_stop
51 Stops the internal timer.
52
54 Provides the common functionality for the widgets that delegate part of
55 their surface to the border elements. A list box can be of an example,
56 where its scroll bars and 3-d borders are such elements.
57
58 Properties
59 indents ARRAY
60 Contains four integers, specifying the breadth of decoration
61 elements for each side. The first integer is width of the left
62 element, the second - height of the lower element, the third -
63 width of the right element, the fourth - height of the upper
64 element.
65
66 The property can accept and return the array either as a four
67 scalars, or as an anonymous array of four scalars.
68
69 Methods
70 get_active_area [ TYPE = 0, WIDTH, HEIGHT ]
71 Calculates and returns the extension of the area without the border
72 elements, or the active area. The extension are related to the
73 current size of a widget, however, can be overridden by specifying
74 WIDTH and HEIGHT. TYPE is an integer, indicating the type of
75 calculation:
76
77 TYPE = 0
78 Returns four integers, defining the area in the inclusive-
79 exclusive coordinates.
80
81 TYPE = 1
82 Returns four integers, defining the area in the inclusive-
83 inclusive coordinates.
84
85 TYPE = 2
86 Returns two integers, the size of the area.
87
89 The class is used for widgets that contain optional scroll bars, and
90 provides means for their maintenance. The class is the descendant of
91 Prima::IntIndents, and adjusts the indents property when scrollbars are
92 shown or hidden, or borderWidth is changed.
93
94 The class does not provide range selection for the scrollbars; the
95 descentant classes must implement that.
96
97 The descendant classes must follow the guidelines:
98
99 · A class must provide "borderWidth", "hScroll", and "vScroll"
100 property keys in profile_default() . A class may provide
101 "autoHScroll" and "autoVScroll" property keys in profile_default()
102 .
103
104 · A class' init() method must set "{borderWidth}", "{hScroll}", and
105 "{vScroll}" variables to 0 before the initialization, call
106 "setup_indents" method, and then assign the properties from the
107 object profile.
108
109 If a class provides "autoHScroll" and "autoVScroll" properties,
110 these must be set to 0 before the initialization.
111
112 · If a class needs to overload one of "borderWidth", "hScroll",
113 "vScroll", "autoHScroll", and "autoVScroll" properties, it is
114 mandatory to call the inherited properties.
115
116 · A class must implement the scroll bar notification callbacks:
117 "HScroll_Change" and "VScroll_Change".
118
119 · A class must not use the reserved variable names, which are:
120
121 {borderWidth} - internal borderWidth storage
122 {hScroll} - internal hScroll value storage
123 {vScroll} - internal vScroll value storage
124 {hScrollBar} - pointer to the horizontal scroll bar
125 {vScrollBar} - pointer to the vertical scroll bar
126 {bone} - rectangular widget between the scrollbars
127 {autoHScroll} - internal autoHScroll value storage
128 {autoVScroll} - internal autoVScroll value storage
129
130 The reserved method names:
131
132 set_h_scroll
133 set_v_scroll
134 insert_bone
135 setup_indents
136 reset_indents
137 borderWidth
138 autoHScroll
139 autoVScroll
140 hScroll
141 vScroll
142
143 The reserved widget names:
144
145 HScroll
146 VScroll
147 Bone
148
149 Properties
150 autoHScroll BOOLEAN
151 Selects if the horizontal scrollbar is to be shown and hidden
152 dynamically, depending on the widget layout.
153
154 autoVScroll BOOLEAN
155 Selects if the vertical scrollbar is to be shown and hidden
156 dynamically, depending on the widget layout.
157
158 borderWidth INTEGER
159 Width of 3d-shade border around the widget.
160
161 Recommended default value: 2
162
163 hScroll BOOLEAN
164 Selects if the horizontal scrollbar is visible. If it is,
165 "{hScrollBar}" points to it.
166
167 vScroll BOOLEAN
168 Selects if the vertical scrollbar is visible. If it is,
169 "{vScrollBar}" points to it.
170
171 scrollBarClass STRING = Prima::ScrollBar
172 Create-only property that allows to change scrollbar class
173
174 hScrollBarProfile, vScrollBarProfile HASH
175 Create-only property that allows to change scrollbar parameters
176 when it is being created
177
178 Properties
179 setup_indents
180 The method is never called directly; it should be called whenever
181 widget layout is changed so that indents are affected. The method
182 is a request to recalculate indents, depending on the widget
183 layout.
184
185 The method is not reentrant; to receive this callback and update
186 the widget layout, that in turn can result in more "setup_indents"
187 calls, overload "reset_indents" .
188
189 reset_indents
190 Called after "setup_indents" is called and internal widget layout
191 is updated, to give a chance to follow-up the layout changes.
192
194 Used for classes that can edit and undo and redo its content.
195
196 Properties
197 undoLimit INTEGER
198 Sets limit on number of stored atomic undo operations. If 0, undo
199 is disabled.
200
201 Methods
202 begin_undo_group
203 Opens bracket for group of actions, undone as single operation.
204 The bracket is closed by calling "end_undo_group".
205
206 end_undo_group
207 Closes bracket for group of actions, opened by "begin_undo_group".
208
209 redo
210 Re-applies changes, formerly rolled back by "undo".
211
212 undo
213 Rolls back changes into internal array, which size cannot extend
214 "undoLimit" value. In case "undoLimit" is 0, no undo actions can be
215 made.
216
218 Dmitry Karasik, <dmitry@karasik.eu.org>.
219
221 Prima, Prima::Widget, Prima::InputLine, Prima::Lists, Prima::Edit,
222 Prima::Outlines, Prima::ScrollBar.
223
224
225
226perl v5.28.0 2017-05-08 Prima::IntUtils(3)