eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'DisplayRootView':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: DisplayRootView


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
         |
         +--DisplayRootView

Package:
stx:libview
Category:
Views-Special
Version:
rev: 1.53 date: 2018/01/16 17:19:41
user: cg
file: DisplayRootView.st directory: libview
module: stx stc-classLibrary: libview
Author:
Claus Gittinger

Description:


this class describes the rootWindow (which is the background window or
desktop and can be used for drawing outside of Views 
i.e. for dragging between Views).

For historic and compatibility reasons, there is a global variable 
called 'RootView', which is bound to the default displays ('Display')
rootview. We recommend, not to access this variable, instead, get a
displays rootView via the #rootView message (sent to the device).
Otherwise, your application will not work in a multiScreen environment.

Instances of myself (i.e. these rootViews) are light-weight views; 
they do not support events, models etc.
They are pure drawing canvases and should be only used for special
applications (i.e. dragging). 
There may be display systems in which rootViews are not
supported/allowed implemented. So be VERY careful when using them.

Be aware, that the rootView is not always visible - some
windowManagers install another (pseudoRoot), into which icons and
windowManager menus are drawn. If that is the case, your paining
into the rootView may not be visible, unless you set the #noClipByChildren
option (see below).
Also, it is not guaranteed, that all devices support drawing in the
root window - especially if the device is a simulated one, such as
a remote webBrowser ...
In general, you should never use the rootView for normal applications.

To draw in the (Displays) root window:

    |rootView|

    rootView := Screen current rootView.
    rootView paint:(Color red).
    rootView fillRectangleX:10 y:10 width:100 height:100.

of course, all stuff from View and its superclasses can be used:

    |rootView|

    rootView := Screen current rootView.
    rootView paint:(Color red).
    rootView noClipByChildren.
    rootView fillRectangleX:10 y:10 width:100 height:100.


Class protocol:

instance creation
o  onDevice: aDisplay
since there is only one RootView - catch new and return
the one and only rootView.


Instance protocol:

accessing
o  model

o  name
return my name - always 'RootWindow'

o  subViews
return the collection of subviews - none here

o  uuid
return my uuid - always the same here.
TODO: think what happens with multiple screens...

destroying
o  destroy
catch destroy - some windowmanagers get confused if
we destroy the rootWindow if it's a virtual root window

dummy
o  keyboardZoom: largerBoolean
CTRL+/- zoom action

o  redrawX: x y: y width: width height: height
ignored

hotkeys
o  addHotKeyHandler: handler forKey: aKey modifierMask: optionalModifierMaskOrNil
install a handler (which should implement keyPress:x:y:view:
and keyRelease:x:y:view: on aKey.
aKey should be a symbolic key (like #F2).
modifierMask may constraint the key to be only handled when a certain
modifier is pressed (use a bitOr combination of device ctrlModifierMask,
altModifierMask etc.) or nil, so the key is always treated as a hotkey

usage example(s):

     Display rootView sensor removeAllEventListeners.

     Display rootView
        addHotKeyHandler:[:ev |
Transcript showCR:ev.
            ev key = 'F3' ifTrue:[
                Dialog information:'YES!'.
            ].
            false.
        ]
        forKey:'F3'
        modifierMask:nil

o  removeHotKeyHandler: handler forKey: aKey modifierMask: optionalModifierMaskOrNil
install a handler (which should implement keyPress:x:y:view:
and keyRelease:x:y:view: on aKey.
aKey should be a symbolic key (like #F2).
modifierMask may constraint the key to be only handled when a certain
modifier is pressed (use a bitOr combination of device ctrlModifierMask,
altModifierMask etc.) or nil, so the key is always treated as a hotkey

initialization & release
o  initialize

o  reinitialize
reinit after snapin

queries
o  canDropObjects: aCollectionOfDropObjects
return true, if aCollectionOfDropObjects can be
dropped in the receiver.
False is returned here, since nothing can be dropped on the desktop.
(for now - actually some systems do allow dropping things on the desktop
and this query should be forwarded to my display device)

o  isActive
for protocol compatibility with regular views

o  isComponentOf: aView

o  isRootView
return true, since yes, I am a rootview

o  isSameOrComponentOf: aView
return true, if I am aView or a (direct or indirect) component of aView

o  isWindowManagerRunning
answer true, if a window manager is currently running.
This is done by performing an action (enabling button events of
root window), which will fail if a window manager is running.

usage example(s):

     DisplayRootView new
     RootView isWindowManagerRunning



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Thu, 28 Mar 2024 18:30:47 GMT