Prima::Widget - window management |
Prima::Widget - window management
Prima::Widget is a descendant of Prima::Component, a class, especially crafted to reflect and govern properties of a system-dependent window, such as its position, hierarchy, outlook etc. Prima::Widget maps onto screen as a rectangular area, with distinct boundaries, pointer and sometimes cursor and a user-selectable input focus.
Prima::Widget class and its descendants are used widely throughout the toolkit, and, indeed provide almost all its user interaction and input-output. The notification system, explained in the Prima::Object manpage, is employed in Prima::Widget heavily, providing the programmer easy and unified access to the system-generated events, that occur when the user moves windows, clicks a mouse, types the keyboard, etc. Descendants of Prima::Widget use the internal, the direct method of overriding the notifications, whereas end programs tend to use the toolkit widgets equipped with anonymous subroutines ( see the Prima::Object manpage for the details).
The functionality of the class is much more extensive comparing to the other built-in classes, and therefore the explanations are grouped in several topics.
The syntax for creation is the same as for all Prima objects:
Prima::Widget-> create( name => 'Widget', size => [ 20, 10], onMouseClick => sub { print "click\n"; }, owner => $widget, );
In the real life, a widget must be almost always
explicitly told about its owner. The owner object
is either a Prima::Widget descendant, in which case
the widget is drawn inside its inferior, or an
application object, and in the latter case a widget
becomes a top-level widget. Because of that, the insert
syntax is much more often used, as it is more illustrative
and provides somewhat more convenience when creating several widgets
in one call ( see the Prima::Object manpage ).
$widget-> insert( 'Prima::Widget', name => 'Widget', size => [ 20, 10], onMouseClick => sub { print "click\n"; }, );
These two examples produce identical results.
As being descendant of Prima::Component, Prima::Widget
sends Create
notification when created ( more precisely,
after its init stage is finished. See the Prima::Object manpage for
details). This notification is called and processed within
create()
call. In addition, another notification, a Setup
message is sent after the widget is created. This message is
posted, so it is called within create()
but processed
in the application event loop. It means that Setup
execution
time is uncertain, as it is with all posted messages; its delivery time
is system-dependent, so its use must be considered with care.
After a widget is created, it is usually asked to render its content,
provided that the widget is visible. This request is delivered by
means of Paint
notification.
When the life time of a widget is over, destroy()
is called,
often implicitly. If a widget is being destroyed because its owner
is, it is guaranteed that the children widgets will be destroyed first,
and the owner afterwards. In such situation, widget can operate with
a limited functionality both with itself and its owners ( see
the Prima::Object manpage, Creation section ).
A widget can use two different ways for representing its
graphic content to the user. The first method is
event-driven, when the Paint
notification arrives,
notifying the widget that it must re-paint itself.
The second is a 'direct' method.
A notification responsible for repainting a widget is Paint
.
It provides a single ( besides the widget itself )
parameter, an object, where the drawing is performed. In an
event-driven call, it is always equals to the widget. However, if
a custom mechanism should be used that directly calls, for example,
$widget-> notify('Paint', $some_other_widget);
for whatever purpose, it is recommended ( not required, though ), to use this parameter, not the widget itself for painting and drawing calls.
The example of Paint
callback is quite simple:
Prima::Widget-> create( ... onPaint => sub { my ( $self, $canvas) = @_; $canvas-> clear; $canvas-> text_out("Clicked $self->{clicked} times", 10, 10); }, onMouseClick => sub { $_[0]-> {clicked}++; $_[0]-> repaint; }, );
As one can see, this example touches some important features
of the event-driven mechanism. First, no begin_paint()
/end_paint()
brackets are used within the callback. These are called implicitly.
Second, when the custom refresh of the widget's graphic content is needed,
no code like notify(q(Paint))
is used - repaint()
method is used instead.
It must be noted, that the actual execution of Paint
callbacks
can be or can be not within the repaint()
call. This behavior is governed by
the ::syncPaint
property.
repaint()
marks the whole widget's area as to be refreshed, as the invalidated
area. For the finer gradation of the area that should be repainted,
invalidate_rect()
and validate_rect()
pair of functions is used.
$x-> C<repaint()>
code is a mere alias to
$x-> invalidate_rect( 0, 0, $x-> size);
call. It must be realized, that the area, passed to invalidate_rect()
only in its ideal ( but a quite often ) execution case will be pertained as a
clipping rectangle when a widget executes its Paint
notification.
The user and system interactions can result in exposition of other
parts of a widget ( like, moving windows over a widget ), and a
resulting clipping rectangle can be much different from the one that was
passed to invalidate_rect()
. Moreover, the clipping rectangle can become
empty as a result of these influences, and the notification will not
be called at all.
Invalid rectangle is presented differently inside and outside
the drawing mode. The first, returned by ::clipRect
, employs
inclusive-inclusive coordinates, whereas invalidate_rect()
, validate_rect()
and get_invalid_rect()
- inclusive-exclusive coordinates. The ideal case
exemplifies the above said:
$x-> onPaint( sub { my @c = $_[0]-> clipRect; print "clip rect:@c\n"; }); $x-> invalidate_rect( 10, 10, 20, 20); ... clip rect: 10 10 19 19
As noted above, ::clipRect
property is set to
the clipping rectangle of the widget area that is needed to be refreshed,
and a smart event handler can take advantage of this information,
increasing the efficiency of the painting procedure.
NB: Further assignments of ::clipRect
property do not
make possible over-painting on the screen area that lies outside
the original clipping region. This note is valid for all paint
operations, however since the original clipping rectangle is
the full area of a canvas, this rule is implicit and unnecessary, because
whatever large the clipping rectangle be, drawing and painting
cannot be performed outside the physical boundaries of the canvas.
The direct rendering, contrary to the event-driven,
is started by a program, not by a system. If a programmer
wishes to paint over a widget immediately, then
begin_paint()
is called, and, if successful, the part
of the screen occupied by a widget is accessible to the drawing
and painting routines.
This method is useful, for example, for graphic demonstration
programs, that draw continuously without any input.
Another field is the screen drawing, which is performed
with Prima::Application class, that does not have Paint
notification. Application's graphic canvas represents the whole screen,
allowing over-drawing the graphic content of other programs.
In major, the event-driven rendering method just adds
implicit begin_paint()
/end_paint()
brackets ( plus some
system-dependent touches, of course ) and is a convenience
version of the direct rendering. Sometimes, however, the
changes needed to be made to a widget's graphic context are
so insignificant, so the direct rendering method is preferable,
because of the cleaner and terser code. As an example might serve
a simple progress bar, that is expected to draw a simple colored bar.
The event-driven code would be
( in short, omitting many details ) as such:
$bar = Widget-> create( width => 100, onPaint => sub { my ( $self, $canvas) = @_; $canvas-> color( cl::Blue); $canvas-> bar( 0, 0, $self-> {progress}, $self-> height); $canvas-> color( cl::Back); $canvas-> bar( $self-> {progress}, 0, $self-> size); }, ); ... $bar-> {progress} += 10; $bar-> repaint; # or, more efficiently, ( but clumsier ) # $bar-> invalidate_rect( $bar->{progress}-10, 0, # $bar->{progress}, $bar-> height);
And the direct driven:
$bar = Widget-> create( width => 100 ); ... $bar-> begin_paint; $bar-> color( cl::Blue); $bar-> bar( $progress, 0, $progress + 10, $bar-> height); $bar-> end_paint; $progress += 10;
The pros and contras are obvious: the event-driven rendered widget correctly represents the status after an eventual repaint, that is like if the user sweeps a window over the progress bar widget. The direct method does cannot be that smart, but if the status bar is the insignificant part of the program, the trade-off functionality vs code simplicity might be considered acceptable.
Both methods can be effectively disabled using the paint locking
mechanism. The lock()
and unlock()
methods can be called several times,
stacking the requests. This feature is useful because many
properties implicitly call repaint()
, and if several of these properties
activate in a row, the unnecessary redrawing of the widget can be avoided.
The drawback is that the last unlock()
call triggers repaint()
unconditionally.
A widget always has its position and size determined, even if
it is not visible on the screen. Prima::Widget provides several
properties that govern the geometry of a widget, with overlapping
functionalities. The base properties are ::origin
and ::size
,
and the derived are ::left
, ::bottom
, ::right
, ::top
,
::width
, ::height
and ::rect
. ::origin
and ::size
operate with two integers, ::rect
with four, others with one
integer value.
As the Prima toolkit coordinate space begins in the lower bottom
corner, the combination of ::left
and ::bottom
is same
as ::origin
, and combination of ::left
, ::bottom
, ::right
and
::top
- same as ::rect
.
When a widget is moved or resized, correspondingly two notifications
occur: Move
and Size
. The parameters to both are old and new
position and size. The notifications occur irrespectable to whether the
geometry change was issued by the program itself or by the user.
Concerning the size of a widget, two additional two-integer
properties exist, ::sizeMin
and ::sizeMax
, that constrain the
extension of a widget in their boundaries. The direct call that
assigns values to the size properties that lie outside
::sizeMin
and ::sizeMax
boundaries, will fail - the widget
extension will be adjusted to the boundary values, not to the
specified ones.
Change to widget's position and size can occur not only by an explicit
call to one of the geometry properties. The toolkit contains
implicit rules, that can move and resize a widget corresponding to
the flags, given to the ::growMode
property. The exact meaning
of the gm::XXX
flags is not given here ( see description to
::growMode
in API section ), but in short, it is possible with
simple means to maintain widget's size and position regarding its
owner, when it is resized. By default, and the default behavior
corresponds to ::growMode
0, widget does not change its size
or position when its owner is resized. It stays always in 'the left
bottom corner'. When, for example, a widget is expected to stay
in 'the right bottom corner', or 'the left top corner', the
gm::GrowLoX and gm::growLoY values must be used, correspondingly.
When a widget is expected to cover, for example, its owner's
lower part and change its width in accord with its owner's,
( as an example a horizontal scroll bar in an editor window
can serve ) the gm::GrowHiX value must be used.
When this implicit size change does occur, the ::sizeMin
and ::sizeMax
do take their part as well - they still do not allow
the widget's size excess their boundaries. However, this
algorithm derives a problem, that is illustrated by the following
conditions. A widget with size-dependent ::growMode
( with
gm::GrowHiX or gm::GrowHiY bits set ) must maintain certain relation between
the owner's size and its own. If the implicit size change would
be dependent on the actual widget size, derived as a result from the previous
implicit size action, then its size (and probably position) will be incorrect
after an attempt is made to change the widget's size to values outside
the size boundaries.
Example: child widget has width 100, gm::GrowHiX growMode and sizeMin set to (95, 95). Its owner has width 200. If the owner widget changes gradually its width from 200 to 190 and then back, the following width table emerges:
Owner Child Initial state 200 100 Shrink 195 -5 95 Shrink 190 -5 95 - as it can not be less than 95. Grow 195 +5 100 Grow 200 +5 105
That picture would be if the gradual size algorithm would
be implemented - the owner changes width by 5, and the child does the same.
The situation is fixed by introducing the virtual size term.
The ::size
property is derived from virtual size, and as
::size
cannot exceed the size boundaries, virtual size can.
It can even accept the negative values. With this intermediate stage
added, the correct picture occurs:
Owner Child's Child's virtual width width Initial state 200 100 100 Shrink 195 -5 95 95 Shrink 190 -5 90 95 Grow 195 +5 95 95 Grow 200 +5 100 100
NB: Strictly speaking, the virtual size must be declared a read-only property,
but currently it is implemented as a get_virtual_size()
function,
and it is planned to fix this discrepancy between the document
and the implementation in favor of the property syntax.
Another geometry issue, or rather a programming technique
must be mentioned - the relative coordinates. It is
the well-known problem, when a dialog window, developed
with one font looks garbled on another system with another
font. The relative coordinates solve the problem; the solution
provides the ::designScale
two-integer property, the
width and height of a font, that was used when the dialog
window was designed. With this property supplied, the position
and size supplied when a widget is actually created, are transformed in
proportion between the designed and the actual font metrics.
The relative coordinates can be used only when passing the
geometry properties values, and only before the creation stage,
before a widget is created, because the scaling calculations
perform in Prima::Widget::profile_check_in()
method.
In order to employ the relative coordinates scheme, the owner
( or the dialog ) widget must set its ::designScale
to the font metrics and ::scaleChildren
property to 1.
Widgets, created with owner that meets these requirements,
participate in the relative coordinates scheme. If
a widget must be excluded from the relative geometry applications,
either the owner's property ::scaleChildren
must be set to 0,
or the widget's ::designScale
must be set to undef
.
As the default ::designScale
value is undef
, no default implicit
relative geometry schemes are applied.
The ::designScale
property is auto-inherited;
its value is copied to the children widgets, unless
the explicit ::designScale
was given during the widget's
creation. This is used when such a child widget serves as an owner
for some other grand-children widgets; the inheritance scheme
allows the grand- ( grand- etc ) children to participate in
the relative geometry scheme.
Note: it is advised to test such applications with the Prima::Stress module, which assigns a random font as the default one, so the testing phase does not involve tweaking of the system settings.
In case two widgets overlap, one of these is drawn in full, whereas the another only partly. Prima::Widget provides management of the Z-axis ordering, but since Z-ordering paradigm can hardly be fit into the properties scheme, the toolkit uses methods instead.
A widget can use four query methods: first()
, last()
, next()
,
and prev()
. These return, correspondingly, the first and the last
widgets in Z-order stack, and the direct neighbors of a widget
( $widget-> next-> prev always equals to the $widget itself, given
that $widget-> next exists ).
The last widget is the topmost one, the one that is drawn fully. The first is the most obscured one, given that all the widgets overlap.
Z-order can also be changed at runtime ( but not during widget's
creation). There are three methods: bring_to_front()
, that sets the
widget last in the order, making it topmost, send_to_back()
, that
does the reverse, and insert_behind()
, that sets a widget behind
the another widget, passed as an argument.
Changes to Z-order trigger ZOrderChanged
notification.
By default, if a widget is a child to a widget
or window, it maintains two features: it is clipped by its
owner's boundaries and is moved together as the owner widget moves.
This set of features grants an owner the parent term. However,
in the toolkit a widget without a parent still does have a valid owner.
Instead of implementing parent property, the ::clipOwner
property was devised. It is 1 by default, and if it is 1, then
owner of a widget is its parent, at the same time. However, when it is 0, many
things change. The widget is neither clipped not moved together
with its parent. The widget become parentless, or, more strictly
speaking, the screen becomes its parent. Moreover,
the widget's origin offset is calculated then not from the owner's
coordinates but from the screen, and mouse events in the
widget do not transgress implicitly to the owner's top-level window
eventual decorations.
The same results are produced if a widget is inserted in
an application object, which does not have screen visualization.
A widget belonging to an application object, can not reset its ::clipOwner
values to 1.
The ::clipOwner
property opens a possibility for the toolkit widgets
to live inside other programs' windows. If the ::parentHandle
is
changed from its default undef
value to a valid system window handle,
the widget becomes child to this window, which can be any application
residing on the same display. This option is dangerous, however:
normally widgets never get destroyed with no reason. A top-level window
is never destroyed before its Close
notification grants the destruction.
This case is special, because a widget, inserted into an alien application,
must be prepared to be destroyed at any moment. It is recommended to
use prior knowledge about such the application, and, even better, use
one or another inter-process communication scheme to interact with it.
A widget does not need to undertake anything special to become an 'owner'.
Any widget, that was set in ::owner
property on any other widget,
becomes owner automatically. Its get_widgets()
method returns non-empty
widget list. get_widgets()
serves same purpose as Prima::Component::get_components()
,
but returns only Prima::Widget descendants.
A widget can change its owner at any moment. The ::owner
property is both
readable and writable, and if a widget is visible during the owner change, it
is immediately appeared under different coordinates and different
clipping condition after the property change ( given that
its ::clipOwner
is 1, of course ).
A widget is visible by default. Visible means that
it is shown on the screen if it is not shadowed by
other widgets ( or system windows ). The visibility
is governed by the ::visible
property, and its
two convenience aliases, show()
and hide()
.
When a widget is invisible, its geometry is not discarded;
the widget pertains its position and size, and is subject to
all previously discussed implicit sizing issues. When change
to ::visible
property is made, the screen is not updated
immediately, but in the next event loop invocation, because uncovering of
the underlying area of a hidden widget, and repainting of a new-shown widget
both depend onto the event-driven rendering functionality. If the graphic
content must be updated, update_view()
must be called, but
there's a problem. It is obvious that if a widget is shown,
the only content to be updated it is its own. When a widget
becomes hidden, it may uncover many more than one widget, depending on
the geometry, so it is unclear what widgets must be updated.
For the practical reasons, it is enough to get one event loop
passed, by calling yield()
method of the $::application
object.
The other notifications may pass here as well, however.
There are other kinds of visibility. A widget can be visible,
but one of its owners can be not. Or, a widget and its owners
can be visible, but they can be over-shadowed by the other
windows. These conditions are returned by showing()
and exposed()
functions. These return boolean values corresponding to the
condition described. So, if a widget is 'exposed', it is
'showing' and 'visible'; exposed()
returns always 0 if a widget
is either not 'showing' or not 'visible'. If a widget is 'showing',
then it is always 'visible'. showing()
returns always 0 if a widget is
invisible.
Visibility changes trigger Hide
and Show
notifications.
One of the key points of any GUI is that only one window at a time can possess a focus. The widget is focused, if the user's keyboard input is directed to it. The toolkit adds another layer in the focusing scheme, as often window managers do, highlighting the decorations of a top-level window over a window with the input focus.
Prima::Widget property ::focused
governs the focused state of a
widget. It is sometimes too powerful to be used. Its more often
substitutes, ::selected
and ::current
properties provide
more respect to widget hierarchy.
::selected
property sets focus to a widget if it
is allowed to be focused, by the usage
of the ::selectable
property. With this granted, the focus
is passed to the widget or to the one of its ( grand-) children.
So to say, when 'selecting' a window with a text field by clicking
on a window, one does not expect the window to be focused, but the text
field. To achieve this goal and reduce unnecessary coding, the
::current
property is introduced. With all equal conditions,
a widget that is 'current' gets precedence in getting selected
over widgets that are not 'current'.
De-selecting, in its turn, leaves the system in such a state when no window
has input focus. There are two convenience shortcuts
select()
and deselect()
defined, aliased to selected(1)
and selected(0),
correspondingly.
As within the GUI space, there can be only one 'focused' widget,
so within the widget space, there can be only one 'current' widget.
A widget can be marked as a current by calling ::current
( or, identically, ::currentWidget
on the owner widget ).
Such markings are performed automatically when a widget is focused.
NB. It must be noted, that the reverse is true: if a widget is explicitly marked as 'current', and belongs to the widget tree with the focus in one of its widgets, then the focus passed to the 'current' widget, or down to hierarchy if it is not selectable.
These relations between current-mark and focus allow the toolkit easily implement the focusing hierarchy. The focused widget is always on the top of the chain of its owner widgets, each of whose is a 'current' widget. If, for example, a window that contains a widget that contains a focused button, become un-focused, and then user selects the window again, then the button will become focused automatically.
Changes to focus produce Enter
and Leave
notifications.
Below discussed mouse- and keyboard- driven focusing schemes.
Note that all of these work via ::selected
, and do not
focus the widgets with ::selectable
set to 0.
The typical behavior of the mouse is when the user left-clicks on a widget, it becomes focused. One can note that not all widgets become focused after the mouse click - scroll bars are the examples. Another kind of behavior is the described above window with the text field - clicking mouse on a window focuses a text field.
Prima::Widget has the ::selectingButtons
property, a combination
of mb::XXX ( mouse buttons ) flags. If the bits corresponding to the
buttons are set, then click of this button will automatically
call ::selected(1)
( not ::focused(1)
! ).
Another boolean property, ::firstClick
determines the behavior
when the mouse button action is up to focus a widget, but the widget's
top-level window is not active. The default value of ::firstClick
is 1,
but if set otherwise, the user
must click twice to a widget to get it focused. The property
does not influence if the top-level window was already active
during the click event.
Due to some vendor-specific GUI designs, it is hardly possibly to force selection of one top-level window when the click was on the another. The window manager or the OS can interfere, although this does not always happen, and produce different results on different platforms. Since the primary goal of the toolkit is portability, such functionality must be considered with care. Moreover, when the user selects a window by clicking not on the toolkit-created widgets, but on the top-level window decorations, it is not possible to discern the case from any other kind of focusing.
The native way to navigate between the toolkit widgets are
tab- and arrow- navigation. The tab ( and its reverse, shift-tab )
key combinations circulate the focus between the widgets in same
top-level group ( not inside the same owner widget group ). The arrow keys,
if the focused widget is not interested in these keystrokes, move
the focus in the specified direction, if it is possible. The methods that
provide the navigations are available and called next_tab()
and
next_positional()
, correspondingly ( see API for the details).
When next_positional()
operates with the geometry of the widgets,
next_tab()
uses the ::tabStop
and ::tabOrder
properties.
::tabStop
, the boolean property, set to 1 by default, tells
if a widget is willing to participate in tab-aided focus
circulation. If it doesn't, next_tab()
never uses it in its algorithm.
::tabOrder
value is an integer, unique within the sibling widgets
( sharing same owner ) list, and is used as simple tag when the next
tab-focus candidate is picked. The default ::tabOrder
value is -1,
which changes automatically after widget creation to the unique value.
The toolkit provides two basic means of the input -
the keyboard and the mouse. Below described three aspects of
the input handling - the event-driven, the polling and
the simulated input issues. The event-driven
input is the more or less natural way of communicating with the user,
so when the user presses the key or moves the mouse, a system
event occurs and triggers the notification in one or more
widgets. Polling methods provide the immediate state of
the input devices; the polling is rarely employed, primarily
because of its limited usability, and because the information
it provides is passed to the notification callbacks anyway.
The simulated input is little more than notify()
call with
specifically crafted parameters. It interacts with the system,
so the emulation can gain the higher level of similarity
to the user actions. The simulated input functions allow
the notifications to be called right away, or post it,
delaying the notification until the next event loop invocation.
KeyDown
and KeyUp
. Both have almost the same list of parameters ( see API ),
that show key, its modifiers ( if any ) that were pressed and
an eventual character code. The algorithms that extract the meaning
of the key, like, discretion between character and
functional keys etc are not described here. The reader is advised
to look at Prima::KeySelector module, which provides convenience
functions for keyboard input values transformations, and to the
Prima::Edit and Prima::InputLine modules, the classes that
use extensively keyboard input. But in short,
the key code is one of the kb::XXX
( like, kb::F10, kb::Esc ) constants,
and the modifier value is a combination of the km::XXX
( km::Ctrl, km::Shift)
constants. The notable exception is kb::None value, which
hints that the character code is of value. Some other kb::XXX
-marked keys
have the character code as well, and it is up to a programmer how to
treat these combinations. It is advised, however, to look at the key
code first, and then to the character code.
KeyDown
event has also the repeat integer parameter, that
shows the repetitive count how many times the key was pressed.
Usually it is 1, but if a widget was not able to get its portion
of events between the key presses, its value can be higher.
If a code doesn't check for this parameter, some keyboard input
may be lost. If the code will be too much complicated by
introducing the repeat-value, one may consider setting the ::briefKeys
property to 0. ::briefKeys
, the boolean property, is 1 by default.
If set to 0, it guarantees that the repeat value will always be 1,
but with the price of under-optimization. If the core KeyDown
processing
code sees repeat value greater than 1, it just calls the notification again.
Along with these two notifications, the TranslateAccel
event
is generated after KeyDown
, if the focused widget is not interested
in the key event. Its usage covers the needs of the other widgets
that are willing to read the user input, even being out of focus.
A notable example can be a button with a hot key, that reacts on
the key press when the focus is elsewhere within its top-level window.
TranslateAccel
has same parameters as KeyDown
, except the REPEAT parameter.
Such out-of-focus input is also used with built-in menu keys translations.
If a descendant of Prima::AbstractMenu is in the reach of the widget tree
hierarchy, then it is checked whether it contains some hot keys that match
the user input. See the Prima::Menu manpage for the details. In particular,
Prima::Widget has ::accelTable
property, a mere slot for an object
that contains a table of hot keys mappings to the anonymous subs.
get_shift_state()
method returns the press state
of the modifier keys, a combination of km::XXX
constants.
key_up()
and key_down()
, that accept the same parameters as
the KeyUp
and KeyDown
notifications do, plus the POST
boolean flag. See API for details.
These methods are convenience wrappers for key_event()
method, which is never used directly.
MouseDown
, MouseUp
, MouseClick
, and MouseWheel
, and the second -
MouseMove
, MouseEnter
, end MouseLeave
.
The first set deals with button actions. Pressing, de-pressing, clicking
( and double-clicking ), the turn of mouse wheel correspond to the four
notifications. The notifications are sent together with the mouse pointer coordinates,
the button that was touched, and the eventual modifier keys that were pressed.
In addition, MouseClick
provides the boolean flag if the click was single or double,
and MouseWheel
- the Z-range of the wheel turn. These notifications occur
when the mouse event occurs within the geometrical bounds of a widget,
with one notable exception, when a widget is in capture mode.
If the ::capture
is set to 1, then these events are sent to the widget even
if the mouse pointer is outside, and not sent to the widgets and windows
that reside under the pointer.
The second set deals with the pointer movements. When the pointer passes over
a widget, it receives first MouseEnter
, then series of MouseMove
,
and finally MouseLeave
. MouseMove
and MouseEnter
notifications provide
X,Y-coordinates and modificator keys; MouseLeave
passes no parameters.
get_mouse_state()
that returns mb::XXX
constant combination, the ::pointerPos
two-integer property reports the current position of the mouse pointer.
mouse_up()
, mouse_down()
, mouse_click()
, mouse_wheel()
and mouse_move()
,
that accept the same parameters as their event counterparts do,
plus the POST boolean flag. See API for details.
These methods are convenience wrappers for mouse_event()
method, which is never used directly.
Prima::Drawable deals only with such color values, that
can be unambiguously decomposed to their red, green and blue components.
Prima::Widget extends the range of the values acceptable by
its color properties, introducing the color schemes.
The color can be set indirectly, without prior knowledge
of what is it its RGB value. There are several
constants defined in cl::
name space, that correspond to the
default values of different color properties of a widget.
Prima::Widget revises the usage of ::color
and ::backColor
,
the properties inherited from Prima::Drawable. Their values
are now full-weight 'foreground' and 'background' colors,
in addition to their function as template values. Moreover, their dynamic change
induces the repainting of a widget, and they can be inherited
from the owner. The inheritance is governed by properties
::ownerColor
and ::ownerBackColor
. While these are true,
changes to owner ::color
or ::backColor
copied automatically
to a widget. Once the widget's ::color
or ::backColor
are
explicitly set, the owner link breaks and ::ownerColor
or
::ownerBackColor
automatically set to 0.
In addition to these two color properties, Prima::Widget
introduces six others.
These are ::disabledColor
, ::disabledBackColor
,
::hiliteColor
, ::hiliteBackColor
, ::light3DColor
, and
::dark3DColor
. The 'disabled' color pair contains the values
that are expected to be used as foreground and background when
a widget is in the disabled state
( see API, ::enabled
property ). The 'hilite' values
serve as the colors for representation of selection inside
a widget. Selection may be of any kind, and some widgets do
not provide any. But for those that do, the 'hilite' color values
provide distinct alternative colors. A good examples are selections
in the text widgets, or in the list boxes. The last pair,
::light3DColor
and ::dark3DColor
is used for drawing
3D-looking outlines of a widget. The purpose of all these properties
is the adequate usage of the color settings, selected by the user using
system-specific tools, so the program written with the toolkit
would look not such different, and more or less conformant to the
user's color preferences.
The additional cl::
constants, mentioned above, represent these
eight color properties. These named correspondingly, cl::NormalText,
cl::Normal, cl::HiliteText, cl::Hilite, cl::DisabledText, cl::Disabled,
cl::Light3DColor and cl::Dark3DColor. cl::NormalText is alias to cl::Fore,
and cl::Normal - to cl::Back. Another constant set, ci::
can be used with the ::colorIndex
property, a multiplexer for all eight color properties. ci::
constants
mimic their non-RGB cl::
counterparts, so the call
hiliteBackColor(cl::Red)
is equal to colorIndex(ci::HiliteText, cl::Red)
.
Mapping from these constants to the RGB color representation
is used with map_color()
method. These cl::
constants alone
are sufficient for acquiring the default values, but the toolkit provides wider
functionality than this. The cl::
constants can be combined with
the wc::
constants, that represent standard widget class.
The widget class is implicitly used when single cl::
constant is used;
its value is read from the ::widgetClass
property, unless
one of wc::
constants is combined with the non-RGB cl::
value. wc::
constants are described in API; their usage can make
call of, for example, backColor( cl::Back)
on a button and on
an input line result in different colors, because the cl::Back
is translated in the first case into cl::Back|wc::Button
, and
in another - cl::Back|wc::InputLine
.
Dynamic change of the color properties result in the
ColorChanged
notification.
Prima::Widget does not change the handling of fonts - the
font selection inside and outside begin_paint()
/end_paint()
is not different at all. A matter of difference is how
does Prima::Widget select the default font.
First, if the ::ownerFont
property is set to 1,
then font of the owner is copied to the widget, and
is maintained all the time while the property is true.
If it is not, the default font values read from the system.
The default font metrics for a widget returned by get_default_font()
method, that often deals with system-dependent and user-selected
preferences ( see Additional resources ). Because a widget hold
an eventual reference to a Prima::Popup object, it contains
get_default_popup_font()
method, that returns the default font
for the popup objects. The dynamic popup font settings governed,
naturally, by the ::popupFont
property. Prima::Window extends the
functionality to get_default_menu_font()
and the ::menuFont
property.
Dynamic change of the font property results in the
FontChanged
notification.
The resources, operated via Prima::Widget class but not that strictly bound to the widget concept, are gathered in this section. The section includes overview of pointer, cursor, hint, menu objects and user-specified resources.
The mouse pointer is the shared resource, that can change its visual representation when it hovers over different kinds of widgets. It is usually a good practice for a text field, for example, set the pointer icon to a jagged vertical line, or indicate a moving window with a cross-arrowed pointer.
A widget can select either one of the predefined system pointers,
mapped by the cr::XXX
constant set, or supply its own pointer icon
of an arbitrary size and color depth.
NB: Not all systems allow the colored pointer icons. System value under sv::ColorPointer index containing a boolean value, whether the colored icons are allowed or not.
In gross, the ::pointer
property is enough for these actions.
It discerns whether it was an icon or a constant passed, and
sets the appropriate properties. These properties are also
accessible separately, although their usage is not encouraged, primarily
because of the tangled relationship between them. These properties are:
::pointerType
, ::pointerIcon
, and ::pointerHotSpot
. See their
details in the API sections.
Another property, which is present only in Prima::Application name space
is called ::pointerVisible
, and governs the visibility of the pointer -
but in all widget instances at once.
The cursor is a blinking rectangular area, indicating the
availability of the input focus in a widget. There can
be ( theoretically ) only one active cursor at a GUI
space, or none at all. Prima::Widget provides several
cursor properties: ::cursorVisible
, ::cursorPos
, and
::cursorSize
. There are also two methods, show_cursor()
and hide_cursor()
, but these are not the convenience shortcuts
but the functions accounting the cursor hide count. If hide_cursor()
was called three times, then show_cursor()
must be called three times
as well until the cursor is re-activated.
::hint
is a text string, that usually describes the widget's purpose
to the user in a brief manner. If the mouse pointer is hovered over the
widget longer than some timeout ( see Prima::Application::hintPause ),
then a label appears with this text, until the pointer is away from the widget.
The hint behavior is governed by Prima::Application, but a widget
can do two additional things about hint: it can enable and disable
it by calling ::showHint
property, and it can inherit the owner's
::hint
and ::showHint
properties using ::ownerHint
and ::ownerShowHint
properties. If, for example, ::ownerHint
is set to 1, then ::hint
value is automatically copied from the
widget's owner, when it changes. If, however, the widget's ::hint
or ::showHint
are explicitly set, the owner link breaks and
::ownerHint
or ::ownerShowHint
are automatically set to 0.
The widget can also operate the ::hintVisible
property,
that shows or hides the hint label immediately, if the mouse pointer
is inside the widget's boundaries.
The default functionality of Prima::Widget coexists with two kinds of the Prima::AbstractMenu
descendants - Prima::AccelTable and Prima::Popup ( Prima::Window
is also with Prima::Menu). The ::items
properties of these objects
are accessible through ::accelItems
and ::popupItems
, whereas
the objects themselves - through ::accelTable
and ::popup
,
correspondingly. As mentioned in User input,
these objects hook the user keyboard input and call the programmer-defined
callback sub if the key stroke
equals to one of their table values. As for ::accelTable
, its
function ends here. ::popup
provides access to a context pop-up menu,
which invocation can be either right-clicking or pressing some
system-dependent key combination. As a little customization,
the ::popupColorIndex
and ::popupFont
properties are introduced.
( ::popupColorIndex
is multiplexed to ::popupColor
,
::popupHiliteColor
, ::popupHiliteBackColor
, etc etc
properties exactly like the ::colorIndex
property ).
The change to font and color properties for a menu object is not always granted. The underlying system capabilities in this area range from total inability for a program to manage the menu fonts and colors in Win32, to a sport for the user changing menu fonts and colors dynamically, with the immediate results in OS/2.
The Prima::Window class provides same methods for the menu bar, introducing
::menu
, ::menuItems
, ::menuColorIndex
( with multiplexing ) and
::menuFont
properties.
It is considered a good idea to incorporate the user preferences into the toolkit look-and-feel. Prima::Widget relies to the system-specific code that tries to map these preferences as close as possible to the toolkit paradigm.
Unix version employs XRDB ( X resource database ), which is the
natural way for the user to tell the preferences with fine
granularity. Win32 and OS/2 read the setting that the user has to
set interactively, using system tools. Nevertheless, the toolkit
can not emulate all user settings that are available on the supported
platforms; it rather takes a 'least common denominator', which is
colors and fonts. fetch_resource()
method is capable of returning
any of such settings, provided it's format is font, color or a string.
The method is rarely called directly.
The appealing idea of making every widget property adjustable via
the user-specified resources is not implemented in full.
It can be accomplished up to a certain degree using fetch_resource()
existing functionality, but it is believed that calling up the method
for the every property for the every widget created is prohibitively
expensive.
Prima::AbstractMenu::items
and is described in the Prima::Menu manpage.
See also: accelTable
The accelTable object can be destroyed safely; its cancellation
can be done either via accelTable(undef)
or destroy()
call.
See also: accelItems
enabled
state as the widget. This property is useful for
the group-like widgets ( ComboBox, SpinEdit etc ), that employ their
children for visual representation.
Default value: 0
ColorChanged
notification and repaints the widget.
See also: color
, colorIndex
, ColorChanged
set()
together with ::top
.
KeyDown
callbacks. If 0, REPEAT parameter is always 1.
Default value: 1
See also: KeyDown
Paint
callback draws not on the screen, but
on the off-screen memory instead. The memory content is copied
to the screen then. Used when complex drawing methods are used,
or if output smoothness is desired.
This behavior can not be always granted, however. If there is not enough system resources ( memory is the one ), then widget draws in the usual manner.
Default value: 0
See also: Paint
If CLIP_OBJECT widget is defined in set-mode call, the pointer movements are confined to CLIP_OBJECT inferior.
See also: MouseDown
, MouseUp
, MouseMove
, MouseWheel
, MouseClick
.
See also: x_centered
, y_centered
, growMode
, origin
, Move
.
Default value: 1
See Parent-children relationship
See also: Prima::Object
owner section, parentHandle
ColorChanged
notification and repaints the widget.
See also: backColor
, colorIndex
, ColorChanged
ci::XXX
constant. Is a complete alias
for ::color
, ::backColor
, ::hiliteColor
, ::hiliteBackColor
,
::disabledColor
, ::disabledBackColor
, ::light3DColor
, and
::dark3DColor
properties. The ci::XXX
constants are:
ci::NormalText or ci::Fore ci::Normal or ci::Back ci::HiliteText ci::Hilite ci::DisabledText ci::Disabled ci::Light3DColor ci::Dark3DColor
The non-RGB cl::
constants, specific to the Prima::Widget color usage are
identical to their ci::
counterparts:
cl::NormalText or cl::Fore cl::Normal or cl::Back cl::HiliteText cl::Hilite cl::DisabledText cl::Disabled cl::Light3DColor cl::Dark3DColor
See also: color
, backColor
, ColorChanged
select()
call.
Within children widgets, only one or none at all can be marked as a current.
See also: currentWidget
, selectable
, selected
, selectedWidget
, focused
select()
call.
See also: current
, selectable
, selected
, selectedWidget
, focused
See also: cursorSize
, cursorVisible
See also: cursorPos
, cursorVisible
See also: cursorSize
, cursorPos
See also: light3DColor
, colorIndex
, ColorChanged
::backColor
when a widget
is in its disabled state.
See also: disabledColor
, colorIndex
, ColorChanged
::color
when a widget
is in its disabled state.
See also: disabledBackColor
, colorIndex
, ColorChanged
See also: responsive
, visible
, Enable
, Disable
FontChanged
notification and repaints the widget.
See also: designScale
, FontChanged
, ColorChanged
gm::GrowLoX widget's left side is kept in constant distance from owner's right side gm::GrowLoY widget's bottom side is kept in constant distance from owner's top side gm::GrowHiX widget's right side is kept in constant distance from owner's right side gm::GrowHiY widget's top side is kept in constant distance from owner's top side gm::XCenter widget is kept in center on its owner horizontal axis gm::YCenter widget is kept in center on its owner vertical axis gm::DontCare widgets origin is maintained constant relative to the screen
gm::GrowAll gm::GrowLoX|gm::GrowLoY|gm::GrowHiX|gm::GrowHiY gm::Center gm::XCenter|gm::YCenter gm::Client gm::GrowHiX|gm::GrowHiY gm::Right gm::GrowLoX|gm::GrowHiY gm::Left gm::GrowHiY gm::Floor gm::GrowHiX
See also: Move
, origin
Default value is 1
See also: MouseDown
, selectable
, selected
, focused
, selectingButtons
::selectable
property.
See also: selectable
, selected
, selectedWidget
, KeyDown
See also: width
,
growMode
, Move
, Size
, get_virtual_size
,
sizeMax
, sizeMin
See also: help
See also: hiliteColor
, colorIndex
, ColorChanged
See also: hiliteBackColor
, colorIndex
, ColorChanged
Prima::Application::hintPause
timeout. The text shows
only if the ::showHint
is 1.
See also: hintVisible
, showHint
, ownerHint
, ownerShowHint
See also: hint
, showHint
, ownerHint
, ownerShowHint
set()
together with ::right
.
See also: dark3DColor
, colorIndex
, ColorChanged
::backColor
property is explicitly set.
See also: ownerColor
, backColor
, colorIndex
::color
property is explicitly set.
See also: ownerBackColor
, color
, colorIndex
::font
property is explicitly set.
See also: font
, FontChanged
::hint
property is explicitly set.
See also: hint
, showHint
, hintVisible
, ownerShowHint
::showHint
property is explicitly set.
See also: hint
, showHint
, hintVisible
, ownerHint
::palette
property is explicitly set.
See also: palette
::clipOwner
is set to 0 ).
See also: ownerPalette
::clipOwner
is 0.
The window can belong to an other application or a process.
Default value is undef.
See also: clipOwner
cr::XXX
constants and an icon. If an icon
contains a hash variable __pointerHotSpot
with an array of two integers, these integers
will be treated as the pointer hot spot. In
get-mode call, this variable is automatically assigned
to an icon, if the result is an icon object.
See also: pointerHotSpot
, pointerIcon
, pointerType
See also: pointer
, pointerIcon
, pointerType
See also: pointerHotSpot
, pointer
, pointerType
See also: get_mouse_state
, screen_to_client
, client_to_screen
cr::XXX
set:
cr::Default same pointer type as owner's cr::Arrow arrow pointer cr::Text text entry cursor-like pointer cr::Wait hourglass cr::Size general size action pointer cr::Move general move action pointer cr::SizeWest, cr::SizeW right-move action pointer cr::SizeEast, cr::SizeE left-move action pointer cr::SizeWE general horizontal-move action pointer cr::SizeNorth, cr::SizeN up-move action pointer cr::SizeSouth, cr::SizeS down-move action pointer cr::SizeNS general vertical-move action pointer cr::SizeNW up-right move action pointer cr::SizeSE down-left move action pointer cr::SizeNE up-left move action pointer cr::SizeSW down-right move action pointer cr::Invalid invalid action pointer cr::User user-defined icon
All constants except cr::User
and cr::Default
present a system-defined
pointers, their icons and hot spot offsets. cr::User
is a general sign that
an icon object was specified explicitly via ::pointerIcon
property.
cr::Default
is a way to tell that a widget inherits its owner pointer type,
no matter is it a system-defined pointer or a custom icon.
See also: pointerHotSpot
, pointerIcon
, pointer
::popup
property will be activated automatically.
The popup object can be destroyed safely; its cancellation
can be done either via popup(undef)
or destroy()
call.
See also: Prima::Menu
, Popup
, Menu
,
popupItems
, popupColorIndex
, popupFont
ci::XXX
constants
( see ::colorIndex
property ).
See also: popupItems
, popupFont
, popup
See also: popupItems
, popupColorIndex
, popupFont
, popup
See also: popupItems
, popupColorIndex
, popupFont
, popup
See also: popupItems
, popupColorIndex
, popupFont
, popup
See also: popupItems
, popupColorIndex
, popupFont
, popup
See also: popupItems
, popupColorIndex
, popupFont
, popup
See also: popupItems
, popupColorIndex
, popup
See also: popupItems
, popupColorIndex
, popupFont
, popup
See also: popupItems
, popupColorIndex
, popupFont
, popup
Prima::AbstractMenu::items
and is described in the Prima::Menu manpage.
See also: popup
, popupColorIndex
, popupFont
See also: popupItems
, popupColorIndex
, popupFont
, popup
::clipOwner
is set to 0 ).
See also: bottom
, right
, top
, left
, origin
,
width
, height
, size
growMode
, Move
, Size
, get_virtual_size
,
sizeMax
, sizeMin
set()
together with ::left
.
::scaleChildren
set to 1, then the newly-created
children widgets inserted in it will be scaled corresponding to the
owner's ::designScale
, given that widget's ::designScale
is not undef
and the owner's is not [0,0].
Default is 1.
See also: designScale
select()
regards this property, and does not
focus a widget that has ::selectable
set to 0.
Default value is 0
See also: current
, currentWidget
, selected
, selectedWidget
, focused
::currentWidget
chain.
See also: current
, currentWidget
, selectable
, selectedWidget
, focused
::selected
set to 1.
See also: current
, currentWidget
, selectable
, selected
, focused
mb::XXX
( mouse button ) flags.
If a widget receives a click with a mouse button, that has
the corresponding bit set in ::selectingButtons
, then
select()
is called.
See also: MouseDown
, firstClick
, selectable
, selected
, focused
Successive only if sv::ShapeExtension
value is true.
::hint
property must contain non-empty string as well, if
the hint label must be shown.
Default value is 1.
See also: hint
, ownerShowHint
, hintVisible
, ownerHint
See also: width
, height
growMode
, Move
, Size
, get_virtual_size
,
sizeMax
, sizeMin
See also: width
, height
, size
growMode
, Move
, Size
, get_virtual_size
,
sizeMin
See also: width
, height
, size
growMode
, Move
, Size
, get_virtual_size
,
sizeMax
Paint
request notifications are stacked
until the event loop is called. If 1, every time the widget
surface gets invalidated, the Paint
notification is called.
Default value is 0.
See also: invalidate_rect
, repaint
, validate_rect
, Paint
See also: tabStop
, next_tab
, selectable
, selected
, focused
Default value is 1.
See also: tabOrder
, next_tab
, selectable
, selected
, focused
set()
together with ::bottom
.
Paint
event.
Default value is 0
See also: Paint
, buffered
.
wc::XXX
constants:
wc::Undef wc::Button wc::CheckBox wc::Combo wc::Dialog wc::Edit wc::InputLine wc::Label wc::ListBox wc::Menu wc::Popup wc::Radio wc::ScrollBar wc::Slider wc::Widget or wc::Custom wc::Window wc::Application
These constants are not associated with the toolkit classes;
any class can use any of these constants in ::widgetClass
.
See also: map_color
, colorIndex
See also: height
growMode
, Move
, Size
, get_virtual_size
,
sizeMax
, sizeMin
See also: insert_behind
, send_to_back
, ZOrderChanged
,first
, next
, prev
, last
Close
message, and returns its boolean exit state.
See also: screen_to_client
, clipOwner
can_close()
, and if successful, destroys a widget.
Returns the can_close()
result.
focused(0)
call
selected(0)
call
::visible
set to 0.
fr::Color - color resource fr::Font - font resource fs::String - text string resource
Such a number of the parameters is used because the method can be called before a widget is created. CLASS_NAME is widget class string, NAME is widget name. CLASS_RESOURCE is class of resource, and RESOURCE is the resource name.
For example, resources 'color' and 'disabledColor' belong to the resource class 'Foreground'.
focused(1)
call
::visible
to 0.
hide_cursor()
was called,
as many time its counterpart show_cursor()
must be called
to reach the cursor's initial state.
See also: show_cursor
, cursorVisible
::helpContext
string value.
The string value is combined
with the widget's owner ::helpContext
strings,
if it is empty or begins with a slash.
A special meaning is assigned to an empty string `` '' -
the call fails when such value is found to be
a component of a such combined value.
This feature can be useful when a window or a dialog
presents a standalone functionality ( and a module),
and the documentation is related more to the module than
to an embedding program. In such case, the grouping widget
holds ::helpContext
as a pod manpage name with a trailing
slash, and its children widgets are assigned ::helpContext
to the topics without the manpage but the leading slash instead.
If the grouping widget has an empty string `` '' as ::helpContext
then the help is forced to be unavailable for all the children
widgets.
See also: helpContext
owner
property set to the
caller widget, and returns the list of references to the newly
created widgets.
Has two calling formats:
$parent-> insert( 'Child::Class', name => 'child', .... );
$parent-> insert( [ 'Child::Class1', name => 'child1', .... ], [ 'Child::Class2', name => 'child2', .... ], );
See also: bring_to_front
, send_to_back
, ZOrderChanged
,first
, next
, prev
, last
See also: validate_rect
, get_invalid_rect
, repaint
, Paint
, syncPaint
, update_view
KeyDown
event
to the system. CODE, KEY, MOD and REPEAT are the parameters
to be passed to the notification callbacks.
See also: key_up
, key_event
, KeyDown
KeyDown
or KeyUp
notifications.
COMMAND is allowed to be either cm::KeyDown
or cm::KeyUp
.
See also: key_down
, key_up
, KeyDown
, KeyUp
KeyUp
event
to the system. CODE, KEY and MOD are the parameters
to be passed to the notification callbacks.
See also: key_down
, key_event
, KeyUp
lock()
was called, as may times its counterpart,
unlock()
must be called to enable re-painting again.
Returns a boolean success flag.
See also: unlock
, repaint
, Paint
, get_locked
cl::XXX
and ci::XXX
combinations into RGB
color representation and returns the result. If COLOR is already
in RGB format, no changes are made.
See also: colorIndex
MouseClick
event
to the system. BUTTON, MOD, X, Y, and DBL_CLICK are the parameters
to be passed to the notification callbacks.
See also: MouseDown
, MouseUp
, MouseWheel
,
MouseMove
, MouseEnter
, MouseLeave
MouseDown
event
to the system. BUTTON, MOD, X, and Y are the parameters
to be passed to the notification callbacks.
See also: MouseUp
, MouseWheel
, MouseClick
,
MouseMove
, MouseEnter
, MouseLeave
MouseEnter
event
to the system. MOD, X, and Y are the parameters
to be passed to the notification callbacks.
See also: MouseDown
, MouseUp
, MouseWheel
, MouseClick
,
MouseMove
, MouseLeave
cm::MouseDown
, cm::MouseUp
,
cm::MouseWheel
, cm::MouseClick
, cm::MouseMove
, cm::MouseEnter
,
cm::MouseLeave
constants.
See also: mouse_down
, mouse_up
, mouse_wheel
, mouse_click
,
mouse_move
, mouse_enter
, mouse_leave
,
MouseDown
, MouseUp
, MouseWheel
, MouseClick
,
MouseMove
, MouseEnter
, MouseLeave
MouseLeave
event
to the system.
See also: MouseDown
, MouseUp
, MouseWheel
, MouseClick
,
MouseMove
, MouseEnter
, MouseLeave
MouseMove
event
to the system. MOD, X, and Y are the parameters
to be passed to the notification callbacks.
See also: MouseDown
, MouseUp
, MouseWheel
, MouseClick
,
MouseEnter
, MouseLeave
MouseUp
event
to the system. BUTTON, MOD, X, and Y are the parameters
to be passed to the notification callbacks.
See also: MouseDown
, MouseWheel
, MouseClick
,
MouseMove
, MouseEnter
, MouseLeave
MouseUp
event
to the system. MOD, X, Y and Z are the parameters
to be passed to the notification callbacks.
See also: MouseDown
, MouseUp
, MouseClick
,
MouseMove
, MouseEnter
, MouseLeave
::tabOrder
list
of sibling widgets. FORWARD is a boolean lookup direction flag.
If none found, the first ( or the last, depending on FORWARD )
widget is returned. Only widgets with ::tabStop
set to 1 participate.
Used in the toolkit keyboard navigation.
See also: next_positional
, tabOrder
, tabStop
, selectable
Used in the toolkit keyboard navigation.
See also: next_tab
, origin
See also: validate_rect
, get_invalid_rect
, invalidate_rect
, Paint
,
update_view
, syncPaint
::enabled
1 or not. Useful for fast check if
a widget should respond to the user actions.
See also: enabled
See also: client_to_screen
Cannot be used inside paint state.
See also: Paint
, get_invalid_rect
selected(1)
call
See also: insert_behind
, bring_to_front
, ZOrderChanged
,first
, next
, prev
, last
::visible
to 1.
hide_cursor()
was called,
as many time its counterpart show_cursor()
must be called
to reach the cursor's initial state.
See also: hide_cursor
, cursorVisible
::visible
1 or not.
lock()
was called, as may times its counterpart,
unlock()
must be called to enable re-painting again.
When last unlock()
is called, an implicit repaint()
call is
made. Returns a boolean success flag.
See also: lock
, repaint
, Paint
, get_locked
invalidate_rect()
or repaint()
calls or the
exposure caused by window movements ( or any other),
then Paint
notification is immediately called.
If no parts are invalid, no action is performed.
If a widget has ::syncPaint
set to 1,
update_view()
is always a no-operation call.
See also: invalidate_rect
, get_invalid_rect
, repaint
, Paint
, syncPaint
, update_view
invalidate_rect()
, restoring the original, 'valid'
state of widget area covered by the rectangular area passed. If a widget
with previously invalid areas was wholly validated by this method, no Paint
notifications occur.
See also: invalidate_rect
, get_invalid_rect
, repaint
, Paint
, syncPaint
, update_view
See also: font
See also: font
invalidate_rect()
,
validate_rect()
and repaint()
, as a rectangular area
( four integers ) that cover all invalid regions in a widget.
If none found, (0,0,0,0) is returned.
See also: validate_rect
, invalidate_rect
, repaint
, Paint
, syncPaint
, update_view
See also: get_parent_handle
lock()
- initiated repaint-blocked state.
mb::XXX
constants, reflecting the currently
pressed mouse buttons.
See also: pointerPos
, get_shift_state
See also: clipOwner
See also: get_handle
, clipOwner
km::XXX
constants, reflecting the currently
pressed keyboard modificator buttons.
See also: get_shift_state
See also: width
, height
, size
growMode
, Move
, Size
, sizeMax
, sizeMin
can_close()
and close()
functions.
If the event flag is cleared during execution,
these functions fail.
ci::XXX
constants.
See also: colorIndex
enabled(0)
call
See also: Enable
, enabled
, responsive
See also: DragOver
, EndDrag
MouseMove
X Y parameters. STATE value
is undefined.
See also: DragDrop
, EndDrag
enabled(1)
call
See also: Disable
, enabled
, responsive
See also: DragDrop
, DragOver
See also: font
, ColorChanged
visible(0)
call
See also: showHint
, ownerShowHint
, hintVisible
, ownerHint
kb::XXX
constants, MOD is a combination of the modificator keys
pressed when the event occurred ( km::XXX
). REPEAT
is how many times the key was pressed; usually it is 1.
( see ::briefKeys
).
The valid km::
constants are:
km::Shift km::Ctrl km::Alt km::KeyPad km::DeadKey
The valid kb::
constants are grouped in several sets.
Some codes are aliased, like, kb::PgDn
and kb::PageDown
.
kb::ShiftL kb::ShiftR kb::CtrlL kb::CtrlR kb::AltL kb::AltR kb::MetaL kb::MetaR kb::SuperL kb::SuperR kb::HyperL kb::HyperR kb::CapsLock kb::NumLock kb::ScrollLock kb::ShiftLock
kb::Backspace kb::Tab kb::Linefeed kb::Enter kb::Return kb::Escape kb::Esc kb::Space
kb::F1 .. kb::F30 kb::L1 .. kb::L10 kb::R1 .. kb::R10
kb::Clear kb::Pause kb::SysRq kb::SysReq kb::Delete kb::Home kb::Left kb::Up kb::Right kb::Down kb::PgUp kb::Prior kb::PageUp kb::PgDn kb::Next kb::PageDown kb::End kb::Begin kb::Select kb::Print kb::PrintScr kb::Execute kb::Insert kb::Undo kb::Redo kb::Menu kb::Find kb::Cancel kb::Help kb::Break kb::BackTab
See also: KeyUp
, briefKeys
, key_down
, help
, popup
,
tabOrder
, tabStop
, accelTable
kb::XXX
constants, MOD is a combination of the modificator keys
pressed when the event occurred ( km::XXX
).
See also: KeyDown
, key_up
Used for the last-minute changes in the menu structure.
See also: popupItems
mb::XXX
constants, MOD is a combination of km::XXX
constants,
reflecting pressed modificator keys during the event,
X and Y are the mouse pointer coordinates. DOUBLE_CLICK
is a boolean flag, set to 1 if it was a double click,
0 if a single.
mb::XXX
constants are:
mb::b1 or mb::Left mb::b2 or mb::Middle mb::b3 or mb::Right mb::b4 mb::b5 mb::b6 mb::b7 mb::b8
See also: MouseDown
, MouseUp
, MouseWheel
,
MouseMove
, MouseEnter
, MouseLeave
mb::XXX
constants, MOD is a combination of
km::XXX
constants, reflecting the pressed modificator keys during the event,
X and Y are the mouse pointer coordinates.
See also: MouseUp
, MouseClick
, MouseWheel
,
MouseMove
, MouseEnter
, MouseLeave
km::XXX
constants, reflecting
the pressed modificator keys during the event,
X and Y are the mouse pointer coordinates.
See also: MouseDown
, MouseUp
, MouseClick
, MouseWheel
,
MouseMove
, MouseLeave
See also: MouseDown
, MouseUp
, MouseClick
, MouseWheel
,
MouseMove
, MouseEnter
km::XXX
constants, reflecting
the pressed modificator keys during the event,
X and Y are the mouse pointer coordinates.
See also: MouseDown
, MouseUp
, MouseClick
, MouseWheel
,
MouseEnter
, MouseLeave
mb::XXX
constants, MOD is a combination of
km::XXX
constants, reflecting the pressed modificator keys during the event,
X and Y are the mouse pointer coordinates.
See also: MouseDown
, MouseClick
, MouseWheel
,
MouseMove
, MouseEnter
, MouseLeave
km::XXX
constants,
reflecting the pressed modificator keys during the event,
X and Y are the mouse pointer coordinates. Z is the virtual
coordinate of a wheel. Typical ( 2001 A.D. ) mouse produces
Z 120-fold values.
See also: MouseDown
, MouseUp
, MouseClick
,
MouseMove
, MouseEnter
, MouseLeave
See also: repaint
, syncPaint
, get_invalid_rect
, scroll
,
colorIndex
, font
See also: popup
Create
notification.
It comes first from the event loop. Prima::Widget does not
use it.
visible(1)
call
See also: Move
, origin
, size
, growMode
,
sizeMax
, sizeMin
, rect
, clipOwner
KeyDown
event. Traverses all the object
tree that the widget which received original KeyDown
event
belongs to. Once the event flag is cleared, the distribution stops.
Used for tracking keyboard events by widgets that are not in focus.
See also: KeyDown
See also: bring_to_front
, insert_behind
, send_to_back
Dmitry Karasik, <dmitry@karasik.eu.org>.
Prima, the Prima::Object manpage, the Prima::Drawable manpage.
Prima::Widget - window management |