|
Class: ModalBox
Object
|
+--GraphicsMedium
|
+--DisplaySurface
|
+--SimpleView
|
+--View
|
+--TopView
|
+--StandardSystemView
|
+--ModalBox
|
+--DialogBox
- Package:
- stx:libview
- Category:
- Views-Basic
- Version:
- rev:
1.135
date: 2022/02/17 18:28:46
- user: cg
- file: ModalBox.st directory: libview
- module: stx stc-classLibrary: libview
this class implements modal boxes; ModalBoxes are different from
others, in that they take control over the current topview, until
all processing is done (i.e. the currently active topview and all of
its subviews will not handle user events while the box is active).
ModalBoxes are either implemented as transient windows
(if UseTransientViews := true) or as override redirect views.
Some window managers have problems with either; so you may want to
change the default setting from your display.rc file.
copyrightCOPYRIGHT (c) 1990 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
defaults
-
defaultExtent
-
this defines the defaultExtent for instances of me;
the value returned here is usually not correct for concrete subclasses,
so you better redefine this method.
The value returned here is usually ignored, and
the value from preferredExtent taken instead.
-
defaultLabel
-
return the boxes default window title.
-
updateStyleCache
-
extract values from the styleSheet and cache them in class variables
Usage example(s):
-
useTransientViews: aBoolean
-
change the way modalBoxes are created on the Display.
If the argument is true, transient views are used;
otherwise override redirect views are used.
Depending on your windowmanager, either one may have problems.
You may want to change the setting
from your display.rc or d_xxx.rc file.
This is now obsolete - transient views work and are always used.
Usage example(s):
ModalBox useTransientViews:false
ModalBox useTransientViews:true
|
initialization
-
initialize
-
UseTransientViews := false
accessing
-
escapeIsCancel
-
return the escapeIsCancel setting - defaults to true for modalMox here.
-
exclusiveKeyboard: aBoolean
-
set/clear exclusive locking of the keyboard;
If set, the box will take total control over the
keyboard, not allowing input to other views/boxes
while active.
DANGER:
only use this for very very urgent boxes, since
no interaction with ANY view on the screen is possible then.
event handling
-
coveredBy: aView
-
the receiver has been covered by another view.
If the other view is a non-modal one, raise
-
terminate
-
this is the close from a windowmanager
(only if UseTransientViews == true)
-
visibilityChange: how
-
raise when covered - this should not be needed, since we
have been created as override-redirect window (which should
stay on top - but some window managers (fvwm) seem to ignore
this ...
-
xxxpointerEnter: state x: x y: y
-
mhmh: this seems to be a special X kludge;
without the following, we will not regain input focus after
pointer is reentered.
initialization & release
-
addToCurrentProject
-
ignored here
-
create
-
(comment from inherited method)
create - make certain that icon is available
-
destroy
-
destroy the view.
redefined to also destroy my shadow, if there is one,
and to release the global keyboard grab (if there is one)
-
initEvents
-
initialize event handling; redefined to enable visibility changes
-
initStyle
-
setup viewStyle specifics
-
initialize
-
must be called if redefined
-
isPopUpView
-
return true, if I want to come up without decoration
and raise to top immediately.
-
realize
-
(comment from inherited method)
must clear this flag
-
reinitialize
-
if I have already been reinited - return
Usage example(s):
-
resize
-
resize myself to make everything visible
-
resizeUnderPointer
-
resize myself to make everything visible, AND possibly change the origin
to have the mouse pointer stay within my bounds.
This is used for self-resizing enterBoxes, to avoid moving
the box away from the cursor.
move & resize
-
doMove
-
the move button was pressed.
This method is only used with non-transient views
(UseTransientViews == false).
-
doResize
-
the resize button was pressed.
This method is only used with non-transient views
(UseTransientViews == false).
queries-internal
-
windowLabelFor: labelString
-
dialogs do not include the hostname in the window label
-
windowStyle
-
return a symbol describing my style (one of: #dialog, #popUp or #normal)
(may be used internally by the device as a decoration hint)
Usage example(s):
show & hide
-
autoHideAfter: seconds with: anAction
-
install a background process, which hides the box
after some time. Also, if non-nil, anAction will be
evaluated then. The action will not be evaluated if
the box is closed by the user pressing a button.
Usage example(s):
|b|
b := InfoBox title:'hello there'.
b autoHideAfter:5 with:[].
b showAtCenter.
|
-
fixSize
-
this is sent right before the modalBox is made visible;
If the size is not fixed, adjust my size.
-
hide
-
make the receiver invisible and leave control
Usage example(s):
this is a kludge for IRIS and others which do not provide backingstore:
when we hide a modalbox (such as a searchbox) which covered
a scrollbar, the scrollbars bitblt-method will copy from the
not-yet redrawn area - effectively clearing the scroller.
We need a short delay here, since at this time, the expose event has
not yet arrived.
|
-
hideRequest
-
hide request from windowGroup (i.e. via Escape key).
Can be redefined in subclasses which don't like this
-
mapped
-
wait till visible for grabbing
-
open
-
default for modalboxes is to come up modal at the pointer position
-
openAt: aPoint
-
default for modalboxes is to come up modal at the pointer position
-
openAtCenter
-
default for modalboxes is to come up modal at the pointer position
-
openModal: aBlock
-
open the box modal;
In addition to the basic (inherited) modalloop, possibly show a shadow.
(these days, the shadow-view is usually disabled, as modern graphics do it now for us)
Stay in the modal loop while aBlock evaluates to true AND the receiver is visible.
(i.e. control is returned to the sender when the receiver is closed)
This makes any interaction with the current window impossible -
however, other views (in other windowgroups) still work.
-
openModalEnsuringDestroyedAfterwards
-
-
show
-
make myself visible (at the last or default position) and take control.
If that position is out of the screen area, moves the receiver to make
it fully visible.
Usage example(s):
|b|
b := InfoBox title:'hello'.
b show.
|
-
showAt: aPoint
-
make myself visible at aPoint.
Fix position to make box fully visible
Usage example(s):
|b|
b := InfoBox title:'hello'.
b showAt:(0 @ 0).
b showAt:(400 @ 400).
|
-
showAt: aPoint center: center
-
make myself visible at aPoint. center specifies
if the view should show up centered around aPoint.
Usage example(s):
|b|
b := InfoBox title:'hello'.
b showAt:(100 @ 100) center:true.
b showAt:(100 @ 100) center:false.
|
-
showAt: aPoint centerX: centerX centerY: centerY
-
make myself visible at aPoint. centerX/centerY specify
if the view should show up centered around aPoint.
Fix position to make box fully visible
Usage example(s):
|b|
b := InfoBox title:'hello'.
b showAt:(100 @ 100).
b showAt:(100 @ 100) centerX:true centerY:false.
|
-
showAtCenter
-
make myself visible at the screen center.
Usage example(s):
|b|
b := InfoBox title:'hello'.
b showAtCenter.
|
-
showAtPointer
-
make myself visible at mouse pointer shifted to have
convenient button under cursor.
self positionOffset should return that offset
(usually redefined, since we don't know here, which button should be under cursor).
Usage example(s):
|b|
b := InfoBox title:'hello'.
b showAtPointer.
|
-
showAtPointerNotCovering: aView
-
make myself visible at mouse pointer shifted to have
convenient button under cursor.
Fix position to make the box fully visible AND to make sure that
aView is not covered.
-
showCenteredIn: aView
-
make myself visible at the center if aView.
Usage example(s):
|b|
b := InfoBox title:'hello'.
b showCenteredIn:Transcript.
|
-
unmapped
-
mhmh - unmapped by the windowManager - if realized (i.e. not closing),
keep the realized flag true (to avoid exiting the modal event loop).
Consider this a kludge.
|